VHDL Issue Number: 1079 Classification: Language Definition Problem Language Version: VHDL-93 Summary: Conflicting rules for direction of concatenation Related Issues: Relevant LRM Sections: 7.2.4 Key Words and Phrases: concatenation Current Status: Submitted 1076-1993 Disposition: N/A Disposition Rationale: N/A Superseded By: N/A ----------------------- Date Submitted: 1994/03/14 Author of Submission: Chuck Swart Author's Affiliation: Mentor Graphics Author's Post Address: 8005 S.W. Boeckman Road Wilsonville, OR 97070-7777 Author's Phone Number: (503) 685-1332 Author's Fax Number: (503) 685-1268 Author's Net Address: chuck_swart@mentorg.com ----------------------- Date Analyzed: 1995/06/15 Author of Analysis: Bill Paulsen Revision Number: $Revision: 1.5 $ Date Last Revised: $Date: 1995/06/16 17:50:16 $ Description of Problem ---------------------- The LRM contains two conflicting rules to determine the direction of the result of a concatenation operation. Both rules occur in section 7.2.4 under case 1 (the case in which both operands are arrays). The lrm first states (page 96, lines 188 to 190): "The direction of the result is the direction of the left operand, unless the left operand is a null array, in which case the direction of the result is that of the right operand." However, later in the same section and the same case the LRM states (page 97, lines 191 to 194): "If both operands are null arrays, then the result of the concatenation is the right operand. Otherwise, the direction and bounds of the result are determined as follows: Let S be the index subtype of the base type of the result. The direction of the result of the concatenation is the direction of S, and the left bound of the result is S'LEFT." These rules conflict when the direction of the left operand differs from the direction of the index subtype of the base type of the array type under consideration. LRS 12 version 2 states: "Adopt an algorithm in which the direction and bounds of the result are taken from the index subtype of the result base type." However, the same LRS states in the Rationale that "The results are not strictly upward compatible, since different index values are computed; but, in practice, this lack of compatibility is expected to cause few problems." This analysis appears to have ignored or at least downplayed the potential upward compatibility problems caused by choosing the direction from the base type instead of from the left operand. Proposed Resolution ------------------- Here are two possible solutions. 1. Remove the first statement about the direction coming from the left operand. This is the cleanest solution and probably reflects the intent of LRS 12. However, the lack of upward compatibility may be a concern. 2. Keep the first wording and change the followup wording to something such as: "If both operands are null arrays, then the result of the concatenation is the right operand. Otherwise, the bounds of the result are determined as follows: Let S be the index subtype of the base type of the result. If the direction of the result is "TO" then the left bound of the result is S'LOW. Otherwise, the left bound of the result is S'HIGH." If solution 2 is adopted, cases 2 (element, array) and 3 (element,element) will also need to be changed to define the direction of the implicit arrays created. Under solution 1, these directions need not be specified, since they are not used. VASG-ISAC Analysis & Rationale ------------------------------ The Description of the Problem is correct: the current rules for concatentation conflict when the direction of the left operand differs from the direction of the index subtype of the base type of the result. Also, the description is correct with respect to wording in LRS 12. VASG-ISAC Recommendation for IEEE Std 1076-1993 ----------------------------------------------- The recommendation is to adopt proposed resolution number 1 from above, which removes the sentence that starts on page 96, line 188: "The direction of the result is the direction of the left operand, ...". (It should be noted that by adopting this proposal, a wider range of concatenations will be legal.) VASG-ISAC Recommendation for Future Revisions --------------------------------------------- Change the wording as above.