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> 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
>
>
> On Sat, Dec 31, 2011 at 5:34 PM, ben cohen <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, and is believed to be clean.Received on Sun Jan 1 07:59:09 2012
This archive was generated by hypermail 2.1.8 : Sun Jan 01 2012 - 07:59:14 PST