VHDL Issue Number: 0193 Classification: Language Definition Problem Language Version: VHDL-87 Summary: VPI Issue 17 -- Base types of constrained arrays Related Issues: 0186 Relevant LRM Sections: 3.2.1 Key Words and Phrases: Anonymous Type Current Status: Analyzed 1076-1993 Disposition: Closed (All Issues Completely Addressed) Disposition Rationale: LRM is clear now, as discussed in 3.2.1. Superseded By: N/A ----------------------- Date Submitted: 1991/03/15 Author of Submission: J. R. Armstrong Author's Affiliation: Virginia Polytechnic Institute and State University Author's Post Address: Bradley Department of Electrical Engineering Virginia Polytechnic Institute and State University Blacksburg, VA 24061 Author's Phone Number: (703) 231-4723 Author's Fax Number: Author's Net Address: JRA@VTVM1.CC.VT.EDU ----------------------- Date Analyzed: 1991/12/05 Author of Analysis: Clive Charlwood Revision Number: $Revision: 1.11 $ Date Last Revised: $Date: 1995/05/13 21:53:48 $ Description of Problem ---------------------- Is the base type of a constrained array type an array type (unconstrained array definition) or an array sub- type (constrained array definition) ? Test File: ch14/s01/02020101.vhd The type of the prefix of the attribute 'RIGHT, 'LOW, or 'LENGTH must be a constrained array subtype. However, LRM doesn't explicitly specify whether the base type of a con- strained array type is constrained or not. --##E1002211145FF********************************************* -- --+ File: [SUITE.CH14.S01]02020101.VHD -- --+ Copyright: (c) 1986 by Intermetrics Inc. All rights reserved -- --+ LRM_Version: IEEE Std. 1076-1987 -- --+ Subsets: None -- --+ Description: -- --+ Test_point - (140100_020201) The prefix of T'BASE may be any type or -- subtype T. -- --+ Test_objective (1) - Test that the prefix T in T'BASE is any type or -- subtype. -- --+ References: None -- --+ Instructions: None -- --+ Keywords: T'BASE, unconstrained array. -- --+ Test_Results: Expect_Success. Self_Checking. -- --+ Test_Type: Locally Static Semantic -- --+ History: Created MM/MCC 8-15-89 -- Modified KSC/VT 8-28-89 -- Corrected 1-7-90 -- --+ Comments: Original file name: S-14-1-0-0002A.VHD -- 13-September-1988 14:10:20 by David Franke(Franke@mcc.com) -- Removed return in process -- Updated to 1076-1987 VHDL, checked w/Recognizer. (Steve)Gro -- out@mcc.com 20jun88 --*********************************************************** entity E is port (PT:BOOLEAN) ; end E; architecture BB of E is signal S1 : BIT_VECTOR (0 to 15); signal S2 : INTEGER ; begin process subtype ST is INTEGER range -5 to 20; type E is (A,B,C,D); type P is range 1 to 24 units U; X=3 U; Y=2 X; end units; type AR1 is array (-4 to -1,C downto A,BIT'BASE'LEFT to BIT'BASE'RIGHT) of ST; type AR2 is array ('X' to 'Z',TRUE downto FALSE) of INTEGER; variable V1 : INTEGER; variable V2 : BIT; variable V3 : E; variable V4 : P; variable V5 : REAL; variable V6 : BOOLEAN; begin V3 := E'BASE'LEFT; V2 := AR1'BASE'RIGHT(3); V5 := REAL'BASE'HIGH; V6 := AR2'BASE'LOW(2); V1 := E'BASE'POS(C); V1 := ST'BASE'VAL(1); V1 := INTEGER'BASE'PRED(1); V4 := P'BASE'SUCC(2 Y); V1 := AR1'BASE'LENGTH(2); S2 <= 8; assert FALSE report "TEST OK for the given Test Point" severity note; wait; end process; end BB; Proposed Resolution ------------------- TBD VASG-ISAC Analysis & Rationale ------------------------------ LRM section 3.2.1 page 3-9 paragraph 5 specifies that: A constrained array definition defines both an array type and a subtype of this type: - The array type is an implicitly declared anonymous type; this type is defined by an (implicit) unconstrained array definition, in which the element subtype indication is that of the constrained array definition, and in which the type mark of each index subtype definition denotes the subtype defined by the corresponding discrete range. - The array subtype is the subtype obtained by imposition of the index constraint on the array type. If a constrained array definition is given for a type declaration, the simple name declared by this declaration denotes the array subtype. From the above paragraph, it is clear that the names AR1, AR2 refer to the constrained subtypes of the corresponding unconstrained anonymous base type. Note: This IR is similar to IR 0186. In both cases the type declaration generates an unexpected anonymous type and a named subtype. VASG-ISAC Recommendation for IEEE Std 1076-1987 ----------------------------------------------- No changes are needed to the LRM. VASG-ISAC Recommendation for Future Revisions --------------------------------------------- When the language is modified for future revisions the designers should consider whether it was possible to clean up this minor point. One way to do this would be to define "special case" semantics for the 'BASE attribute for a constrained array to do "what the user expects". This does make the definition of 'BASE more complicated. This may not be desirable.