errata/211: 3.11.2: localparam behavior not clear

From: Shalom Bresticker (Shalom.Bresticker@motorola.com)
Date: Thu Aug 14 2003 - 08:10:03 PDT

  • Next message: Shalom.Bresticker@motorola.com: "errata/416: check use of constant_expression"

    Precedence: bulk

    The following reply was made to PR errata/211; it has been noted by GNATS.

    From: Shalom Bresticker <Shalom.Bresticker@motorola.com>
    To: etf-bugs@boyd.com
    Cc:
    Subject: errata/211: 3.11.2: localparam behavior not clear
    Date: Thu, 14 Aug 2003 18:07:04 +0300

     The following is resent in order to preserve it in the database. Shalom.
     
        Date: Mon, 11 Aug 2003 13:06:34 -0700
        From: "Brophy, Dennis"<dennisb@model.com>
     
       In regards to issue 211 we discussed this morning, the implementation of
     localparam in ModelSim appears to be consistent with the LRM. It may be that
     the
     words which appear in the LRM do not match the intent of the team.
     
       In 12.2.2.1, the override of values by an ordered list shall follow the order
     of
     declaration. When a localparam is sandwiched between two other non-local
     parameters, it is not possible to pass in the two parameters since the second
     value would be targeted to the localparam by LRM definition.
     
       If the intention was to "skip" a localparam, the LRM needs to be modified.
     Otherwise, a compliant implementation should issue an error. That is, the code
     shown in 211 should be flagged as an error and I think the LRM is clear on that
     point:
     
        12.2.2.1 Parameter value assignment by ordered list
     
        The order of the assignments in the module instance parameter value
        assignment by ordered list shall follow the order of declaration of
        the parameters within the module. It is not necessary to assign values
        to all of the parameters within a module when using this method. However,
        it is not possible to skip over a parameter.
     
     
           Date: Mon, 11 Aug 2003 16:19:09 -0700
           From: Michael McNamara<mac@verisity.com>
     
     Section 12.2 talks about overriding parameters. It never mentions
     localparams.
     
     The localparam is a new datatype introduced with 1364-2001, defined in
     Section 3.11.2.
     
     Section 3.11.2 clearly specifies that the value of localparams can not
     be overridden using the specific methods that apply to parameters.
     
     I quote:
     
       3.11.2 Local parameters - localparam
     
       Verilog-HDL localparam - local parameter(s) are identical to
       parameters except that they can not directly be modified with the
       defparam statement or by the ordered or named parameter value
       assignment. Local parameters can be assigned to a constant
       expression containing a parameters which can be modified with the
       defparam statement or by ordered or named parameter value
       assignment. See section 12.1.3 for details.
     
     So I believe the LRM is self consistent in this case, with the
     exception that the reference to 12.1.3 in Section 3.11.2 should
     instead point to 12.2
     
     I also note (again) that an index and/or a table of contents that went
     down two levels (which was contained in the DRAFT 6 which we all
     approved) would have helped your team immensely in getting this
     correct the first time.
     
     
        Date: Mon, 11 Aug 2003 17:01:42 -0400 (EDT)
        From: Steven Sharp<sharp@cadence.com>
     
     Like Mac, I interpret all of the text about overriding parameters as not
     applying to localparams because they are not technically parameters.
     There is no need for a special rule about skipping localparams for
     overrides, any more than there is a special rule about skipping regs
     or nets for overrides; the overrides simply don't apply to any objects
     other than parameters, which means that they don't apply to localparams.
     This results in skipping them when overriding by position (just as you
     would skip any other non-parameter declaration), and producing an error
     when overriding by name (just as you would produce an error for any other
     attempt to override a name that is not a parameter).
     
     However, this argument is weakened by the practice of using the term
     parameter elsewhere to refer to both parameters and localparams. It
     would have been too much work to change all the old references to
     parameters to say "parameters and localparams". It was a lot easier
     to just say that localparams act like parameters except in regard to
     overrides.
     
     Unfortunately, the description of that exception can be misinterpreted
     as meaning that you can try to override localparams just like parameters,
     but it produces an error when you do. Nor are the engineers working
     on ModelSim the only ones who have come to this conclusion. The
     engineer implementing localparams in NC-Verilog came to this same wrong
     conclusion, and I had to correct them. This indicates that the text
     needs some clarification.
     
     
           Date: Mon, 11 Aug 2003 17:21:09 -0700
           From: Michael McNamara<mac@verisity.com>
     
     My position is that 3.11.2 holds the precise text needed; it is just
     that without an index or table of contents, people don't find this.
     
     One addtion that would help would be text in 12.2 that points to
     3.11.2.
     
     
        Date: Wed, 13 Aug 2003 18:12:00 -0400 (EDT)
        From: Steven Sharp<sharp@cadence.com>
     
     There are essentially two questions to be answered for this issue.
     
     1. Is it the consensus of the ETF that the intent of the LRM was for
        localparams to be ignored/skipped when doing parameter override by
        position?
     
     2. Does the existing LRM text need to be changed to make the intent
        clearer?
     
     
           Date: Wed, 13 Aug 2003 15:31:31 -0700
           From: Krishna Garlapati<krishna@synplicity.com>
     
     When implementing this feature into the Verilog compiler here, I came
     across this question. With a careful reading of the related sections
     on parameters and localparams I thought that the intent of the LRM was
     clear. I think its pretty explicit that the LRM wants to treat parameters
     and localparms differently and hence localparams should not have any impact
     on parameter overrides.
     
     I don't object to make changes in the LRM, but I think the intent
     is pretty clear.
     



    This archive was generated by hypermail 2.1.4 : Thu Aug 14 2003 - 08:19:30 PDT and
    sponsored by Boyd Technology, Inc.