LCS for Signal expressions connected mapped to a signal in parameter - Addresses Level Sensitive Wait

LCS Number: LCS-2016-063
Version: 2 {31-Jan-2017}
1 {05-Jan-2017}
Date: 31-Jan-2017
Status: Voting
Author: Jim Lewis
Email: Main.JimLewis
Source Doc: Signal expressions connected mapped to a signal in parameter
Summary: Signal expressions connected mapped to a signal in parameter - addresses Level Sensitive Wait

Voting Results: Cast your votes here

Yes:

  1. Lieven Lemiengre - 2017-01-27 ver 1

No:

  1. Jim Lewis - 2017-01-31 ver 2 - technical issues in proposal for which I do not have an answer at this time. It really requires the expressions to be an implicit signal with zero delay, similar to 'delayed. This is much different than ports.

Abstain:

  1. Martin Zabel - 2017-02-10 ver 2 - I don't know whether a dynamic construction and elaboration of signal declaration and assignment is possible.
  2. Brent Hayhoe - 2017-02-16 Version 2 - Abstain due to lack of personal time for review.
  3. Martin Thompson- 2017-02-17 Version 2 - Abstain due to lack of personal time for review.

Revision Notes

Revision 2:

  • Changes last added paragraph of p22 - the one that creates the implicit signal
  • Added example to 4.2.2.3

Style Notes

Changes are shown in red font. Deletions are crossed out. Editing notes in green font.

Analysis

The approach here is to facilitate an approach that uses subprograms to implement this feature. The key limitation to subprograms implementing this issue is being able to pass a signal class expression to a subprogram.

This analysis borrows generously from LCS-2006-122, Signal expressions in Port maps

OTOH, creating language syntax for a level sensitive wait statement could potentially be done, but it would not provide as much benefit as Signal expressions in signal parameter maps.

Details of Language Change

Section 4.2.2.1 Formal parameter lists

Edit page 21, 3rd paragraph:

In a subprogram call, the actual designator (see 6.5.7.1) associated with a formal parameter of class signal shall be either a name denoting a signal or an expression. The actual designator associated with a formal of class variable shall be a name denoting a variable. The actual designator associated with a formal of class constant shall be an expression. The actual designator associated with a formal of class file shall be a name denoting a file.

Section 4.2.2.3 Signal parameters

[Edit: page 22, paragraph 7 as follows]
If an actual signal or expression is associated with a signal parameter of mode in, and if the type of the formal is a scalar type, then it is an error if the subtype of the actual is not compatible with the subtype of the formal. If an actual signal is associated with a signal parameter of mode in or inout, and if the type of the formal is a scalar type, then it is an error if the subtype of the actual is not compatible with the subtype of the formal. Similarly, if an actual signal is associated with a signal parameter of mode out or inout, and if the type of the actual is a scalar type, then it is an error if the subtype of the formal is not compatible with the subtype of the actual.

[Edit: page 22, last paragraph as follows]
For a formal parameter of a composite subtype, If a formal signal parameter of a composite subtype of any mode is associated with an actual parameter that is a signal, the index ranges of the formal, if it is an array, and of any array subelements, are determined as specified in 5.3.2.2. It is an error if the actual signal does not contain a matching subelement for each subelement of the formal. It is also an error if the mode of the formal is in or inout and if the value of each scalar subelement of the actual does not belong to the subtype of the corresponding subelement of the formal.

[Add: page 22, after paragraph above.
Sizing rules when expression is connected to a formal with that is a composite which is unconstrained or partially constrained. Adapted from LCS-2006-122]

If a formal signal parameter of mode in is associated with an expression and the formal is of an unconstrained or partially constrained composite type requiring determination of index ranges from the actual according to the rules of 5.3.2.2, then the expression shall be one of the following:
? The name of an object whose subtype is globally static
? An indexed name whose prefix is one of the members of this list
? A slice name whose prefix is one of the members of this list and whose discrete range is a globally static discrete range
? An aggregate, provided all choices are locally static and all expressions in element associations are expressions described in this list
? A function call whose return type mark denotes a globally static subtype
? A qualified expression or type conversion whose type mark denotes a globally static subtype
? An expression described in this list and enclosed in parentheses

[Add: page 22, after paragraph above.
Creates of an implicit signal for the expression. Adapted from LCS-2006-122]

