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

From: Shalom Bresticker (Shalom.Bresticker@freescale.com)
Date: Tue Jan 18 2005 - 02:50:23 PST

  • Next message: Kausik Datta: "RE: Issue: Scope Rules (IEEE P1364-2005/D2, 5/26/03)"

    Hi.

    This has nothing to do with scope rules.

    Your problem comes from 10.3.2:

    "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."

    You have a function named bar which implicitly declares a variable named bar inside the function.
    It is illegal to explicitly declare a variable with the same name within the function.

    Shalom

    Bineet SRIVASTAVA wrote:

    > 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

    --
    Shalom Bresticker                        Shalom.Bresticker @freescale.com
    Design & Verification Methodology                    Tel: +972 9  9522268
    Freescale Semiconductor Israel, Ltd.                 Fax: +972 9  9522890
    POB 2208, Herzlia 46120, ISRAEL                     Cell: +972 50 5441478
    

    [ ]Freescale Internal Use Only [ ]Freescale Confidential Proprietary



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