|
@@ -452,5 +452,56 @@ module motor_axis_words #(parameter integer AXIS_COUNT=3)
|
|
|
words[AXIS_COUNT-1]<=write_data;
|
|
words[AXIS_COUNT-1]<=write_data;
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
- assign read_data=words[0];
|
|
|
|
|
|
|
+ // Eight documented two-register DSP pipelines carry144 zero-initialized
|
|
|
|
|
+ // state bits. Remaining clocks stay in fabric registers, so the complete
|
|
|
|
|
+ // delay is still exactly AXIS_COUNT clocks. The half-period reset bit is
|
|
|
|
|
+ // outside this range. One-axis verification keeps the original bank.
|
|
|
|
|
+ generate if(AXIS_COUNT>=2)begin:dsp_storage
|
|
|
|
|
+ wire [143:0] dsp_delayed;
|
|
|
|
|
+ genvar d;
|
|
|
|
|
+ for(d=0;d<8;d=d+1)begin:lanes
|
|
|
|
|
+ ef2_motor_delay18 u_delay(.clk(clk),.rst_n(rst_n),
|
|
|
|
|
+ .data(write_data[32+d*18+:18]),.delayed(dsp_delayed[d*18+:18]));
|
|
|
|
|
+ end
|
|
|
|
|
+ wire [143:0] complete_delay;
|
|
|
|
|
+ if(AXIS_COUNT==2)begin:two
|
|
|
|
|
+ assign complete_delay=dsp_delayed;
|
|
|
|
|
+ end else begin:tail
|
|
|
|
|
+ reg [143:0] stages[0:AXIS_COUNT-3];
|
|
|
|
|
+ integer j;
|
|
|
|
|
+ always @(posedge clk or negedge rst_n)begin
|
|
|
|
|
+ if(!rst_n)for(j=0;j<AXIS_COUNT-2;j=j+1)stages[j]<=0;
|
|
|
|
|
+ else begin
|
|
|
|
|
+ stages[0]<=dsp_delayed;
|
|
|
|
|
+ for(j=1;j<AXIS_COUNT-2;j=j+1)stages[j]<=stages[j-1];
|
|
|
|
|
+ end
|
|
|
|
|
+ end
|
|
|
|
|
+ assign complete_delay=stages[AXIS_COUNT-3];
|
|
|
|
|
+ end
|
|
|
|
|
+ assign read_data={words[0][321:176],complete_delay,words[0][31:0]};
|
|
|
|
|
+ end else begin:fabric_storage
|
|
|
|
|
+ assign read_data=words[0];
|
|
|
|
|
+ end endgenerate
|
|
|
|
|
+endmodule
|
|
|
|
|
+
|
|
|
|
|
+// UG401 section17 documents independent input-A and product registers.
|
|
|
|
|
+// Unsigned multiplication by1 uses those two stages as an18-bit delay.
|
|
|
|
|
+// This is internal storage, not an arithmetic service or a new clock domain.
|
|
|
|
|
+module ef2_motor_delay18(input wire clk,rst_n,input wire[17:0]data,output wire[17:0]delayed);
|
|
|
|
|
+`ifdef PROD2U_TD_VENDOR_RAM
|
|
|
|
|
+ wire [35:0] product;
|
|
|
|
|
+ EF2_LOGIC_MULT #(.INPUT_WIDTH_A(18),.INPUT_WIDTH_B(18),.OUTPUT_WIDTH(36),
|
|
|
|
|
+ .INPUTFORMAT("UNSIGNED"),.INPUTREGA("ENABLE"),.INPUTREGB("DISABLE"),
|
|
|
|
|
+ .OUTPUTREG("ENABLE"),.IMPLEMENT("DSP"),.SRMODE("ASYNC")) u_pipeline(
|
|
|
|
|
+ .clk(clk),.a(data),.b(18'd1),.p(product),.cea(1'b1),.ceb(1'b1),.cepd(1'b1),
|
|
|
|
|
+ .rstan(rst_n),.rstbn(rst_n),.rstpdn(rst_n));
|
|
|
|
|
+ assign delayed=product[17:0];
|
|
|
|
|
+`else
|
|
|
|
|
+ reg [17:0] input_stage,product_stage;
|
|
|
|
|
+ always @(posedge clk or negedge rst_n)begin
|
|
|
|
|
+ if(!rst_n)begin input_stage<=0;product_stage<=0;end
|
|
|
|
|
+ else begin input_stage<=data;product_stage<=input_stage;end
|
|
|
|
|
+ end
|
|
|
|
|
+ assign delayed=product_stage;
|
|
|
|
|
+`endif
|
|
|
endmodule
|
|
endmodule
|