data/full_repos/permissive/119387855/mips_control.v
 line:1 column:1: Illegal character '\x00'
data/verilator_xmls/fabc5efd-8ef8-408d-b50a-a35ec44cebb6.xml
module mips_control(reg_dst, alu_src, mem_to_reg, reg_write, mem_read, mem_write, branch, alu_op, jump, byte_number, op_code, funct);

	output reg [1:0] reg_dst ;
	output reg alu_src;
	output reg [1:0] mem_to_reg ;
	output reg reg_write;
	output reg mem_read;
	output reg mem_write;
	output reg [1:0] branch ;
	output reg [3:0] alu_op ;
	output reg [1:0] jump ;
	output reg [1:0] byte_number ;

	input [5:0] op_code;
	input [5:0] funct;



	always @* begin
		
		if(op_code == 6'b000000) begin
			reg_dst = 2'b11;
			alu_src = 1'b0;
			mem_to_reg = 2'b00;
			mem_read = 1'b0;
			mem_write = 1'b0;
			branch = 2'b00;
			byte_number = 2'b00;
			
			if(funct == 6'b001000) begin
				alu_op = 4'b0011;
				jump = 2'b01;
				reg_write = 1'b0;
				
				$display("R type JR instruction %b", funct);
				
			end else begin	
				reg_write = 1'b1;
				jump = 2'b00;
				
				$display("R type other instruction %b", funct);
				
				case (funct) 
					6'b100000 :
						alu_op = 4'b0100;		
					6'b100001 :
						alu_op = 4'b0101;	
					6'b100100 :
						alu_op = 4'b0000; 
					6'b100111 :
						alu_op = 4'b0010; 
					6'b100101 :
						alu_op = 4'b0001;
					6'b101010 :
						alu_op = 4'b1110;
					6'b101011 :
						alu_op = 4'b1111;
					6'b000000 :
						alu_op = 4'b1000;
					6'b000010 :
						alu_op = 4'b1010;
					6'b100010 :
						alu_op = 4'b0110;
					6'b100011 :
						alu_op = 4'b0111;
							
					default : $display("Error in R type instruction %b",funct); 		 
				endcase
			
			end
		end else begin
			if(op_code == 6'b000010) begin
				reg_dst = 2'b01;
				alu_src = 1'b0;
				mem_to_reg = 2'b00;
				reg_write = 1'b0;
				mem_read = 1'b0;
				mem_write = 1'b0;
				branch = 2'b00;
				alu_op = 4'b0011;
				jump = 2'b11;
				byte_number = 2'b00;
				
				$display("J type J instruction %b", op_code);
				
			end else if(op_code == 6'b000011) begin
			
				reg_dst = 2'b01;
				alu_src = 1'b0;
				mem_to_reg = 2'b01;
				reg_write = 1'b1;
				mem_read = 1'b0;
				mem_write = 1'b0;
				branch = 2'b00;
				alu_op = 4'b0011;
				jump = 2'b11;
				byte_number = 2'b00;
				
				$display("J type JAL instruction %b", op_code);
			
			end else if (op_code == 6'b100011 || op_code == 6'b110000) begin
			
				reg_dst = 2'b00;
				alu_src = 1'b1;
				mem_to_reg = 2'b11;
				reg_write = 1'b1;
				mem_read = 1'b1;
				mem_write = 1'b0;
				branch = 2'b00;
				alu_op = 4'b0100;
				jump = 2'b00;
				byte_number = 2'b00;
				
				$display("I type LB or LL instruction %b", op_code);
				
			end else if(op_code == 6'b100100) begin
			
				reg_dst = 2'b00;
				alu_src = 1'b1;
				mem_to_reg = 2'b11;
				reg_write = 1'b1;
				mem_read = 1'b1;
				mem_write = 1'b0;
				branch = 2'b00;
				alu_op = 4'b0100;
				jump = 2'b00;
				byte_number = 2'b10;
				
				$display("I type LBU instruction %b", op_code);
				
			end else if(op_code == 6'b100101) begin
			
				reg_dst = 2'b00;
				alu_src = 1'b1;
				mem_to_reg = 2'b11;
				reg_write = 1'b1;
				mem_read = 1'b1;
				mem_write = 1'b0;
				branch = 2'b00;
				alu_op = 4'b0100;
				jump = 2'b00;
				byte_number = 2'b01;
				
				$display("I type LHU instruction %b", op_code);
				
			end else if(op_code == 6'b001111) begin
				reg_dst = 2'b00;
				alu_src = 1'b1;
				mem_to_reg = 2'b00;
				reg_write = 1'b1;
				mem_read = 1'b0;
				mem_write = 1'b0;
				branch = 2'b00;
				alu_op = 4'b1100;
				jump = 2'b00;
				byte_number = 2'b00;
				
				$display("I type LUI instruction %b", op_code);
				
			end else if(op_code == 6'b101011 || op_code == 6'b111000) begin
			
				reg_dst = 2'b00;
				alu_src = 1'b1;
				mem_to_reg = 2'b11;
				reg_write = 1'b0;
				mem_read = 1'b0;
				mem_write = 1'b1;
				branch = 2'b00;
				alu_op = 4'b0100;
				jump = 2'b00;
				byte_number = 2'b00;
				
				$display("I type SW OR SC instruction %b", op_code);
				
			end else if(op_code == 6'b101000) begin
			
				reg_dst = 2'b00;
				alu_src = 1'b1;
				mem_to_reg = 2'b11;
				reg_write = 1'b0;
				mem_read = 1'b0;
				mem_write = 1'b1;
				branch = 2'b00;
				alu_op = 4'b0100;
				jump = 2'b00;
				byte_number = 2'b10;
				
				$display("I type SB instruction %b", op_code);
				
			end else if(op_code == 6'b101011) begin
			
				reg_dst = 2'b00;
				alu_src = 1'b1;
				mem_to_reg = 2'b11;
				reg_write = 1'b0;
				mem_read = 1'b0;
				mem_write = 1'b1;
				branch = 2'b00;
				alu_op = 4'b0100;
				jump = 2'b00;
				byte_number = 2'b01;
				
				$display("I type SH instruction %b", op_code);
				
			end else if (op_code == 6'b000100) begin
			
				reg_dst = 2'b00;
				alu_src = 1'b0;
				mem_to_reg = 2'b00;
				reg_write = 1'b0;
				mem_read = 1'b0;
				mem_write = 1'b0;
				branch = 2'b01;
				alu_op = 4'b0110;
				jump = 2'b00;
				byte_number = 2'b00;
				
				$display("I type BEQ instruction %b", op_code);
				
			end else if (op_code == 6'b000101) begin
			
				reg_dst = 2'b00;
				alu_src = 1'b0;
				mem_to_reg = 2'b00;
				reg_write = 1'b0;
				mem_read = 1'b0;
				mem_write = 1'b0;
				branch = 2'b10;
				alu_op = 4'b0110;
				jump = 2'b00;
				byte_number = 2'b00;
				
				$display("I type BNE instruction %b", op_code);
				
			end else begin
			
				reg_dst = 2'b00;
				alu_src = 1'b1;
				mem_to_reg = 2'b00;
				reg_write = 1'b1;
				mem_read = 1'b0;
				mem_write = 1'b0;
				branch = 2'b00;
				jump = 2'b00;
				byte_number = 2'b00;
				
				$display("I type other instructions %b", op_code);
				
				case(op_code)
					6'b001000 :
						alu_op = 4'b0100;		
					6'b001001 :
						alu_op = 4'b0101;	
					6'b001100 :
						alu_op = 4'b0000; 	
					6'b001101 :
						alu_op = 4'b0001;
					6'b001010 :
						alu_op = 4'b1110;
					6'b001011 :
						alu_op = 4'b1111;
						
					default : $display("Error in I type instruction %b",op_code);
				
				endcase
				
			end
		
		end

	end


endmodule
module mips_control(reg_dst, alu_src, mem_to_reg, reg_write, mem_read, mem_write, branch, alu_op, jump, byte_number, op_code, funct);


	output reg [1:0] reg_dst ;
	output reg alu_src;
	output reg [1:0] mem_to_reg ;
	output reg reg_write;
	output reg mem_read;
	output reg mem_write;
	output reg [1:0] branch ;
	output reg [3:0] alu_op ;
	output reg [1:0] jump ;
	output reg [1:0] byte_number ;

	input [5:0] op_code;
	input [5:0] funct;



	always @* begin
		
		if(op_code == 6'b000000) begin
			reg_dst = 2'b11;
			alu_src = 1'b0;
			mem_to_reg = 2'b00;
			mem_read = 1'b0;
			mem_write = 1'b0;
			branch = 2'b00;
			byte_number = 2'b00;
			
			if(funct == 6'b001000) begin
				alu_op = 4'b0011;
				jump = 2'b01;
				reg_write = 1'b0;
				
				$display("R type JR instruction %b", funct);
				
			end else begin	
				reg_write = 1'b1;
				jump = 2'b00;
				
				$display("R type other instruction %b", funct);
				
				case (funct) 
					6'b100000 :
						alu_op = 4'b0100;		
					6'b100001 :
						alu_op = 4'b0101;	
					6'b100100 :
						alu_op = 4'b0000; 
					6'b100111 :
						alu_op = 4'b0010; 
					6'b100101 :
						alu_op = 4'b0001;
					6'b101010 :
						alu_op = 4'b1110;
					6'b101011 :
						alu_op = 4'b1111;
					6'b000000 :
						alu_op = 4'b1000;
					6'b000010 :
						alu_op = 4'b1010;
					6'b100010 :
						alu_op = 4'b0110;
					6'b100011 :
						alu_op = 4'b0111;
							
					default : $display("Error in R type instruction %b",funct); 		 
				endcase
			
			end
		end else begin
			if(op_code == 6'b000010) begin
				reg_dst = 2'b01;
				alu_src = 1'b0;
				mem_to_reg = 2'b00;
				reg_write = 1'b0;
				mem_read = 1'b0;
				mem_write = 1'b0;
				branch = 2'b00;
				alu_op = 4'b0011;
				jump = 2'b11;
				byte_number = 2'b00;
				
				$display("J type J instruction %b", op_code);
				
			end else if(op_code == 6'b000011) begin
			
				reg_dst = 2'b01;
				alu_src = 1'b0;
				mem_to_reg = 2'b01;
				reg_write = 1'b1;
				mem_read = 1'b0;
				mem_write = 1'b0;
				branch = 2'b00;
				alu_op = 4'b0011;
				jump = 2'b11;
				byte_number = 2'b00;
				
				$display("J type JAL instruction %b", op_code);
			
			end else if (op_code == 6'b100011 || op_code == 6'b110000) begin
			
				reg_dst = 2'b00;
				alu_src = 1'b1;
				mem_to_reg = 2'b11;
				reg_write = 1'b1;
				mem_read = 1'b1;
				mem_write = 1'b0;
				branch = 2'b00;
				alu_op = 4'b0100;
				jump = 2'b00;
				byte_number = 2'b00;
				
				$display("I type LB or LL instruction %b", op_code);
				
			end else if(op_code == 6'b100100) begin
			
				reg_dst = 2'b00;
				alu_src = 1'b1;
				mem_to_reg = 2'b11;
				reg_write = 1'b1;
				mem_read = 1'b1;
				mem_write = 1'b0;
				branch = 2'b00;
				alu_op = 4'b0100;
				jump = 2'b00;
				byte_number = 2'b10;
				
				$display("I type LBU instruction %b", op_code);
				
			end else if(op_code == 6'b100101) begin
			
				reg_dst = 2'b00;
				alu_src = 1'b1;
				mem_to_reg = 2'b11;
				reg_write = 1'b1;
				mem_read = 1'b1;
				mem_write = 1'b0;
				branch = 2'b00;
				alu_op = 4'b0100;
				jump = 2'b00;
				byte_number = 2'b01;
				
				$display("I type LHU instruction %b", op_code);
				
			end else if(op_code == 6'b001111) begin
				reg_dst = 2'b00;
				alu_src = 1'b1;
				mem_to_reg = 2'b00;
				reg_write = 1'b1;
				mem_read = 1'b0;
				mem_write = 1'b0;
				branch = 2'b00;
				alu_op = 4'b1100;
				jump = 2'b00;
				byte_number = 2'b00;
				
				$display("I type LUI instruction %b", op_code);
				
			end else if(op_code == 6'b101011 || op_code == 6'b111000) begin
			
				reg_dst = 2'b00;
				alu_src = 1'b1;
				mem_to_reg = 2'b11;
				reg_write = 1'b0;
				mem_read = 1'b0;
				mem_write = 1'b1;
				branch = 2'b00;
				alu_op = 4'b0100;
				jump = 2'b00;
				byte_number = 2'b00;
				
				$display("I type SW OR SC instruction %b", op_code);
				
			end else if(op_code == 6'b101000) begin
			
				reg_dst = 2'b00;
				alu_src = 1'b1;
				mem_to_reg = 2'b11;
				reg_write = 1'b0;
				mem_read = 1'b0;
				mem_write = 1'b1;
				branch = 2'b00;
				alu_op = 4'b0100;
				jump = 2'b00;
				byte_number = 2'b10;
				
				$display("I type SB instruction %b", op_code);
				
			end else if(op_code == 6'b101011) begin
			
				reg_dst = 2'b00;
				alu_src = 1'b1;
				mem_to_reg = 2'b11;
				reg_write = 1'b0;
				mem_read = 1'b0;
				mem_write = 1'b1;
				branch = 2'b00;
				alu_op = 4'b0100;
				jump = 2'b00;
				byte_number = 2'b01;
				
				$display("I type SH instruction %b", op_code);
				
			end else if (op_code == 6'b000100) begin
			
				reg_dst = 2'b00;
				alu_src = 1'b0;
				mem_to_reg = 2'b00;
				reg_write = 1'b0;
				mem_read = 1'b0;
				mem_write = 1'b0;
				branch = 2'b01;
				alu_op = 4'b0110;
				jump = 2'b00;
				byte_number = 2'b00;
				
				$display("I type BEQ instruction %b", op_code);
				
			end else if (op_code == 6'b000101) begin
			
				reg_dst = 2'b00;
				alu_src = 1'b0;
				mem_to_reg = 2'b00;
				reg_write = 1'b0;
				mem_read = 1'b0;
				mem_write = 1'b0;
				branch = 2'b10;
				alu_op = 4'b0110;
				jump = 2'b00;
				byte_number = 2'b00;
				
				$display("I type BNE instruction %b", op_code);
				
			end else begin
			
				reg_dst = 2'b00;
				alu_src = 1'b1;
				mem_to_reg = 2'b00;
				reg_write = 1'b1;
				mem_read = 1'b0;
				mem_write = 1'b0;
				branch = 2'b00;
				jump = 2'b00;
				byte_number = 2'b00;
				
				$display("I type other instructions %b", op_code);
				
				case(op_code)
					6'b001000 :
						alu_op = 4'b0100;		
					6'b001001 :
						alu_op = 4'b0101;	
					6'b001100 :
						alu_op = 4'b0000; 	
					6'b001101 :
						alu_op = 4'b0001;
					6'b001010 :
						alu_op = 4'b1110;
					6'b001011 :
						alu_op = 4'b1111;
						
					default : $display("Error in I type instruction %b",op_code);
				
				endcase
				
			end
		
		end

	end


endmodule