data/full_repos/permissive/149079484/RISC-V_Cache-lab/ALUControl.v
data/verilator_xmls/dac6bf60-333e-44db-b0b8-90eaf063ecc6.xml
module ALUControl (
	input wire [6:0] ALUOp, 
	input wire [2:0] funct3,
	input wire [6:0] funct7,

	output reg [4:0] ALU_operation
	);

	always @(*) begin
		if (ALUOp == 7'b0110111 || ALUOp == 7'b0010111) begin
			if (ALUOp == 7'b0110111) ALU_operation = 5'b01000;
			else if (ALUOp == 7'b0010111) ALU_operation = 5'b00000;
		end
		else if (ALUOp == 7'b0110011) begin
			if (funct3 == 3'b000 && funct7 == 7'b0000000) ALU_operation = 5'b00000;
			else if (funct3 == 3'b000 && funct7 == 7'b0100000) ALU_operation = 5'b00001;
			else if (funct3 == 3'b001) ALU_operation = 5'b01101;
			else if (funct3 == 3'b010) ALU_operation = 5'b10110;
			else if (funct3 == 3'b011) ALU_operation = 5'b10111;
			else if (funct3 == 3'b100) ALU_operation = 5'b00110;
			else if (funct3 == 3'b101 && funct7 == 7'b0000000) ALU_operation = 5'b01010;
			else if (funct3 == 3'b101 && funct7 == 7'b0100000) ALU_operation = 5'b01011;
			else if (funct3 == 3'b110) ALU_operation = 5'b00011;
			else if (funct3 == 3'b111) ALU_operation = 5'b00010;
		end
		else if (ALUOp == 7'b0010011) begin
			if (funct3 == 3'b000) ALU_operation = 5'b00000;
			else if (funct3 == 3'b010) ALU_operation = 5'b10110;
			else if (funct3 == 3'b011) ALU_operation = 5'b10111;
			else if (funct3 == 3'b100) ALU_operation = 5'b00110;
			else if (funct3 == 3'b110) ALU_operation = 5'b00011;
			else if (funct3 == 3'b111) ALU_operation = 5'b00010;
			else if (funct3 == 3'b001) ALU_operation = 5'b01101;
			else if (funct3 == 3'b101 && funct7 == 7'b0000000) ALU_operation = 5'b01010;
			else if (funct3 == 3'b101 && funct7 == 7'b0100000) ALU_operation = 5'b01011;
		end
		else if (ALUOp == 7'b0000011) begin
			if (funct3 == 3'b000) ALU_operation = 5'b00000;
			else if (funct3 == 3'b001) ALU_operation = 5'b00000;
			else if (funct3 == 3'b010) ALU_operation = 5'b00000;
			else if (funct3 == 3'b100) ALU_operation = 5'b00000;
			else if (funct3 == 3'b101) ALU_operation = 5'b00000;
		end
		else if (ALUOp == 7'b0100011) begin
			if (funct3 == 3'b000) ALU_operation = 5'b00000;
			else if (funct3 == 3'b001) ALU_operation = 5'b00000;
			else if (funct3 == 3'b010) ALU_operation = 5'b00000;
		end
		else if (ALUOp == 7'b1100011) begin
			if (funct3 == 3'b000) ALU_operation = 5'b10000;
			else if (funct3 == 3'b001) ALU_operation = 5'b10001;
			else if (funct3 == 3'b100) ALU_operation = 5'b10010;
			else if (funct3 == 3'b101) ALU_operation = 5'b10011;
			else if (funct3 == 3'b110) ALU_operation = 5'b10100;
			else if (funct3 == 3'b111) ALU_operation = 5'b10101;
		end
		else if (ALUOp == 7'b1101111 || ALUOp == 7'b1100111) begin
			if (ALUOp == 7'b1101111) ALU_operation = 5'b00000;
			else if (ALUOp == 7'b1100111) ALU_operation = 5'b00000;
		end
		else begin
			ALU_operation = 5'bxxxxx;
		end
	end
endmodule
module ALUControl (
	input wire [6:0] ALUOp, 
	input wire [2:0] funct3,
	input wire [6:0] funct7,

	output reg [4:0] ALU_operation
	);


	always @(*) begin
		if (ALUOp == 7'b0110111 || ALUOp == 7'b0010111) begin
			if (ALUOp == 7'b0110111) ALU_operation = 5'b01000;
			else if (ALUOp == 7'b0010111) ALU_operation = 5'b00000;
		end
		else if (ALUOp == 7'b0110011) begin
			if (funct3 == 3'b000 && funct7 == 7'b0000000) ALU_operation = 5'b00000;
			else if (funct3 == 3'b000 && funct7 == 7'b0100000) ALU_operation = 5'b00001;
			else if (funct3 == 3'b001) ALU_operation = 5'b01101;
			else if (funct3 == 3'b010) ALU_operation = 5'b10110;
			else if (funct3 == 3'b011) ALU_operation = 5'b10111;
			else if (funct3 == 3'b100) ALU_operation = 5'b00110;
			else if (funct3 == 3'b101 && funct7 == 7'b0000000) ALU_operation = 5'b01010;
			else if (funct3 == 3'b101 && funct7 == 7'b0100000) ALU_operation = 5'b01011;
			else if (funct3 == 3'b110) ALU_operation = 5'b00011;
			else if (funct3 == 3'b111) ALU_operation = 5'b00010;
		end
		else if (ALUOp == 7'b0010011) begin
			if (funct3 == 3'b000) ALU_operation = 5'b00000;
			else if (funct3 == 3'b010) ALU_operation = 5'b10110;
			else if (funct3 == 3'b011) ALU_operation = 5'b10111;
			else if (funct3 == 3'b100) ALU_operation = 5'b00110;
			else if (funct3 == 3'b110) ALU_operation = 5'b00011;
			else if (funct3 == 3'b111) ALU_operation = 5'b00010;
			else if (funct3 == 3'b001) ALU_operation = 5'b01101;
			else if (funct3 == 3'b101 && funct7 == 7'b0000000) ALU_operation = 5'b01010;
			else if (funct3 == 3'b101 && funct7 == 7'b0100000) ALU_operation = 5'b01011;
		end
		else if (ALUOp == 7'b0000011) begin
			if (funct3 == 3'b000) ALU_operation = 5'b00000;
			else if (funct3 == 3'b001) ALU_operation = 5'b00000;
			else if (funct3 == 3'b010) ALU_operation = 5'b00000;
			else if (funct3 == 3'b100) ALU_operation = 5'b00000;
			else if (funct3 == 3'b101) ALU_operation = 5'b00000;
		end
		else if (ALUOp == 7'b0100011) begin
			if (funct3 == 3'b000) ALU_operation = 5'b00000;
			else if (funct3 == 3'b001) ALU_operation = 5'b00000;
			else if (funct3 == 3'b010) ALU_operation = 5'b00000;
		end
		else if (ALUOp == 7'b1100011) begin
			if (funct3 == 3'b000) ALU_operation = 5'b10000;
			else if (funct3 == 3'b001) ALU_operation = 5'b10001;
			else if (funct3 == 3'b100) ALU_operation = 5'b10010;
			else if (funct3 == 3'b101) ALU_operation = 5'b10011;
			else if (funct3 == 3'b110) ALU_operation = 5'b10100;
			else if (funct3 == 3'b111) ALU_operation = 5'b10101;
		end
		else if (ALUOp == 7'b1101111 || ALUOp == 7'b1100111) begin
			if (ALUOp == 7'b1101111) ALU_operation = 5'b00000;
			else if (ALUOp == 7'b1100111) ALU_operation = 5'b00000;
		end
		else begin
			ALU_operation = 5'bxxxxx;
		end
	end
endmodule