Subject: Re: [sv-cc] another directC question - defaults for args, passing by name
From: Andrzej Litwiniuk (Andrzej.Litwiniuk@synopsys.com)
Date: Tue Feb 11 2003 - 16:30:42 PST
> > Please correct me if I'm wrong.
>
> You can skip arguments and use named arguments in general in SV, you
> just can't mix the two after you use a named binding (I would rather not
> mix them at all).
>
> SV Draft 2 covers this etc in section 10.5.3.
>
> Kev.
Thanks Kevin & Francoise for pointing this!
My appologies: I didn't know about those changes,
Apparently DirectC needs proofreading against LRM 3.0.
I was amazed - I'm kind of digressing now - by the sub-chapter 10.5.
It uses the term "subroutine" while everywhere else it is function/task.
Then, default values for arguments. Pls. notice the absence of any restrictions!
So, I guess, literal aggregates (structs, arrays) are allowed for default
values of arguments? And what about default values for arguments passed
by reference ('var')?
What it would mean to have: 'task foo(var int i = 10);' ?
Well, it ain't my problem, sv-bc guys surely will take care of it.
Talking about =our= problems, it shouldn't be a big deal to allow
the default values for arguments of external functions.
It shouldn't be permitted, however, for exported SV functions called from C.
(Kevin may comment that it would be a different story had we built the interface
upon C++.)
I see, however, some issues with passing by name.
Again, it shouldn't be permitted for exported SV functions called from C.
For external functions the names of formal arguments are optional (while they
are obligatory for native subroutines - let me enjoy this long forgotten term).
It won't make any sense to have the names of formal arguments only for some
of them and still use passing by name.
We may propose all-or-none approach, or require that passing by name is allowed
only if all formal args have names.
There is a more serious issue with argument passing by reference ('var').
I'm afraid we'll have to do something.
Until now, the actual passing mode for DirectC was transparent to Verilog;
it would matter only for the C code whether the argument is passed by value
or by reference, and it would be automatically inferred from the type of value.
One of requirements for DirectC was to keep it similar to native 'subroutines'.
Does it mean that DirectC should allow for explicit specification of argument
passing by referense vs. by value?
If so, then we may have to rework everything ...
Andrzej
> > > Francoise Martinolle wrote:
> > > > I am digging more in the directC document and I found something which needs
> > > > to be specified:
> > > > directC functions which are called from within Verilog must have all the
> > > > parameters specified on the call either by position or by name. We should
> > > > not allow to skip to provide a parameter if a default value is provided in the function
> > > > declaration for that argument.
> > > >
> > > > Francoise
> >
> >
>
>
This archive was generated by hypermail 2b28 : Tue Feb 11 2003 - 16:31:25 PST