R
rekz
Guest
I have the following ALU as a part of my datapath and I want to
optimize it more as I think that doing the way below is slow:
module ALU(Reg1, Reg2, Control, Result);
input signed[31:0] Reg1;
input signed[31:0] Reg2;
input[2:0] Control;
output[31:0] Result;
reg signed[31:0] Result;
reg[63:0] mul;
always @(Reg1, Reg2, Control) begin
case (Control)
3'b001: // ADD
Result =Reg1+Reg2;
3'b010: // SUBTRACT
Result =Reg1-Reg2;
3'b011: // AND
Result=Reg1&Reg2;
3'b100: // MUL
begin
mul = Reg1 * Reg2;
Result = mul[31:0];
end
3'b101:
begin
end
default:
Result = Reg1;
endcase
end
endmodule
how can I optimize it more? Should I create a gate level adder? Will
it speed up more in the synthesis report
optimize it more as I think that doing the way below is slow:
module ALU(Reg1, Reg2, Control, Result);
input signed[31:0] Reg1;
input signed[31:0] Reg2;
input[2:0] Control;
output[31:0] Result;
reg signed[31:0] Result;
reg[63:0] mul;
always @(Reg1, Reg2, Control) begin
case (Control)
3'b001: // ADD
Result =Reg1+Reg2;
3'b010: // SUBTRACT
Result =Reg1-Reg2;
3'b011: // AND
Result=Reg1&Reg2;
3'b100: // MUL
begin
mul = Reg1 * Reg2;
Result = mul[31:0];
end
3'b101:
begin
end
default:
Result = Reg1;
endcase
end
endmodule
how can I optimize it more? Should I create a gate level adder? Will
it speed up more in the synthesis report