aboutsummaryrefslogtreecommitdiff
path: root/src/logic_unit.v
blob: 85c9137f48f7fa72e2c1e5af609690081f9f068c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
module logic_unit #(
  parameter N = 32
)(
  input [N-1:0] lu_src0, lu_src1,
  input [1:0] lu_op, // 00: AND, 01: OR, 10: XOR
  output reg [N-1:0] lu_result
);
  
  always @ (*) begin
    case (lu_op)
      2'b00: lu_result <= lu_src0 & lu_src1;
      2'b01: lu_result <= lu_src0 | lu_src1;
      2'b10: lu_result <= lu_src0 ^ lu_src1;
    endcase
  end

endmodule