[sv-bc] RE: [sv-ec] Question on foreach loop

From: Arturo Salz <Arturo.Salz_at_.....>
Date: Thu Nov 16 2006 - 19:08:52 PST
Stu,

When skipping a dimension iterator, you will typically keep that
dimension constant:

        foreach( B [ q, r, , s ] ) $display( B[q][r][0]s] );

Also, if the skipped dimensions are towards the end (the right), you can
effectively "slice off" those dimensions.

        Arturo


-----Original Message-----
From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of
Stuart Sutherland
Sent: Thursday, November 16, 2006 6:11 PM
To: sv-bc@eda.org; sv-ec@eda-stds.org
Subject: [sv-ec] 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 19:09:01 2006

This archive was generated by hypermail 2.1.8 : Thu Nov 16 2006 - 19:09:17 PST