-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathALU_Decoder.v
More file actions
17 lines (14 loc) · 787 Bytes
/
ALU_Decoder.v
File metadata and controls
17 lines (14 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
module ALU_Decoder(ALUOp,funct3,funct7,op,ALUControl);
input [1:0]ALUOp;
input [2:0]funct3;
input [6:0]funct7,op;
output [2:0]ALUControl;
assign ALUControl = (ALUOp == 2'b00) ? 3'b000 :
(ALUOp == 2'b01) ? 3'b001 :
((ALUOp == 2'b10) & (funct3 == 3'b000) & ({op[5],funct7[5]} == 2'b11)) ? 3'b001 :
((ALUOp == 2'b10) & (funct3 == 3'b000) & ({op[5],funct7[5]} != 2'b11)) ? 3'b000 :
((ALUOp == 2'b10) & (funct3 == 3'b010)) ? 3'b101 :
((ALUOp == 2'b10) & (funct3 == 3'b110)) ? 3'b011 :
((ALUOp == 2'b10) & (funct3 == 3'b111)) ? 3'b010 :
3'b000 ;
endmodule