Subject: [sv-cc] How do I call a specific instance of an exported function ?
From: Stickley, John (john_stickley@mentorg.com)
Date: Thu Feb 27 2003 - 16:16:07 PST
Andrzej and Joao,
I'm still having difficulty understanding how the
specification is allowing for calls of specific instances
of exported module scoped functions.
In our discussions late last year I thought we had
agreed to the idea of making the first argument
of a call from C to SV a handle representing the
instance of the module containing the function to
be called.
Yet nowhere in the C layer do I see provision for how
that is done.
Please comment on my feedback I sent earlier that
recommends adding the 3 C layer functions to allow
for context sensitivity handling (svGetHandleByName(),
svSetUserContext(), svGetUserContext()).
The capability, in my view is crucial.
The problem is quite simple:
If you export a function 'foo' defined in module 'bar'
as follows:
export bar::foo;
And you have 4 instances of bar instantiated under 'top':
module top();
     bar bar1( port maps ... );
     bar bar2( port maps ... );
     bar bar3( port maps ... );
     bar bar4( port maps ... );
endmodule
How, in my C model do I call bar1.foo() ?
My recommended solution:
// Get the context handle:
svHandle bar1Handle = svGetHandleByName( "top.bar1" );
// Call the function:
foo( bar1Handle, other args ... );
If we do not allow for this, it is, in my view,
a big omission. In my opinion, 90% + of calls
to exported SV functions will be to ones
in specific instances of specific modules.
Calls to free standing functions defined in module $root
will be the vast minority.
We need to nail this down.
-- johnS
                                                            __
                        ______                             |  \
______________________/      \__                         /    \
                                 \       H  Dome      ___/     |
John Stickley                 E |       a  __    ___/  /       \____
Principal Engineer            l |       l  | \  /
Verification Solutions Group    |       f  |  \/     ____
Mentor Graphics Corp. - MED   C \         --  /     /
17 E. Cedar Place             a  \     __/   /     /
Ramsey, NJ  07446             p  |    /        ___/
                                  |   /        /
mailto:John_Stickley@mentor.com  \           /
Phone: (201)818-2585              \         /
                                    ---------
This archive was generated by hypermail 2b28 : Thu Feb 27 2003 - 16:21:48 PST