VHDL Issue Number: 1048 Classification: Language Clarification Language Version: VHDL-93 Summary: Deferred constant reference before complete definition. Related Issues: 0236, 0020 Relevant LRM Sections: 2.6 Key Words and Phrases: Deferred constant usage Current Status: ISAC-Approved 1076-1993 Disposition: N/A Disposition Rationale: N/A Superseded By: N/A ----------------------- Date Submitted: 1991/03/11 Author of Submission: Laurence Groves (edited by Bill Paulsen) 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: N/A Author's Net Address: larry@Synopsys.COM ----------------------- Date Analyzed: 1995/04/10 Author of Analysis: Clive R. Charlwood Revision Number: $Revision: 1.9 $ Date Last Revised: $Date: 1995/06/20 22:56:36 $ Description of Problem ---------------------- (This IR supersedes IR 0236.) Consider the following code fragment from a package declaration: constant C : bit_vector(1 to 3); signal S : bit_vector(C'range); -- failure here It appears that the LRM is ambiguous on this point. LRM 2.6, paragraph 5: Within a package declaration that contains the declaration of a deferred constant, and within the body of that package (before the end of the corresponding full declaration), the use of a name that denotes the deferred constant is only allowed in the default expression for a local generic, local port, or formal parameter. The result of evaluating an expression that references a deferred constant before the elaboration of the corresponding full declaration is not defined by the language. The last sentence is key: "... not defined by the language." The above case falls into this rather ambiguous statement. Additionally, in IR 0020 (status: ISAC approved) supports not relaxing current rules regarding deferred constants. Proposed Resolution ------------------- Modify the last sentence of paragraph 5, section 2.6 to read: Any other reference to a deferred constant before elaboration of the corresponding full declaration is an error. VASG-ISAC Analysis & Rationale ------------------------------ A careful reading of the first quoted sentence states that "... the use of a name ... is only allowed in the default expression for a local generic, local port, or formal parameter." Therfore the above code is clearly illegal. VASG-ISAC Recommendation for IEEE Std 1076-1993 ----------------------------------------------- No LRM change is required. VASG-ISAC Recommendation for Future Revisions --------------------------------------------- We recommend that the next version of the language consider treating references to a deferred constant differently from reads. In particular, adding or reading an attribute should probably be legal as soon as the constant is declared.