VHDL Issue Number: 0166 Classification: Language Deficiencies and Modeling Problems Language Version: VHDL-87 Summary: Enumeration literal to string conversion needed. Related Issues: None. Relevant LRM Sections: 14.1 Key Words and Phrases: Enumeration literal, predefined attributes Current Status: Submitted 1076-1993 Disposition: Closed (All Issues Completely Addressed) Disposition Rationale: LRM addresses these concerns now. Superseded By: N/A ----------------------- Date Submitted: 1991/03/14 Author of Submission: Paul Menchini Author's Affiliation: CAD Language Systems, Inc. Author's Post Address: P.O. Box 13036 Research Triangle Park, NC 27709-3036 Author's Phone Number: (919) 361-1913 Author's Fax Number: Author's Net Address: mench@clsi.com ----------------------- Date Analyzed: TBD Author of Analysis: TBD Revision Number: $Revision: 1.9 $ Date Last Revised: $Date: 1995/05/13 19:34:42 $ Description of Problem ---------------------- There is currently no convenient way to convert enumeration literals to strings. Such a facility is useful, e.g., in assertion statements and can also simplify the use of TextIO. Proposed Resolution ------------------- Copying Ada, define the following three additional predefined attributes (see Ada Section 3.5.5 for the Ada versions of these predefined attributes): T'WIDTH Kind: Value Prefix: Any discrete or physical type or subtype T. Result type: *universal_integer*. Result: The maximum image length of all over all values of the subtype T. (The *image* is the sequence of characters returned by the attribute IMAGE, see below.) If T is a null range, the result is zero. T'IMAGE(X) Kind: Function Prefix: Any discrete or physical type or subtype T. Parameter: An expression whose type is the base type of T. Result type: Type String. Result: The *image* of the value of X; that is, a sequence of characters representing the value in display form. The image of an integer value is the corresponding decimal literal without underlines, leading zeros, exponent, or trailing spaces, but with a single leading character that is either a minus sign or a space. The index range of the result is an ascending range whose lower bound is one and whose upper bound is the length of the string. The image of an enumeration value is either the corresponding identifier in upper case or the corresponding character literal (including the two apostrophes); neither leading nor trailing spaces are included. The image of a value of a physical type is the image of position number of the physical value followed by a single space followed by the image of the base unit in upper case. T'VALUE (X) Kind: Function Prefix: Any discrete or physical type or subtype T. Parameter: An expression whose type is type String. Result type: The base type of T. Result: The value of type or subtype T whose image is the parameter, stripped of extraneous whitespace and converted to upper case. Restrictions: An error occurs if there is no value of type or subtype T whose image is the parameter (after stripping and case shifting, if required). (Note, there has been submitted a European requirement that covers 'IMAGE and 'VALUE; this one is provided to add 'WIDTH and to suggest LRM language.) VASG-ISAC Analysis & Rationale ------------------------------ TBD VASG-ISAC Recommendation for IEEE Std 1076-1987 ----------------------------------------------- TBD VASG-ISAC Recommendation for Future Revisions --------------------------------------------- TBD