Language Change Specification for Deferred Shared Variables Proposal

LCS

LCS Number: LCS-2016-080
Version: 1.0
Date: 24-Jul-16
Status: Draft
Author: Brent Hayhoe
Email: Brent.Hayhoe@AftonroyNOSPAM.com
Source Doc: Deferred Shared Variables
Summary: Enable a shared variable declaration within the same package as its associated protected type declaration

Details of Language Change:

LRM 4.7 Package declarations

page 31 middle

Replace the 5th paragraph beginning:

'NOTE--Not all packages ...'

with the following paragraph:

'NOTE--Not all packages will have a package body. In particular, a package body is unnecessary if no subprograms, deferred constants, deferred shared variables, deferred signals, or protected type definitions are declared in the package declaration.'


Replace the second package body code with:


   -- A package declaration that needs a package body:
      package TriState is
         type Tri is ('0', '1', 'Z', 'E');
         function BitVal (Value: Tri) return Bit;
         function TriVal (Value: Bit) return Tri;
         type TriVector is array (Natural range <>) of Tri;
         function Resolve (Sources: TriVector) return Tri;
         constant TriA_c : Tri;
         deferred constant TriB_c : Tri;
         deferred shared variable Tri_sv : Tri;
         deferred signal Tri_s : Tri;
      end package TriState;

LRM 4.8 Package bodies

page 31 middle

Replace the 1st paragraph beginning:

'A package body defines ...'

with the following paragraph:

'A package body defines the bodies of subprograms and, the values of deferred constants, deferred shared variables and the initial values of deferred signals declared in the interface to the package.'

page 32 middle

Replace the 5th paragraph beginning:

'If a given package declaration ...'

with the following paragraph:

'If a given package declaration contains a deferred constant declaration (see 6.4.2.2), a deferred shared variable declaration (see 6.4.2.4) or a deferred signal declaration (see 6.4.2.3), then a constant declaration, a shared variable declaration or a signal declaration with the same respective identifier shall appear as a declarative item in the corresponding package body. This object declaration is called the full declaration of the deferred constant, deferred shared variable or deferred signal. The subtype indication given in the full declaration shall lexically conform to that given in the deferred constant declaration, deferred shared variable declaration or deferred signal declaration.'


Replace the 6th paragraph beginning:

'Within a package declaration ...'

with the following paragraph:

Within a package declaration that contains the declaration of a deferred constant, and within the body of that package (before the end of the corresponding full declaration), the use of a name that denotes the deferred constant is only allowed in the default expression for a local generic, local port, or formal parameter. The result of evaluating an expression that references a deferred constant, a deferred shared variable or a deferred signal before the elaboration of theits corresponding full declaration is not defined by the language.

LRM 4.10 Conformance rules

page 34 top

Replace the 3rd paragraph beginning:

'Lexical conformance is likewise ...'

with the following paragraph:

'Lexical conformance is likewise defined for subtype indications in deferred constant declarations, deferred shared variable declarations, or deferred signal declarations.'

LRM 6.4.2.2 Constant declarations

page 67 middle

Replace the BNF production with:


constant_declaration ::=
     constant identifier_list : subtype_indication [ := expression ] ;
   | deferred constant identifier_list : subtype_indication ;


Replace the paragraph beginning:

'If the assignment symbol ":=" followed by an expression is not present in a constant declaration, then ...'

with the following paragraph:

'If the assignment symbol ":=" followed by an expression is not present in a constant declaration, or the reserved word constant is preceded by the reserved word deferred, then the declaration declares a deferred constant. It is an error if such a constant declaration appears anywhere other than in a package declaration. The corresponding full constant declaration, which defines the value of the constant, shall appear in the body of the package (see 4.8).'

page 68 top

Add to the end of the 'Examples' list:


constant TOLER: DISTANCE := 1.5 nm;
constant PI: REAL := 3.141592;
constant CYCLE_TIME: TIME := 100 ns;
constant Propagation_Delay: DELAY_LENGTH; -- A deferred constant.
deferred constant Propagation_Delay: DELAY_LENGTH; -- A deferred constant.

LRM 6.4.2.3 Signal declarations

page 68 top

Replace the BNF productions with:

signal_declaration ::=
     signal identifier_list : subtype_indication [ signal_kind ] [ := expression ] ;
   | deferred signal identifier_list : subtype_indication [ signal_kind ] ;

signal_kind ::= register | bus


After the paragraph beginning:

'In the absence of an explicit default expression ...'

insert the following paragraph:

'If the assignment symbol ":=" followed by an expression is not present in a signal declaration and the reserved word signal is preceded by the reserved word deferred, then the declaration declares a deferred signal. It is an error if such a signal declaration appears anywhere other than in a package declaration. The corresponding full signal declaration, which defines the initial value of the signal, shall appear in the body of the package (see 4.8).'

page 69 middle

Add to the end of the 'Examples' list:

signal S: STANDARD.BIT_VECTOR (1 to 10);
signal CLK1, CLK2: TIME;
signal OUTPUT: WIRED_OR MULTI_VALUED_LOGIC;
deferred signal INPUT: BIT; -- A deferred signal.

LRM 6.4.2.4 Variable declarations

page 70 top

Replace the BNF production with:

variable_declaration ::=
     [ shared ] variable %identifier_list : subtype_indication [ := expression ] ;
   | [ deferred ] shared variable identifier_list : protected_subtype_indication ;


After the paragraph beginning:

'If the variable declaration includes the assignment symbol followed by an expression ...'

insert the following paragraph:

'If the reserved words shared variable are preceded by the reserved word deferred in a shared variable declaration, then the declaration declares a deferred shared variable. It is an error if such a shared variable declaration appears anywhere other than in a package declaration. The corresponding full shared variable declaration, which associates the method(s) and variable(s) of the corresponding protected type with the shared variable, shall appear in the body of the package (see 4.8).'

page 71 bottom

Add to the end of the 'Examples' list:

variable INDEX: INTEGER range 0 to 99 := 0;
   -- Initial value is determined by the initial value expression
variable COUNT: POSITIVE;
   -- Initial value is POSITIVE'LEFT; that is,1
variable MEMORY: BIT_MATRIX (0 to 7, 0 to 1023);
   -- Initial value is the aggregate of the initial values of each element
shared variable Counter: SharedCounter;
   -- See 5.6.2 and 5.6.3 for the definitions of SharedCounter
shared variable addend, augend, result: ComplexNumber;
   -- See 5.6.2 and 5.6.3 for the definition of ComplexNumber
variable bit_stack: VariableSizeBitArray;
   -- See 5.6.2 and 5.6.3 for the definition of VariableSizeBitArray;
deferred shared variable COUNT: POSITIVE; -- A deferred shared variable.
   -- Methods and variable(s) defined in the package body

LRM 15.10 Reserved words

page 236

Insert the new reserved word deferred after the reserved word default in the list.

LRM Annex C Syntax summary

page 483

Replace the 'constant_declaration' BNF production with the following:

constant_declaration ::=                                         [§ 6.4.2.2]
     constant identifier_list : subtype_indication [ := expression ];
   | deferred constant identifier_list : subtype_indication ;

page 497

Replace the 'signal_declaration' BNF production with the following:

signal_declaration ::=                                           [§ 6.4.2.3]
     signal identifier_list : subtype_indication [ signal_kind ] [ := expression ] ;
   | deferred signal identifier_list : subtype_indication [ signal_kind ] ;

page 500

Replace the 'variable_declaration' BNF production with the following:

variable_declaration ::=                                         [§ 6.4.2.4]
     [ shared ] variable %identifier_list : subtype_indication [ := expression ] ;
   | [ deferred ] shared variable identifier_list : protected_subtype_indication ;

LRM Annex I Glossary

page 563

Insert before the 'deferred constant' item the following:

'deferred: The reserved word deferred inserted at the beginning of statement declaring an object declaration of class constant, signal or the subclass shared variable, within a package declaration, defines the object as deferred and delays the analysis of the object until the associated package body is analysed.'

page 563

Replace the 'deferred constant' item with the following:

'deferred constant: A constant that is declared without an assignment symbol (:=) and its corresponding expression, or with the reserved word deferred in a package declaration. A corresponding full declaration of the constant shall exist in the package body to define the value of the constant. (6.4.2.2)'


Insert the two new 'deferred shared variable' and 'deferred signal' items after the 'deferred constant' item:

'deferred shared variable: A shared variable that is declared with the reserved word deferred in a package declaration. A corresponding full declaration of the shared variable shall exist in the package body. (6.4.2.4)'

'deferred signal: A signal that is declared with the reserved word deferred in a package declaration. A corresponding full declaration of the signal shall exist in the package body with an initial value of the signal. (6.4.2.3)'

page 567

Replace the 'full declaration' item with the following:

'full declaration: A constant declaration, shared variable declaration, or signal declaration occurring in a package body with the same identifier as that of a deferred constant declaration, deferred shared variable declaration, or deferred signal declaration in the corresponding package declaration. A full type declaration is a type declaration corresponding to an incomplete type declaration. (4.8)'

page 571

Replace the 'lexically conform' item with the following:

'lexically conform: Two subprogram specifications are said to lexically conform if, apart from certain allowed minor variations, both specifications are formed by the same sequence of lexical elements, and corresponding lexical elements are given the same meaning by the visibility rules. Lexical conformance is defined similarly for deferred constant declarations, deferred shared variable declarations and deferred signal declarations . (4.10)'

page 578

Replace the 'shared variable' item with the following:

'shared variable: A variable accessible by more than one process. Such variables shall be of a protected type. Shared variables declared in packages can also be deferred shared variables. (6.4.2.4)'

page 579

Replace the 'signal' item with the following:

'signal: An object with a past history of values. A signal may have multiple drivers, each with a current value and projected future values. The term signal refers to objects declared by signal declarations or port declarations. Signals declared in packages can also be deferred signals. (6.4.2.3)'

Edit | Attach | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r1 - 2016-11-28 - 11:25:48 - TWikiGuest
 
Copyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback