RE: [sv-bc] Query related with default value to ref port.

From: Bresticker, Shalom <shalom.bresticker_at_.....>
Date: Sun Aug 16 2009 - 05:34:19 PDT
In particular, the LRM also says in 13.5.2:

"Only the following shall be legal to pass by reference:
- a variable,
- a class property,
- a member of an unpacked structure, or
- an element of an unpacked array" 


It had been proposed that the LRM say something to the effect that a default causes the subroutine call to be evaluated as though the default had been specified explicitly in the call. However, this was not stated because there is a difference. An expression appearing in the subroutine call is evaluated in the context of the call, whereas a default is evaluated in the context of the subroutine declaration.

Steven's statements that "the default must be a legal value to use as the actual argument" and "anything that is illegal to insert would also be illegal as a default value" could be used to clarify the intent.

Shalom


> -----Original Message-----
> From: owner-sv-bc@server.eda.org 
> [mailto:owner-sv-bc@server.eda.org] On Behalf Of Steven Sharp
> Sent: Monday, July 13, 2009 8:18 PM
> To: dhiraj@cal.interrasystems.com; sv-bc@server.eda.org; 
> Dave_Rich@mentor.com
> Subject: RE: [sv-bc] Query related with default value to ref port.
> 
> 
> >From: "Rich, Dave" <Dave_Rich@mentor.com>
> 
> >Although I cannot find it in the LRM, I believe the 
> intention of a ref
> >argument is that it cannot be left unspecified. This 
> probably needs to
> >be explicitly stated.
> 
> The LRM says that defaults are allowed for ref arguments, so they can
> definitely be left unspecified.  However, the default must be a legal
> value to use as the actual argument.
> 
> 
> >> When the subroutine is called, arguments with default values can be
> >> omitted from the call, and the compiler
> >> shall insert their corresponding values.".
> 
> Therefore, anything that is illegal to insert would also be illegal as
> a default value.
> 
>  
> >> So is the following testcase is valid
> >> 
> >> task automatic TASK1(ref bit signed [6:0] in1 = -16, input signed
> >[5:0] in2,
> 
> The actual passed to a ref argument must be a variable.  You cannot
> pass -16 to a ref argument, so you cannot use it as a default.
> 
> 
> >> As most of the standard simulators are showing error for this.
> 
> As they should.
> 
> 
> Steven Sharp
> sharp@cadence.com
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Sun Aug 16 05:38:25 2009

This archive was generated by hypermail 2.1.8 : Sun Aug 16 2009 - 05:39:23 PDT