[sv-cc] FW: [sv-bc] External Functions and Tasks proposal


Subject: [sv-cc] FW: [sv-bc] External Functions and Tasks proposal
From: Warmke, Doug (doug_warmke@mentorg.com)
Date: Fri Mar 14 2003 - 07:54:45 PST


Joao, others,
 
Please see the forwarded proposal from Peter Flake that appeared on
SV-BC.
He is saying that the "external" keyword truly should have prototype
semantics.
This is not in matching with our requirements for external functions,
which we
stated should be semantically equivalent to a true function declaration.
(i.e. they stand in for a C function which would normally be declared in
SV
at that particular declarative scope)
 
I think our usage of the term "extern" is too much in conflict with the
prototype-oriented usage required by the other committees.
As a result, I reluctantly think we should go back to using
the keyword "import" instead of "extern" for describing external
functions.
And probably we should use the term "imported function" whenever we
currently use the term "exported function".
 
Given the deadline situation, please send comments soon(!)
 
Thanks and regards,
Doug
 
-----Original Message-----
From: Peter Flake [mailto:Peter.Flake@synopsys.com]
Sent: Friday, March 14, 2003 7:27 AM
To: sv-bc@server.eda.org
Cc: Arturo Salz
Subject: [sv-bc] External Functions and Tasks proposal

ADD to draft 3 new section 10.6

5.8 External tasks and functions

Some tools require each module to be analyzed separately. If the module
uses tasks or functions declared in $root, the names and argument types
need to be visible to the analysis to allow checking. However it is
important that each analysis does not create its own copy of the task or
function.

SystemVerilog allows the existence elsewhere of a task or function name
and prototype to be declared using the extern keyword. For example
        extern function int func1(int I);

If this external declaration is in $root, the same name can be declared
with the same prototype more than once.

A declarations of a task or function prototype requires a matching
declaration (with the same arguments) somewhere else , otherwise there
is an elaboration error. For example:
        function int func1(int I);
             return I;
        endfunction

If the prototype is in the $root scope, the task or function must be
declared in the $root scope.

If the prototype is in an interface, the task or function must be
declared in one of the modules connected to an instance of that
interface.

If the prototype is a class, the task or function must be declared as an
out-of-body method (see section 11.20).



This archive was generated by hypermail 2b28 : Fri Mar 14 2003 - 07:55:54 PST