fixed lmp_mult parameters, ram init filepath

This commit is contained in:
Blaise Tine
2020-09-04 07:51:46 -07:00
parent dccea80b68
commit 42e3b6c45d
36 changed files with 738 additions and 495 deletions

View File

@@ -1,21 +1,18 @@
`include "VX_platform.vh"
module VX_divide #(
parameter WIDTHN = 1,
parameter WIDTHD = 1,
parameter WIDTHQ = 1,
parameter WIDTHR = 1,
parameter WIDTHN = 1,
parameter WIDTHD = 1,
parameter WIDTHQ = 1,
parameter WIDTHR = 1,
parameter NSIGNED = 0,
parameter DSIGNED = 0,
parameter PIPELINE = 0
parameter LATENCY = 0
) (
input wire clk,
input wire reset,
input wire clk_en,
input wire enable,
input wire [WIDTHN-1:0] numer,
input wire [WIDTHD-1:0] denom,
output wire [WIDTHQ-1:0] quotient,
output wire [WIDTHR-1:0] remainder
);
@@ -27,11 +24,11 @@ module VX_divide #(
lpm_divide divide (
.clock (clk),
.clken (enable),
.numer (numer),
.denom (denom),
.quotient (quotient_unqual),
.remain (remainder_unqual),
.clken (clk_en)
.remain (remainder_unqual)
);
defparam
@@ -41,7 +38,7 @@ module VX_divide #(
divide.lpm_nrepresentation = NSIGNED ? "SIGNED" : "UNSIGNED",
divide.lpm_drepresentation = DSIGNED ? "SIGNED" : "UNSIGNED",
divide.lpm_hint = "MAXIMIZE_SPEED=6,LPM_REMAINDERPOSITIVE=FALSE",
divide.lpm_pipeline = PIPELINE;
divide.lpm_pipeline = LATENCY;
assign quotient = quotient_unqual [WIDTHQ-1:0];
assign remainder = remainder_unqual [WIDTHR-1:0];
@@ -72,34 +69,24 @@ module VX_divide #(
end
end
if (PIPELINE == 0) begin
if (LATENCY == 0) begin
assign quotient = quotient_unqual [WIDTHQ-1:0];
assign remainder = remainder_unqual [WIDTHR-1:0];
end else begin
reg [WIDTHN-1:0] quotient_pipe [0:PIPELINE-1];
reg [WIDTHD-1:0] remainder_pipe [0:PIPELINE-1];
reg [WIDTHN-1:0] quotient_pipe [0:LATENCY-1];
reg [WIDTHD-1:0] remainder_pipe [0:LATENCY-1];
for (genvar i = 0; i < PIPELINE; i++) begin
always @(posedge clk) begin
if (reset) begin
quotient_pipe[i] <= 0;
remainder_pipe[i] <= 0;
end else begin
if (clk_en) begin
if (i == 0) begin
quotient_pipe[i] <= quotient_unqual;
remainder_pipe[i] <= remainder_unqual;
end else begin
quotient_pipe[i] <= quotient_pipe[i-1];
remainder_pipe[i] <= remainder_pipe[i-1];
end
end
for (genvar i = 0; i < LATENCY; i++) begin
always @(posedge clk) begin
if (enable) begin
quotient_pipe[i] <= (0 == i) ? quotient_unqual : quotient_pipe[i-1];
remainder_pipe[i] <= (0 == i) ? remainder_unqual : remainder_pipe[i-1];
end
end
end
assign quotient = quotient_pipe[PIPELINE-1][WIDTHQ-1:0];
assign remainder = remainder_pipe[PIPELINE-1][WIDTHR-1:0];
assign quotient = quotient_pipe[LATENCY-1][WIDTHQ-1:0];
assign remainder = remainder_pipe[LATENCY-1][WIDTHR-1:0];
end
`endif