Thread: XST issues with loop code View Single Post
04-19-2006, 04:53 PM
 Jeff Brower Guest Posts: n/a
XST issues with loop code

All-

comparisons inside nested loop code within an always block. The code
is of this form:

always @( a[0], a[1], a[2], ... ) begin

for (i=0; i<32; i++) begin

for (j=0; j<32; j++) begin

if (a[j][4:0] == i) begin

if (a[j][28:27] == 2'd2) <-- comparison

b1[i][j] = 1'b1;

else

b2[i][j] = 1'b1;
end
else begin
b1[i][j] = 1'b0;
b2[i][j] = 1'b0;
end
end
end
end

What I found for the following ways to do the innermost comparison:

if (a[j][28:27] == 2) <--- crashes XST

if (a[j][28:27] == 2'd2) <--- doesn't crash XST, but generates
incorrect netlist

if (((a[j][28:27] & 32'h03000000) >> 28) = 2) <--- generates correct
netlist, works

Results were the same whether I used while loops (see XST answer
records 22625 and 22066) or used a genvar for the outer loop (outside
the always block).

This is with XST 7.1i. From the answer records about XST issues with
loop code, I might guess this problem could persist a while, possibly
through 9.1i or longer. I thought I would put this up for future
reference, in case anyone else runs into the same thing.

-Jeff