aboutsummaryrefslogtreecommitdiff
path: root/src/logic_unit.v
blob: f9f62a2ab57ff65e6f82e6d44ab45d638a350f44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
module logic_unit (
  input [31:0] a, b,
  input [1:0] op,
  output reg [31:0] result
);
  
always @ (*) begin
  case (op)
    2'b00: result <= a & b; // AND
    2'b01: result <= a | b; // OR
    2'b10: result <= a ^ b; // XOR
    default: result <= 32'b0;
  endcase
end

endmodule