Source

mini-mips / alu_control_mips.v

Full commit

module alu_control_mips
	(input wire [5:0] inst,
	input wire [1:0] aluOp,
	output reg [3:0] aluControl);

	always @(*)
	begin
		casex ({aluOp, inst})
			8'b00??????: aluControl = 4'b0010;
			8'b01??????: aluControl = 4'b0110;
			8'b10100000: aluControl = 4'b0010;
			8'b10100010: aluControl = 4'b0110;
			8'b10100100: aluControl = 4'b0000;
			8'b10100101: aluControl = 4'b0001;
			8'b10101010: aluControl = 4'b0111;
			8'b10100111: aluControl = 4'b1100;
			default: $display("ERROR alu_control_mips: default case - {aluOp, inst}: %b %b", aluOp,inst);
		endcase
	end
endmodule