Subject: Re: ISSUE:DirectC:DirectC i/f should support mechanism for calling Verilog task/function from a DirectC application
From: Kevin Cameron x3251 (Kevin.Cameron@nsc.com)
Date: Wed Oct 23 2002 - 10:12:07 PDT
> From: "Swapnajit Mittra" <mittra@juno.com>
> 
> On Mon, 21 Oct 2002 17:30:56 -0700 "Warmke, Doug"
> <doug_warmke@mentorg.com> writes:
> Swapnajit, 
> Some brief comments on your proposal. 
> We can discuss more at the appropriate time in the meeting or in email. 
> > 
> > o If an external C function calls a Verilog task, no 
> > simulation time must elapse during the execution of that task. 
> > (This is, because a C function in DirectC is a zero-time event). 
> > However, no such restriction shall be in place when a Verilog 
> > task is called from a cmodule. 
> > 
> I think this is overly restrictive.  It will not work out well if 
> some implementations want to directly integrate C models 
> living in a threaded environment (e.g. TestBuilder, SystemC) 
> together with HDL models.  Let's keep an open mind 
> about making large scale changes to DirectC. 
The issue of elapsed time has to do with saving the C routine's
call-stack i.e. if you call any C routine from the simulator kernel
then you (usually) have to return from that routine to continue
simulating. If the C routine calls a task that suspends it cannot
return. The work-around is to not use the CPU stack for saving
context (cmodule?) or use multiple stacks (which is usually very
ineffecient because of the CPU context switching overhead [SystemC?]).
That's why it's better to write your functions in SV rather than
calling external C routines :-)
Kev.
>    Doug, 
> 
>    I understand your concern. But, can not these C models 
>    be written as cmodules (or be embedded within cmodules) ? 
> 
>    I think (Joao, correct me if I am wrong) a DirectC 
>    external C function and a cmodule to some sense 
>    are analogous to a Verilog function and task respectively. 
>    External C functions are 0-time activities whereas 
>    cmodules are not. 
> 
>    I would not mind if we change that proposition (that DirectC 
>    external C functions should be 0-time activity), but my 
>    concerns there are: 
> 
>    o Whether that will break any other basic structure of the 
>    whole scheme. 
> 
>    o Whether we have sufficient time to undertake this type of 
>    fundamental changes. Personally I think we should rather be 
>    late than producing things that are half cooked, but I know 
>    we are working under some tight schedule here.
> --
> Swapnajit Mittra
> Project VeriPage ::: http://www.angelfire.com/ca/verilog
This archive was generated by hypermail 2b28 : Wed Oct 23 2002 - 10:16:31 PDT