For Jonathan intent it should be :
foreach (a[x]) begin
tmp = a[x];
foreach (tmp[y]) begin
DANiel
_____
From: Bresticker, Shalom [mailto:shalom.bresticker@intel.com]
Sent: Wednesday, June 02, 2010 3:48 PM
To: Daniel Mlynek; 'Jonathan Bromley'
Cc: 'Paul Graham'; 'sv-bc'
Subject: RE: [sv-bc] scope of break/continue within foreach loop
should have been
"foreach (a[x,y])"
Shalom
_____
From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of Daniel
Mlynek
Sent: Wednesday, June 02, 2010 4:42 PM
To: 'Jonathan Bromley'
Cc: 'Paul Graham'; 'sv-bc'
Subject: RE: [sv-bc] scope of break/continue within foreach loop
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.
DANiel
_____
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 <http://www.mailscanner.info/> MailScanner, and is believed to be clean. --------------------------------------------------------------------- Intel Israel (74) Limited This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Wed Jun 2 07:02:45 2010
This archive was generated by hypermail 2.1.8 : Wed Jun 02 2010 - 07:05:25 PDT