VHDL Issue Number: 0096 Classification: Language Definition Problem Language Version: VHDL-87 Summary: Subtype of slice must be defined for case expression check. Related Issues: 0078 Relevant LRM Sections: 7.4, 8.7 Key Words and Phrases: Case statement, slice, locally static subtype Current Status: VASG-Approved 1076-1993 Disposition: Closed (All Issues Completely Addressed) Disposition Rationale: LRM 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: 1989/09/01 Author of Analysis: Doug Dunlop Revision Number: $Revision: 1.10 $ Date Last Revised: $Date: 1995/08/03 18:12:47 $ Description of Problem ---------------------- If a slice appears as the select expression in a case statement, the LRM requires the subtype of the slice to be a locally static subtype. However, the LRM does not define the subtype of a slice. Proposed Resolution ------------------- It is tempting to give rules for deriving the subtype of a slice from its prefix and discrete range. However, this is not as easy as it may seem considering null slices and slice prefixes whose direction is unknown. Hence for now we simply say that a slice is never of a locally static subtype. For select expressions in case statements, qualifying the slice with a locally static subtype is an easy workaround. VASG-ISAC Analysis & Rationale ------------------------------ There appear to be two possibilities for solving this problem. As mentioned above, one option is to define the subtype of a slice. The second is to re-phrase the requirements on the case statement select expression without using the concept of a locally static array subtype. The first option is at first tempting. The definition of the subtype of a slice would have to be "syntax-oriented" in order for the rules that define when a subtype is locally static to be applicable. This seems rather unappealing because it would add complexity to the definition of a slice only for the purpose of making the LRM rules for case statement select expressions work. No where else does the "subtype" of a slice matter. Another aspect of this solution that does not "feel right" is that it would make slices stand out as the only non-declared typed entity whose subtype was explictily defined. What about objects designated by access types? What about aggregates? What about results of function calls? Should these have subtypes as well? Perhaps then it makes more sense to simply re-state the requirements on the case statement select expression. This indeed is the short-term recommendation for solving this problem; in the long term, the entire notion of "locally static subtype" needs thorough review (see below). VASG-ISAC Recommendation for IEEE Std 1076-1987 ----------------------------------------------- The following is the recommendation that addresses the subject of this IR as well as that of IR-0078. Read Paragraphs 3-5 of LRM 8.7 (beginning "If the expression is the name ...", "If the expression is of a ...", and "For other forms ...", respectively) as though they were written as the following two paragraphs: If the expression is of a one-dimensional character array type, then the expression must be either a slice name whose discrete range is locally static, the name of an object whose subtype is locally static, or a qualified expression or type conversion whose type mark denotes a locally static subtype. Furthermore, the element subtype of the one-dimensional array type must be locally static. Finally, each possible value for the expression, given, the above restrictions, must be represented once and only once in the set of choices of the case statement, and no other value is allowed. If the expression is of a discrete type, then if the expression is the name of an object whose subtype is locally static, then each value of the subtype must be represented once and only once in the set of choices of the case statement, and no other value is allowed; this rule is likewise applied if the expression is a qualified expression or type conversion whose type mark denotes a locally static subtype. Otherwise, each value of the base type of the expression must be represented once and only once in the set of choices, and no other value is allowed. VASG-ISAC Recommendation for Future Revisions --------------------------------------------- The above is a short-term solution. This whole area is, frankly speaking, a mess and needs to be re-considered in the next revision of the standard. Some of these issues are "Do we need the concept of a locally static subtype at all?", "Why is locally static subtype used in the definition of a locally static primary?", and "How does/should the element subtype of an array subtype fit in?"