From: owner-sv-ac@eda.org [mailto:owner-sv-ac@eda.org] On Behalf Of ben cohen
Sent: Sunday, January 01, 2012 5:58 PM
To: sv-ac@eda-stds.org; stuart@sutherland-hdl.com
Cc: Korchemny, Dmitry
Subject: [sv-ac] Re: sv-ac: example error in "9.7 Fine-grain process control"?
After more thoughts, the model work without the fork join, even though it might be a better style. However, the first reported issue is still there:
task do_n_way( int N ); // line 98
process job[1:N]; // (99): Range must be bounded by constant expressions.
Ben Cohen
On Sat, Dec 31, 2011 at 8:47 PM, ben cohen <hdlcohen@gmail.com<mailto:hdlcohen@gmail.com>> wrote:
In code below (copied mostly from LRM), I think that this statement is incorrect:
for( int j = 1; j <= N; j++ ) // wait for all processes to start
wait( job[j] != null );
I think that this should be
for( int j = 1; j <= N; j++ ) // wait for all processes to start
fork
wait( job[j] != null );
join_none
Without the fork, these wait(job...) are sequential.
From 9.4.3 Level-sensitive event control
The wait statement shall evaluate a condition; and, if it is not true (as defined in 12.4), the procedural statements
following the wait statement shall remain blocked until that condition becomes true before continuing.
Attached is a modified model that I constructed to test the LRM example using a simulator. The simulator yielded:
run 100ns
# @t= 0, waiting for jobs[ 1] to start
# @t= 0, waiting for jobs[ 2] to start
# @t= 0, waiting for jobs[ 3] to start
# @t= 2, in task, k= 1
# @t= 3, in task also, k= 1
# @t= 3, killing job 2
# @t= 3, killing job 3
I suggest that the example be modified to reflect code that compiles and reflects the intent of the example.
The way it is now, I believe that the LRM model is in error in 2 respects.
Ben Cohen
systemverilog.us<http://systemverilog.us>
On Sat, Dec 31, 2011 at 5:34 PM, ben cohen <hdlcohen@gmail.com<mailto:hdlcohen@gmail.com>> wrote:
Below is code copied from LRM, draft 4 (slightly modified to comment out the "...;" and add a call to the task.
A simulator cage me this error code upon compilation:
(99): Range must be bounded by constant expressions
Is LRM is error here?
Thanks,
Ben
---- module mprocess; // line 96 task do_n_way( int N ); // line 98 process job[1:N]; // (99): Range must be bounded by constant expressions. for ( int j = 1; j <= N; j++ ) fork automatic int k = j; begin job[k] = process::self(); $display(" in task, k=%d", k); // ... ; end join_none for( int j = 1; j <= N; j++ ) // wait for all processes to start wait( job[j] != null ); job[1].await(); // wait for first process to finish for ( int k = 1; k <= N; k++ ) begin if ( job[k].status != process::FINISHED ) job[k].kill(); end endtask initial begin : init do_n_way(3); end :init endmodule :mprocess -- This message has been scanned for viruses and dangerous content by MailScanner<http://www.mailscanner.info/>, 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 Sun Jan 1 10:52:14 2012
This archive was generated by hypermail 2.1.8 : Sun Jan 01 2012 - 10:52:28 PST