Re: [sv-ec] RE: [sv-bc] Can a function contain a fork/join/any/none?

From: Gordon Vreugdenhil <gordonv_at_.....>
Date: Wed Feb 22 2006 - 14:15:04 PST
Arturo Salz wrote:
[...]
> 
> [Arturo] I agree with this statement. As a starting point we could 
> define this in terms of the following legal transformation:


Arturo, I think that we could go this way but note that your rewrite
is not quite the same semantically.

In particular, if I have:

    C my_c = new();

the rewritten routine makes no guarantees about when the "always"
block containing the fork...join_none will run with respect to
any other initialization.  This could be somewhat surprising if
a user expects the threads to get started (an perhaps do some
initialization for the thread states) before other initial blocks run.

If we go this route (or similar), I'd really like to see the current
LRM wording changed such that this is a valid rewrite for both
function and non-function fork...join_none (thus loosening the
current restriction that fork...join_none can't be started until
a blocking stmt is encountered).

Further, would this also impact the RNG states?  Dave brought that
up and the issue of how one counts this is important.

This may also be a bit of a semantic issue in terms of how
to seed such implicit threads that might exist in a package.

Gord.


>             class C;                        =>        class C;
>                 function C::new();                      static 
> mailbox#(C) mbox = new();
>                     …
>                     fork XXX join_none               function C::new();
>                     …                                             …
>                 endfunction                                   mbox.put( 
> this );
>             endclass                                           …
>                                                                 endfunction
> 
>                                                                 task 
> fork_in_new()
>                                                                     fork 
> XXX join_none;
>                                                                 endtask
> 
>                                                             endclass
>                                                             always begin
>                                                                 C q;
>     C::mbox.get( q );
>     q.fork_in_new();
> end
> 
>  
> 
> It’s important to note is that although the two code versions are 
> semantically equivalent, the right one is a lot more verbose and error 
> prone.
> 
> Dave
> 
>  

-- 
--------------------------------------------------------------------
Gordon Vreugdenhil                                503-685-0808
Model Technology (Mentor Graphics)                gordonv@model.com
Received on Wed Feb 22 14:15:13 2006

This archive was generated by hypermail 2.1.8 : Wed Feb 22 2006 - 14:15:59 PST