TWiki
>
P1076 Web
>
Vhdl2019CollectedRequirements
>
PrecedenceUnaryLogical
(2020-02-17,
JimLewis
)
(raw view)
E
dit
A
ttach
---+!! Precedence of Unary Logical Operators %TOC% ---++ Proposal Information * Who Updates: Main.JimLewis, <Add YourName>, ... * Date Proposed: 2013-11-14 * Date Last Updated: 2013-11-14 * Priority: * Complexity: * Focus: Testbench ---++ Requirement Summary In VHDL-2008 LRM p118, the precedence of the unary logical operators is not listed and needs to be. ---++ Related and/or Competing Issues: NONE ---++ Issue Summary: Bugzilla 278 and 280 [[https://bugzilla.mentor.com/show_bug.cgi?id=278][Bugzilla 278]] ... Skipping over the part that is ok ... the list on 9.2.1, Operators-General, is misleading and technically incorrect, since it lists logic_operators as second in the list and states the the "operators are listed in order of increasing precedence." This statement implies that my original claim about precedence is true. One possible solution is to add "logical reduction operators" or "unary logical operators" to the miscellaneous_operator list, to give them the correct precedence. A further issue is that NOTE 2 on page 118 is wrong. It appears to be a relic of the way the grammar was originally written, not as it was finally approved. [[https://bugzilla.mentor.com/show_bug.cgi?id=280][Bugzilla 280]] ... Closes saying it is ok and to see 278 for discussion ---++ Actions Change the grammar production for miscellaneous operator to miscellaneous_operator ::= ** | abs | not | _unary_ _logical_operator Delete note 2 at the top of 118 that reads: "NOTE 2—The syntax for an expression involving a unary condition operator or unary logical operator in combination with any other operator requires that the unary operator and its operand be a parenthesized expression. For example, the expressions “(and A) and B” and “A and (and B)” are legal, whereas the expression “and A and B” and “A and and B” are not. Similarly, “and (and A)” is legal, whereas “and and A” is not. An expression consisting only of a unary condition oprator or unary logical operator and its operand need not be parenthesized." ---++ General Comments -- Main.DavidKoontz - 2014-10-07 If 9.1 Note 2 (top of P.118) where it would represent a lexical ambiguity between the EBNF and 9.2 Operators, 9.2.1 General, para 10: <blockquote> Operators of higher precedence are associated with their operands before operators of lower precedence. Where the language allows a sequence of operators, operators with the same precedence level are associated with their operands in textual order, from left to right. The precedence of an operator is fixed and cannot be changed by the user, but parentheses can be used to control the association of operators and operands. </blockquote> This would require parentheses to avoid an elaboration time error. -- Main.DavidKoontz - 2017-02-05 You could note that the BNF non-terminal production factor is correct in that it includes an alternative logical_operator primary. What's missing is support in the precedence table found in 9.2.1, a text narrative issue, noting the that NOTE 2 in 9.2.2 (top of page 118) is inaccurate - logical operators are not the lowest precedence. Also note the production miscellaneous_operator is found no where else in the BNF (other than Annex C) instead choices given in the production demonstrate the the highest precedence class. A proper solution might be to remove the mentions of BNF productions in the precedence table instead proving lead in text mentioning the classes of operators and the unary not logical operator, remove 9.2.2 NOTE 2, delete the Annex C BNF notation for the production miscellaneous_operator and to remove NOTE 2 of 9.2.1 which is specific to the unary not operator. <literal><table border='1' cellpadding='0' cellspacing='1' style='height: 2px;'> <tbody> <tr> <td> <div title='Page 2'> <div> <div> <p>Condition operator</p> </div> </div> </div> </td> <td> <div title='Page 2'> <div> <div> <p>??</p> </div> </div> </div> </td> </tr> <tr> <td> <div title='Page 2'> <div> <div> <p>Binary logical operators</p> </div> </div> </div> </td> <td> <div title='Page 2'> <div> <div> <p><b>and or nand nor xor xnor</b></p> </div> </div> </div> </td> </tr> <tr> <td> <div title='Page 2'> <div> <div> <p>Relational operators</p> </div> </div> </div> </td> <td> <div title='Page 2'> <div> <div> <p>= /= < <= > >= ?= ?/= ?< ?<= ?> ?>=</p> </div> </div> </div> </td> </tr> <tr> <td> <div title='Page 2'> <div> <div> <p>Shift operators</p> </div> </div> </div> </td> <td> <div title='Page 2'> <div> <div> <p><b>sll srl sla sra rol ror</b></p> </div> </div> </div> </td> </tr> <tr> <td> <div title='Page 2'> <div> <div> <p>Adding operators</p> </div> </div> </div> </td> <td> <div title='Page 2'> <div> <div> <p>+ – &</p> </div> </div> </div> </td> </tr> <tr> <td> <div title='Page 2'> <div> <div> <p>Signs</p> </div> </div> </div> </td> <td> <div title='Page 2'> <div> <div> <p>+ –</p> </div> </div> </div> </td> </tr> <tr> <td> <div title='Page 2'> <div> <div> <p>Multiplying operators</p> </div> </div> </div> </td> <td> <div title='Page 2'> <div> <div> <p>* / <b>mod rem</b></p> </div> </div> </div> </td> </tr> <tr> <td> <div title='Page 2'> <div> <div> <p>Miscellaneous operators, <br />unary logical operator <b>not</b>, <br />logical reduction operators</p> </div> </div> </div> </td> <td> <div title='Page 2'> <div> <div> <p>** <b> abs not and or nand nor xor xnor</b></p> </div> </div> </div> </td> </tr> </tbody> </table></literal> It might be worth adding two headers to 9.2.2: <div title="Page 3"> 9.2.2 Logical operators (add before para 1): 9.2.2.1 Binary logical operators and unary logical operator not The binary logical operators and, or, nand, nor, xor, and xnor, and the unary logical operator not are defined for predefined types BIT and BOOLEAN. They are also defined for any one-dimensional array type whose element type is BIT or BOOLEAN. and <div title="Page 3"> .2.2 Logical operators (add before para 8): 9.2.2.2 Logical reduction operators The unary logical operators and, or, nand, nor, xor, and xnor are referred to as logical reduction operators. The logical reduction operators are predefined for any one-dimensional array type whose element type is BIT or BOOLEAN. The result type for the logical reduction operators is the same as the element type of the operand. -- </div> </div> This does not provide an additional level of precedence as implied in Peter Flake's LCS ( [[http://www.eda-twiki.org/cgi-bin/view.cgi/P1076/LCS2016_I13][LCS2016_I13]] R15) to eliminate parenthesis needed today to specify precedence order among the current highest level of precedence. That LCS does not reference this proposal and provides no readily apparent support for the added level of precedence. ---++ Supporters _Add your signature here to indicate your support for the proposal<br /><br />-- [[Main.BrentHahoe][Brent Hayhoe]] - 2014-10-13
E
dit
|
A
ttach
|
P
rint version
|
H
istory
: r7
<
r6
<
r5
<
r4
<
r3
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r7 - 2020-02-17 - 15:34:36 -
JimLewis
P1076
Log In
or
Register
P1076 Web
Create New Topic
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
Webs
Main
P1076
Ballots
LCS2016_080
P10761
P1647
P16661
P1685
P1734
P1735
P1778
P1800
P1801
Sandbox
TWiki
VIP
VerilogAMS
Copyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback