aboutsummaryrefslogtreecommitdiff
path: root/rtl/src/logic_unit.v
blob: fad0287c51edf2020af086b880f7a5b3c32a00a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// logic unit:
// Logic part of alu.

module logic_unit (
  input [31:0] a, 
  input [31:0] b,

  input [1:0] op,
  
  output reg [31:0] result
);

`include "include/consts.vh"
  
always @ (*) begin
  case (op)
    LOGIC_OP_AND: result = a & b; // AND
    LOGIC_OP_OR:  result = a | b; // OR
    LOGIC_OP_XOR: result = a ^ b; // XOR
    default:      result = 32'b0;
  endcase
end

endmodule