Re: [sv-cc] Re: [sv-ec] default value and initialization for handles


Subject: Re: [sv-cc] Re: [sv-ec] default value and initialization for handles
From: Andrzej Litwiniuk (Andrzej.Litwiniuk@synopsys.com)
Date: Wed Feb 26 2003 - 11:18:30 PST


1. Initial values of handles

   "Why would we require the tool to initialize systemVerilog variables
    which are pointer to C objects to NULL?"

   One way of another, everything has some initial value (accidental bits).
   Better it be defined.
   For a handle, NULL is the natural initial value.

2. Default value in function/task declarations for a handle

   "Default value in function/task declarations cannot be provided for handle
    types because ..."

   Only literals/constants may be used as default values.
   There is only one constant (literal) for handle types: NULL.
   Hence it might seem redundant to provide NULL as a default value of a handle
   if a handle type is initialized to NULL anyway.
   An argument cannot be omitted, however, if default value is not defined.

   It's irrelevant here whether NULL is classified as singular data type
   or not. If there are good reasons for NULL not be singular, then
   the restrictions (syntax or plain English) for default values should
   be changed to allow default values for handles.
 
Regards,
Andrzej

> Why would we require the tool to initialize systemVerilog variables which
> are pointer to C objects to NULL?
> Why not leaving the variable uninitialized until the variable object is
> assigned in some ways either in the SV code or when passed as an inout to a
> directC function?
>
> Default value in function/task declarations cannot be provided for handle
> types because they
> are not singular data types. The reason they are not singular data type is
> that C handles cannot be cast to other data types.
>
> Francoise
> '
>
> At 08:16 AM 2/26/2003 -0800, Andy Tsay wrote:
> >Hi,
> >
> >In SV3.1 Draft 3, section 3.7 Handle data type:
> >Handles shall always be initialized to the value null,
> >which has a value of 0 on the C side, which ...
> >
> >Does the above paragraph require the tool to set
> >default value null for all handles?
> >
> >Thanks,
> >Andy
> >
> >--- Francoise Martinolle <fm@cadence.com> wrote:
> > > section 10.5.3 states that you can have a default
> > > value for any singular
> > > data type.
> > > A singular type excludes handles.
> > > Why wouldn't we allow a default value of null for
> > > handle types?
> > >
> > > Are we allowing array and structure literals as
> > > argument default values if
> > > the array/struct or union is packed? The section on
> > > array and struct
> > > literals only shows unpacked arrays and literal
> > > examples.
> > >
> > > Example:
> > > typedef struct packed {
> > > logic [3:0] a;
> > > logic [5:0] b;
> > > } mystruct
> > >
> > > function void foo(mystruct s = {4'b1, 5});



This archive was generated by hypermail 2b28 : Wed Feb 26 2003 - 11:20:45 PST