Re: [sv-bc] Iterating over arrayed and generated instances with 'foreach'

From: Steven Sharp <sharp_at_.....>
Date: Mon Feb 06 2006 - 14:18:03 PST
As Gord and Dave have already noted, instance arrays are not truly
arrays.  They can be heterogeneous, i.e. different elements of the
"array" can be very different from each other.  A name may represent
objects of different sizes in different instances, or different kinds
(i.e. a variable in one, a function in another, a block in another,
not exist in another).

>As noted in http://eda.org/svdb/bug_view_page.php?bug_id=897 , I agree
>that there ought to be a generate foreach.  But how would that help with
>the example of sending messages at run time to each interface instance
>in an array?

Well, you could use a generate foreach to initialize an array of virtual
interfaces to the elements of the instance array.  Then you could use
that array of virtual interfaces in your foreach loop.

An array of virtual interfaces is presumably supposed to be homogeneous,
which allows it to be treated as a true array.  However, this requires
some extrapolation from the text in the LRM.  It specifies that a
virtual interface can only be assigned an interface of the same "type".
However, it fails to recognize the need to deal with specializations
of the interface type, created by parameterization of the interfaces.

(This failure of the LRM is not specific to arrays of virtual interfaces.
I just filed Mantis item 1324 for the lack of treatment of specializations
of virtual interfaces.)

Anyway, if we assume that this whole specialization thing gets cleared
up, then the reason you can treat an array of virtual interfaces as an
array is that all elements must have the same specialization.  With an
"array" of instances, this is not guaranteed.

Steven Sharp
sharp@cadence.com
Received on Mon Feb 6 14:18:08 2006

This archive was generated by hypermail 2.1.8 : Mon Feb 06 2006 - 14:19:04 PST