RE: [sv-bc] Question on foreach loop

From: Rich, Dave <Dave_Rich_at_.....>
Date: Thu Nov 16 2006 - 20:23:18 PST
The user has to provide a value for the skipped index. That could be an
expression that is dependent or independent of the other indexes. 

There's no rule requiring you to access the array used in the foreach
iterator or access any array; A *foreach* is just a shortcut for
declaring nested *for* loops. The body of the loop can use those
iterates any way they choose.

Dave


> -----Original Message-----
> From: owner-sv-bc@server.eda.org [mailto:owner-sv-bc@server.eda.org]
On
> Behalf Of Stuart Sutherland
> Sent: Thursday, November 16, 2006 6:11 PM
> To: sv-bc@server.eda.org; sv-ec@server.eda-stds.org
> Subject: [sv-bc] Question on foreach loop
> 
> 
> I am having a little difficulty understanding one of the foreach loop
> examples in section 10.5.3 of the LRM.
> 
>   bit [3:0][2:1] B [5:1][4];
>   foreach( B [ q, r, , s ] ) ...
> 
> The LRM states: "The second foreach causes q to iterate from 5 to 1, r
> from
> 0 to 3, and s from 2 to 1 (iteration over the third index is
skipped)".
> 
> I do I read or write into the array if the third index is "skipped"?
It
> is
> illegal to skip the third index when accessing the array (i.e.:
> B[q][r][][s]), so of what value is skipping one of the iterators?
> 
> Stu
> ~~~~~~~~~~~~~~~~~~~~~~~~~
> Stuart Sutherland
> stuart@sutherland-hdl.com
> +1-503-692-0898
> 
Received on Thu Nov 16 20:23:25 2006

This archive was generated by hypermail 2.1.8 : Thu Nov 16 2006 - 20:23:40 PST