VHDL Issue Number: 0081 Classification: Language Definition Problem Language Version: VHDL-87 Summary: The evaluation time of a range is unclear. Related Issues: 0069 Relevant LRM Sections: 7.4 Key Words and Phrases: Range, range attribute, static range Current Status: ISAC-Approved 1076-1993 Disposition: Closed (All Issues Completely Addressed) Disposition Rationale: Section 7.4 was updated. Superseded By: N/A ----------------------- Date Submitted: 1989/02/10 Author of Submission: Doug Dunlop Author's Affiliation: Intermetrics, Inc. Author's Post Address: 4733 Bethesda Ave #415 Bethesda, MD 20814 Author's Phone Number: (301) 657-3775 Author's Fax Number: Author's Net Address: dunlop@inmet.inmet.com ----------------------- Date Analyzed: 1990/10/02 Author of Analysis: Doug Dunlop Revision Number: $Revision: 1.6 $ Date Last Revised: $Date: 1995/08/03 17:58:00 $ Description of Problem ---------------------- LRM 7.4 defines a locally static range as one whose bounds are locally static expressions. It is clear what this definition means for ranges of the form X Y where X and Y are expressions but the definition is not appropriate for ranges of the form 'RANGE where is a subtype or an object. Specifically, it is not clear what expressions are the bounds of such a range. This is perhaps plain in cases such as subtype X is STRING(E1 to E2); ... X'range ... but is impossible to determine (statically) in cases such as procedure P(X : STRING) is ... X'range ... end P; ... variable Y : STRING(E1 to E2); variable Z : STRING(E1 to E2); ... P(Y); ... P(Z); The same problem applies for determining when a range is globally static (see LRM 7.4). Proposed Resolution ------------------- In line with the decisions of 0069, it is assumed that a range attribute reference is a locally static range if and only if the prefix in the reference is a locally static subtype. Similarly it is assumed that a range attribute reference is a globally static range if and only if the prefix in the reference is a globally static subtype. VASG-ISAC Analysis & Rationale ------------------------------ It is true that it is not well-defined if a range is locally static when the range is in the form of an attribute reference. In a similar way, it is not well-defined if a range is globally static when the range is in the form of an attribute reference. The easiest way to address this problem is to state (as suggested above) that a range in the form of an attribute reference is a locally static range if and only if the prefix is a locally static subtype. An analogous statement could be made for globally static ranges. These would be simple, effective rules that parallel the "staticness" associated with other pre-defined attributes given in LRM 7.4. The rules also mesh well with the recommendations of IR-0069. Other rules (e.g., perhaps based on the "staticness" of the "corresponding" discrete range in the constrained array subtype) do not have these properties and therefore seem less desirable. In researching this issue, two additional problems concerning staticness and attributes that yield ranges have surfaced. First, the definition of a static name (see LRM 6.1) needs to take into account discrete ranges appearing within a name. To illustrate, a name such as X(Y'RANGE) may or not match the intuition behind a static name, depending on the nature of Y. The current definition of a static name does not properly take into account discrete ranges (since these syntactically are not expressions). Getting this definition correct is important, e.g., in names forming the left-hand side of signal assignments the staticness of the name affects the number of drivers created. A second language problem that surfaced in studying this area concerns Item 7 from the Page 7-16 list reads: 7. a predefined attribute of a globally static subtype that is a value or range; This language seems a contradiction since an attribute that is a range cannot be (syntactically) a primary; such attribute references fit syntactically in VHDL as discrete ranges. Strictly speaking then it does not make a great deal of sense to ask whether a primary in an expression is a predefined attribute (of a globally static subtype) that is a range. VASG-ISAC Recommendation for IEEE Std 1076-1987 ----------------------------------------------- First, we recommend the suggestion described above. That is, a range in the form of an attribute reference is a locally static range if and only if the prefix is a locally static subtype. Similarly, a range in the form of an attribute reference is a globally static range if and only if the prefix is a globally static subtype. Second, we recommend that there be an additional requirement on the formal definition of a static name; specifically a static name may not contain a slice whose discrete range is not globally static (see LRM 7.4 for when a discrete range is globally static). We also recommend the analogous requirement for a locally static name. Finally, we recommend that the phrase "or a range" in Item 7 of the Page 7-16 list be ignored. VASG-ISAC Recommendation for Future Revisions --------------------------------------------- This issue and all other VHDL87 issues pertaining to the theme of "staticness" should be reviewed as a package when the language is revised.