If the actual part of a given association element for a formal signal parameter of a subprogram is the reserved word inertial followed by an expression, or is an expression, and the subprogram call is enclosed within an architecture body, block statement, or generate statement, then the given association element is equivalent to association of the parameter with an anonymous signal implicitly declared in the architecture declarative part or block declarative part that immediately encloses the subprogram call. The signal has the same subtype as the formal parameter and is the target of an implicit concurrent signal assignment statement of the form
anonymous <= E;
where E is the expression in the actual part of the given association element. Any loop index or variable referenced in the expression is replaced by the current value of the loop index or variable. The signal declaration is initialized to the current value of E. The concurrent signal assignment statement occurs in the architecture statement part or block statement part that immediately encloses the subprogram call.

It is an error if the actual part of a given association element for a formal signal parameter of a subprogram is the reserved word inertial followed by an expression, or is an expression, and the subprogram call is not enclosed within an architecture body, block statement, or generate statement.

[Add: page 23, after notes at end of 4.2.2.3]
Example:

-- Procedure call with expression mapped to signal parameter
architecture Arch is 
    procedure WaitForCond (signal S : boolean ; ... ) ; 
begin
    process 
    begin
      ...
      WaitForCond(A = 5, ...) ;
      
-- Equivalent design with expression transformed to a signal assignment
architecture Arch is 
    procedure WaitForCond (signal S : boolean ; ... ) ; 
    signal anonymous : boolean ; 
begin
    anonymous <= A = 5 ; 
    process 
    begin
      ...
      WaitForCond(anonymous, ...) ;

6.5.7.1 General (of Association lists)

[Edit: page 83, last paragraph before notes]

It is an error if the reserved word inertial appears in an association element other than in a port or parameter map aspect.

Section 14.6 Dynamic Elaboration

[Edit/Add Page 213, paragraph part of list starting with b)]

b) Execution of a subprogram call involves the elaboration of the parameter association list. This involves the elaboration of the parameter association element or elements in the association list associated with each interface declaration. Elaboration of the parameter association elements associated with a formal parameter declaration proceeds as follows:
1) The subtype indication of the corresponding formal parameter declaration is elaborated.
2) The formal part or parts of the parameter association elements corresponding to the formal parameter declaration are elaborated.
3) If the type of the formal parameter is an array type or contains a subelement that is of an array type, the rules of 5.3.2.2 are applied to determine the index ranges.
4) If the actual in a parameter association element that corresponds to a formal signal parameter with mode in is an expression, then elaboration of the parameter association element consists of constructing and elaborating the equivalent anonymous signal declaration, concurrent signal assignment statement and parameter association element (see 4.2.2.3); the parameter or subelement or slice thereof designated by the formal part is then associated with the anonymous signal. Otherwise, for For each parameter association element associated with the formal parameter declaration, the parameter or subelement or slice thereof designated by the formal part is then associated with the actual part.
5) If the formal parameter is a variable of mode out, then the implicit initial value for the object is determined.



Comments

The title of this LCS is misleading

-- Lieven Lemiengre - 2017-01-27

This LCS requires that signals can be declared in subprograms, processes, or even sequential blocks (if LCS-2016-007 is approved) because these may be the "enclosing block" of the subprogram call. This is not possible in the current LRM and not addressed in this LCS. Consider the following example:

entity e is
  port (
    x : in  bit;
    y : out bit);
end entity e;

architecture a of e is

  function f1 (signal x : bit) return bit is
  begin
    return not x;
  end function;

  function f2 (signal x : bit) return bit is
  begin
    return f1(not x);
  end function f2;

begin  -- architecture a

  process(x)
  begin
    y <= f2(not x);
  end process;

end architecture a;

-- Martin Zabel - 2017-01-30

@MZ I deleted my incorrect late night analysis

-- Jim Lewis - 2017-01-30

@MZ, my intent is that the signal and signal declaration are contained in the enclosing concurrent declaration. It is not clear that the current text, "then the given association element is equivalent to association of the parameter with an anonymous signal implicitly declared in the declarative region that immediately encloses the block." actually accomplishes this.

-- Jim Lewis - 2017-01-31

@JL What is the initial value of the signal in the subprogram, how does the delta cycle delay associated with the signal impact the execution of the code.

-- Jim Lewis - 2017-01-31

Revision 2 posted. Addresses issues above of @MZ and @JL above.

-- Jim Lewis - 2017-01-31

Updated revision 2 to identify subprograms that are called with an expression in a signal parameter but are not in an architecture body, block statement, or generate statement as an error. Hence, I think this only excludes subprogram calls done in a package body - which largely do not have a reason for a signal expression on the parameter.

-- Jim Lewis - 2017-01-31

Topic revision: r13 - 2020-02-17 - 15:34:41 - JimLewis
 
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