VHDL Issue Number: 1044 Classification: Language Clarification Language Version: VHDL-87 Summary: Definition of 'HIGH and 'LOW in a null range Related Issues: 0013 supersedes 0224 Relevant LRM Sections: 3.1,14.1 Key Words and Phrases: null range, 'high and 'low values Current Status: VASG-Approved 1076-1993 Disposition: Disposition Rationale: Superseded By: ----------------------- Date Submitted: 1991/03/21 Author of Submission: Laurence Groves Author's Affiliation: Synopsys Inc. Author's Post Address: 1098 Alta Ave. Mountain View, CA 94043 Author's Phone Number: (415) 962-5426 Author's Fax Number: Author's Net Address: larry@Synopsys.COM ----------------------- Date Analyzed: 11 Aug 2004 Author of Analysis: Chuck Swart Revision Number: 2 Date Last Revised: 12 May 2005 Description of Problem ---------------------- Consider the following: entity E is subtype S is real range 20.0 to 0.0; end; architecture A of E is begin process variable R : real := 5.0; begin R := S'HIGH; -- what is the value of R after assignment? end process; end; Is R assigned 0.0 or 20.0? According to LRM 3.1, paragraph 3: The range L to R is called an ascending range; if L > R, then the range is a null range. [...] The smaller of L and R is called the lower bound, and the larger, the upper bound, of the range. [...] The smaller of L and R is called the lower bound (= 0.0), and the larger is the upper bound (= 20.0). This appears to be true even for null arrays. Therefore, T'HIGH is the larger of L and R, and T'HIGH = 20.0. However, the note at the end of 14.1 states: The relationship between the values of the LEFT, RIGHT, LOW, and HIGH attributes is expressed in the following table: Ascending Descending Range Range T'LEFT = T'LOW T'HIGH T'RIGHT = T'HIGH T'LOW Here T'RIGHT and T'HIGH are equivalent for ascending ranges. Therefore T'HIGH = T'RIGHT = 0.0. Proposed Resolution ------------------- Strike the note at the end of 14.1. VASG-ISAC Analysis & Rationale ------------------------------ The Author is correct that there is an inconsistency between the note at the end of 14.1 and the normative text. However, the interpretation of the note is more useful than the normative text. The second interpretation allows uniform handling of constructs like: FOR i IN a'LOW TO a'HIGH With the existing normative interpretation the code would always have to first check for a null range before executing the FOR loop. With the interpretation of the note, the FOR loop will (as expected) not be executed for a null range. VASG-ISAC Recommendation for IEEE Std 1076-2002 ----------------------------------------------- No Change. VASG-ISAC Recommendation for Future Revisions --------------------------------------------- The language in 3.1 should be revised to define the upper bound as the right bound of an ascending range or the left bound of a descending range, and to define the lower bound as the left bound of an ascending range or the right bound of a descending range. It should also define the terms "left bound" and "right bound", which are currently not defined.