summaryrefslogtreecommitdiff
path: root/alu_control/v0.1/alu_control.v
blob: fb6a743bef3392c7fa0d7aba2c71b40dab49e2f7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
module alu_control(
    input [1:0] alu_op,
    input [3:0] opcode,
    output reg [2:0] alu_cnt
    
);

wire [5:0]alu_control_in;
assign alu_control_in = {alu_op, opcode};

always @(alu_control_in)
casex (alu_control_in)
   6'b10xxxx: alu_cnt=3'b000;
   6'b01xxxx: alu_cnt=3'b001;
   6'b000010: alu_cnt=3'b000;
   6'b000011: alu_cnt=3'b001;
   6'b000100: alu_cnt=3'b010;
   6'b000101: alu_cnt=3'b011;
   6'b000110: alu_cnt=3'b100;
   6'b000111: alu_cnt=3'b101;
   6'b001000: alu_cnt=3'b110;
   6'b001001: alu_cnt=3'b111;
  default: alu_cnt=3'b000;
endcase

endmodule