for (j=0;j<k;j=j+1) begin:loop2
assign row[i+1][j][m+i:0] = {1'b0,row[i][j][m+i-1:0]};
end
row
is a register.
It does not work as I am doing it. Can anyone please help me to fix it?
Thank you very much.
for (j=0;j<k;j=j+1) begin:loop2
assign row[i+1][j][m+i:0] = {1'b0,row[i][j][m+i-1:0]};
end
row
is a register.
It does not work as I am doing it. Can anyone please help me to fix it?
Thank you very much.
When I try to compile your code (using the VCS simulator), I get the following type of compile error:
The following expression should be a constant: (m+i)
Obviously, since you have provided an incomplete code sample, I have had to make many assumptions about how you have declared your variables. I assumed that i
and m
are integer
variables. If that is the case, you could attempt to use a generate
block.
If that is not the case, you must:
"It does not work as I am doing it" is not very descriptive.
assign
is used for a continuous assignment. It does not look like that is what you want. Remove the assign
keyword for a regular procedural assignment.
It is true that assign keyword should not be used there since that for loop has to be inside of an always block. Assign can only be used outside an always block. The error means that you are indexing the array with a variable expression.
I'm guessing that m is not a loop variable and therefore the values are unknown and could potentially result in invalid values for the array. This results in the expression being non sythesizable as well. If m is truly some variable value you are going to have to restructure your logic for it to work.
for (d=k-1;d>0;d=d-1) begin:loop8
input_temp[d][0][m+d-1:0] <= {s_temp[d-1][m+d-2],s_temp[d-1][m+d-2:0]};
input_temp[d][1][m+d-1:0] <= {c_temp[d-1][m+d-2:0],1'b0};
for (c=0;c<k;c=c+1) begin:loop5
row[d][c][m+d-1:0] <= {row[d-1][c][m+d-2],row[d-1][c][m+d-2:0]};
end
end
This is my updated code, which correct all the error, but it still does not work, this code block is inside always. m is parameter.
Can you please help me out, thanks