Subject: Re: [sv-cc] DirectC C Layer - revised - 'context' functions
From: Andrzej Litwiniuk (Andrzej.Litwiniuk@synopsys.com)
Date: Tue Feb 04 2003 - 17:23:45 PST
> > 3.5 'Context' and non-'context' functions
> >
> > Only functions specified as 'context' in their corresponding SV external
> > declarations may safely call functions from other APIs, including PLI and VPI
> > functions, or exported SV functions.
KEVIN:
> I see no reason for this restriction. It will cause a major headache for anyone
> allocating static objects in C/C++ with PLI/VPI handles back into the simulator
> and wanting to use simple calls to send messages.
> > For functions not specified as 'context' the effects of calling PLI or VPI
> > functions or SV functions are unpredictable and such calls may crash.
KEVIN:
> I see no reason why this should be true.
Kevin,
Some of PLI/VPI functions require some environment being set, like the "current
instance" or "current task". Calls of 'context' functions will be specially
instrumented to set the required environment, while there will be no overhead
for all other functions, not specified as 'context'. This is the main rationale
for the concept of 'context' functions.
How about the following phrasing:
------------------
3.5 'Context' and non-'context' functions
Some PLI and VPI functions require that the context of their call is known.
It takes a special instrumentation of their call to provide such context; for
example, some variables refering to "current instance" or "current task" must be
set.
Such context and the involved instrumentation of a function call is, however,
usually not needed. In order to avoid an unnecessary overhead, external function
calls in SV code are not instrumented unless the external function is specified
as 'context' in its SV external declaration.
Only the calls of 'context' functions are properly instrumented and therefore
only those functions may safely call all functions from other APIs, including
PLI and VPI functions, or exported SV functions.
For functions not specified as 'context' the effects of calling PLI or VPI
functions or SV functions may be, depending on a function, unpredictable and
such calls may crash if the callee requires the context that has not been set
properly.
------------------
Andrzej
This archive was generated by hypermail 2b28 : Tue Feb 04 2003 - 17:24:18 PST