>From: "Daniel Mlynek" <daniel.mlynek@aldec.com.pl>
>The syntax proposed by you (foreach (a[x][y]) ) is not valid according to
>LRM. Froeach can take :
>hierarchical_array_identifier
>
>as an argument, not array member select.
You are correct. I consider this to be a problem, as there are times
when you want to iterate through an array that is an element of another
array. And if you are iterating through one of the non-fixed-size array
types, you have to specify which element you want to iterate through.
I described this problem in a note on Mantis 1712.
> _____
>
>From: Jonathan Bromley [mailto:jonathan.bromley@verilab.com]
>Sent: Wednesday, June 02, 2010 12:44 PM
>To: Daniel Mlynek
>Cc: Paul Graham; sv-bc
>Subject: Re: [sv-bc] scope of break/continue within foreach loop
>
>
>I agree with Daniel. If break takes you right out of foreach, you can
>easily get
>the "break out of inner loop" behaviour by splitting the loop:
>
> foreach (a[x,y]) begin
> ...mess with a[x][y];
> break; // should break out completely
> end
>
> foreach (a[x]) begin
> foreach (a[x][y]) begin // this scans only y, right????
> ...mess with a[x][y];
> break; // breaks out of y-loop only
> end
> end
>
>But if break only breaks the innermost loop, it's troublesome to break
>out of the whole "foreach".
>--
>Jonathan Bromley
>
>
>On Wed, Jun 2, 2010 at 11:31 AM, Daniel Mlynek <daniel.mlynek@aldec.com.pl>
>wrote:
>
>
>Imho break should break the whole loop any other hahviour would be just
>hard to understand ie:
>
>module top;
>int arr[10][3];
>initial
>foreach (arr[i,j]) begin
> $display(i, j);
> if (i==2) break; //this breaks the foreach and finishes whole tests
>end
>endmodule
>
>DANiel
>
>
>-----Original Message-----
>From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of Paul
>Graham
>
>Sent: Tuesday, June 01, 2010 11:55 PM
>To: sv-bc
>Subject: [sv-bc] scope of break/continue within foreach loop
>
>
>A foreach statement with multiple variables is defined as equivalent to a
>set of nested for loops. If a break statement is executed in the body of a
>forever loop, does it break out of the innermost of these nested for loops,
>or does it break out of the outermost? Likewise for a continue statement.
>I guess it should be the outermost loop. Could this be clarified?
>
>Paul
>
>--
>This message has been scanned for viruses and dangerous content by
>MailScanner, and is believed to be clean.
>
>
>--
>This message has been scanned for viruses and
>dangerous content by MailScanner, and is
>believed to be clean.
>
>
>
>
>
>--
>This message has been scanned for viruses and
>dangerous content by MailScanner, and is
>believed to be clean.
>
Steven Sharp | Architect | Cadence
P: 508.459.1436 M: 774.535.4149 www.cadence.com
-- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Wed Jun 2 18:01:29 2010
This archive was generated by hypermail 2.1.8 : Wed Jun 02 2010 - 18:04:10 PDT