DDS
DDS copied to clipboard
Index 2 out of range [1:0] out_sin_buf_taylor
I like the code!
Is there a mistake at the lines '214' and '275' of dds.sv?
always_ff @(posedge clk) begin
integer k;
for (k = 0; k < TAYLOR_OUT_PIPELINE_STAGES; k = k + 1) begin
Shouldn't it be:
always_ff @(posedge clk) begin
integer k;
for (k = 0; k < TAYLOR_OUT_PIPELINE_STAGES-1; k = k + 1) begin
Otherwise it doesn't make sense with:
reg signed [OUT_DW - 1 : 0] out_sin_buf_taylor[TAYLOR_PIPELINE_STAGES - 2 : 0];
reg signed [OUT_DW - 1 : 0] out_cos_buf_taylor[TAYLOR_PIPELINE_STAGES - 2 : 0];
Since otherwise the index goes out of range!
Hi, I think it does not go out of range because there is an if around the assignment
else if (k < TAYLOR_PIPELINE_STAGES -1) begin // stages 6-7
out_sin_buf_taylor[k] <= out_sin_buf_taylor[k-1];
Yes you are correct, except for the if(!reset_n) part.
It seems that some synthesize software doesn't like it if index goes out of range for !reset_n Probably most synthesize tools recognize it is a reset, so they don't bother that it goes out of range.
integer k;
for (k = 0; k < TAYLOR_PIPELINE_STAGES; k = k + 1) begin
if (!reset_n) begin
out_sin_buf_taylor[k] <= '0;
out_cos_buf_taylor[k] <= '0;
sin_extended[k] <= '0;
cos_extended[k] <= '0;
phase_error_multiplied_buf[k] <= '0;
phase_error_multiplied_buf2[k] <= '0;
valid_taylor[k] <= '0;
end else begin
if(k == 0) begin
yes u r right. The code could be a bit cleaned up in general. PRs are welcome :)