RE: Issue: Scope Rules (IEEE P1364-2005/D2, 5/26/03)

From: Kausik Datta (kausikd@cal.interrasystems.com)
Date: Tue Jan 18 2005 - 03:01:28 PST

  • Next message: Shalom Bresticker: "Re: comment syntax"

    Hi Bineet,
    I think Formality is giving the correct error message.
    Please see the following section (10.3.2) of LRM.

    Thanks
    Kausik Datta
    Interra Systems India Pvt. Ltd.

    10.3.2 Returning a value from a function
    The function definition shall implicitly declare a variable, internal to the function, with the same name as the
    function. This variable either defaults to a 1-bit reg or is the same type as the type specified in the function
    declaration. The function definition initializes the return value from the function by assigning the function
    result to the internal variable with the same name as the function.
    It is illegal to declare another object with the same name as the function in the scope where the function is
    declared. Inside a function, there is an implied variable with the name of the function, which may be used in
    expressions within the function. It is, therefore, also illegal to declare another object with the same name as
    the function inside the function scope.

    -----Original Message-----
    From: owner-etf@boyd.com [mailto:owner-etf@boyd.com]On Behalf Of Bineet
    SRIVASTAVA
    Sent: Tuesday, January 18, 2005 4:08 PM
    To: etf@boyd.com
    Cc: Bineet SRIVASTAVA
    Subject: Issue: Scope Rules (IEEE P1364-2005/D2, 5/26/03)

    In section : 12.6 for Scope rules (IEEE P1364-2005/D2, 5/26/03)

    "If an identifier is referenced directly (without a hierarchical path) within a task, function, or named block, it
    shall be declared either locally within the task, function, or named block, or within a module, task or named
    block that is higher in the same branch of the name tree that contains the task, function, or named block. If it
    is declared locally, then the local item shall be used; if not, the search shall continue upward until an item by
    that name is found or until a module boundary is encountered."

    example:

    module foo(a,b);
    input a;
    output b;

    function bar;
    input in;
    reg bar;

    bar = in;
    endfunction

    assign b = bar(a);

    endmodule

    For the above example :
    Synplify - Error (for no assignment to function)
    VCS - Warning (Ignoring second declaration)
    Formality - Error (Redeclaration of 'bar')

    Does that mean any ambiguity in scope rules section.

    Any thoughts??

    Regards
    Bineet Srivastava
    ST Microlectronics Ltd.
    NOIDA, INDIA



    This archive was generated by hypermail 2.1.4 : Tue Jan 18 2005 - 02:45:21 PST and
    sponsored by Boyd Technology, Inc.