UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
2,293 Views
Registered: ‎10-18-2012

Incorrect handling of range selects when assigning a value to an array member?

Hello everybody,

 

I've been struggling the last days with some mysterious error (this appeared for Verilog code). It occurs when I'm trying to assign part selects of an array item in a combinational block. At the block's beginning, I apply a default value to the signals in question.

To give you an impression of what I'm trying to explain, take a look at this code:

reg [12:0] inManQueueDIn[0:(VC-1)];
// snip
for(currVC_combWork = 0;currVC_combWork < VC;currVC_combWork = currVC_combWork + 1) begin inManQueueDIn[currVC_combWork] = 0; // snip case(xbarInState[currVC_combWork])
// snip
HT_GATE_XBAR_IN_STATE_HEADER2:
  begin
inManQueueDIn[currVC_combWork][8:5] = inXbarCurrSrc[currVC_combWork];

case(xbarRxData_internal[currVC_combWork][5:0]) h28,'h29,'h2a,'h2b,'h2c,'h2d,'h2e,'h2f,'h08,'h09,'h0a,'h0b,'h0c,'h0d,'h0e,'h0f,'h30: begin inManQueueDIn[currVC_combWork][4] = 1; inManQueueDIn[currVC_combWork][3:0] = xbarRxData_internal[currVC_combWork][25:22];
end end // snip endcase // snip end


Just to mention: currVC_combWork is an integer variable, VC a parameter with value 3. However, this should be irrelevant as I have the same problem with another source file which does not contain a for loop or depend on parameters (I just chose this one as it is less complex).

Now what happens is the following:

XST generates latches for the members of inManQueueDIn - which it should not do due to the assigned default value (at least that's what I always learned)...

And then reports multiple sources for the net finally. Obviously, it detects the two assignments as being independent from each other.

It does not even seem to make a difference if explicit assignments to the individual array members are made for all cases. The result is always the same. So it appears to me to be an error, or did I miss something? As far as I know (I reviewed this in some textbooks), the structure is perfectly legal in Verilog 2001.

 

Now my question is: did anyone else observe this? Does anyone see some error I made which would explain this?

 

However, I found a workaround for it, using which I can synthesize and implement the design. But it is very inconvenient, as I now use an individual signal for each array entry, complicating code and rendering arrays useless. It is viable for me in this case as the arrays in question are quite small, but XST should be able to handle this properly.

If it is and I just made some stupid mistake (maybe I just overlooked something), please tell me!

 

Kind regards,

Johannes

0 Kudos