RE: mantis items 1456 and 1488 from sv-cc committee -

From: Shabtay Matalon <shabtay_at_.....>
Date: Wed Oct 25 2006 - 09:03:45 PDT
Thanks John for sending the updated text of the Mantis items. This is
useful.

 

Before sending the next draft of the DPI chapter, here are is my
proposed language for how to extend the calls to DPI exported functions
and utility functions from any HVL. Please review these chapters and
let's discuss these tomorrow.

 

Also feel free to comment by email.

 

Regard,

 

Shabtay

 

 

 

5.7 Calling DPI exported functions outside an imported context function
[Re: IM219]

Mantis item 1456 of Accellera working group states that the
SystemVerilog context of DPI export tasks and functions must be known
when they are called, including when they are called by SystemVerilog
functions or tasks, or they are called by DPI imports. When an import
invokes the svSetScope utility prior to calling the export, it sets the
context explicitly. Otherwise, the context will be the context of the
instantiated scope where the import declaration is located. Because
imports with diverse instantiated scopes can export the same task or
function, multiple instances of such an export can exist after
elaboration. Prior to any invocations of svSetScope, these export
instances would have different contexts, which would reflect their
imported caller's instantiated scope. 

SCEMI 2 extends the scope of the SystemVerilog DPI use model by allowing
Hardware Verification Languages (HVL) linked with the C side to call DPI
exported functions. 

 

DPI exported functions can be invoked from HVL only at simulation run
time if the HVL call was made immediately after an imported function
call or immediately after an implicit or explicit flush in a SCE-MI 2.0
pipe that was initiated from the HDL side. Calling exported functions
from HVL under any other conditions is prohibited and may result in
undefined behavior.

 

The above statement prohibits calling DPI exported function during HDL
side compilation. It also restricts calling it from any PLI/VPI or VHPI
callback that calls the HVL. It also prohibits any HVL called from a
SystemVerilog system task from calling exported functions. HVL and C
code executing concurrently with the SystemVerilog code should not call
exported functions. 

 

While SCE-MI 2 allows HVLs to call exported functions subject to the
above restrictions, it does not mandate the linking of any particular
HVL to the C side for an implementation to be SCE-MI 2 compliant. It is
up to vendors and users to decide which HVL if any will be linked to a
SCE-MI 2.0 C side implementation.

 

5.8 Calling DPI utility functions outside imported context functions
[Re: IM219]

 

Section F.8 of IEEE 1800-2005 (see reference []) states that:

 

DPI defines a small set of functions to help programmers work with DPI
context tasks and functions. The term scope is used in the task or
function names for consistency with other SystemVerilog terminology. The
terms scope and context are equivalent for DPI tasks and functions. 

There are functions that allow the user to retrieve and manipulate the
current operational scope. There are also functions to associate an
opaque user data pointer with an HDL scope. This pointer can then later
be retrieved when an imported DPI function is called from that scope.

Mantis item 1456 of Accellera working group states that the behavior of
DPI utility functions that manipulate context is undefined when they are
invoked by any function or task that is not part of a DPI context call
chain (see 26.4.3). Similarly, the behavior of exported tasks or
functions is undefined when they are invoked by a DPI call chain that
lacks the context characteristic.

 

SCEMI 2 extends the scope of the SystemVerilog DPI use model by allowing
HVL methods/tasks to call the DPI utility functions supported by SCE-MI
2 per section 3.6. 

 

DPI utility functions can be called from HVL only at the simulation run
time if the HVL call was made immediately after an imported function
call or immediately after an implicit or explicit flush in a SCE-MI 2.0
pipe that was initiated from the HDL side. Calling DPI Utility functions
from HVL under any other conditions is prohibited and may result in
undefined behavior. 

 

The above statement prohibits calling DPI Utility function during HDL
side compilation. It also restricts calling it from any PLI/VPI or VHPI
callback that calls the HVL. It also prohibits any HVL called from a
SystemVerilog system task from calling DPI utility functions. HVL and C
code executing concurrently with the SystemVerilog code should not call
DPI utility functions. 

 

 

The DPI utility functions that can be called from HVL subject to the
above restrictions are:[SM1] 

svGetScope() 

svSetScope() 

svGetNameFromScope() 

svGetScopeFromName() 

svPutUserData() 

svGetUserData() 

svGetCallerInfo() 

 

Any other DPI utility functions cannot be called from HVL.

 

 

>-----Original Message-----

>From: owner-itc@eda.org [mailto:owner-itc@eda.org] On Behalf Of John

>Stickley

>Sent: Monday, October 23, 2006 1:42 PM

>To: 'itc@eda.org'

>Subject: mantis items 1456 and 1488 from sv-cc committee

> 

>Greetings ITC Techies,

> 

>As per one of my AIs from last meeting, I've attached

>the full text of Mantis items 1456 and 1488.

> 

>This is the reworded text regarding calling exported

>functions and SV utility functions from areas in C

>code outside of imported DPI function contexts.

> 

>-- johnS

> 

>This email may contain material that is confidential, privileged

>and/or attorney work product for the sole use of the intended

>recipient.  Any review, reliance or distribution by others or

>forwarding without express permission        /\

>is strictly prohibited. If you are     /\   |  \

>not the intended recipient please     |  \ /   |

>contact the sender and delete        /    \     \

>all copies.                      /\_/  K2  \_    \_

>______________________________/\/            \     \

>John Stickley                   \             \     \

>Mgr., Acceleration Methodologies \             \________________

>Mentor Graphics - MED             \_

>17 E. Cedar Place                   \   john_stickley@mentor.com

>Ramsey, NJ  07446                    \     Phone: (201) 818-2585

>________________________________________________________________

________________________________

 [SM1]Called from outside an imported function.
Received on Wed Oct 25 09:04:03 2006

This archive was generated by hypermail 2.1.8 : Wed Oct 25 2006 - 09:04:15 PDT