VHDL Issue Number: 1124 Classification: Language Definition Problem Language Version: VHDL-93 Summary: Are all actuals evaluated in incremental binding? Related Issues: IR1096, 1081 Relevant LRM Sections: 5.2.1 Key Words and Phrases: Incremental binding, Current Status: ISAC-Approved 1076-1987 Disposition: N/A Disposition Rationale: N/A Superseded By: N/A ----------------------- Date Submitted: 1997/01/22 Author of Submission: Chuck Swart Author's Affiliation: Analogy Author's Post Address: 9205 SW Gemini Drive Beaverton, OR 97008 Author's Phone Number: 503-520-2741 Author's Fax Number: 503-643-3361 Author's Net Address: cswart@analogy.com ----------------------- Date Analyzed: 1997/07/22 Author of Analysis: Greg Peterson Peter Ashenden Revision Number: $Revision: 1.1 $ Date Last Revised: $Date: 1997/01/24 19:12:10 $ Description of Problem ---------------------- Consider the following code fragment constructed along the lines of the incremental binding example in LRM section 5.2.1 (impurefcn is an impure function with no arguments which returns an integer value): ENTITY test1 IS GENERIC( g1,g2,g3: integer); END ENTITY test1; PACKAGE my_gates IS COMPONENT test1 IS GENERIC( g1,g2,g3: integer); END COMPONENT test1; END PACKAGE my_gates; ENTITY test2 IS END ENTITY test2; USE work.my_gates.ALL; ARCHITECTURE structure OF test2 IS FOR L1:test1 USE ENTITY work.test1(behavior) --primary binding indication GENERIC MAP (impurefcn,OPEN,impurefcn) --for instance L1 ... BEGIN L1: test1; ... END ARCHITECTURE structure; CONFIGURATION different OF test2 IS FOR structure FOR L1: test1 --incremental binding GENERIC MAP (g2=>impurefcn,g3=>impurefcn) --of L1; rebinds its generics ... END CONFIGURATION different. Two questions appear to be unresolved in the LRM: (1) How many calls to impurefcn are made? In particular are the actual expressions related to the primary binding indication evaluated even when these values are overridden by the incremental binding? (2) In what order are the calls to impurefcn made? Proposed Resolution ------------------- TBD VASG-ISAC Analysis & Rationale ------------------------------ While it might be tempting to prohibit use of impure functions in actuals of binding indications, the language definition does not allow that. The normative part of the standard does not specify that the actual should be static. Furthermore, 7.4.2 Note 2 lines 664-667 explictly indicate that a generic constant may be initialized with an expression that is neither globally nor locally static. The answer to question (1) is that the actual expression for an overriden generic association in a primary binding indication are not evaluated. 5.2.1 lines 180-181 state that, for a formal generic that is rebound by an incremental binding indication, "the association given in the primary binding indication has no effect for the given instance." While this makes it clear that the formal is not associated with the actual in the primary binding indication, it does not state whether the actual expression is evaluated. To determine whether the expression is evaluated, it is necessary to consider the equivalent block structure for the component instance and the elaboration rules. 9.6.1 states that a component instantiation is equivalent to a pair of nested block statements, the outer of which corresponds to the component instance, and the inner of which corresponds to the bound design entity. 9.6.1 lines 432-435 specify that the generic map aspect of the inner block is the generic map aspect of the binding indication that binds the component instance to the design entity. 12.4.3 specifies that elaboration of a component instantiation statement consists of elaboration of the equivalent block statements. 12.4.1 specifies that elaboration of a block statement includes elaborating the block header. 12.2 specifies that elaboration of the block header includes elaborating the generic map aspect. 12.2.2 specifies that elaborating the generic map aspect involves (indirectly) evaluation of the actual expression in an element association. The implication of these rules is that the binding indication for the equivalent block is formed first, and the actual expressions in the binding indication are evaluated later. An overridden association in the primary binding indication has no effect by virtue of being replaced with the association in the incremental binding indication. Hence the overridden association does not appear in the final binding indication for the component instance, and its actual part is never evaluated. The answer to question (2) is that the order is undefined. The LRM does not define the order of elaboration of elements in an association list. In the issue author's example, the generic map aspects of the primary and incremental binding indications together form a generic map aspect for the inner equivalent block, as follows: generic map ( g1 => impurefcn, g2 => impurefcn, g3 => impurefcn ) The order of evaluation of the function calls is undefined. VASG-ISAC Recommendation for IEEE Std 1076-1993 ----------------------------------------------- No change. VASG-ISAC Recommendation for Future Revisions --------------------------------------------- No change.