Altera_Forum
Honored Contributor
14 years agoStoring data in array
Hi,
I wrote a simple code for multiplication and wanted to store the result in an array. The code does not show any error during compilation, but the output is zeros. Could some one tell me why I am unable to store the result in array. The code is as follows. always @(posedge clk)begin
for(i=0;i<5;i=i+1)
begin
temp= x*h[i];
end
y=temp[0]+temp[1]+temp[2]+temp[3]+temp[4];
out[n]=y;
n=n+1'b1;
end
endmodule
"Y" is my actual output and out is a register (array) in which I would like to store the result of y. When I run this code, the value of y is displayed, but out is zeros. counter "n" is a register. I would appreciate any suggestions regarding this. Thank you, Ambrin