RE: [sv-cc] extern/export function declarations


Subject: RE: [sv-cc] extern/export function declarations
From: Joao Geada (Joao.Geada@synopsys.com)
Date: Wed Mar 05 2003 - 08:55:16 PST


Francoise,

Item 1:

For points a, b, c: I'll go with any reasonable approach that the majority wants.

For point d: Yes, of course. Good point. I'll ensure that the proposal explicitly
             states this.

For point e:
I am concerned about the usage of alias to declare the foreign name, because
there are *no* restrictions on the number of aliases that can be applied to
any given name. ie given a single function "foo", I can provide multiple
foreign aliases for it iff using the SV alias mechanism.
Is this desirable ? Why ?

For item 2: yes, all this has to be stated explicitly.

Joao
==============================================================================
Joao Geada, PhD Principal Engineer Verif Tech Group
Synopsys, Inc TEL: (508) 263-8083
344 Simarano Drive, Suite 300, FAX: (508) 263-8069
Marlboro, MA 01752, USA
==============================================================================

-----Original Message-----
From: owner-sv-cc@eda.org [mailto:owner-sv-cc@eda.org]On Behalf Of
Francoise Martinolle
Sent: Wednesday, March 05, 2003 9:44 AM
To: sv-cc@eda.org
Subject: [sv-cc] extern/export function declarations

In preparation for the meeting today, I put together what I would like the
extern/export
declarations to be

For providing function prototypes for external functions, I like to have:

   a) matching the syntax of extern methods in classes.
       If you really want to use the import keyword I would prefer import
extern
       to mean importing a function from an external language.
   b) the full prototype required
   c) the extern declaration can appear multiply in any declarative scope
but at least an
       extern declaration is required in the scope where SV calls the C
function.
   d) extern declaration equivalence checks done by the SV compiler
   e) an alias declaration used separately (because using a cname =
SVfunction_name is not
an alias declaration but a new syntax for aliasing names; we need to reuse
the already designed components of the SV language and not reinvent another
way of doing it.
      The alias declaration must be in the same scope as the extern

extern [pure|context] function return_type SVfunction_name (ansi-style
arguments with mode, type, argument names and default value);
alias cname = SVfunction_name;

2 extern declarations are equivalent iff:
    . their signature are identical (both parameter types and result types
of the respective 2 extern
      declarations must be identical)
      note: is it lexically identical or statically identical.
              for example, an integer number (3) can be used to specify the
left range in one
                                declaration and a binary value 2'b11 could
specify the left and right ranges of the
                                other declaration, or even a parameter
which value is 3.
     . the number and order of the parameters is identical
     . the name of the parameters can differ and are optional, they are all
required if SV calls by name
       and the names must match the names in the visible extern declaration.
     . default values are identical.

For the export declaration, if the export declaration has to be in the same
scope as the SV function declaration then no need for full path name or
prototype.
If I want to be able to put the export anywhere in the design, I need the
instance pathname and full prototype because this would help in generating
the C code to call the SV function (allocation of space
for passing actual values to the SV function must be done in C, the return
value of the SV function
may be used in the C code).
If the full prototype is given, then we must define the equivalence between
an export and the real
function declaration and between 2 exports.
The advantage of being able to put the exports anywhere and in particular
to put all of them
in a separate verilog file allows to change your C application which would
call additional SV functions without having to recompile the module which
contains the called SV function.

I like the following syntax:

export function fname; // full prototype to be determined)
alias cname = function_name;

a) we could have export extern to mean export to an external language
b) prototype or not depends of where the declaration can be
c) a separate alias declaration

Francoise
        '



This archive was generated by hypermail 2b28 : Wed Mar 05 2003 - 08:58:52 PST