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

From: Brad Pierce <Brad.Pierce_at_.....>
Date: Sun Feb 05 2006 - 13:21:12 PST
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

 

 
Received on Sun Feb 5 13:21:24 2006

This archive was generated by hypermail 2.1.8 : Sun Feb 05 2006 - 13:22:47 PST