RE: [sv-bc] Serious issue with default expressions for task and function arguments

From: Mark Hartoog <Mark.Hartoog_at_.....>
Date: Thu Mar 03 2005 - 10:39:56 PST
> In this case there is no p1 visible at the point of compilation
> of function f.  Is this legal?  Is SV adopting dynamic scoping? :-)

The LRM says "The elements of the expression must be visible at the scope 
of subroutine". In your example, 'p1' would be an unresolved identifier
in the scope of the subroutine, so this would be illegal.

I think part of the confusion here is what the term "elements of the 
expression" means. When you have an expression like 'p1', I think the 
element of the expression is the object that the identifier 'p1' resolves
to in that scope. Other people seem to think that the element of
the expression is simply the identifier itself. Perhaps this needs to 
be reworded to make clear what was meant.  

> -----Original Message-----
> From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org]On Behalf Of Paul
> Graham
> Sent: Thursday, March 03, 2005 10:24 AM
> To: gordonv@model.com
> Cc: ieee1800@eda.org; sv-bc@eda.org
> Subject: Re: [sv-bc] Serious issue with default expressions for task and
> function arguments
> 
> 
> >     The default_value is an expression. The expression is evaluated in
> >     the scope of the caller each time the subroutine is called. The
> >     elements of the expression must be visible at the scope of subroutine
> 
> Here's another example:
> 
> function f(integer x = p1);
>    return x;
> endfunction
> 
> module m1(...);
>     parameter p1 = 1;
>     assign q = f();	// q == 1
> endmodule
> 
> module m1(...);
>     parameter p1 = 2;
>     assign q = f();	// q == 2
> endmodule
> 
> In this case there is no p1 visible at the point of compilation
> of function f.  Is this legal?  Is SV adopting dynamic scoping? :-)
> 
> Paul
Received on Thu Mar 3 10:40:01 2005

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2005 - 10:40:09 PST