I want to compute sum of elements of an array. Elements of the array are assigned on each clock rising edge (sequentially). I don't want to get the sum of elements on the next clock rising edge, So the design of sum must be combinational. I can get the correct result in simulation without any errors, but my code is not synthesized in ISE (Xilinx Synthesis tool). I'm working on Spartan3.
My code :
always @* begin
sum = 0;
for (i=0; i<K; i=i+1)
sum = sum + shiftReg[i];
end
ERROR :
Xst:902 - Unexpected shiftReg event in always block sensitivity list.
I searched for solutions. One way is to add all of the elements of shiftReg
in sensitivity list, but in my project the number of elements is K
(K
is a parameter).