TWiki
>
P1076 Web
>
VHDL2017
>
LCS2016_072b
(revision 17) (raw view)
Edit
Attach
---+ Language Change Specification for Function Knows Vector Size ---++ | <sticky><b>LCS Number:</b></sticky> | LCS-2016-072b | | <sticky><b>Version:</b> </sticky> | 18 | | <sticky><b>Date:</b> </sticky> | 23-Mar-2017 | | <sticky><b>Status:</b> </sticky> | Voting | | <sticky><b>Authors:</b> </sticky> | Kevin Jennings, Martin Zabel, Jim Lewis, and Patrick Lehmann | | <sticky><b>Source Doc:</b></sticky> | [[FunctionKnowsVectorSize][FunctionKnowsVectorSize]] | | <sticky><b>History Doc:</b></sticky> | [[LCS2016_072b_History][History]] | | <sticky><b>Derived from and conflicts with:</b></sticky> | [[TopLCS2016_072][LCS_2016_072]] | ---++ Style Notes <noautolink><sticky> Changes are shown in %RED%red font%ENDCOLOR%. Deletions are %RED%<del>crossed out</del>%ENDCOLOR%. Editing notes in %GREEN%green font%ENDCOLOR%. ---++ Details of Language Change ---+++ LRM 4.1 General (of Subprograms and packages) ---++++ 72b.1: Page 19 edit second paragraph There are two forms of subprograms: procedures and functions. A procedure call is a statement; a function call is an expression and returns a value. Certain functions, designated <i>pure</i> functions, return the same value each time they are called with the same values as actual parameters; the remainder, <i>%RED%impure%ENDCOLOR%</i> functions, may return a different value each time they are called, even when multiple calls have the same actual parameter values. %RED%For the purposes of determining purity, the return identifier of a function is considered a parameter.%ENDCOLOR% In addition, %RED%impure%ENDCOLOR% functions can update objects outside of their scope and can access a broader class of values than can pure functions. The definition of a subprogram can be given in two parts: a subprogram declaration defining its calling conventions, and a subprogram body defining its execution. ---+++ LRM 4.2.1 General (Subprogram declarations) ---++++ 72b.2: Page 19 near bottom and page 487 <pre><font color="black"> function_specification ::= [ pure | impure ] function designator subprogram_header [ [ parameter ] ( formal_parameter_list ) ] return %RED%[ return_identifier of ]%ENDCOLOR% type_mark </font></pre> ---++++ 72b.3: Page 20 edit first paragraph The specification of a procedure specifies its designator, its generics (if any), and its formal parameters (if any). The specification of a function specifies its designator, its generics (if any), its formal parameters (if any), %RED%its return identifier (if any), %ENDCOLOR% the subtype of the returned value (the result subtype), and whether or not the function is pure. A function is impure if its specification contains the reserved word impure; otherwise, it is said to be pure. A procedure designator is always an identifier. A function designator is either an identifier or an operator symbol. A designator that is an operator symbol is used for the overloading of an operator (see 4.5.2). The sequence of characters represented by an operator symbol shall be an operator belonging to one of the classes of operators defined in 9.2. Extra spaces are not allowed in an operator symbol, and the case of letters is not significant. ---++++ 72b.4-1: Page 20 Add after the first paragraph <font color="red"> For a function that includes a return identifier, an implicit subtype declaration, whose name is the return identifier, is created as the first declaration in the subprogram declarative part. The properties of the implicitly declared subtype denoted by the return identifier shall be determined from the immediate context of a the funciton call, as follows: ---++++ 72b.4-2: Page 20 edit to list item a a) If the function call is the expression following the assignment symbol ":=" in a constant, variable, or signal declaration, then the subtype denoted by the return identifier is the subtype of the corresponding object declaration. ---++++ 72b.4-3: Page 20 edit to list item b b) If the function call is the value expression in an assignment statement whose target is not an aggregate, then the subtype denoted by the return identifier is the subtype of the target of the assignment statement. ---++++ 72b.4-4: Page 20 edit to list item c c) If the function call is the actual in an association element, then the subtype denoted by the return identifier is the subtype of the corresponding formal. ---++++ 72b.4-5: Page 20 edit to list item d d) If the function call is the formal in an association element, then the subtype denoted by the return identifier is the subtype of the corresponding actual. ---++++ 72b.4-6: Page 20 edit to list item e e) If the function call is the operand in a qualified expression, then the subtype denoted by the return identifier is the subtype defined by the type mark of the qualified expression. ---++++ 72b.4-6: Page 20 next paragraph It is an error if a function has a return identifier and * the function is called from a context other than the ones above. * the subtype of the return identifier is a unconstrained or partially constrained composite subtype. </font> <br> <br> ---++ Comments %COMMENT%</sticky> <span data-mce-mark="1"></noautolink></span>
Edit
|
Attach
|
P
rint version
|
H
istory
:
r20
<
r19
<
r18
<
r17
<
r16
|
B
acklinks
|
V
iew topic
|
Raw edit
|
More topic actions...
Topic revision: r1 - 2017-07-22 - 17:43:49 -
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