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

From: Gordon Vreugdenhil <gordonv_at_.....>
Date: Thu Mar 03 2005 - 08:48:30 PST
While reviewing aspects of the draft SV standard, we came across
the following in Section 11.4.3 (Default argument values [Tasks and
Functions]):

    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
    and, if used, at the scope of the caller. If the default_value is not
    used, the expression is not evaluated and need not be visible at the
    scope of the caller.


The LRM requires that the terms of the default expression to be resolved
in the context of the **caller**.  This is not at all reasonable
as a general programming language semantic definition, nor in
the context of separate compilation and hierarchically referenced
tasks and functions.

Consider obvious examples such as:

    module A;
       parameter p1 = 1;
       function integer f(integer x = p1) ......
    endmodule

    module B;
       real p1;
       A a();
       initial $display(a.f);
    endmodule

The LRM currently requires that actual parameter value used in
the call of a.f will be the value of "p1" from B.p1.

Although in the context of synthesis, one could conceivably make
an argument that this "macro" view of default values might be
useful (since hierarchical calls aren't allowed), in the context
of simulation, this is not reasonable.

This issue will be raised as part of Mentor's official response, but
I wanted to raise this immediately since we consider this to be
a very significant flaw.

Gord
-- 
--------------------------------------------------------------------
Gordon Vreugdenhil,  Staff Engineer               503-685-0808
Model Technology (Mentor Graphics)                gordonv@model.com
Received on Thu Mar 3 08:48:34 2005

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2005 - 08:48:41 PST