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

From: Gordon Vreugdenhil <gordonv_at_.....>
Date: Sun Feb 05 2006 - 21:10:37 PST
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:11:04 2006

This archive was generated by hypermail 2.1.8 : Sun Feb 05 2006 - 21:13:38 PST