I'm writing a FIR filter in Verilog, but the circuit does not synthesize. I've tried many different things, but ultimately it doesn't seem to want to synthesize the sum of an array.
I have tried splitting up the sum into 8 or 16 or 32 different sums; then summing those.
As soon as I try to use the resulting sum to drive another register, it starts having trouble synthesizing.
Initially I tried doing the summation and FIR multiplication at one time:
sum = 0;
for (ii=0; ii<2048; ii=ii+1) begin
sum = sum + taps[ii]*signalHist[ii];
end
This didn't work(synthesis never completed). So I tried splitting the multiplication into one loop and triggering the sum on the next clock cycle. Still no good.
Then I tried manually splitting the sum into many different sums (eg. 16 or 32) - then summing those 32 sums on the next clock cycle. This seems to synthesize as long as I didn't use the result to drive anything else in my design, but as soon as I try to use that final sum to drive another register I get synthetization problems (Quartus spins forever).
for (ii=0; ii<2048; ii=ii+1) begin
product[ii] <= taps[ii]*signalHist[ii];
end
productTrig <= ~productTrig; //triggers sum on next clock cycle
The first part of the sum was as follows, summing 64 points at a time below (I tried 128, 256, etc):
sumOfItAll[0] = 0;
sumOfItAll[1] = 0;
...
SumOfItAll[31] = 0;
for (ii=0; ii<64; ii=ii+1) begin //4096 or 256 loops
sumOfItAll[0] = sumOfItAll[0] + product[ii];
sumOfItAll[1] = sumOfItAll[1] + product[ii+1*64];
...
sumOfItAll[31] = sumOfItAll[31] + product[ii+31*64];
end
sumOfItAllTrig = ~sumOfItAllTrig;// triggers the second sum of these
And the second part of the sum, triggered on the next clock cycle:
sum = 0;
for (ii=0; ii<32; ii=ii+1) begin
sum = sum + sumOfItAll[ii];
end
doneReading = ~doneReading; //triggers the sum to be output to DAC register
All this splitting the summation up manually; and it seems to have the same synthesis issues - Quartus just spins forever.
If I don't use that resulting sumOfItAll[ii] (or only use sumOfItAll[0], for example) it synthesizes just fine. But that, of course, is not what I am trying to do.
Is there something fundamentally wrong with my HDL, or what I'm trying to do with Verilog? Is there any way I can get these 2048-point (or more) sums to synthesize?
Is there a way I can get Quartus to do this by letting it use more clock cycles?