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

From: Brad Pierce <Brad.Pierce_at_.....>
Date: Sun Feb 05 2006 - 21:40:23 PST
Gord,

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?

-- Brad

-----Original Message-----
From: Gordon Vreugdenhil [mailto:gordonv@model.com] 
Sent: Sunday, February 05, 2006 9:11 PM
To: Brad Pierce
Cc: sv-bc@eda.org
Subject: Re: [sv-bc] Iterating over arrayed and generated instances with
'foreach'

Brad, hierarchical references into arrayed instances are required
to have constant index values -- they are hierarchical names,
not selects.  SV has, unfortunately, deepened the confusion
between "select" and "hierarchical reference".  Unless you
want to have a "generate foreach" (which wouldn't be such a
bad idea if properly restricted), there isn't any way to
dynamically iterate over an array of interfaces or other
instances, including generates.

Gord


Brad Pierce wrote:
> A natural usage for 'foreach' is to iterate over an array of
instances, 
> for example, to send a message across each interface instance in an 
> array of interfaces.  I can't see in the LRM anyplace that explicitly 
> says that's legal.
> 
>  
> 
> Likewise, even iterating the old-fashioned way (with 'for'), the LRM 
> seems silent about the legality of applying the array querying 
> functions, such as $left(), to arrayed instances.
> 
>  
> 
> For generated instances, it's even more important to be able to
iterate 
> with 'foreach', because generated instances are not necessarily
contiguous
> 
>  
> 
>             for (genvar I = 0; I < N; I += 2) begin:GEN
> 
>                        ...
> 
>  
> 
> This is similar to iterating over an associative dimension, which can
be 
> done with 'foreach', but not generally with 'for'.
> 
>  
> 
> -- Brad
> 
>  
> 
>  
> 

-- 
--------------------------------------------------------------------
Gordon Vreugdenhil                                503-685-0808
Model Technology (Mentor Graphics)                gordonv@model.com
Received on Sun Feb 5 21:40:36 2006

This archive was generated by hypermail 2.1.8 : Sun Feb 05 2006 - 21:41:40 PST