VHDL Issue Number: 0187 Classification: Language Definition Problem Language Version: VHDL-87 Summary: VPI Issue 11 -- Is INTEGER'LOW within range? Related Issues: None Relevant LRM Sections: 3.1.2.1, 3.1.4.1 Key Words and Phrases: Integer, integer range, real Current Status: Analyzed 1076-1993 Disposition: Bugs Fixed, Enhancements Outstanding Disposition rationale: N/A 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/11/19 Author of Analysis: Stephen Bailey Revision Number: $Revision: 1.10 $ Date Last Revised: $Date: 1995/05/13 19:34:42 $ Description of Problem ---------------------- Is -(INTEGER'LOW) in the valid range of integers? Test File: ch07/s02/s5/03030101.vhd (see comment section) In the test, if the expression abs(-MININT) is considered to be legal, it is an expect success test. Otherwise, it is an expect failure test. We also have a similar issue: Is REAL'LOW-1.0 or REAL'HIGH+1.0 in the valid range of reals? Test file: ch03/s01/s4/02020101.vhd If REAL'LOW-1.0 and REAL'HIGH+1.0 are ruled to be in the valid range of reals for some implementations, this test should be an expect success test. --##72503311145FF7250121725022172503117250321********************************* -- --+ File: [SUITE.CH07.S02.S5]03030101.VHD -- --+ Copyright: (c) 1986 by Intermetrics Inc. All rights reserved -- --+ LRM_Version: IEEE Std. 1076-1987 -- --+ Subsets: None -- --+ Description: -- --+ Test_point - (070250_030301) "An expression is said to be locally static -- iff every operator -- in the expression denotes a predefined operator whose operands and result -- are scalar and every primary in the expression is a locally static primary -- which in this case, is a function call whose function name denotes a pre- -- defined operator, and whose actual parameters are each locally static -- expressions. -- --+ Test_objective (1) - Test that static expressions formed with the operator -- abs abd ** have the correct static value. -- cases: -- for "abs": types integer, real, and physical -- with positive, negative, and zero values. -- for "**": types integer and real with positive, -- negative, and zero values. Except: left -- operand is integer and right operand is negative. -- --+ References: Secondary LRM Coverage: -- 070250_010201, 070250_020201, 070250_030101, 070250_030201 -- --+ Instructions: None -- --+ Keywords: Static expressions -- --+ Test_Results: Expect_Success. Output_Checked. -- --+ Test_Type: Locally Static Semantic -- --+ History: Created MM/MCC 7-17-89 -- Modified CHC/VT 8-30-89 -- Corrected KSC/VT 12-22-89 -- Corrected CHC/VT 5-8-90 -- --+ Comments: Original file name: S-07-2-1-5003A.VHD -- 10-September-1988 13:57:12 by David Franke(Franke@mcc.com) -- Updated package and package body declarations, -- changed s to sec -- Updated to 1076-1987 VHDL, checked w/Recognizer. -- (Steve)Grout@mcc.com 20jun8 -- -- Zycad claimed that - (integer'low) could be integer'high + 1 -- for some implementations and thus -(integer'low) could cause -- overflow. This test will be sent to VASG for clarification. --**************************************************************************** package P is function F return boolean; constant MININT : integer := integer'low; end P ; package body P is function F return boolean is subtype ALWAYS_TRUE is boolean range TRUE to TRUE; variable A : ALWAYS_TRUE; begin case A is when ( (abs(-9532) = 9532) and (abs(-1.2e-10) > 0.0) and (abs 0 = 0) and (abs 0.0 = 0.0) and (abs 10000 = 10000) and (abs 32.0 = 32.0) and (abs(-1 sec) = 1 sec) and (abs (0 fs) = 0 fs) and (abs (-MININT) = abs MININT )) => null; end case; case A is when ( (1.0**2 = 1.0) and ((-1.0)**1 = -1.0) and (0.0**77 = 0.0) and (-0.5**(-1) < (-1.9) ) and (2.0**(-2) < 1.5) and ((-10)**2 = 100) and (100000.0**0 = 1.0) and ( 100000**0 = 1) and (8**3 = 512) ) => null; end case; return TRUE; end F; end P ; entity E is end E; architecture A of E is begin process begin assert FALSE report "TEST OK for given Test Point" severity note; wait; end process; end A; --##31402211445FF********************************************* -- --+ File: [SUITE.CH03.S01.S4]02020101.VHD -- --+ Copyright: (c) 1986 by Intermetrics Inc. All rights reserved -- --+ LRM_Version: IEEE Std. 1076-1987 -- --+ Subsets: None -- --+ Description: -- --+ Test_point - (030141_020201) "[A floating point type definition defines -- both a type and a subtype of that type. The type is an anonymous typ -- the range of which is selected by the implementation;] this range mus -- be such that it wholly contains the range given in the floating type -- definition." -- --+ Test_objective (1) - Test if the range specified in the range constraint -- exceeds the range provided by the implementation, an error occurs -- (REAL'LOW-1..REAL'HIGH+1) -- --+ References: None -- --+ Instructions: None -- --+ Keywords: Floating Type Definition, Range -- --+ Test_Results: Expect_Failure. Output_Checked. Approximate -- Error Message: "Range exceeds implementation." -- --+ Test_Type: Locally Static Semantic -- --+ History: Created MM/MCC 6-16-89 -- Modified CHC/VT 8-23-89 -- Modified CHC/VT 5-4-90 -- --+ Comments: Original file name: E-03-1-4-0003A.VHD -- Updated to 1076-1987 VHDL, checked w/Recognizer. (Deene)Ogden@mc -- com 20jun88 -- -- This might be valid for some implementations. --*********************************************************** -- Begin test: >>> entity E is port (PT: BOOLEAN) ; type REAL1 is range REAL'LOW-1.0 to REAL'HIGH+1.0; -- Failure_here -- SEMANTIC ERROR: RANGE EXCEEDS IMPLEMENTATION end E; architecture Aa of E is begin end Aa; Proposed Resolution ------------------- TBD VASG-ISAC Analysis & Rationale ------------------------------ The comment below accurately reflects the author's analysis of the two issues involved in this IR. The comment is replicated here by reference. VASG-ISAC Recommendation for IEEE Std 1076-1987 ----------------------------------------------- No change of the LRM is required. VASG-ISAC Recommendation for Future Revisions --------------------------------------------- Future versions of the LRM should continue to explicitly state the implementation-dependent characteristics of the language of which these two issues are part of.