Re: [sv-bc] Task and Function inout port with default argument

From: Greg Jaxon <Greg.Jaxon_at_.....>
Date: Mon Dec 18 2006 - 09:47:02 PST
Sonjoy Mondal wrote:
> Hi,
> 
> 
>       can Task or Function inout port be assigned to a constant as 
> default argument? such as
> 
>     function signed [11:0] FUNC1(input signed [7:0] in1, inout reg 
> signed [9:0] in2 = -15);
> 
>    if yes then how the value of inout port in2 is copied into the actual 
> when  subroutine returns?

Sonjoy,

A default argument value only comes into play when there /is no/ actual
argument supplied.  Omitting this actual argument should cancel
the request for "copy out" action in addition to allowing the
"copy in" of the default value.

Describing this as suppression of the "copy out" semantic action
will hopefully be enough to warn implementors away from copying
out into the default value's storage location.

In all directions except "ref", a separate formal variable
is provided for the use of the function/task regardless of whether
that variable gets a "default" value, one copied-in from
an actual argument, the uninitialized automatic value, or a
the (latched?) wraparound value of a static formal.

This also suggests to me that ALL output arguments are optional,
although that is probably not the currently accepted interpretation
of the LRM.

Greg
Received on Mon Dec 18 09:47:07 2006

This archive was generated by hypermail 2.1.8 : Mon Dec 18 2006 - 09:48:13 PST