LCS Number: | LCS-2016-036a |
Version: | 7 |
Date: | 27-Feb-2017 |
Status: | Voting |
Author: | Thomas Preusser |
Email: | Thomas Preusser |
Source Doc: | ConditionalExpressions |
History Doc: | History |
Summary: | Introduce first-class conditional expressions (baseline version) |
conditional_or_unaffected_expression ::=
expression_or_unaffected { when condition else expression_or_unaffected } [ when condition ]
expression_or_unaffected ::=
expression | unaffected
conditional_expression ::=
expression { when condition else expression }
expression ::= condition_operator primary | logical_expression
...
primary ::=
name
| literal
| aggregate
| function_call
| qualified_expression
| type_conversion
| allocator
| ( conditional_expression )
condition ::= expression
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.
constant_declaration ::=
constant identifier_list : subtype_indication [ := conditional_expression ] ;
signal_declaration ::=
signal identifier_list : subtype_indication [ signal_kind ] [ := conditional_expression ] ;
variable_declaration ::=
[ shared ] variable identifier_list : subtype_indication [ := conditional_expression ] ;
interface_object_declaration ::= interface_constant_declaration | interface_signal_declaration | interface_variable_declaration | interface_file_declaration
interface_constant_declaration ::=
[ constant ] identifier_list : [ in ] subtype_indication [ := static_conditional_expression ]
interface_signal_declaration ::=
[ signal ] identifier_list : [ mode ] subtype_indication [ bus ] [ := static_conditional_expression ]
interface_variable_declaration ::=
[ variable ] identifier_list : [ mode ] subtype_indication [ := static_conditional_expression ]
interface_file_declaration ::= file identifier_list : subtype_indication
association_list ::= association_element { , association_element }
...
actual_designator ::=
[ inertial ] conditional_expression
| signal_name
| variable_name
| file_name
| subtype_indication
| subprogram_name
| instantiated_package_name
| *open*
attribute_specification ::=
attribute attribute_designator of entity_specification is conditional_expression ;
condition ::= expression
simple_signal_assignment ::= simple_waveform_assignment | simple_force_assignment | simple_release_assignment
simple_waveform_assignment ::= target <= [ delay_mechanism ] waveform ;
simple_force_assignment ::=
target <= force [ force_mode ] conditional_or_unaffected_expression ;
target <= [ delay_mechanism ] unaffected ;
A simple waveform assignment or a simple force assignment that from an expression that evaluates to the special value of unaffected 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.
conditional_signal_assignment ::=conditional_waveform_assignment| conditional_force_assignmentconditional_waveform_assignment ::=target <= [ delay_mechanism ] conditional_waveforms ;
conditional_waveforms ::= waveform when condition { else waveform when condition } [ else waveform ]
conditional_force_assignment ::=
target <= force [ force_mode ] conditional_expressions ;
conditional_expressions ::=
expression when condition { else expression when condition } [else expression]
The delay mechanism for a conditional waveform assignment statement is discussed in 10.5.2.1.
...
...
else
target <= delay_mechanism waveformN;
end if; _(This is for context. Keep this part and above.)_
target <= force expression1 when condition1 else ...(This deletes all the force-related productions from the bottom of page 156 through the bottom of 157.)else target <= force expressionN; end if;
variable_assignment_statement ::=
[ label : ] simple_variable_assignment
| [ label : ] conditional_variable_assignment
| [ label : ] selected_variable_assignment
simple_variable_assignment ::=
target := conditional_or_unaffected_expression ;
actual_designator ::=
[ inertial ] conditional_expression [§6.5.7.1]
| signal_name
| variable_name
...
attribute_specification ::=
attribute attribute_designator of entity_specification is conditional_expression ; [§7.2]
condition ::= expression [10.29.1]
conditional_expression ::=
expression { when condition else expression } [§9.1]
conditional_or_unaffected_expression ::=
expression_or_unaffected { when condition else expression_or_unaffected } [ when condition ] [§9.1]
conditional_expressions ::=expression when condition { else expression when condition } [else expression] [§10.5.3]
conditional_force_assignment ::=
target <= force [ force_mode ] conditional_expressions ; [§10.5.3]
conditional_signal_assignment ::=conditional_waveform_assignment| conditional_force_assignmenttarget <= [ delay_mechanism ] conditional_waveforms ; [§10.5.3]
conditional_variable_assignment ::=
target := conditional_expressions ; [§10.6.3]
conditional_waveform_assignment ::=target <= [ delay_mechanism ] conditional_waveforms ; [§10.5.3]
constant_declaration ::=
constant identifier_list : subtype_indication [ := conditional_expression ] ; [§6.4.2.2]
expression_or_unaffected ::=
expression | unaffected [§9.1]
interface_constant_declaration ::=
[ constant ] identifier_list : [ in ] subtype_indication [ := static_conditional_expression ] [§6.5.2]
interface_signal_declaration ::=
[ signal ] identifier_list : [ mode ] subtype_indication [ bus ] [ := static_conditional_expression ] [§6.5.2]
interface_variable_declaration ::=
[ variable ] identifier_list : [ mode ] subtype_indication [ := static_conditional_expression ] [§6.5.2]
primary ::=
name
...
| ( conditional_expression ) [§9.1]
signal_declaration ::=
signal identifier_list : subtype_indication [ signal_kind ] [ := conditional_expression ] ; [§6.4.2.3]
simple_force_assignment ::=
target <= force [ force_mode ] conditional_or_unaffected_expression ; [§10.5.2.1]
simple_variable_assignment ::=
target := conditional_or_unaffected_expression ; [§10.6.2.1]
variable_assignment_statement ::=
[ label : ] simple_variable_assignment
| [ label : ] conditional_variable_assignment
| [ label : ] selected_variable_assignment [§10.6.1]
variable_declaration ::=
[ shared ] variable identifier_list : subtype_indication [ := conditional_expression ] ; [§6.4.2.4]