TWiki
>
P1076 Web
>
Vhdl2019CollectedRequirements
>
ConditionalExpressions
>
LCS2016_036a
(revision 52) (raw view)
Edit
Attach
---+ Language Change Specification for Conditional Expressions and/or Operators <span style="background-color: transparent;">Proposal</span> <table border="1" cellpadding="0" cellspacing="0" id="table1" rules="all"> <tbody> <tr> <td bgcolor="#ffffff" valign="top"> *LCS Number:* </td> <td bgcolor="#ffffff" valign="top">LCS-2016-036a</td> </tr> <tr> <td bgcolor="#edf4f9" valign="top"> *Version:* </td> <td bgcolor="#edf4f9" valign="top">7</td> </tr> <tr> <td bgcolor="#ffffff" valign="top"> *Date:* </td> <td bgcolor="#ffffff" valign="top">27-Feb-2017</td> </tr> <tr> <td bgcolor="#edf4f9" valign="top"> *Status:* </td> <td bgcolor="#edf4f9" valign="top">Voting</td> </tr> <tr> <td bgcolor="#ffffff" valign="top"> *Author:* </td> <td bgcolor="#ffffff" valign="top">Thomas Preusser</td> </tr> <tr> <td bgcolor="#edf4f9" valign="top"> *Email:* </td> <td bgcolor="#edf4f9" valign="top"> [[http://www.eda-twiki.org/cgi-bin/view.cgi/Main/ThomasPreusser][Thomas Preusser]]</td> </tr> <tr> <td bgcolor="#ffffff" valign="top"> *Source Doc:* </td> <td bgcolor="#ffffff" valign="top"> ConditionalExpressions </td> </tr> <tr> <td bgcolor="#ffffff" valign="top"> *History Doc:* </td> <td bgcolor="#ffffff" valign="top"> [[LCS2016_036a_History][History]]</td> </tr> <tr> <td bgcolor="#edf4f9" valign="top"> *Summary:* </td> <td bgcolor="#edf4f9" valign="top">Introduce first-class conditional expressions (*baseline* version)</td> </tr> </tbody> </table> ---+++ Details of Language Change <sticky> %RED%Modifications%ENDCOLOR% are shown in %RED%red%ENDCOLOR% font. %RED%<del>Deletions</del>%ENDCOLOR% are %RED%<del>striked out</del>%ENDCOLOR%. ---++++ LRM Section 9.1 General ---+++++ Edit 36a.1 An expression is a formula that defines the computation of a value. %GREEN%<i>(Introduce conditional expressions on top of unconditional ones.)</i> %ENDCOLOR% <pre>%RED%conditional_or_unaffected_expression ::= expression_or_unaffected { <b>when</b> condition <b>else</b> expression_or_unaffected } [ <b>when</b> condition ]%ENDCOLOR% </pre> <pre>%RED%expression_or_unaffected ::= expression | <b>unaffected</b> %ENDCOLOR% </pre> <pre>%RED%conditional_expression ::= expression { <b>when</b> condition <b>else</b> expression }%ENDCOLOR% </pre> <pre>expression ::= condition_operator primary | logical_expression</pre> <pre>... </pre> <pre>primary ::= name | literal | aggregate | function_call | qualified_expression | type_conversion | allocator | ( %RED%conditional_%ENDCOLOR%expression ) </pre> ---+++++ Edit 36a.2 %GREEN%<i>(Move this production from previously 10.2.)</i>%ENDCOLOR% <pre>%RED%condition ::= expression%ENDCOLOR%</pre> Each primary has a value and a type. The only names allowed as primaries are attributes that yield values and names denoting objects or values. In the case of names denoting objects other than objects of file types or protected types, the value of the primary is the value of the object. In the case of names denoting either file objects or objects of protected types, the value of the primary is the entity denoted by the name. The type of an expression depends only upon the types of its operands and on the operators applied; for an overloaded operand or operator, the determination of the operand type, or the identification of the overloaded operator, depends on the context (see 12.5). For each predefined operator, the operand and result types are given in the following subclause. ---+++++ Edit 36a.3 %GREEN%<i>(Define semantics of conditional expression - to be inserted before Note 1.)</i>%ENDCOLOR% %RED%All of the candidate result expressions in a conditional expression shall have the same base type. The value of a conditional expression is the value of the choice preceding the first condition that evaluates to TRUE, if any. Otherwise, the value is determined from the final, unconditional choice.%ENDCOLOR% ---+++++ Edit 36a.4 %RED%Each of the choices in a conditional or unaffected expression either is a candidate result expression of a common base type or consists of the keyword *unaffected*. For the purpose of evaluation, a conditional or unaffected expression whose last choice has a condition is implicitly completed by a final unconditional choice of *unaffected*. The conditional or unaffected expression evaluates to the choice preceding the first condition that evaluates to TRUE, if any. Otherwise, the value is determined from the final (possibly implicitly added) unconditional choice.%ENDCOLOR% ---++++ LRM Section 6.4.2.2 Constant Declarations ---+++++ Edit 36a.5 A constant declaration declares a _constant_ of the specified type. Such a constant is an _explicitly declared constant_. %GREEN%<i>(Allow top-level conditional expressions for value expression.)</i>%ENDCOLOR% <pre>constant_declaration ::= <b>constant</b> identifier_list : subtype_indication [ := %RED%conditional_%ENDCOLOR%expression ] ; </pre> ---++++ LRM Section 6.4.2.3 Signal Declarations ---+++++ Edit 36a.6 A signal declaration declares a _signal_ of the specified type. Such a signal is an _explicitly declared signal_. %GREEN%<i>(Allow top-level conditional expressions for value expression.)</i>%ENDCOLOR% <pre>signal_declaration ::= <b>signal</b> identifier_list : subtype_indication [ signal_kind ] [ := %RED%conditional_%ENDCOLOR%expression ] ; </pre> ---++++ LRM Section 6.4.2.4 Variable Declarations ---+++++ Edit 36a.7 A variable declaration declares a _variable_ of the specified type. Such a variable is an _explicitly declared variable_. %GREEN%<i>(Allow top-level conditional expressions for value expression.)</i>%ENDCOLOR% <pre>variable_declaration ::= [ <b>shared</b> ] <b>variable</b> identifier_list : subtype_indication [ := %RED%conditional_%ENDCOLOR%expression ] ; </pre> ---++++ LRM Section 6.5.2 Interface Object Declarations ---+++++ Edit 36a.8 An interface object declaration declares an _interface object_ of a specified type. Interface objects include _interface constants_ that appear as generics of a design entity, a component, a block, a package, or a subprogram, or as constant parameters of subprograms; _interface signals_ that appear as ports of a design entity, component, or block, or as signal parameters of subprograms; _interface variables_ that appear as variable parameters of subprograms; _interface files_ that appear as file parameters of subprograms. <pre>interface_object_declaration ::= interface_constant_declaration | interface_signal_declaration | interface_variable_declaration | interface_file_declaration </pre> <pre>interface_constant_declaration ::= [ <b>constant</b> ] identifier_list : [ <b>in</b> ] subtype_indication [ := <i>static</i>_%RED%conditional_%ENDCOLOR%expression ] </pre> <pre>interface_signal_declaration ::= [ <b>signal</b> ] identifier_list : [ mode ] subtype_indication [ <b>bus</b> ] [ := <i>static</i>_%RED%conditional_%ENDCOLOR%expression ] </pre> <pre>interface_variable_declaration ::= [ <b>variable</b> ] identifier_list : [ mode ] subtype_indication [ := <i>static</i>_%RED%conditional_%ENDCOLOR%expression ] </pre> <pre>interface_file_declaration ::= <b>file</b> identifier_list : subtype_indication </pre> ---++++ LRM Section 6.5.7.1 General ---+++++ Edit 36a.9 An association list, other than one appearing in an interface package generic map aspect (see 6.5.5), establishes correspondences between formal or local generic, port, or parameter names on the one hand and local or actual names, expressions, subtypes, subprograms, or packages on the other. <pre>association_list ::= association_element { , association_element } </pre> <pre>... </pre> <pre>actual_designator ::= [ <b>inertial</b> ] %RED%conditional_%ENDCOLOR%expression | <i>signal_</i>name | <i>variable_</i>name | <i>file_</i>name | subtype_indication | <i>subprogram_</i>name | <i>instantiated_package_</i>name | *open* </pre> ---++++ LRM Section 7.2 Attribute Specification ---+++++ Edit 36a.10 An attribute specification associates a user-defined attribute with one or more named entities and defines the value of that attribute for those entities. The attribute specification is said to _decorate_ the named entity. %GREEN% _(Allow a conditional expression.)_ %ENDCOLOR% <pre>attribute_specification ::= <b>attribute</b> attribute_designator <b>of</b> entity_specification <b>is</b> %RED%conditional_%ENDCOLOR%expression ; </pre> ---++++ LRM Section 9.2.9 Condition Operator ---+++++ Edit 36a.11 %GREEN% _(Fix the points of the bullet list.)_ %ENDCOLOR% In certain circumstances, the condition operator is implicitly applied to an expression that occurs as a condition in any of the following places: * %RED%<del>After *when* in a conditional variable assignment statement (see 10.6.3)</del>%ENDCOLOR% * %RED%After *when* in a conditional or a conditional or unaffected expression (see 9.1)%ENDCOLOR% <p> </p> ---++++ LRM Section 10.2 Wait Statement ---+++++ Edit 36a.12 The wait statement causes the suspension of a process statement or a procedure. %GREEN%<i>(Delete production moved to 9.1.)</i>%ENDCOLOR% <pre>%RED%<del>condition ::= expression</del>%ENDCOLOR%</pre> ---++++ LRM Section 10.5.2.1 General ---+++++ Edit 36a.13 %GREEN%<i>(Allow conditional_or_unaffected_expression in grammar production.)</i>%ENDCOLOR% <pre>simple_signal_assignment ::= simple_waveform_assignment | simple_force_assignment | simple_release_assignment </pre> <pre>simple_waveform_assignment ::= target <= [ delay_mechanism ] waveform ; </pre> <pre>simple_force_assignment ::= target <= <b>force</b> [ force_mode ] %RED%conditional_or_unaffected_%ENDCOLOR%expression ; </pre> ---+++++ Edit 36a.14 %GREEN%<i>(Update definition of *unaffected* semantics.)</i>%ENDCOLOR% It is an error if the pulse rejection limit for any inertially delayed signal assignment statement is either negative or greater than the time expression associated with the first waveform element. %RED%<del>A simple signal assignment of the form</del>%ENDCOLOR% <pre>%RED%<del>target <= [ delay_mechanism ] <b>unaffected</b> ;</del>%ENDCOLOR% </pre> %RED%A simple waveform assignment or a simple force assignment that from an expression that evaluates to the special value of *unaffected* %ENDCOLOR% has the same effect as replacing the given assignment with a null statement (not an assignment with a null waveform element). The right-hand side of a simple force assignment or a simple release assignment may optionally specify a force mode. A force mode consisting of the reserved word *in* specifies that an effective-value force or an effective-value release is to be scheduled, and a force mode consisting of the reserved word *out* specifies that a driving-value force or a driving-value release is to be scheduled. ---++++ LRM Section 10.5.3 Conditional Signal Assignments ---+++++ Edit 36a.15 The conditional signal assignment represents an equivalent if statement that assigns values to signals %RED%<del>or that forces or releases signals</del>%ENDCOLOR%. ---+++++ Edit 36a.16 %GREEN% _(Remove following productions now subsumed by the expression syntax.)_ %ENDCOLOR% <pre>conditional_signal_assignment ::= %RED%<del>conditional_waveform_assignment</del>%ENDCOLOR% %RED%<del>| conditional_force_assignment</del>%ENDCOLOR% %RED%<del>conditional_waveform_assignment ::=</del>%ENDCOLOR% target <= [ delay_mechanism ] conditional_waveforms ; </pre> <pre>conditional_waveforms ::= waveform <b>when</b> condition { <b>else</b> waveform <b>when</b> condition } [ <b>else</b> waveform ] </pre> <pre>%RED%<del>conditional_force_assignment ::= target <= <b>force</b> [ force_mode ] conditional_expressions ;</del>%ENDCOLOR% </pre> <pre>%RED%<del>conditional_expressions ::= expression <b>when</b> condition { <b>else</b> expression <b>when</b> condition } [<b>else</b> expression]</del>%ENDCOLOR% </pre> The delay mechanism for a conditional waveform assignment statement is discussed in 10.5.2.1. ... <pre>... <b>else</b> target <= delay_mechanism waveformN; <b>end</b> <b>if</b>; %GREEN% _(This is for context. Keep this part and above.)_ %ENDCOLOR% </pre> ---+++++ Edit 36a.17 %GREEN% _(Remove unfolding of signal assignment from a conditional expression into *if* statements, starting at the end of page 156.)_ %ENDCOLOR% %RED%<del>If the conditional signal assignment is of the form</del> <pre>%RED%<del>target <= <b>force</b> expression1 <b>when</b> condition1 <b>else</b> ...</del>%ENDCOLOR% %GREEN% <i>(This deletes all the <b>force</b>-related productions from the bottom of page 156 through the bottom of 157.)</i> %ENDCOLOR% %RED%<del> <b>else</b> target <= <b>force</b> expressionN; <b>end</b> <b>if</b>; </del>%ENDCOLOR% </pre> ---+++++ Edit 36a.18 %GREEN% _(Stop deleting, following is context to be kept.)_ %ENDCOLOR% The characteristics of the target, waveforms, expressions, and conditions in the conditional assignment statement shall be such that the equivalent sequential statement is a legal statement. ---++++ LRM Section 10.6.1 General ---+++++ Edit 36a.19 A variable assignment statement replaces the current value of a variable with a new value specified by an expression. The named variable and the right-hand side expression shall be of the same type. %GREEN% _(Remove conditional assignment now assumed by the conditional expression.)_ %ENDCOLOR% <pre>variable_assignment_statement ::= [ label : ] simple_variable_assignment %RED%<del>| [ label : ] conditional_variable_assignment</del>%ENDCOLOR% | [ label : ] selected_variable_assignment </pre> ---++++ LRM Section 10.6.2.1 Simple Variable Assignments -- General ---+++++ Edit 36a.20 <pre>simple_variable_assignment ::= target := %RED%conditional_or_unaffected_%ENDCOLOR%expression ; </pre> ---+++++ Edit 36a.21 %GREEN% _(Insert the description of *unaffected* for variable assignment at the end of the section.)_ %ENDCOLOR% An error occurs if the aforementioned subtype checks fail. %RED%A simple variable assignment from an expression that evaluates to the special value of *unaffected* has the same effect as replacing the given assignment by a null statement (not an assignment of a null value).%ENDCOLOR% ---++++ %RED%<del>LRM Section 10.6.3 Conditional Variable Assignments</del>%ENDCOLOR% ---+++++ Edit 36a.22 %GREEN% _(Remove this section entirely, and renumber the later sections accordingly.)_ %ENDCOLOR% ---++++ Annex C - Syntax Summary ---+++++ Edit 36a.23 %GREEN% _(Update productions and their references.)_ %ENDCOLOR% <pre>actual_designator ::= [ <b>inertial</b> ] %RED%conditional_%ENDCOLOR%expression [§6.5.7.1] | <i>signal_</i>name | <i>variable_</i>name ... </pre> ---+++++ Edit 36a.24 <pre>attribute_specification ::= <b>attribute</b> attribute_designator <b>of</b> entity_specification <b>is</b> %RED%conditional_%ENDCOLOR%expression ; [§7.2] </pre> ---+++++ Edit 36a.25 <pre>condition ::= expression [%RED%<del>10.2</del>%ENDCOLOR%%RED%9.1%ENDCOLOR%] </pre> ---+++++ Edit 36a.26 <pre>%RED%conditional_expression ::= expression { <b>when</b> condition <b>else</b> expression } [§9.1]%ENDCOLOR% </pre> ---+++++ Edit 36a.27 <pre>%RED%conditional_or_unaffected_expression ::= expression_or_unaffected { <b>when</b> condition <b>else</b> expression_or_unaffected } [ <b>when</b> condition ] [§9.1]%ENDCOLOR% </pre> ---+++++ Edit 36a.28 <pre>%RED%<del>conditional_expressions ::=</del>%ENDCOLOR%<br />%RED%<del> expression <b>when</b> condition { else expression when condition } [else expression] [§10.5.3]</del>%ENDCOLOR% </pre> ---+++++ Edit 36a.29 <pre>%RED%<del>conditional_force_assignment ::= target <= <b>force</b> [ force_mode ] conditional_expressions ; [§10.5.3]</del>%ENDCOLOR% </pre> ---+++++ Edit 36a.30 <pre>conditional_signal_assignment ::= %RED%<del>conditional_waveform_assignment</del>%ENDCOLOR% %RED%<del>| conditional_force_assignment</del>%ENDCOLOR% %RED%target <= [ delay_mechanism ] conditional_waveforms ;%ENDCOLOR% [§10.5.3] </pre> ---+++++ Edit 36a.32 <pre>%RED%<del>conditional_variable_assignment ::= target := conditional_expressions ; [§10.6.3]</del>%ENDCOLOR% </pre> ---+++++ Edit 36a.33 <pre>%RED%<del>conditional_waveform_assignment ::=</del>%ENDCOLOR% %RED%<del>target <= [ delay_mechanism ] conditional_waveforms ; [§10.5.3]</del>%ENDCOLOR% </pre> ---+++++ Edit 36a.34 <pre>constant_declaration ::= <b>constant</b> identifier_list : subtype_indication [ := %RED%conditional_%ENDCOLOR%expression ] ; [§6.4.2.2] </pre> ---+++++ Edit 36a.35 <pre>%RED%expression_or_unaffected ::= expression | <b>unaffected</b> %ENDCOLOR% [§9.1] </pre> ---+++++ Edit 36a.36 <pre>interface_constant_declaration ::= [ <b>constant</b> ] identifier_list : [ <b>in</b> ] subtype_indication [ := <i>static</i>_%RED%conditional_%ENDCOLOR%expression ] [§6.5.2] </pre> ---+++++ Edit 36a.37 <pre>interface_signal_declaration ::= [ <b>signal</b> ] identifier_list : [ mode ] subtype_indication [ <b>bus</b> ] [ := <i>static</i>_%RED%conditional_%ENDCOLOR%expression ] [§6.5.2] </pre> ---+++++ Edit 36a.38 <pre>interface_variable_declaration ::= [ <b>variable</b> ] identifier_list : [ mode ] subtype_indication [ := <i>static</i>_%RED%conditional_%ENDCOLOR%expression ] [§6.5.2] </pre> ---+++++ Edit 36a.39 <pre>primary ::= name ... | ( %RED%conditional_%ENDCOLOR%expression ) [§9.1] </pre> ---+++++ Edit 36a.40 <pre>signal_declaration ::= <b>signal</b> identifier_list : subtype_indication [ signal_kind ] [ := %RED%conditional_%ENDCOLOR%expression ] ; [§6.4.2.3] </pre> ---+++++ Edit 36a.41 <pre>simple_force_assignment ::= target <= <b>force</b> [ force_mode ] %RED%conditional_or_unaffected_%ENDCOLOR%expression ; [§10.5.2.1] </pre> ---+++++ Edit 36a.42 <pre>simple_variable_assignment ::= target := %RED%conditional_or_unaffected_%ENDCOLOR%expression ; [§10.6.2.1] </pre> ---+++++ Edit 36a.43 <pre>variable_assignment_statement ::= [ label : ] simple_variable_assignment %RED%<del>| [ label : ] conditional_variable_assignment</del>%ENDCOLOR% | [ label : ] selected_variable_assignment [§10.6.1] </pre> ---+++++ Edit 36a.44 <pre>variable_declaration ::= [ <b>shared</b> ] <b>variable</b> identifier_list : subtype_indication [ := %RED%conditional_%ENDCOLOR%expression ] ; [§6.4.2.4] </pre> ---++ <a name="Comments"></a><a name="Comments"></a>Comments %COMMENT%
Edit
|
Attach
|
P
rint version
|
H
istory
:
r67
|
r54
<
r53
<
r52
<
r51
|
B
acklinks
|
V
iew topic
|
Raw edit
|
More topic actions...
Topic revision: r1 - 2017-07-23 - 13:08:32 -
TWikiGuest
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