Re: DirectC: C layer


Subject: Re: DirectC: C layer
From: Kevin Cameron x3251 (Kevin.Cameron@nsc.com)
Date: Wed Dec 11 2002 - 18:28:35 PST


> From sharp@cadence.com Wed Dec 11 16:51:11 2002
>
> >I agree. There's a proposal for copy-in and copy-out (pass-by-value) returns
> for SV types in
> >my document. Copy-out is limited to return values because that's the only
> pass-by-value output
> >of a C call.
>
> It doesn't have to be limited that way. An argument declared as output or
> inout in SV can be received by C as a pass-by-reference.
>
> SV would allocate memory space for the output or inout argument. If it is
> an inout, it copies the input to the space. It passes a pointer to the
> space to C. C can read and write to the argument just like any C reference
> argument. When it returns, SV copies the output and inout values back to
> the SV actuals, with full SV simulation semantics.

I thought about doing that and decided that it was a bit ugly - I might
think about it a bit more and remove the limitation.

> The same approach can handle argument types that C requires to be passed
> by reference (like arrays). If they are input on the SV side, they would
> not be copied back out, preserving the SV argument direction.
>
> It works like Verilog on the Verilog side, and it works like C on the C side.
>
> Steven Sharp
> sharp@cadence.com

You can pass arrays by value in C if you wrap them in a struct - it's just
syntactically ugly.

Kev.



This archive was generated by hypermail 2b28 : Wed Dec 11 2002 - 18:30:09 PST