TWiki
>
P1076 Web
>
TopLCS2016_072c
(2017-04-02,
PatrickLehmann
)
(raw view)
E
dit
A
ttach
---+ Language Change Specification for Function Knows Vector Size ---++ | <sticky><b>LCS Number:</b></sticky> | LCS-2016-072b | | <sticky><b>Version:</b> </sticky> | 2 | | <sticky><b>Date:</b> </sticky> | 19-Mar-2017 | | <sticky><b>Status:</b> </sticky> | Voting | | <sticky><b>Authors:</b> </sticky> | Kevin Jennings, Martin Zabel, Jim Lewis, Patrick Lehmann, and Rob Gaddi | | <sticky><b>Source Doc:</b></sticky> | [[FunctionKnowsVectorSize]] | | <sticky><b>Derived from and conflicts with:</b></sticky> | [[TopLCS2016_072][LCS_2016_072]] [[LCS2016_072b][LCS_2016_072b]] | ---+++ Voting Results: Cast your votes here Yes: 1. %USERSIG{RobGaddi - 2017-03-21}% ver 2 2. %USERSIG{Kevin Jennings -- Mar 22, 2017}% Ver 2 -- I'm for whichever version (72, 72b, 72c) that passes. No: Abstain: 1. %USERSIG{JimLewis- 2017-03-22}% In concept I support this. Have not had time yet to review the particulars ---++ Revision History Revision 15: * Branched off of Jim's 072b, differs again in page 20. * This is revision/branch of LCS_2016_72 written by Kevin Jennings and Martin Zabel * It only differs by the text of the added paragraph on page 20 to address issues Revision 14: Jim's work Revision 13: Kevin and Martin's work ---++ 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%. ---++ Reviewing Notes <sticky><pre>%GREEN% function TO_UNSIGNED(x : natural) return tgt : unsigned is begin tgt := TO_UNSIGNED(x, tgt'length); return tgt; end function TO_UNSIGNED; function TO_SIGNED(x : integer) return tgt : signed is begin return TO_SIGNED(x, tgt'length); end function TO_SIGNED; %ENDCOLOR%</pre></sticky> ---++ Details of Language Change ---+++ LRM 4.2.1 General (Subprogram declarations) ---++++ Page 19 near bottom <sticky><pre> function_specification ::= [ pure | impure ] function designator subprogram_header [ [ parameter ] ( formal_parameter_list ) ] return %RED%[ <i>return_</i>identifier : ]%ENDCOLOR% type_mark </pre></sticky> ---++++ 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. ---++++ Page 20 Add after the first paragraph <font color="red"> The return identifier of a function declaration creates an implicit variable declaration, the name of which is the return identifier and the subtype of which (T) is determined by the context of the function call. The initial value of the variable is equal to T'LEFT. This implicit declaration is the first declaration in the subprogram declarative part of the function and can be referenced in later explicit declarations. The subtype of the return identifier can be determined in the following contexts:%BR% a) If the function call is an expression following the assignment symbol ":=" in a constant, variable, or signal declaration, then the subtype of the return variable shall be subtype of the corresponding object declaration.%BR% b) If the function call is the value expression in an assignment statement where the target is a declared object (or a member thereof), then the subtype of the return variable shall be the subtype of the target of the assignment.%BR% c) If the function call is the actual in an association element, then the subtype of the return variable shall be the subtype of the corresponding formal.%BR% d) If the function call is the formal in an association element, then the subtype of the return variable shall be the subtype of the corresponding actual.%BR% e) If the function call is the operand of a qualified expression, then the subtype of the return variable shall be the subtype defined by the type mark of the qualified expression.%BR% In any of these cases, it is an error if the subtype of the return variable is an unconstrained or a partially constrained composite subtype. </font> ---++++ Page 20 Add at the end %RED% NOTE 4 -- While the return variable of a function with a return identifier can be assigned to, this does not serve as mechanism to provide the result of the function. Once the return variable is created, it is entirely without connection to the result of the function. It is legal to explicitly return the value of the return variable. %ENDCOLOR% ---+++ 6.5.4 Interface subprogram declarations ---++++ Page 76 near bottom of page and page 489 near middle of the page <sticky><pre> interface_function_specification ::= [ pure | impure ] function designator [ [ parameter ] ( formal_parameter_list ) ] return %RED%[ <i>return_</i>identifier : ]%ENDCOLOR% type_mark </pre></sticky> ---+++ Annex C (informative) Syntax summary ---++++ Page 487 middle <sticky><pre> <b>[§ 4.2.1]</b> function_specification ::= [ pure | impure ] function designator subprogram_header [ [ parameter ] ( formal_parameter_list ) ] return %RED%[ <i>return_</i>identifier : ]%ENDCOLOR% type_mark </pre></sticky> ---++++ Page 489 middle <sticky><pre> interface_function_specification ::= <b>[§ 6.5.4]</b> [ pure | impure ] function designator [ [ parameter ] ( formal_parameter_list ) ] return %RED%[ <i>return_</i>identifier : ]%ENDCOLOR% type_mark </pre></sticky> <br> <br> ---++ Comments %COMMENT%</sticky> </noautolink>
E
dit
|
A
ttach
|
P
rint version
|
H
istory
: r6
<
r5
<
r4
<
r3
<
r2
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r6 - 2017-04-02 - 15:43:17 -
PatrickLehmann
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