Language Change Specification for Inferring Constraints from Initial Values for Signals and Variables

Proposal

LCS Number: LCS-2016-019
Version: 8
Date: 2017-02-24
Status:  
Author: Ryan Hinton
Martin Zabel
Jim Lewis
Email: Main.RyanHinton
Main.MartinZabel
Main.JimLewis
Source Doc: Inferring Constraints from Initial Values for Signals and Variables
History Doc: History
Summary: Allow for signal and variable subtype constraints to be inferred from initial value

Style Notes

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

Details of Language Change

LRM 5.3.2.2 Index constraints and discrete ranges

edit 019.1: Bulleted list from the end of page 47 to the beginning of page 48

The index range for each index of an array object or array subelement of a composite object is determined as follows:

a) ... [Remove this item and fix bullet labels of ensuing list.]

ba) For a constant, variable, or signal declared by an object declaration, if the subtype indication of the object declaration of the constant defines the index range, then the index range of the constant object is that defined by the subtype indication; otherwise, the index range of the constant object is the corresponding index range of the initial value if one is given. For a constant with an initialization expression, a variable, or a signal, it is an error if the index range is not determinable from either the subtype indication or the initialization expression.

edit 019.2: LRM 14.4.2.5 Object declarations

The rules of this subclause apply only to explicitly declared objects (see 6.4.2.1). Generic declarations, port declarations, and other interface declarations are elaborated as described in 14.3.2 through 14.3.5 and 14.6.

Elaboration of an object declaration that declares an object other than a file object or an object of a protected type proceeds as follows:

a) The subtype indication is first elaborated; this establishes the subtype of the object.

b) If the object declaration includes an explicit initialization expression, then the initial value of the object is obtained by evaluating the expression. It is an error if the value of the expression does not belong to the subtype of the object; if the object is a composite object, then an implicit subtype conversion is first performed on the value unless the object is a constant whose subtype indication denotes an unconstrained type. Otherwise, any implicit initial value for the object is determined.

a) The subtype indication is first elaborated; this establishes an initial subtype of the object.

b) If the object declaration includes an initialization expression,

  • The initial value of the object is obtained by evaluating the expression.
  • If the object is a composite object, then an implicit subtype conversion is performed on the initial value.
  • It is an error if the initial value does not belong to the subtype of the object.
  • If the subtype of the object is either an unconstrained or partially constrained type, for each index range that is not determined, the corresponding index range of the initial value is used.
  • It is an error if an index range cannot be determined from either the subtype indication or the initial value.

c) If the object declaration is a signal or variable and does not include an initialization expression,

  • It is an error if the subtype of the object is either an unconstrained or partially constrained type.
  • Any implicit initial value for the object is determined.
d c) The object is created.

e d) Any initial value is assigned to the object.

(Delete following paragraph because it repeats information from the steps above (for VHDL-2008) without clarification or additional information.)

The initialization of such an object (either the declared object or one of its subelements) involves a check that the initial value belongs to the subtype of the object. For a composite object declared by an object declaration, an implicit subtype conversion is first applied as for an assignment statement, unless the object is a constant whose subtype is an unconstrained type.

(Remainder of section on file objects and protecte type objects remains unmodified.)

Comments

Topic revision: r41 - 2017-07-22 - 17:07:19 - JimLewis
 
Copyright © 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback