aboutsummaryrefslogtreecommitdiff
path: root/src/logic_unit.v
blob: 0bbd64294e53089680e97b07e9fb2dcf6de91999 (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] src0, src1,
  input [1:0] op, // 00: AND, 01: OR, 10: XOR
  output reg [N-1:0] result
);
  
always @ (*) begin
  case (op)
  2'b00: result <= src0 & src1;
  2'b01: result <= src0 | src1;
  2'b10: result <= src0 ^ src1;
  endcase
end

endmodule