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

From: Bresticker, Shalom <shalom.bresticker_at_.....>
Date: Fri Feb 17 2006 - 01:45:43 PST
Is it really true that "functions are not supposed to interact with the scheduler"?

In 1364-2005, 11.4.1(a) says, "Execution of statements in a particular begin-end block can be suspended in
favor of other processes in the model;"

and 11.4.2 says, "Another source of nondeterminism is that statements without time-control constructs in behavioral
blocks do not have to be executed as one event... At any time while evaluating a behavioral statement, the simulator may
suspend execution and place the partially completed event as a pending active event on the event queue. The
effect of this is to allow the interleaving of process execution, although the order of interleaved execution is
nondeterministic and not under control of the user."

This implies that the scheduler may suspend function execution in the middle. If this is not so, it needs to be explicitly stated.

Shalom

________________________________________
From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of Rich, Dave
Sent: Thursday, February 16, 2006 4:12 PM
To: Ambar Sarkar; sv-ec@eda.org; sv-bc@eda.org
Subject: [sv-bc] RE: [sv-ec] Can a function contain a fork/join/any/none?

"time consuming"  would mean anything that could block a thread(process). But there are really two separate issues here. One is the fact that functions are not supposed to interact with the scheduler. Events get created outside the function as outputs are assigned, but the function does no scheduling. We also don't have to worry about active region functions versus inactive-region(program block) functions either.

But the other major issue is that time consuming threads roots can start from more places than just always or initial blocks if you allow a function to call a fork_join_none. They can start form continuous assignments or in variable declarations. And those variable declarations could be in a package, which in turn are not supposed to contain any rooted threads.

Dave


________________________________________
From: Ambar Sarkar [mailto:ambar.sarkar@paradigm-works.com] 
Sent: Thursday, February 16, 2006 4:14 AM
To: Rich, Dave; sv-ec@eda.org; sv-bc@eda.org
Subject: RE: [sv-ec] Can a function contain a fork/join/any/none?

Dave,

Is there a definition of the term "time consuming"? A fork/join none(not the others) is non time consuming as far as I understand. Or is it being seen as the conceptual  equivalent of a task call and thus recommended against in function calls?

Regards,
-Ambar

________________________________________
From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of Rich, Dave
Sent: Thursday, February 16, 2006 12:33 AM
To: sv-ec@eda.org; sv-bc@eda.org
Subject: [sv-ec] Can a function contain a fork/join/any/none?

A number of people have asked me the above question, and my immediate answer has been no. However, it looks like a number of things that were ruled out by the BNF in 1364 by having separate function_statement and statement productions, have been let back in by the 1800 BNF.  Also, there are a number of new constructs in SystemVerilog that may need restrictions for use by a function. The fork/join_none was added to SystemVerilog, but since there are restrictions on any time controlling statements, or task enables, it doesn't seem to make much sense to allow it.

I'm not sure which committee should have this issue, but I think the sv-bc should create some guarantees about what a function is and is not allowed to do. The sv-ec may have to review which added constructs make or break those guarantees.

This is mantis 1336.

Dave


David Rich
Verification Technologist
Design Verification & Test Division
Mentor Graphics Corporation
dave_rich@mentor.com
Office:   408 487-7206
Cell:     510 589-2625
Received on Fri Feb 17 01:46:08 2006

This archive was generated by hypermail 2.1.8 : Fri Feb 17 2006 - 01:48:11 PST