Make ALU div/mul pipelines longer and support logic element multiplication mode for better long pipeline performance

This commit is contained in:
wgulian3
2020-02-22 20:16:13 -05:00
parent b2afe526fe
commit 23aabbf01d
2 changed files with 43 additions and 21 deletions

View File

@@ -14,8 +14,8 @@ module VX_alu(
output reg out_alu_stall output reg out_alu_stall
); );
localparam div_pipeline_len = 10; localparam div_pipeline_len = 20;
localparam mul_pipeline_len = 3; localparam mul_pipeline_len = 8;
wire[31:0] unsigned_div_result; wire[31:0] unsigned_div_result;
wire[31:0] unsigned_rem_result; wire[31:0] unsigned_rem_result;
@@ -62,6 +62,7 @@ module VX_alu(
.WIDTHB(64), .WIDTHB(64),
.WIDTHP(64), .WIDTHP(64),
.SPEED("HIGHEST"), .SPEED("HIGHEST"),
.FORCE_LE("YES"),
.PIPELINE(mul_pipeline_len) .PIPELINE(mul_pipeline_len)
) multiplier ( ) multiplier (
.clock(clk), .clock(clk),

View File

@@ -5,7 +5,8 @@ module VX_mult
parameter WIDTHP=1, parameter WIDTHP=1,
parameter REP="UNSIGNED", parameter REP="UNSIGNED",
parameter SPEED="MIXED", // "MIXED" or "HIGHEST" parameter SPEED="MIXED", // "MIXED" or "HIGHEST"
parameter PIPELINE=0 parameter PIPELINE=0,
parameter FORCE_LE="NO"
) )
( (
input clock, aclr, clken, input clock, aclr, clken,
@@ -30,21 +31,41 @@ module VX_mult
localparam lpm_speed=SPEED == "HIGHEST" ? 10:5; localparam lpm_speed=SPEED == "HIGHEST" ? 10:5;
lpm_mult#( if (FORCE_LE == "YES") begin
.LPM_WIDTHA(WIDTHA), lpm_mult#(
.LPM_WIDTHB(WIDTHB), .LPM_WIDTHA(WIDTHA),
.LPM_WIDTHP(WIDTHP), .LPM_WIDTHB(WIDTHB),
.LPM_REPRESENTATION(REP), .LPM_WIDTHP(WIDTHP),
.LPM_PIPELINE(PIPELINE), .LPM_REPRESENTATION(REP),
.MAXIMIZE_SPEED(lpm_speed) .LPM_PIPELINE(PIPELINE),
) quartus_mult( .DSP_BLOCK_BALANCING("LOGIC ELEMENTS"),
.clock(clock), .MAXIMIZE_SPEED(lpm_speed)
.aclr(aclr), ) quartus_mult(
.clken(clken), .clock(clock),
.dataa(dataa), .aclr(aclr),
.datab(datab), .clken(clken),
.result(result) .dataa(dataa),
); .datab(datab),
.result(result)
);
end
else begin
lpm_mult#(
.LPM_WIDTHA(WIDTHA),
.LPM_WIDTHB(WIDTHB),
.LPM_WIDTHP(WIDTHP),
.LPM_REPRESENTATION(REP),
.LPM_PIPELINE(PIPELINE),
.MAXIMIZE_SPEED(lpm_speed)
) quartus_mult(
.clock(clock),
.aclr(aclr),
.clken(clken),
.dataa(dataa),
.datab(datab),
.result(result)
);
end
end end
else begin else begin
@@ -92,13 +113,13 @@ module VX_mult
/* * * * * * * * * * * * * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * * * * * * */
if (REP == "SIGNED") begin if (REP == "SIGNED") begin
assign result = $signed($signed(dataa_pipe_end) * $signed(datab_pipe_end)); assign result = $signed($signed(dataa_pipe_end)*$signed(datab_pipe_end));
end end
else begin else begin
assign result = dataa_pipe_end * datab_pipe_end; assign result = dataa_pipe_end*datab_pipe_end;
end end
end end
endgenerate endgenerate
endmodule : VX_mult endmodule: VX_mult