Fill in the architecture to build a functional ALU for RV32I. The operands are 32 bits each.

The operation should be performed according the 4-bit input operation, which is made up of {imm7[5], imm3} from the instruction.

This is summarized in the following table (note that these are listed in order shown on the instruction reference, not in binary order):

0000ADD (add)
1000SUB (subtract)
0001SLL (shift left logical)
0010SLT (set if less than)
0011SLTU (set if less than unsigned)
0100XOR (bitwise XOR)
0101SRL (shift right logical)
1101SRA (shift right arithmetic)
0110OR (bitwise OR)
0111AND (bitwise AND)


module alu(input logic[31:0] operand1, input logic[31:0] operand2, input logic[3:0] operation, output logic[31:0] result); // You're building a real processor!! endmodule

Are you confident about this change? (select one to recompile)

Compiler/test output: