Style Notes
Changes are shown in red font.
Deletions are crossed out.
Editing notes in green font.
Reviewing Notes
This LCS borrows heavily from the 1076-2008 addition of generics to packages and subprograms.
See LCS-2006-133 and LCS-2006-134
Details of Language Change
5.6 Protected types
5.6.2 Protected type declarations
034.1: after 1st paragraph of 5.6.2 production for protected type declaration on page 58
protected_type_declaration ::=
protected
protected_type_header
protected_type_declarative_part
end protected [ protected_type_simple_name ]
protected_type_header ::=
[ generic_clause
[ generic_map_aspect ; ] ]
034.2: Immediately after BNF productions for protected type declaration on page 58
[Author Comment: First paragraph provided for editing location reference]
If a simple name appears at the end of a protected type declaration,
it shall repeat the identifier of the type
declaration in which the protected type definition is included.
If the protected type header is empty, the protected type declared by a
protected type declaration is called a simple protected type.
If the protected type header contains a generic clause and no generic
map aspect, the protected type is called an uninstantiated protected type.
If the protected type header contains both a generic clause and a generic map
aspect, the protected type is called a generic-mapped protected type.
A protected type declared with a generic clause in which every
generic declaration has a default, and with no generic map aspect, is
still considered to be an uninstantiated protected type and is not a
generic-mapped protected type with default associations for all of the
generic declarations.
034.3: Add example following other examples in 5.6.2 on page 59 just before 5.6.3
-- A protected type with a generic clause
type ScoreBoardGenericPType is protected
generic (
type ExpectedType ;
type ActualType ;
function check(Actual : ActualType ; Expected : ExpectedType) return boolean
) ;
...
end protected ScoreBoardGenericPType ;
034.4: New section: 5.6.4 Protected type instantiation definition
A protected type instantiation declaration defines an instance of an
uninstantiated protected type.
The instance is called an instantiated protected type.
A protected type instantiation declaration is the conjunction of a
type declaration (see 6.2) and a protected type instantiation definition.
protected_type_instantiation_definition ::=
new uninstantiated_protected_type_name [ generic_map_aspect ]
The uninstantiated protected type name shall denote an uninstantiated protected type
declared in a protected type declaration.
The generic map aspect, if present, optionally associates a single actual with each formal generic (or
member thereof) in the corresponding protected type declaration.
Each formal generic (or member thereof) shall be associated at most once.
The generic map aspect is described in 6.5.7.2.
The protected type instantiation declaration is equivalent to a protected type declaration
and a protected type body that jointly define a generic-mapped protected type.
The simple name of the generic-mapped protected type declaration is the identifier of the
protected type instantiation declaration.
The generic-mapped protected type declaration has the generic clause of the uninstantiated
protected type declaration, the generic map aspect of the protected type instantiation declaration,
and the declarations of the uninstantiated protected type declaration.
The meaning of any identifier appearing anywhere in the generic-mapped protected type
declaration or protected type body is that associated with the corresponding occurrence
of the identifier in the protected type instantiation declaration, the uninstantiated
protected type declaration, or the uninstantiated protected type body, respectively,
except that an identifier that denotes the uninstantiated protected type
denotes, instead, the generic-mapped protected type.
If the protected type instantiation declaration occurs immediately within an enclosing
package declaration, the generic-mapped protected type body occurs at the end of the
package body corresponding to the enclosing package declaration.
If there is no such package body, then there is implicitly a package body corresponding
to the enclosing package declaration, and that implicit body
contains the generic-mapped protected type body.
Examples:
-- See 5.6.2 for declaration of ScoreBoardGenericPType
type ScoreBoardPType_slv is new ScoreBoardGenericPType
generic map (
ExpectedType => std_logic_vector,
ActualType => std_logic_vector,
check => std_match
) ;
6.2 Type declarations
034.5: Modify the production for type definition on page 64
type_definition ::=
scalar_type_definition
| composite_type_definition
| access_type_definition
| file_type_definition
| protected_type_definition
| protected_type_instance_definition
6.4.2.4 Variable declarations
034.6: Modify the production for variable delcaration as below on page 70
variable_declaration ::=
[ shared ] variable identifier_list : subtype_indication [ generic_map_aspect ] [ := expression ] ;
034.7: New paragraph. Becomes 2nd paragraph after the above variable declaration production on page 70
When a generic map aspect is present, the subtype indication
shall denote an uninstantiated protected type declared in a protected type declaration.
The generic map aspect, in this case, optionally associates a single actual with each
formal generic (or member thereof) in the corresponding protected type declaration.
Each formal generic (or member thereof) shall be associated at most once.
The generic map aspect is described in 6.5.7.2.
For a variable declaration whose type is specified by an uninstantiated protected type and generic
map aspect there is an equivalent implicit protected type instance
declaration and a variable declaration whose type is
the implicitly defined protected type instance.
The implicit protected type instance is defined immediately prior to the
variable declaration in the same declarative region.
A reference to the variable declaration whose type is an uninstantiated protected
type and a generic map aspect is the same as a reference to a variable declaration whose type is
an explicitly declared protected type instance.
The implicitly defined protected type instance declaration does not have
a simple name.
It is an error if the subtype denotes an uninstantiated protected type and a formal generic does
not get a value through either association or a default value.
It is an error if a generic map aspect is present and the subtype indication is not an uninstantiated protected type.
034.8: Edit Examples at end of 6.4.2.4 on page 71
Examples:
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;
architecture A of E is
-- See 5.6.2, 5.6.3, and 5.6.4 for related protected type declarations
shared variable Counter: SharedCounter;
shared variable addend, augend, result: ComplexNumber;
shared variable ScoreBoard_slv : ScoreBoardPType_slv ;
shared variable ScoreBoard_int : ScoreBoardGenericPType generic map (
ExpectedType => integer,
ActualType => integer,
check => std.standard."="
) ;
begin
process
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
variable bit_stack: VariableSizeBitArray;
begin
. . .
6.5.2 Interface object declarations
034.9: Page 73, First paragraph of section 6.5.2
[comment: Either need to add constants allowed as a generic to a
protected type, or be more general.
Edit takes the path of being more general since it
removes the redundant and difficult to maintain text.]
An interface object declaration declares an interface object of a specified type. Interface objects include
interface constants that appear as generics of a design entity, a component, a block, a package, or a
subprogram, or as constant parameters of subprograms; interface signals that appear as ports of a design
entity, component, or block, or as signal parameters of subprograms; interface variables that appear as
variable parameters of subprograms; interface files that appear as file parameters of subprograms.
interface constants, interface signals, interface variables, and interface files.
6.5.3 Interface type declarations
034.10: Page 75, First paragraph of section 6.5.3
[Yield: to LCS_2016_049 if it is accepted]
An interface type declaration declares an interface type that appears
as a generic of a design entity, a
component, a block, a package, or a subprogram.
in a generic clause.
6.5.4 Interface subprogram declarations
034.11: Page 76, First paragraph of section 6.5.4
An interface subprogram declaration declares an interface subprogram that appears
as a generic of a design entity, a
component, a block, a package, or a subprogram.
in a generic clause.
6.5.4 Interface subprogram declarations
034.12: Page 77, First 2 paragraphs of the page
Within an entity declaration, an architecture body, a component declaration, or an uninstantiated
subprogram or package declaration that declares a given interface subprogram, the name of the given
interface subprogram denotes an undefined subprogram declaration and body.
The name of an interface subprogram declaration of a block statement (including an implied block statement
representing a component instance or a bound design entity), a generic-mapped package or a generic-mapped
subprogram denotes the subprogram specified as the corresponding actual in a generic association
list.
Within a construct that has an interface subprogram declaration, but does not map it,
the name of the given interface subprogram denotes an undefined subprogram declaration and body.
Within a construct that maps a given interface subprogram declaration, the name of the given
interface subprogram denotes the subprogram specified as the corresponding actual in a generic association
list.
6.5.5 Interface package declarations
034.13: Page 77, First paragraph of section 6.5.5
An interface package declaration declares an interface package that appears
as a generic of a design entity, a
component, a block, a package, or a subprogram.
in a generic clause.
034.14: Page 77, last two paragraphs of section 6.5.5
Within an entity declaration, an architecture body, a component declaration, or an uninstantiated
subprogram or package declaration that declares a given interface package, the name of the given interface
package denotes an undefined instance of the uninstantiated package.
The name of an interface package declaration of a block statement (including an implied block statement
representing a component instance or a bound design entity), a generic-mapped package or a genericmapped
subprogram denotes the instantiated package specified as the corresponding actual in a generic
association list.
Within a construct that has an interface package declaration, but does not map it,
the name of the given interface package denotes an undefined instance of the uninstantiated package.
Within a construct that maps a given interface package declaration, the name of the given
interface package denotes the instantiated package specified as the corresponding actual in a generic
association list.
6.5.6 Interface lists
6.5.6.1 General
034.15: Page 78, First paragraph of section 6.5.6.1
An interface list contains the interface declarations.
required by a subprogram, a component, a
design entity, a block statement, or a package.
6.5.6.2 Generic clauses
034.16: first paragraph in 6.5.6.2 on page 78
Generics provide a channel for information to be communicated to a block, a package,
or,
a subprogram, or a protected type
from its environment.
The following applies to external blocks defined by design entities, to internal blocks
defined by block statements, and to packages
and,
subprograms
, and protected types.
034.17: third paragraph (BNF counts as a paragraph) in 6.5.6.2 on page 78
The generics of a block, a package,
or,
a subprogram
, or a protected type
are defined by a generic interface list. Each interface
element in such a generic interface list declares a formal generic.
034.18: P79 note on bottom of page in 6.5.6.2
NOTE-Generics may be used to control structural, dataflow, or
behavioral characteristics of a block, a package,
or a subprogram, or a protected type,
or may simply be used as documentation.
In particular, generics may be used to specify the size of ports;
the number of subcomponents within a block; the timing
characteristics of a block; or even the physical characteristics of
a design such as temperature, capacitance, or location.
6.5.7 Association lists
034.19: Third paragraph counting BNF as one paragraph in 6.5.7.1 page 81
Each association element in an association list associates one actual designator with the corresponding
interface element in the interface list.
of a subprogram declaration, component declaration,
entity declaration, block statement, or package.
The corresponding interface element is determined either by position or by name.
6.5.7.2 Generic map aspects
034.20: 1st paragraph in 6.5.7.2 on page 84
A generic map aspect, other than one appearing in an interface package generic map aspect (see 6.5.5),
associates values, subtypes, subprograms, or instantiated packages with the formal generics of a block, a
package, or a subprogram, or a protected type.
The following applies to external blocks defined by design entities, to internal
blocks defined by block statements, and
to packages and, subprograms, and a protected types.
034.21: 5th paragraph in 6.5.7.2 on page 84
[Add new list item as the last item in the list for the list that starts with]
The purpose of a generic map aspect is as follows:
[5 other list items unmodified]
[Edit as follows if LCS_2016_14a is rejected]
- A generic map aspect appearing immediately within a protected
type header associates actuals with the formals defined by the same protected type header.
This applies to a generic map aspect appearing in
a protected type header of an explicitly declared generic-mapped protected type,
a generic-mapped protected type that is equivalent to a protected type instantiation declaration,
or a generic-mapped protected type that is implicitly declared when the subtype indication of
a variable declaration is an uninstantiated protected type and it has a generic map aspect.
[Edit as follows if LCS_2016_14a is accepted]
- A generic map aspect appearing immediately within a protected
type header associates actuals with the formals defined by the same protected type header.
This applies to a generic map aspect appearing in
a protected type header of an explicitly declared generic-mapped protected type,
a generic-mapped protected type that is equivalent to a protected type instantiation declaration,
or a generic-mapped protected type that is implicitly declared when the subtype indication of
a variable declaration, access type definition, or an allocator is an uninstantiated
protected type and it has a generic map aspect.
034.22: Note 2 at the end of in 6.5.7.2 on page 85
NOTE 2-A local generic (from a component declaration) or
formal generic (from a package, a subprogram,
a protected type,
a block statement, or from the entity declaration of the enclosing
design entity) may appear as an actual in a generic map aspect.
12.2 Scope of declarations
034.23: List item f
f) A formal generic declaration in an entity declaration,
an uninstantiated package declaration, or
an uninstantiated subprogram declaration,
or an uninstantiated protected type declaration
12.3 Visibility
034.24: List item s on page 188 see also LCS2016_033
s) For a subprogram declared immediately within a given protected type declaration,
other than in a protected type declaration that
defines an uninstantiated protected type
: at the place of the suffix in a selected name whose prefix denotes an object of the
protected type.
034.25: New list item following list item t on page 188 continuing the count from LCS2016_028
x) For a formal generic declaration of a given
protected type declaration: at the place of the formal part
(before the compound delimiter =>) of a named association element
of a corresponding generic map aspect.
034.26: paragraph 5 on Page 189
Two declarations that occur immediately within the same declarative region,
other than the declarative region of a block implied by a component instantiation
or the declarative region of a generic-mapped package
or subprogram equivalent to a package instance
or a subprogram instance,
or a protected type instance,
shall not be homographs,
unless exactly one of them is the implicit declaration of a predefined operation or is an implicit alias of such
an implicit declaration. In such cases, a predefined operation or alias thereof is always hidden by the other
homograph. Where hidden in this manner, an implicit declaration is hidden within the entire scope of the
other declaration (regardless of which declaration occurs first); the implicit declaration is visible neither by
selection nor directly.
For a declarative region of a block implied by a component instantiation
or the declarative region of a generic-mapped package
or subprogram equivalent to a package instance
or a subprogram instance,
the rules of this paragraph are applied to the corresponding entity declaration,
component declaration,
uninstantiated package declaration,
or
uninstantiated subprogram declaration,
or uninstantiated protected type,
as appropriate.
14.3. Elaboration of a block, package, or subprogram header
[034.27: Edit section title to add protected type]
14.3. Elaboration of a block, package, or
subprogram, or protected type header
14.3.1 General
034.28: first paragraph of 14.3.1 on pages 202 and 203
Elaboration of a block header consists of the elaboration of the generic clause,
the generic map aspect, the port clause, and the port map aspect.
Similarly, elaboration of a package header consists of the elaboration of
the generic clause and the generic map aspect;
elaboration of a protected type header consists of the
elaboration of the generic clause and the generic map aspect;
and elaboration of a subprogram header consists of the
elaboration of the generic clause equivalent to the generic list of the subprogram header and the generic map
aspect.
034.29: 14.4.2.3 Type declarations %red% and instantiations
034.30: 2nd from last paragraph on page 207
Elaboration of a protected type
definition
declaration, other than a uninstantiated protected type declaration,
consists of the elaboration, in the order given, of each of the
declarations occurring immediately within the protected type definition.
Elaboration of an uninstantiated protected type declaration
simply establishes that the name by which the protected type may be referenced
subsequently in protected type instantiation declarations.
Elaboration of a protected type body has no effect other than to establish that the body, from then on, can be
used during the elaboration of objects of the given protected type.
Elaboration of a protected type instantiation declaration consists of
elaboration of the equivalent generic-mapped protected type declaration,
followed by elaboration of the corresponding equivalent generic-mapped
protected type body (see 5.6.3).
If the protected type instantiation declaration occurs immediately within an
enclosing package declaration,
elaboration of the equivalent generic-mapped protected type body occurs as
part of elaboration of the body, whether explicit or implicit, of the enclosing package.
Similarly, if the protected type instantiation declaration occurs immediately within an
enclosing protected type declaration,
elaboration of the equivalent generic-mapped protected type body occurs as
part of elaboration of the protected type body.
14.4.2.5 Object declarations
034.31: 1st paragraph of 14.4.2.5 on page 208
The rules of this subclause apply only to explicitly declared objects (see 6.4.2.1)
and an uninstantiated protected type with a corresponding generic map aspect.
Generic declarations, port
declarations, and other interface declarations are elaborated as described in 14.3.2 through 14.3.5 and 14.6.
034.32: last paragraph of 14.4.2.5 before the notes on page 208
The elaboration of an object of a protected type
other than an uninstantiated protected type
consists of the elaboration of the subtype indication, followed by creation of the object.
The elaboration of an object of an uninstantiated protected type
and its corresponding generic map aspect consists of the
elaboration of the equivalent implicitly defined protected type instance,
followed by elaboration of the variable whose type is the implicitly
defined protected type instance.
Creation of the object consists of elaborating, in the order given, each of
the declarative items in the protected type body.
Annex C Syntax Summary
034.33: Updates to protected type declaration from section 5.6.2
protected_type_declaration ::=
protected
protected_type_header
protected_type_declarative_part
end protected [ protected_type_simple_name ]
protected_type_header ::=
[ generic_clause
[ generic_map_aspect ; ] ]
034.34: New syntax for protected type instantiation definition from section 5.6.4
protected_type_instantiation_definition ::=
new uninstantiated_protected_type_name [ generic_map_aspect ] ;
034.35: Updates to type definition from section 6.2
type_definition ::=
scalar_type_definition
| composite_type_definition
| access_type_definition
| file_type_definition
| protected_type_definition
| protected_type_instance_definition
034.36: Updates to Variable declarations from section 6.4.2.4
variable_declaration ::=
[ shared ] variable identifier_list : subtype_indication [ generic_map_aspect ] [ := expression ] ;
Annex I, Glossary
034.37: Definition of Generic on page 567
generic: An interface declaration in the block header of a
block statement, a component declaration, or an
entity declaration, in the package header of a package declaration,
or
in the subprogram header of a subprogram specification,
or in the protected type header of a protected type declaration.
Generics provide a channel for static information to be communicated to a block,
a package, or a subprogram,
or a protected type from its environment.
Unlike explicit declarations, however, the value or
subtype denoted by a generic can be supplied externally, either in a
component instantiation statement, in a configuration specification,
in a variable declaration,
or in a package, or subprogram
or a protected type instantiation declaration. (6.5.6.2)
034.38: Add Glossary entries
B.--- generic-mapped protected type: A protected type declared by a protected type declaration containing a generic
list and a generic map aspect. A generic-mapped protected type may be declared explicitly, or may be equivalent to
a protected type instantiation. (ยง5.6.2)
B.--- simple protected type: A protected type declared by a protected type declaration containing no generic list and no
generic map aspect. (ยง5.6.2)
B.--- uninstantiated protected type: A protected type declared by a protected type declaration containing a generic list
and no generic map aspect. An uninstantiated protected type may be instantiated with a protected type instantiation
declaration or in a variable declaration. (ยง5.6.2)
Afterword Notes
Author Comments:
The current proposal only adds generics to protected types.
This allows a simplified approach to dealing the generic map aspect by
adding it to variable declaration.
If generics are to be added to other types, such as records, this becomes
a more complex problem. It would not be so bad if the already defined term
subtype indication could be modified to accomodate a generic map aspect,
however, a generic map aspect creates a new type, so this would not be
appropriate. Hence, a new term, such as type indication would need to
be introduced such as below:
type_indication ::=
subtype_indication[ generic_map_aspect ]
A generic type cannot currently be a simple protected type, however, a
generic type could be an uninstantiated protected type.