pyVHDLModel.IEEE
This module contains library and package declarations for VHDL library IEEE.
Classes
Ieee: Predefined VHDL libraryieee.Math_Real: Predefined packageieee.math_real.Math_Real_Body: Predefined package body of packageieee.math_real.Math_Complex: Predefined packageieee.math_complex.Math_Complex_Body: Predefined package body of packageieee.math_complex.Std_Logic_1164: Predefined packageieee.std_logic_1164.Std_Logic_1164_Body: Predefined package body of packageieee.std_logic_1164.Std_Logic_TextIO: Predefined packageieee.std_logic_textio.Numeric_Bit: Predefined packageieee.numeric_bit.Numeric_Bit_Body: Predefined package body of packageieee.numeric_bit.Numeric_Bit_Unsigned: Predefined packageieee.numeric_bit_unsigned.Numeric_Bit_Unsigned_Body: Predefined package body of packageieee.numeric_bit_unsigned.Numeric_Std: Predefined packageieee.numeric_std.Numeric_Std_Body: Predefined package body of packageieee.numeric_std.Numeric_Std_Unsigned: Predefined packageieee.numeric_std_unsigned.Numeric_Std_Unsigned_Body: Predefined package body of packageieee.numeric_std_unsigned.Fixed_Float_Types: Predefined packageieee.fixed_float_types.Fixed_Generic_Pkg: Predefined packageieee.fixed_generic_pkg.Fixed_Generic_Pkg_Body: Predefined package body of packageieee.fixed_generic_pkg.Fixed_Pkg: Predefined packageieee.fixed_pkg.Float_Generic_Pkg: Predefined packageieee.float_generic_pkg.Float_Generic_Pkg_Body: Predefined package body of packageieee.float_generic_pkg.Float_Pkg: Predefined packageieee.float_pkg.Std_Logic_Arith_MentorGraphics: Predefined Mentor Graphics packageieee.std_logic_arith.Std_Logic_Arith_Body_MentorGraphics: Predefined package body of Mentor Graphics packageieee.std_logic_arith.VITAL_Timing: Predefined packageieee.VITAL_Timing.VITAL_Timing_Body: Predefined package body of packageieee.VITAL_Timing.VITAL_Primitives: Predefined packageieee.VITAL_Primitives.VITAL_Primitives_Body: Predefined package body of packageieee.VITAL_Primitives.VITAL_Memory: Predefined packageieee.VITAL_Memory.VITAL_Memory_Body: Predefined package body of packageieee.VITAL_Memory.Std_Logic_Arith_Synopsys: Predefined Synopsys packageieee.std_logic_arith.Std_Logic_Misc: Predefined Synopsys packageieee.std_logic_misc.Std_Logic_Misc_Body: Predefined package body of Synopsys packageieee.std_logic_misc.Std_Logic_Signed: Predefined Synopsys packageieee.std_logic_signed.Std_Logic_TextIO_Synopsys: Predefined Synopsys packageieee.std_logic_textio.Std_Logic_Unsigned: Predefined Synopsys packageieee.std_logic_unsigned.
Classes
- class pyVHDLModel.IEEE.Ieee(flavor=None)[source]
Predefined VHDL library
ieee.The following predefined packages are in this library:
Math
Std_logic
Numeric
Fixed/floating point
Synopsys packages
Std_Logic_Arith
Mentor Graphics packages
Std_Logic_Arith
VITAL packages
See also
- Other predefined libraries:
Library
Std
Inheritance
- Parameters:
flavor (IEEEFlavor | None)
- __init__(flavor=None)[source]
Initializes the
ieeelibrary.- Parameters:
flavor (
IEEEFlavor|None) – The flavor of theieeelibrary this instance provides.- Raises:
VHDLModelException – If the given IEEE library flavor is unknown.
- Return type:
None
- _flavor: IEEEFlavor
The flavor of the
ieeelibrary this instance provides.
- property Flavor: IEEEFlavor
Read-only property to access the flavor (
_flavor).- Returns:
The flavor.
- property AllowBlackbox: bool
Property to return whether a design supports blackboxes, inherited from the parent if not set locally (
_allowBlackbox).Algorithm
If allow blackbox property is locally set, return the local value,
Otherwise, return allow blackbox value from parent object.
- Returns:
True, if blackboxes are allowed.- Raises:
VHDLModelException – If neither a local value is set nor a parent object is available to inherit the value from.
- Setter accepts:
- property Architectures: dict[str, dict[str, Architecture]]
Read-only property to access the dictionary of all architecture declarations in this library (
_architectures).- Returns:
Dictionary of all architectures, indexed by normalized entity identifier, then by normalized architecture identifier.
- property Configurations: dict[str, Configuration]
Read-only property to access the dictionary of all configuration declarations in this library (
_configurations).- Returns:
Dictionary of all configurations, indexed by normalized identifier.
- property Contexts: dict[str, Context]
Read-only property to access the dictionary of all context declarations in this library (
_contexts).- Returns:
Dictionary of all contexts, indexed by normalized identifier.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this library by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Property to access the library’s documentation (
_documentation).Hint
Unlike every other documented entity, a library’s documentation cannot come from VHDL source: the language has no library declaration to attach a comment to. It is therefore settable, so a caller can supply one from elsewhere - a compile-order file, a project description, …
- Returns:
Associated documentation of this VHDL library.
- property Entities: dict[str, Entity]
Read-only property to access the dictionary of all entity declarations in this library (
_entities).- Returns:
Dictionary of all entities, indexed by normalized identifier.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexArchitectures()
Index declared items in all architectures.
Algorithm
Iterate all architectures:
Index all declared items.
→pyVHDLModel.DesignUnit.Architecture.IndexDeclaredItems()
See also
IndexPackages()Index all declared items in a package.
IndexPackageBodies()Index all declared items in a package body.
IndexEntities()Index all declared items in an entity.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- IndexEntities()
Index declared items in all entities.
Algorithm
Iterate all entities:
Index all declared items.
→pyVHDLModel.DesignUnit.Entity.IndexDeclaredItems()
See also
IndexPackages()Index all declared items in a package.
IndexPackageBodies()Index all declared items in a package body.
IndexArchitectures()Index all declared items in an architecture.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- IndexPackageBodies()
Index declared items in all package bodies.
Algorithm
Iterate all package bodies:
Index all declared items.
→pyVHDLModel.DesignUnit.PackageBody.IndexDeclaredItems()
See also
IndexPackages()Index all declared items in a package.
IndexEntities()Index all declared items in an entity.
IndexArchitectures()Index all declared items in an architecture.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- IndexPackages()
Index declared items in all packages.
Algorithm
Iterate all packages:
Index all declared items.
→pyVHDLModel.DesignUnit.Package.IndexDeclaredItems()
See also
IndexPackageBodies()Index all declared items in a package body.
IndexEntities()Index all declared items in an entity.
IndexArchitectures()Index all declared items in an architecture.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- IterateDesignUnits(filter=<DesignUnitKind.All: 63>)
Iterate all design units in the library.
A union of
DesignUnitKindvalues can be given to filter the returned result for suitable design units.Algorithm
Iterate all contexts in that library.
Iterate all packages in that library.
Iterate all package bodies in that library.
Iterate all entities in that library.
Iterate all architectures in that library.
Iterate all configurations in that library.
- Parameters:
filter (
DesignUnitKind) – An enumeration with possibly multiple flags to filter the returned design units.- Return type:
- Returns:
A generator to iterate all matched design units in the library.
See also
pyVHDLModel.Design.IterateDesignUnits()Iterate all design units in the design.
pyVHDLModel.Document.IterateDesignUnits()Iterate all design units in the document.
- LinkArchitectures()
Link all architectures to corresponding entities.
Algorithm
Iterate all architecture groups (grouped per entity symbol’s name).
Check if entity symbol’s name exists as an entity in this library.
For each architecture in the same architecture group:
Add architecture to entities architecture dictionary
pyVHDLModel.DesignUnit.Entity._architectures.Assign found entity to architecture’s entity symbol
pyVHDLModel.DesignUnit.Architecture._entitySet parent namespace of architecture’s namespace to the entitie’s namespace.
Add an edge in the dependency graph from the architecture’s corresponding dependency vertex to the entity’s corresponding dependency vertex.
- Raises:
VHDLModelException – If entity name doesn’t exist.
VHDLModelException – If architecture name already exists for entity.
- Return type:
See also
LinkPackageBodies()Link all package bodies to corresponding packages.
LinkPackageInstances()Link all package instances to corresponding generic packages.
- LinkPackageBodies()
Link all package bodies to corresponding packages.
Algorithm
Iterate all package bodies.
Check if package body symbol’s name exists as a package in this library.
Add package body to package
pyVHDLModel.DesignUnit.Package._packageBody.Assign found package to package body’s package symbol
pyVHDLModel.DesignUnit.PackageBody._packageSet parent namespace of package body’s namespace to the package’s namespace.
Add an edge in the dependency graph from the package body’s corresponding dependency vertex to the package’s corresponding dependency vertex.
- Raises:
VHDLModelException – If package name doesn’t exist.
- Return type:
See also
LinkArchitectures()Link all architectures to corresponding entities.
LinkPackageInstances()Link all package instances to corresponding generic packages.
- LinkPackageInstances()
Link all package instances to corresponding generic packages.
Algorithm
Iterate all package instances.
Todo
Check if package body symbol’s name exists as a package in this library.
Add package body to package
pyVHDLModel.DesignUnit.Package._packageBody.Assign found package to package body’s package symbol
pyVHDLModel.DesignUnit.PackageBody._packageSet parent namespace of package body’s namespace to the package’s namespace.
Add an edge in the dependency graph from the package body’s corresponding dependency vertex to the package’s corresponding dependency vertex.
- Raises:
VHDLModelException – If generic package name doesn’t exist.
- Return type:
See also
LinkArchitectures()Link all architectures to corresponding entities.
LinkPackageBodies()Link all package bodies to corresponding packages.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property PackageBodies: dict[str, PackageBody]
Read-only property to access the dictionary of all package body declarations in this library (
_packageBodies).- Returns:
Dictionary of all package bodies, indexed by normalized identifier.
- property Packages: dict[str, Package]
Read-only property to access the dictionary of all package declarations in this library (
_packages).- Returns:
Dictionary of all packages, indexed by normalized identifier.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- Visit(visitor)
Walk this model element with a visitor.
A model class implements its walk; a class without one raises.
- Parameters:
visitor (
Visitor) – The visitor receiving the events.- Raises:
NotImplementedError – Always, because the element’s class has no walk of its own.
- Return type:
- __annotate_func__()
The type of the None singleton.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the library.
Format:
Library: 'my_library'- Return type:
- Returns:
String representation of the library.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats a representation of the library.
Format:
Library: 'my_library'- Return type:
- Returns:
String representation of the library.
- _allowBlackbox
Allow blackboxes for components;
Noneinherits the parent’s setting.
- _architectures: dict[str, dict[str, Architecture]]
Dictionary of all architectures defined in a library.
- _dependencyVertex: Vertex
Reference to the vertex in the dependency graph representing the library.
This reference is set byCreateDependencyGraph().
- _documentation
The associated documentation of a model entity.
- _identifier
The identifier of a model entity.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _parent
Reference to a parent entity in the logical model hierarchy.
- class pyVHDLModel.IEEE.Math_Real(identifier=None)[source]
Predefined package
ieee.math_real.Inheritance
- Parameters:
identifier (str | None)
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- AddGenericItem(genericItem)
Add a generic at the end of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to add.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property AllowBlackbox: bool
Property to return whether a design supports blackboxes, inherited from the parent if not set locally (
_allowBlackbox).Algorithm
If allow blackbox property is locally set, return the local value,
Otherwise, return allow blackbox value from parent object.
- Returns:
True, if blackboxes are allowed.- Raises:
VHDLModelException – If neither a local value is set nor a parent object is available to inherit the value from.
- Setter accepts:
- property Components: dict[str, Component]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DeferredConstants: dict[str, DeferredConstant]
Read-only property to access the deferred constants (
_deferredConstants).- Returns:
Dictionary of deferred constants, indexed by normalized identifier.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- property GenericCount: int
Read-only property to return the number of generics in
_genericItems.- Returns:
The generic count.
- property GenericItems: list[GenericInterfaceItemMixin]
Read-only property to access the generic items (
_genericItems).- Returns:
List of generic items.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
A generic package’s generics share the declarative region of its declarative part.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- InsertGenericItem(index, genericItem)
Insert a generic at a position of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
index (
int) – Position, from0(first) toGenericCount(append). A negative index counts from the end, as forlist.insert():-1inserts before the last generic.genericItem (
GenericInterfaceItemMixin) – The generic to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
- IterateSingleGenericDeclarations(predicate=None)
Iterate all generics per declared identifier, in declaration order.
A generic constant yields one single declaration per identifier:
generic (A, B : positive)yields two. A generic type, subprogram or package declares exactly one identifier and is yielded itself.- Parameters:
predicate (
Callable[[SingleGenericDeclarationMixin|GenericInterfaceItemMixin],bool] |None) – Optional, filter function to select the yielded generics. Default: all.- Return type:
Generator[SingleGenericDeclarationMixin|GenericInterfaceItemMixin]- Returns:
A generator to iterate all (selected) generics.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- MoveGenericItem(genericItem, index)
Move a generic to a position of the generic clause.
The generic stays a generic of this language construct: only the order of the generic clause changes. A generic subprogram is an overload: if the language construct’s namespace is indexed, it refers to the overload declared last afterwards.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to move.index (
int) – Position of the generic after the move, from0(first) toGenericCountminus one (last). A negative index counts from the end, as for alistindex:-1moves the generic to the end.
- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
NotInNamespaceError – If the namespace is indexed, and the identifier of a generic subprogram refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property PackageBody: PackageBody | None
Read-only property to access the package body (
_packageBody).- Returns:
The package body, or
Noneif not set.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- RemoveGenericItem(genericItem)
Remove a generic from the generic clause.
The generic is detached: its parent is cleared and its identifiers are removed from the language construct’s namespace, if it has one. The generic itself is unchanged and can be added to another language construct, or inserted at another position.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to remove.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic isn’t declared in it.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic refers to another element, e.g. a duplicate declaration.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
InsertGenericItem()→ Insert a generic at a position of the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package declaration, its context clause, its generic clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION = False
Trueif it continues its parent’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>, <class 'pyVHDLModel.Object.DeferredConstant'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this package: its generics share the declarative region.
- Return type:
- Returns:
Tuple of declarations: the generics, then the declared items.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexGenericItems()
Add the generics to the host’s namespace; a generic subprogram is an overload.
- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item – The declared item.
- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package.
- Return type:
- Returns:
Tuple of the package body, if linked (
_packageBody).
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Remove a declared item, which a concurrent declaration region doesn’t handle itself.
A deferred constant is removed from
_deferredConstants. An entry referring to another deferred constant of the same identifier (a duplicate declaration) is kept:RemoveDeclaredItem()indexes the region again.- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- _VisitGenericClause(visitor)
Walk the generic clause, if there are generics, with a visitor.
The generics are separated by semicolons.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __init__(identifier=None)
Initializes a predefined package.
By default the VHDL package name is the Python class name. Pass
identifierwhen the two must differ - e.g. when two vendor flavors of the same VHDL package need distinct Python classes.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package declaration.
Format:
mylib.myPackage- Return type:
- Returns:
String representation of the package declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package declaration.
Format:
Package: 'mylib.myPackage'- Return type:
- Returns:
Formatted package declaration.
- _allowBlackbox
Allow blackboxes for components;
Noneinherits the parent’s setting.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _deferredConstants: dict[str, DeferredConstant]
Deferred constants, indexed by name.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _genericItems
List of all generics, in declaration order.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _packageBody: Nullable[PackageBody]
The corresponding package body, or
Noneif none was analyzed.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.Math_Real_Body(packageIdentifier=None)[source]
Predefined package body of package
ieee.math_real.Inheritance
- Parameters:
packageIdentifier (str | None)
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- property Components: dict[str, Any]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
Index declared items listed in the concurrent declaration region.
Algorithm
Clear all lookup tables and remove all declared items from
_namespace. Interface items and imported items stay in the namespace.Iterate all declared items:
Every declared item is added to
_namespace, except a protected type body.If the declared item is a
ProtectedTypeBody, skip it: it completes its protected type.If the declared item is a
FullType, then add an entry to_types.If the declared item is a
Subtype, then add an entry to_subtypes.If the declared item is a
Function, then add an entry to_functions.If the declared item is a
Procedure, then add an entry to_procedures.If the declared item is a
Constant, then add an entry to_constants.If the declared item is a
Signal, then add an entry to_signals.If the declared item is a
Variable, TODO.If the declared item is a
SharedVariable, then add an entry to_sharedVariables.If the declared item is a
File, then add an entry to_files.If the declared item is neither of these types, call
_IndexOtherDeclaredItem().
Derived classes may override this virtual function.
Indexing again yields the same lookup tables and namespace.
See also
pyVHDLModel.Design.IndexPackages()Iterate all packages in the design and index declared items.
pyVHDLModel.Library.IndexPackages()Iterate all packages in the library and index declared items.
pyVHDLModel.Library._IndexOtherDeclaredItem()Iterate all packages in the library and index declared items.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property Package: PackageSymbol
Read-only property to access the package (
_package).- Returns:
The package.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package body, its context clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION: ClassVar[bool] = True
A package body continues its package’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this declarative region.
A host class with interface items extends the list by its interface items, listed first.
- Return type:
- Returns:
Tuple of declarations: the declared items, in declaration order.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package body.
- Return type:
- Returns:
Tuple of the package, if linked.
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Hook to remove declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __init__(packageIdentifier=None)
Initializes a predefined package body.
By default the VHDL package name is the Python class name with the trailing
_Bodyremoved. PasspackageIdentifierwhen the two must differ.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package body declaration.
Format:
mylib.myPackage(body)- Return type:
- Returns:
String representation of the package body declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package body declaration.
Format:
Package Body: mylib.myPackage(body)- Return type:
- Returns:
Formatted package body declaration.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _package: PackageSymbol
Reference to the package this body implements.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.Math_Complex[source]
Predefined package
ieee.math_complex.Inheritance
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- AddGenericItem(genericItem)
Add a generic at the end of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to add.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property AllowBlackbox: bool
Property to return whether a design supports blackboxes, inherited from the parent if not set locally (
_allowBlackbox).Algorithm
If allow blackbox property is locally set, return the local value,
Otherwise, return allow blackbox value from parent object.
- Returns:
True, if blackboxes are allowed.- Raises:
VHDLModelException – If neither a local value is set nor a parent object is available to inherit the value from.
- Setter accepts:
- property Components: dict[str, Component]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DeferredConstants: dict[str, DeferredConstant]
Read-only property to access the deferred constants (
_deferredConstants).- Returns:
Dictionary of deferred constants, indexed by normalized identifier.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- property GenericCount: int
Read-only property to return the number of generics in
_genericItems.- Returns:
The generic count.
- property GenericItems: list[GenericInterfaceItemMixin]
Read-only property to access the generic items (
_genericItems).- Returns:
List of generic items.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
A generic package’s generics share the declarative region of its declarative part.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- InsertGenericItem(index, genericItem)
Insert a generic at a position of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
index (
int) – Position, from0(first) toGenericCount(append). A negative index counts from the end, as forlist.insert():-1inserts before the last generic.genericItem (
GenericInterfaceItemMixin) – The generic to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
- IterateSingleGenericDeclarations(predicate=None)
Iterate all generics per declared identifier, in declaration order.
A generic constant yields one single declaration per identifier:
generic (A, B : positive)yields two. A generic type, subprogram or package declares exactly one identifier and is yielded itself.- Parameters:
predicate (
Callable[[SingleGenericDeclarationMixin|GenericInterfaceItemMixin],bool] |None) – Optional, filter function to select the yielded generics. Default: all.- Return type:
Generator[SingleGenericDeclarationMixin|GenericInterfaceItemMixin]- Returns:
A generator to iterate all (selected) generics.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- MoveGenericItem(genericItem, index)
Move a generic to a position of the generic clause.
The generic stays a generic of this language construct: only the order of the generic clause changes. A generic subprogram is an overload: if the language construct’s namespace is indexed, it refers to the overload declared last afterwards.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to move.index (
int) – Position of the generic after the move, from0(first) toGenericCountminus one (last). A negative index counts from the end, as for alistindex:-1moves the generic to the end.
- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
NotInNamespaceError – If the namespace is indexed, and the identifier of a generic subprogram refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property PackageBody: PackageBody | None
Read-only property to access the package body (
_packageBody).- Returns:
The package body, or
Noneif not set.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- RemoveGenericItem(genericItem)
Remove a generic from the generic clause.
The generic is detached: its parent is cleared and its identifiers are removed from the language construct’s namespace, if it has one. The generic itself is unchanged and can be added to another language construct, or inserted at another position.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to remove.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic isn’t declared in it.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic refers to another element, e.g. a duplicate declaration.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
InsertGenericItem()→ Insert a generic at a position of the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package declaration, its context clause, its generic clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION = False
Trueif it continues its parent’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>, <class 'pyVHDLModel.Object.DeferredConstant'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this package: its generics share the declarative region.
- Return type:
- Returns:
Tuple of declarations: the generics, then the declared items.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexGenericItems()
Add the generics to the host’s namespace; a generic subprogram is an overload.
- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item – The declared item.
- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package.
- Return type:
- Returns:
Tuple of the package body, if linked (
_packageBody).
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Remove a declared item, which a concurrent declaration region doesn’t handle itself.
A deferred constant is removed from
_deferredConstants. An entry referring to another deferred constant of the same identifier (a duplicate declaration) is kept:RemoveDeclaredItem()indexes the region again.- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- _VisitGenericClause(visitor)
Walk the generic clause, if there are generics, with a visitor.
The generics are separated by semicolons.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package declaration.
Format:
mylib.myPackage- Return type:
- Returns:
String representation of the package declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package declaration.
Format:
Package: 'mylib.myPackage'- Return type:
- Returns:
Formatted package declaration.
- _allowBlackbox
Allow blackboxes for components;
Noneinherits the parent’s setting.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _deferredConstants: dict[str, DeferredConstant]
Deferred constants, indexed by name.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _genericItems
List of all generics, in declaration order.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _packageBody: Nullable[PackageBody]
The corresponding package body, or
Noneif none was analyzed.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.Math_Complex_Body[source]
Predefined package body of package
ieee.math_complex.Inheritance
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- property Components: dict[str, Any]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
Index declared items listed in the concurrent declaration region.
Algorithm
Clear all lookup tables and remove all declared items from
_namespace. Interface items and imported items stay in the namespace.Iterate all declared items:
Every declared item is added to
_namespace, except a protected type body.If the declared item is a
ProtectedTypeBody, skip it: it completes its protected type.If the declared item is a
FullType, then add an entry to_types.If the declared item is a
Subtype, then add an entry to_subtypes.If the declared item is a
Function, then add an entry to_functions.If the declared item is a
Procedure, then add an entry to_procedures.If the declared item is a
Constant, then add an entry to_constants.If the declared item is a
Signal, then add an entry to_signals.If the declared item is a
Variable, TODO.If the declared item is a
SharedVariable, then add an entry to_sharedVariables.If the declared item is a
File, then add an entry to_files.If the declared item is neither of these types, call
_IndexOtherDeclaredItem().
Derived classes may override this virtual function.
Indexing again yields the same lookup tables and namespace.
See also
pyVHDLModel.Design.IndexPackages()Iterate all packages in the design and index declared items.
pyVHDLModel.Library.IndexPackages()Iterate all packages in the library and index declared items.
pyVHDLModel.Library._IndexOtherDeclaredItem()Iterate all packages in the library and index declared items.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property Package: PackageSymbol
Read-only property to access the package (
_package).- Returns:
The package.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package body, its context clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION: ClassVar[bool] = True
A package body continues its package’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this declarative region.
A host class with interface items extends the list by its interface items, listed first.
- Return type:
- Returns:
Tuple of declarations: the declared items, in declaration order.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package body.
- Return type:
- Returns:
Tuple of the package, if linked.
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Hook to remove declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package body declaration.
Format:
mylib.myPackage(body)- Return type:
- Returns:
String representation of the package body declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package body declaration.
Format:
Package Body: mylib.myPackage(body)- Return type:
- Returns:
Formatted package body declaration.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _package: PackageSymbol
Reference to the package this body implements.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.Std_Logic_1164[source]
Predefined package
ieee.std_logic_1164.Predefined types:
std_ulogic,std_ulogic_vectorstd_logic,std_logic_vector
Inheritance
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- AddGenericItem(genericItem)
Add a generic at the end of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to add.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property AllowBlackbox: bool
Property to return whether a design supports blackboxes, inherited from the parent if not set locally (
_allowBlackbox).Algorithm
If allow blackbox property is locally set, return the local value,
Otherwise, return allow blackbox value from parent object.
- Returns:
True, if blackboxes are allowed.- Raises:
VHDLModelException – If neither a local value is set nor a parent object is available to inherit the value from.
- Setter accepts:
- property Components: dict[str, Component]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DeferredConstants: dict[str, DeferredConstant]
Read-only property to access the deferred constants (
_deferredConstants).- Returns:
Dictionary of deferred constants, indexed by normalized identifier.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- property GenericCount: int
Read-only property to return the number of generics in
_genericItems.- Returns:
The generic count.
- property GenericItems: list[GenericInterfaceItemMixin]
Read-only property to access the generic items (
_genericItems).- Returns:
List of generic items.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
A generic package’s generics share the declarative region of its declarative part.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- InsertGenericItem(index, genericItem)
Insert a generic at a position of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
index (
int) – Position, from0(first) toGenericCount(append). A negative index counts from the end, as forlist.insert():-1inserts before the last generic.genericItem (
GenericInterfaceItemMixin) – The generic to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
- IterateSingleGenericDeclarations(predicate=None)
Iterate all generics per declared identifier, in declaration order.
A generic constant yields one single declaration per identifier:
generic (A, B : positive)yields two. A generic type, subprogram or package declares exactly one identifier and is yielded itself.- Parameters:
predicate (
Callable[[SingleGenericDeclarationMixin|GenericInterfaceItemMixin],bool] |None) – Optional, filter function to select the yielded generics. Default: all.- Return type:
Generator[SingleGenericDeclarationMixin|GenericInterfaceItemMixin]- Returns:
A generator to iterate all (selected) generics.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- MoveGenericItem(genericItem, index)
Move a generic to a position of the generic clause.
The generic stays a generic of this language construct: only the order of the generic clause changes. A generic subprogram is an overload: if the language construct’s namespace is indexed, it refers to the overload declared last afterwards.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to move.index (
int) – Position of the generic after the move, from0(first) toGenericCountminus one (last). A negative index counts from the end, as for alistindex:-1moves the generic to the end.
- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
NotInNamespaceError – If the namespace is indexed, and the identifier of a generic subprogram refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property PackageBody: PackageBody | None
Read-only property to access the package body (
_packageBody).- Returns:
The package body, or
Noneif not set.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- RemoveGenericItem(genericItem)
Remove a generic from the generic clause.
The generic is detached: its parent is cleared and its identifiers are removed from the language construct’s namespace, if it has one. The generic itself is unchanged and can be added to another language construct, or inserted at another position.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to remove.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic isn’t declared in it.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic refers to another element, e.g. a duplicate declaration.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
InsertGenericItem()→ Insert a generic at a position of the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package declaration, its context clause, its generic clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION = False
Trueif it continues its parent’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>, <class 'pyVHDLModel.Object.DeferredConstant'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this package: its generics share the declarative region.
- Return type:
- Returns:
Tuple of declarations: the generics, then the declared items.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexGenericItems()
Add the generics to the host’s namespace; a generic subprogram is an overload.
- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item – The declared item.
- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package.
- Return type:
- Returns:
Tuple of the package body, if linked (
_packageBody).
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Remove a declared item, which a concurrent declaration region doesn’t handle itself.
A deferred constant is removed from
_deferredConstants. An entry referring to another deferred constant of the same identifier (a duplicate declaration) is kept:RemoveDeclaredItem()indexes the region again.- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- _VisitGenericClause(visitor)
Walk the generic clause, if there are generics, with a visitor.
The generics are separated by semicolons.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package declaration.
Format:
mylib.myPackage- Return type:
- Returns:
String representation of the package declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package declaration.
Format:
Package: 'mylib.myPackage'- Return type:
- Returns:
Formatted package declaration.
- _allowBlackbox
Allow blackboxes for components;
Noneinherits the parent’s setting.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _deferredConstants: dict[str, DeferredConstant]
Deferred constants, indexed by name.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _genericItems
List of all generics, in declaration order.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _packageBody: Nullable[PackageBody]
The corresponding package body, or
Noneif none was analyzed.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.Std_Logic_1164_Body(packageIdentifier=None)[source]
Predefined package body of package
ieee.std_logic_1164.Inheritance
- Parameters:
packageIdentifier (str | None)
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- property Components: dict[str, Any]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
Index declared items listed in the concurrent declaration region.
Algorithm
Clear all lookup tables and remove all declared items from
_namespace. Interface items and imported items stay in the namespace.Iterate all declared items:
Every declared item is added to
_namespace, except a protected type body.If the declared item is a
ProtectedTypeBody, skip it: it completes its protected type.If the declared item is a
FullType, then add an entry to_types.If the declared item is a
Subtype, then add an entry to_subtypes.If the declared item is a
Function, then add an entry to_functions.If the declared item is a
Procedure, then add an entry to_procedures.If the declared item is a
Constant, then add an entry to_constants.If the declared item is a
Signal, then add an entry to_signals.If the declared item is a
Variable, TODO.If the declared item is a
SharedVariable, then add an entry to_sharedVariables.If the declared item is a
File, then add an entry to_files.If the declared item is neither of these types, call
_IndexOtherDeclaredItem().
Derived classes may override this virtual function.
Indexing again yields the same lookup tables and namespace.
See also
pyVHDLModel.Design.IndexPackages()Iterate all packages in the design and index declared items.
pyVHDLModel.Library.IndexPackages()Iterate all packages in the library and index declared items.
pyVHDLModel.Library._IndexOtherDeclaredItem()Iterate all packages in the library and index declared items.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property Package: PackageSymbol
Read-only property to access the package (
_package).- Returns:
The package.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package body, its context clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION: ClassVar[bool] = True
A package body continues its package’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this declarative region.
A host class with interface items extends the list by its interface items, listed first.
- Return type:
- Returns:
Tuple of declarations: the declared items, in declaration order.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package body.
- Return type:
- Returns:
Tuple of the package, if linked.
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Hook to remove declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __init__(packageIdentifier=None)
Initializes a predefined package body.
By default the VHDL package name is the Python class name with the trailing
_Bodyremoved. PasspackageIdentifierwhen the two must differ.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package body declaration.
Format:
mylib.myPackage(body)- Return type:
- Returns:
String representation of the package body declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package body declaration.
Format:
Package Body: mylib.myPackage(body)- Return type:
- Returns:
Formatted package body declaration.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _package: PackageSymbol
Reference to the package this body implements.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.Std_Logic_TextIO[source]
Predefined package
ieee.std_logic_textio.Inheritance
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- AddGenericItem(genericItem)
Add a generic at the end of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to add.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property AllowBlackbox: bool
Property to return whether a design supports blackboxes, inherited from the parent if not set locally (
_allowBlackbox).Algorithm
If allow blackbox property is locally set, return the local value,
Otherwise, return allow blackbox value from parent object.
- Returns:
True, if blackboxes are allowed.- Raises:
VHDLModelException – If neither a local value is set nor a parent object is available to inherit the value from.
- Setter accepts:
- property Components: dict[str, Component]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DeferredConstants: dict[str, DeferredConstant]
Read-only property to access the deferred constants (
_deferredConstants).- Returns:
Dictionary of deferred constants, indexed by normalized identifier.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- property GenericCount: int
Read-only property to return the number of generics in
_genericItems.- Returns:
The generic count.
- property GenericItems: list[GenericInterfaceItemMixin]
Read-only property to access the generic items (
_genericItems).- Returns:
List of generic items.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
A generic package’s generics share the declarative region of its declarative part.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- InsertGenericItem(index, genericItem)
Insert a generic at a position of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
index (
int) – Position, from0(first) toGenericCount(append). A negative index counts from the end, as forlist.insert():-1inserts before the last generic.genericItem (
GenericInterfaceItemMixin) – The generic to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
- IterateSingleGenericDeclarations(predicate=None)
Iterate all generics per declared identifier, in declaration order.
A generic constant yields one single declaration per identifier:
generic (A, B : positive)yields two. A generic type, subprogram or package declares exactly one identifier and is yielded itself.- Parameters:
predicate (
Callable[[SingleGenericDeclarationMixin|GenericInterfaceItemMixin],bool] |None) – Optional, filter function to select the yielded generics. Default: all.- Return type:
Generator[SingleGenericDeclarationMixin|GenericInterfaceItemMixin]- Returns:
A generator to iterate all (selected) generics.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- MoveGenericItem(genericItem, index)
Move a generic to a position of the generic clause.
The generic stays a generic of this language construct: only the order of the generic clause changes. A generic subprogram is an overload: if the language construct’s namespace is indexed, it refers to the overload declared last afterwards.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to move.index (
int) – Position of the generic after the move, from0(first) toGenericCountminus one (last). A negative index counts from the end, as for alistindex:-1moves the generic to the end.
- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
NotInNamespaceError – If the namespace is indexed, and the identifier of a generic subprogram refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property PackageBody: PackageBody | None
Read-only property to access the package body (
_packageBody).- Returns:
The package body, or
Noneif not set.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- RemoveGenericItem(genericItem)
Remove a generic from the generic clause.
The generic is detached: its parent is cleared and its identifiers are removed from the language construct’s namespace, if it has one. The generic itself is unchanged and can be added to another language construct, or inserted at another position.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to remove.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic isn’t declared in it.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic refers to another element, e.g. a duplicate declaration.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
InsertGenericItem()→ Insert a generic at a position of the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package declaration, its context clause, its generic clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION = False
Trueif it continues its parent’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>, <class 'pyVHDLModel.Object.DeferredConstant'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this package: its generics share the declarative region.
- Return type:
- Returns:
Tuple of declarations: the generics, then the declared items.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexGenericItems()
Add the generics to the host’s namespace; a generic subprogram is an overload.
- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item – The declared item.
- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package.
- Return type:
- Returns:
Tuple of the package body, if linked (
_packageBody).
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Remove a declared item, which a concurrent declaration region doesn’t handle itself.
A deferred constant is removed from
_deferredConstants. An entry referring to another deferred constant of the same identifier (a duplicate declaration) is kept:RemoveDeclaredItem()indexes the region again.- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- _VisitGenericClause(visitor)
Walk the generic clause, if there are generics, with a visitor.
The generics are separated by semicolons.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package declaration.
Format:
mylib.myPackage- Return type:
- Returns:
String representation of the package declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package declaration.
Format:
Package: 'mylib.myPackage'- Return type:
- Returns:
Formatted package declaration.
- _allowBlackbox
Allow blackboxes for components;
Noneinherits the parent’s setting.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _deferredConstants: dict[str, DeferredConstant]
Deferred constants, indexed by name.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _genericItems
List of all generics, in declaration order.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _packageBody: Nullable[PackageBody]
The corresponding package body, or
Noneif none was analyzed.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.Numeric_Bit[source]
Predefined package
ieee.numeric_bit.Inheritance
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- AddGenericItem(genericItem)
Add a generic at the end of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to add.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property AllowBlackbox: bool
Property to return whether a design supports blackboxes, inherited from the parent if not set locally (
_allowBlackbox).Algorithm
If allow blackbox property is locally set, return the local value,
Otherwise, return allow blackbox value from parent object.
- Returns:
True, if blackboxes are allowed.- Raises:
VHDLModelException – If neither a local value is set nor a parent object is available to inherit the value from.
- Setter accepts:
- property Components: dict[str, Component]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DeferredConstants: dict[str, DeferredConstant]
Read-only property to access the deferred constants (
_deferredConstants).- Returns:
Dictionary of deferred constants, indexed by normalized identifier.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- property GenericCount: int
Read-only property to return the number of generics in
_genericItems.- Returns:
The generic count.
- property GenericItems: list[GenericInterfaceItemMixin]
Read-only property to access the generic items (
_genericItems).- Returns:
List of generic items.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
A generic package’s generics share the declarative region of its declarative part.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- InsertGenericItem(index, genericItem)
Insert a generic at a position of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
index (
int) – Position, from0(first) toGenericCount(append). A negative index counts from the end, as forlist.insert():-1inserts before the last generic.genericItem (
GenericInterfaceItemMixin) – The generic to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
- IterateSingleGenericDeclarations(predicate=None)
Iterate all generics per declared identifier, in declaration order.
A generic constant yields one single declaration per identifier:
generic (A, B : positive)yields two. A generic type, subprogram or package declares exactly one identifier and is yielded itself.- Parameters:
predicate (
Callable[[SingleGenericDeclarationMixin|GenericInterfaceItemMixin],bool] |None) – Optional, filter function to select the yielded generics. Default: all.- Return type:
Generator[SingleGenericDeclarationMixin|GenericInterfaceItemMixin]- Returns:
A generator to iterate all (selected) generics.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- MoveGenericItem(genericItem, index)
Move a generic to a position of the generic clause.
The generic stays a generic of this language construct: only the order of the generic clause changes. A generic subprogram is an overload: if the language construct’s namespace is indexed, it refers to the overload declared last afterwards.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to move.index (
int) – Position of the generic after the move, from0(first) toGenericCountminus one (last). A negative index counts from the end, as for alistindex:-1moves the generic to the end.
- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
NotInNamespaceError – If the namespace is indexed, and the identifier of a generic subprogram refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property PackageBody: PackageBody | None
Read-only property to access the package body (
_packageBody).- Returns:
The package body, or
Noneif not set.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- RemoveGenericItem(genericItem)
Remove a generic from the generic clause.
The generic is detached: its parent is cleared and its identifiers are removed from the language construct’s namespace, if it has one. The generic itself is unchanged and can be added to another language construct, or inserted at another position.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to remove.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic isn’t declared in it.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic refers to another element, e.g. a duplicate declaration.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
InsertGenericItem()→ Insert a generic at a position of the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package declaration, its context clause, its generic clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION = False
Trueif it continues its parent’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>, <class 'pyVHDLModel.Object.DeferredConstant'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this package: its generics share the declarative region.
- Return type:
- Returns:
Tuple of declarations: the generics, then the declared items.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexGenericItems()
Add the generics to the host’s namespace; a generic subprogram is an overload.
- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item – The declared item.
- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package.
- Return type:
- Returns:
Tuple of the package body, if linked (
_packageBody).
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Remove a declared item, which a concurrent declaration region doesn’t handle itself.
A deferred constant is removed from
_deferredConstants. An entry referring to another deferred constant of the same identifier (a duplicate declaration) is kept:RemoveDeclaredItem()indexes the region again.- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- _VisitGenericClause(visitor)
Walk the generic clause, if there are generics, with a visitor.
The generics are separated by semicolons.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package declaration.
Format:
mylib.myPackage- Return type:
- Returns:
String representation of the package declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package declaration.
Format:
Package: 'mylib.myPackage'- Return type:
- Returns:
Formatted package declaration.
- _allowBlackbox
Allow blackboxes for components;
Noneinherits the parent’s setting.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _deferredConstants: dict[str, DeferredConstant]
Deferred constants, indexed by name.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _genericItems
List of all generics, in declaration order.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _packageBody: Nullable[PackageBody]
The corresponding package body, or
Noneif none was analyzed.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.Numeric_Bit_Body(packageIdentifier=None)[source]
Predefined package body of package
ieee.numeric_bit.Inheritance
- Parameters:
packageIdentifier (str | None)
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- property Components: dict[str, Any]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
Index declared items listed in the concurrent declaration region.
Algorithm
Clear all lookup tables and remove all declared items from
_namespace. Interface items and imported items stay in the namespace.Iterate all declared items:
Every declared item is added to
_namespace, except a protected type body.If the declared item is a
ProtectedTypeBody, skip it: it completes its protected type.If the declared item is a
FullType, then add an entry to_types.If the declared item is a
Subtype, then add an entry to_subtypes.If the declared item is a
Function, then add an entry to_functions.If the declared item is a
Procedure, then add an entry to_procedures.If the declared item is a
Constant, then add an entry to_constants.If the declared item is a
Signal, then add an entry to_signals.If the declared item is a
Variable, TODO.If the declared item is a
SharedVariable, then add an entry to_sharedVariables.If the declared item is a
File, then add an entry to_files.If the declared item is neither of these types, call
_IndexOtherDeclaredItem().
Derived classes may override this virtual function.
Indexing again yields the same lookup tables and namespace.
See also
pyVHDLModel.Design.IndexPackages()Iterate all packages in the design and index declared items.
pyVHDLModel.Library.IndexPackages()Iterate all packages in the library and index declared items.
pyVHDLModel.Library._IndexOtherDeclaredItem()Iterate all packages in the library and index declared items.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property Package: PackageSymbol
Read-only property to access the package (
_package).- Returns:
The package.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package body, its context clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION: ClassVar[bool] = True
A package body continues its package’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this declarative region.
A host class with interface items extends the list by its interface items, listed first.
- Return type:
- Returns:
Tuple of declarations: the declared items, in declaration order.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package body.
- Return type:
- Returns:
Tuple of the package, if linked.
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Hook to remove declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __init__(packageIdentifier=None)
Initializes a predefined package body.
By default the VHDL package name is the Python class name with the trailing
_Bodyremoved. PasspackageIdentifierwhen the two must differ.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package body declaration.
Format:
mylib.myPackage(body)- Return type:
- Returns:
String representation of the package body declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package body declaration.
Format:
Package Body: mylib.myPackage(body)- Return type:
- Returns:
Formatted package body declaration.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _package: PackageSymbol
Reference to the package this body implements.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.Numeric_Bit_Unsigned(identifier=None)[source]
Predefined package
ieee.numeric_bit_unsigned.Inheritance
- Parameters:
identifier (str | None)
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- AddGenericItem(genericItem)
Add a generic at the end of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to add.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property AllowBlackbox: bool
Property to return whether a design supports blackboxes, inherited from the parent if not set locally (
_allowBlackbox).Algorithm
If allow blackbox property is locally set, return the local value,
Otherwise, return allow blackbox value from parent object.
- Returns:
True, if blackboxes are allowed.- Raises:
VHDLModelException – If neither a local value is set nor a parent object is available to inherit the value from.
- Setter accepts:
- property Components: dict[str, Component]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DeferredConstants: dict[str, DeferredConstant]
Read-only property to access the deferred constants (
_deferredConstants).- Returns:
Dictionary of deferred constants, indexed by normalized identifier.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- property GenericCount: int
Read-only property to return the number of generics in
_genericItems.- Returns:
The generic count.
- property GenericItems: list[GenericInterfaceItemMixin]
Read-only property to access the generic items (
_genericItems).- Returns:
List of generic items.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
A generic package’s generics share the declarative region of its declarative part.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- InsertGenericItem(index, genericItem)
Insert a generic at a position of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
index (
int) – Position, from0(first) toGenericCount(append). A negative index counts from the end, as forlist.insert():-1inserts before the last generic.genericItem (
GenericInterfaceItemMixin) – The generic to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
- IterateSingleGenericDeclarations(predicate=None)
Iterate all generics per declared identifier, in declaration order.
A generic constant yields one single declaration per identifier:
generic (A, B : positive)yields two. A generic type, subprogram or package declares exactly one identifier and is yielded itself.- Parameters:
predicate (
Callable[[SingleGenericDeclarationMixin|GenericInterfaceItemMixin],bool] |None) – Optional, filter function to select the yielded generics. Default: all.- Return type:
Generator[SingleGenericDeclarationMixin|GenericInterfaceItemMixin]- Returns:
A generator to iterate all (selected) generics.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- MoveGenericItem(genericItem, index)
Move a generic to a position of the generic clause.
The generic stays a generic of this language construct: only the order of the generic clause changes. A generic subprogram is an overload: if the language construct’s namespace is indexed, it refers to the overload declared last afterwards.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to move.index (
int) – Position of the generic after the move, from0(first) toGenericCountminus one (last). A negative index counts from the end, as for alistindex:-1moves the generic to the end.
- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
NotInNamespaceError – If the namespace is indexed, and the identifier of a generic subprogram refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property PackageBody: PackageBody | None
Read-only property to access the package body (
_packageBody).- Returns:
The package body, or
Noneif not set.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- RemoveGenericItem(genericItem)
Remove a generic from the generic clause.
The generic is detached: its parent is cleared and its identifiers are removed from the language construct’s namespace, if it has one. The generic itself is unchanged and can be added to another language construct, or inserted at another position.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to remove.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic isn’t declared in it.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic refers to another element, e.g. a duplicate declaration.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
InsertGenericItem()→ Insert a generic at a position of the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package declaration, its context clause, its generic clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION = False
Trueif it continues its parent’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>, <class 'pyVHDLModel.Object.DeferredConstant'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this package: its generics share the declarative region.
- Return type:
- Returns:
Tuple of declarations: the generics, then the declared items.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexGenericItems()
Add the generics to the host’s namespace; a generic subprogram is an overload.
- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item – The declared item.
- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package.
- Return type:
- Returns:
Tuple of the package body, if linked (
_packageBody).
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Remove a declared item, which a concurrent declaration region doesn’t handle itself.
A deferred constant is removed from
_deferredConstants. An entry referring to another deferred constant of the same identifier (a duplicate declaration) is kept:RemoveDeclaredItem()indexes the region again.- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- _VisitGenericClause(visitor)
Walk the generic clause, if there are generics, with a visitor.
The generics are separated by semicolons.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __init__(identifier=None)
Initializes a predefined package.
By default the VHDL package name is the Python class name. Pass
identifierwhen the two must differ - e.g. when two vendor flavors of the same VHDL package need distinct Python classes.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package declaration.
Format:
mylib.myPackage- Return type:
- Returns:
String representation of the package declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package declaration.
Format:
Package: 'mylib.myPackage'- Return type:
- Returns:
Formatted package declaration.
- _allowBlackbox
Allow blackboxes for components;
Noneinherits the parent’s setting.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _deferredConstants: dict[str, DeferredConstant]
Deferred constants, indexed by name.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _genericItems
List of all generics, in declaration order.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _packageBody: Nullable[PackageBody]
The corresponding package body, or
Noneif none was analyzed.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.Numeric_Bit_Unsigned_Body[source]
Predefined package body of package
ieee.numeric_bit_unsigned.Inheritance
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- property Components: dict[str, Any]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
Index declared items listed in the concurrent declaration region.
Algorithm
Clear all lookup tables and remove all declared items from
_namespace. Interface items and imported items stay in the namespace.Iterate all declared items:
Every declared item is added to
_namespace, except a protected type body.If the declared item is a
ProtectedTypeBody, skip it: it completes its protected type.If the declared item is a
FullType, then add an entry to_types.If the declared item is a
Subtype, then add an entry to_subtypes.If the declared item is a
Function, then add an entry to_functions.If the declared item is a
Procedure, then add an entry to_procedures.If the declared item is a
Constant, then add an entry to_constants.If the declared item is a
Signal, then add an entry to_signals.If the declared item is a
Variable, TODO.If the declared item is a
SharedVariable, then add an entry to_sharedVariables.If the declared item is a
File, then add an entry to_files.If the declared item is neither of these types, call
_IndexOtherDeclaredItem().
Derived classes may override this virtual function.
Indexing again yields the same lookup tables and namespace.
See also
pyVHDLModel.Design.IndexPackages()Iterate all packages in the design and index declared items.
pyVHDLModel.Library.IndexPackages()Iterate all packages in the library and index declared items.
pyVHDLModel.Library._IndexOtherDeclaredItem()Iterate all packages in the library and index declared items.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property Package: PackageSymbol
Read-only property to access the package (
_package).- Returns:
The package.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package body, its context clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION: ClassVar[bool] = True
A package body continues its package’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this declarative region.
A host class with interface items extends the list by its interface items, listed first.
- Return type:
- Returns:
Tuple of declarations: the declared items, in declaration order.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package body.
- Return type:
- Returns:
Tuple of the package, if linked.
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Hook to remove declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package body declaration.
Format:
mylib.myPackage(body)- Return type:
- Returns:
String representation of the package body declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package body declaration.
Format:
Package Body: mylib.myPackage(body)- Return type:
- Returns:
Formatted package body declaration.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _package: PackageSymbol
Reference to the package this body implements.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.Numeric_Std[source]
Predefined package
ieee.numeric_std.Predefined types:
unresolved_unsigned,unsignedunresolved_signed,signed
Inheritance
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- AddGenericItem(genericItem)
Add a generic at the end of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to add.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property AllowBlackbox: bool
Property to return whether a design supports blackboxes, inherited from the parent if not set locally (
_allowBlackbox).Algorithm
If allow blackbox property is locally set, return the local value,
Otherwise, return allow blackbox value from parent object.
- Returns:
True, if blackboxes are allowed.- Raises:
VHDLModelException – If neither a local value is set nor a parent object is available to inherit the value from.
- Setter accepts:
- property Components: dict[str, Component]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DeferredConstants: dict[str, DeferredConstant]
Read-only property to access the deferred constants (
_deferredConstants).- Returns:
Dictionary of deferred constants, indexed by normalized identifier.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- property GenericCount: int
Read-only property to return the number of generics in
_genericItems.- Returns:
The generic count.
- property GenericItems: list[GenericInterfaceItemMixin]
Read-only property to access the generic items (
_genericItems).- Returns:
List of generic items.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
A generic package’s generics share the declarative region of its declarative part.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- InsertGenericItem(index, genericItem)
Insert a generic at a position of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
index (
int) – Position, from0(first) toGenericCount(append). A negative index counts from the end, as forlist.insert():-1inserts before the last generic.genericItem (
GenericInterfaceItemMixin) – The generic to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
- IterateSingleGenericDeclarations(predicate=None)
Iterate all generics per declared identifier, in declaration order.
A generic constant yields one single declaration per identifier:
generic (A, B : positive)yields two. A generic type, subprogram or package declares exactly one identifier and is yielded itself.- Parameters:
predicate (
Callable[[SingleGenericDeclarationMixin|GenericInterfaceItemMixin],bool] |None) – Optional, filter function to select the yielded generics. Default: all.- Return type:
Generator[SingleGenericDeclarationMixin|GenericInterfaceItemMixin]- Returns:
A generator to iterate all (selected) generics.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- MoveGenericItem(genericItem, index)
Move a generic to a position of the generic clause.
The generic stays a generic of this language construct: only the order of the generic clause changes. A generic subprogram is an overload: if the language construct’s namespace is indexed, it refers to the overload declared last afterwards.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to move.index (
int) – Position of the generic after the move, from0(first) toGenericCountminus one (last). A negative index counts from the end, as for alistindex:-1moves the generic to the end.
- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
NotInNamespaceError – If the namespace is indexed, and the identifier of a generic subprogram refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property PackageBody: PackageBody | None
Read-only property to access the package body (
_packageBody).- Returns:
The package body, or
Noneif not set.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- RemoveGenericItem(genericItem)
Remove a generic from the generic clause.
The generic is detached: its parent is cleared and its identifiers are removed from the language construct’s namespace, if it has one. The generic itself is unchanged and can be added to another language construct, or inserted at another position.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to remove.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic isn’t declared in it.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic refers to another element, e.g. a duplicate declaration.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
InsertGenericItem()→ Insert a generic at a position of the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package declaration, its context clause, its generic clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION = False
Trueif it continues its parent’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>, <class 'pyVHDLModel.Object.DeferredConstant'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this package: its generics share the declarative region.
- Return type:
- Returns:
Tuple of declarations: the generics, then the declared items.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexGenericItems()
Add the generics to the host’s namespace; a generic subprogram is an overload.
- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item – The declared item.
- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package.
- Return type:
- Returns:
Tuple of the package body, if linked (
_packageBody).
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Remove a declared item, which a concurrent declaration region doesn’t handle itself.
A deferred constant is removed from
_deferredConstants. An entry referring to another deferred constant of the same identifier (a duplicate declaration) is kept:RemoveDeclaredItem()indexes the region again.- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- _VisitGenericClause(visitor)
Walk the generic clause, if there are generics, with a visitor.
The generics are separated by semicolons.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package declaration.
Format:
mylib.myPackage- Return type:
- Returns:
String representation of the package declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package declaration.
Format:
Package: 'mylib.myPackage'- Return type:
- Returns:
Formatted package declaration.
- _allowBlackbox
Allow blackboxes for components;
Noneinherits the parent’s setting.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _deferredConstants: dict[str, DeferredConstant]
Deferred constants, indexed by name.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _genericItems
List of all generics, in declaration order.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _packageBody: Nullable[PackageBody]
The corresponding package body, or
Noneif none was analyzed.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.Numeric_Std_Body(packageIdentifier=None)[source]
Predefined package body of package
ieee.numeric_std.Inheritance
- Parameters:
packageIdentifier (str | None)
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- property Components: dict[str, Any]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
Index declared items listed in the concurrent declaration region.
Algorithm
Clear all lookup tables and remove all declared items from
_namespace. Interface items and imported items stay in the namespace.Iterate all declared items:
Every declared item is added to
_namespace, except a protected type body.If the declared item is a
ProtectedTypeBody, skip it: it completes its protected type.If the declared item is a
FullType, then add an entry to_types.If the declared item is a
Subtype, then add an entry to_subtypes.If the declared item is a
Function, then add an entry to_functions.If the declared item is a
Procedure, then add an entry to_procedures.If the declared item is a
Constant, then add an entry to_constants.If the declared item is a
Signal, then add an entry to_signals.If the declared item is a
Variable, TODO.If the declared item is a
SharedVariable, then add an entry to_sharedVariables.If the declared item is a
File, then add an entry to_files.If the declared item is neither of these types, call
_IndexOtherDeclaredItem().
Derived classes may override this virtual function.
Indexing again yields the same lookup tables and namespace.
See also
pyVHDLModel.Design.IndexPackages()Iterate all packages in the design and index declared items.
pyVHDLModel.Library.IndexPackages()Iterate all packages in the library and index declared items.
pyVHDLModel.Library._IndexOtherDeclaredItem()Iterate all packages in the library and index declared items.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property Package: PackageSymbol
Read-only property to access the package (
_package).- Returns:
The package.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package body, its context clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION: ClassVar[bool] = True
A package body continues its package’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this declarative region.
A host class with interface items extends the list by its interface items, listed first.
- Return type:
- Returns:
Tuple of declarations: the declared items, in declaration order.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package body.
- Return type:
- Returns:
Tuple of the package, if linked.
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Hook to remove declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __init__(packageIdentifier=None)
Initializes a predefined package body.
By default the VHDL package name is the Python class name with the trailing
_Bodyremoved. PasspackageIdentifierwhen the two must differ.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package body declaration.
Format:
mylib.myPackage(body)- Return type:
- Returns:
String representation of the package body declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package body declaration.
Format:
Package Body: mylib.myPackage(body)- Return type:
- Returns:
Formatted package body declaration.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _package: PackageSymbol
Reference to the package this body implements.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.Numeric_Std_Unsigned[source]
Predefined package
ieee.numeric_std_unsigned.Inheritance
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- AddGenericItem(genericItem)
Add a generic at the end of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to add.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property AllowBlackbox: bool
Property to return whether a design supports blackboxes, inherited from the parent if not set locally (
_allowBlackbox).Algorithm
If allow blackbox property is locally set, return the local value,
Otherwise, return allow blackbox value from parent object.
- Returns:
True, if blackboxes are allowed.- Raises:
VHDLModelException – If neither a local value is set nor a parent object is available to inherit the value from.
- Setter accepts:
- property Components: dict[str, Component]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DeferredConstants: dict[str, DeferredConstant]
Read-only property to access the deferred constants (
_deferredConstants).- Returns:
Dictionary of deferred constants, indexed by normalized identifier.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- property GenericCount: int
Read-only property to return the number of generics in
_genericItems.- Returns:
The generic count.
- property GenericItems: list[GenericInterfaceItemMixin]
Read-only property to access the generic items (
_genericItems).- Returns:
List of generic items.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
A generic package’s generics share the declarative region of its declarative part.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- InsertGenericItem(index, genericItem)
Insert a generic at a position of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
index (
int) – Position, from0(first) toGenericCount(append). A negative index counts from the end, as forlist.insert():-1inserts before the last generic.genericItem (
GenericInterfaceItemMixin) – The generic to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
- IterateSingleGenericDeclarations(predicate=None)
Iterate all generics per declared identifier, in declaration order.
A generic constant yields one single declaration per identifier:
generic (A, B : positive)yields two. A generic type, subprogram or package declares exactly one identifier and is yielded itself.- Parameters:
predicate (
Callable[[SingleGenericDeclarationMixin|GenericInterfaceItemMixin],bool] |None) – Optional, filter function to select the yielded generics. Default: all.- Return type:
Generator[SingleGenericDeclarationMixin|GenericInterfaceItemMixin]- Returns:
A generator to iterate all (selected) generics.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- MoveGenericItem(genericItem, index)
Move a generic to a position of the generic clause.
The generic stays a generic of this language construct: only the order of the generic clause changes. A generic subprogram is an overload: if the language construct’s namespace is indexed, it refers to the overload declared last afterwards.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to move.index (
int) – Position of the generic after the move, from0(first) toGenericCountminus one (last). A negative index counts from the end, as for alistindex:-1moves the generic to the end.
- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
NotInNamespaceError – If the namespace is indexed, and the identifier of a generic subprogram refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property PackageBody: PackageBody | None
Read-only property to access the package body (
_packageBody).- Returns:
The package body, or
Noneif not set.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- RemoveGenericItem(genericItem)
Remove a generic from the generic clause.
The generic is detached: its parent is cleared and its identifiers are removed from the language construct’s namespace, if it has one. The generic itself is unchanged and can be added to another language construct, or inserted at another position.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to remove.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic isn’t declared in it.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic refers to another element, e.g. a duplicate declaration.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
InsertGenericItem()→ Insert a generic at a position of the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package declaration, its context clause, its generic clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION = False
Trueif it continues its parent’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>, <class 'pyVHDLModel.Object.DeferredConstant'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this package: its generics share the declarative region.
- Return type:
- Returns:
Tuple of declarations: the generics, then the declared items.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexGenericItems()
Add the generics to the host’s namespace; a generic subprogram is an overload.
- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item – The declared item.
- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package.
- Return type:
- Returns:
Tuple of the package body, if linked (
_packageBody).
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Remove a declared item, which a concurrent declaration region doesn’t handle itself.
A deferred constant is removed from
_deferredConstants. An entry referring to another deferred constant of the same identifier (a duplicate declaration) is kept:RemoveDeclaredItem()indexes the region again.- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- _VisitGenericClause(visitor)
Walk the generic clause, if there are generics, with a visitor.
The generics are separated by semicolons.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package declaration.
Format:
mylib.myPackage- Return type:
- Returns:
String representation of the package declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package declaration.
Format:
Package: 'mylib.myPackage'- Return type:
- Returns:
Formatted package declaration.
- _allowBlackbox
Allow blackboxes for components;
Noneinherits the parent’s setting.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _deferredConstants: dict[str, DeferredConstant]
Deferred constants, indexed by name.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _genericItems
List of all generics, in declaration order.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _packageBody: Nullable[PackageBody]
The corresponding package body, or
Noneif none was analyzed.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.Numeric_Std_Unsigned_Body[source]
Predefined package body of package
ieee.numeric_std_unsigned.Inheritance
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- property Components: dict[str, Any]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
Index declared items listed in the concurrent declaration region.
Algorithm
Clear all lookup tables and remove all declared items from
_namespace. Interface items and imported items stay in the namespace.Iterate all declared items:
Every declared item is added to
_namespace, except a protected type body.If the declared item is a
ProtectedTypeBody, skip it: it completes its protected type.If the declared item is a
FullType, then add an entry to_types.If the declared item is a
Subtype, then add an entry to_subtypes.If the declared item is a
Function, then add an entry to_functions.If the declared item is a
Procedure, then add an entry to_procedures.If the declared item is a
Constant, then add an entry to_constants.If the declared item is a
Signal, then add an entry to_signals.If the declared item is a
Variable, TODO.If the declared item is a
SharedVariable, then add an entry to_sharedVariables.If the declared item is a
File, then add an entry to_files.If the declared item is neither of these types, call
_IndexOtherDeclaredItem().
Derived classes may override this virtual function.
Indexing again yields the same lookup tables and namespace.
See also
pyVHDLModel.Design.IndexPackages()Iterate all packages in the design and index declared items.
pyVHDLModel.Library.IndexPackages()Iterate all packages in the library and index declared items.
pyVHDLModel.Library._IndexOtherDeclaredItem()Iterate all packages in the library and index declared items.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property Package: PackageSymbol
Read-only property to access the package (
_package).- Returns:
The package.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package body, its context clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION: ClassVar[bool] = True
A package body continues its package’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this declarative region.
A host class with interface items extends the list by its interface items, listed first.
- Return type:
- Returns:
Tuple of declarations: the declared items, in declaration order.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package body.
- Return type:
- Returns:
Tuple of the package, if linked.
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Hook to remove declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package body declaration.
Format:
mylib.myPackage(body)- Return type:
- Returns:
String representation of the package body declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package body declaration.
Format:
Package Body: mylib.myPackage(body)- Return type:
- Returns:
Formatted package body declaration.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _package: PackageSymbol
Reference to the package this body implements.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.Fixed_Float_Types(identifier=None)[source]
Predefined package
ieee.fixed_float_types.Inheritance
- Parameters:
identifier (str | None)
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- AddGenericItem(genericItem)
Add a generic at the end of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to add.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property AllowBlackbox: bool
Property to return whether a design supports blackboxes, inherited from the parent if not set locally (
_allowBlackbox).Algorithm
If allow blackbox property is locally set, return the local value,
Otherwise, return allow blackbox value from parent object.
- Returns:
True, if blackboxes are allowed.- Raises:
VHDLModelException – If neither a local value is set nor a parent object is available to inherit the value from.
- Setter accepts:
- property Components: dict[str, Component]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DeferredConstants: dict[str, DeferredConstant]
Read-only property to access the deferred constants (
_deferredConstants).- Returns:
Dictionary of deferred constants, indexed by normalized identifier.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- property GenericCount: int
Read-only property to return the number of generics in
_genericItems.- Returns:
The generic count.
- property GenericItems: list[GenericInterfaceItemMixin]
Read-only property to access the generic items (
_genericItems).- Returns:
List of generic items.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
A generic package’s generics share the declarative region of its declarative part.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- InsertGenericItem(index, genericItem)
Insert a generic at a position of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
index (
int) – Position, from0(first) toGenericCount(append). A negative index counts from the end, as forlist.insert():-1inserts before the last generic.genericItem (
GenericInterfaceItemMixin) – The generic to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
- IterateSingleGenericDeclarations(predicate=None)
Iterate all generics per declared identifier, in declaration order.
A generic constant yields one single declaration per identifier:
generic (A, B : positive)yields two. A generic type, subprogram or package declares exactly one identifier and is yielded itself.- Parameters:
predicate (
Callable[[SingleGenericDeclarationMixin|GenericInterfaceItemMixin],bool] |None) – Optional, filter function to select the yielded generics. Default: all.- Return type:
Generator[SingleGenericDeclarationMixin|GenericInterfaceItemMixin]- Returns:
A generator to iterate all (selected) generics.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- MoveGenericItem(genericItem, index)
Move a generic to a position of the generic clause.
The generic stays a generic of this language construct: only the order of the generic clause changes. A generic subprogram is an overload: if the language construct’s namespace is indexed, it refers to the overload declared last afterwards.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to move.index (
int) – Position of the generic after the move, from0(first) toGenericCountminus one (last). A negative index counts from the end, as for alistindex:-1moves the generic to the end.
- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
NotInNamespaceError – If the namespace is indexed, and the identifier of a generic subprogram refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property PackageBody: PackageBody | None
Read-only property to access the package body (
_packageBody).- Returns:
The package body, or
Noneif not set.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- RemoveGenericItem(genericItem)
Remove a generic from the generic clause.
The generic is detached: its parent is cleared and its identifiers are removed from the language construct’s namespace, if it has one. The generic itself is unchanged and can be added to another language construct, or inserted at another position.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to remove.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic isn’t declared in it.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic refers to another element, e.g. a duplicate declaration.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
InsertGenericItem()→ Insert a generic at a position of the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package declaration, its context clause, its generic clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION = False
Trueif it continues its parent’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>, <class 'pyVHDLModel.Object.DeferredConstant'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this package: its generics share the declarative region.
- Return type:
- Returns:
Tuple of declarations: the generics, then the declared items.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexGenericItems()
Add the generics to the host’s namespace; a generic subprogram is an overload.
- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item – The declared item.
- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package.
- Return type:
- Returns:
Tuple of the package body, if linked (
_packageBody).
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Remove a declared item, which a concurrent declaration region doesn’t handle itself.
A deferred constant is removed from
_deferredConstants. An entry referring to another deferred constant of the same identifier (a duplicate declaration) is kept:RemoveDeclaredItem()indexes the region again.- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- _VisitGenericClause(visitor)
Walk the generic clause, if there are generics, with a visitor.
The generics are separated by semicolons.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __init__(identifier=None)
Initializes a predefined package.
By default the VHDL package name is the Python class name. Pass
identifierwhen the two must differ - e.g. when two vendor flavors of the same VHDL package need distinct Python classes.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package declaration.
Format:
mylib.myPackage- Return type:
- Returns:
String representation of the package declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package declaration.
Format:
Package: 'mylib.myPackage'- Return type:
- Returns:
Formatted package declaration.
- _allowBlackbox
Allow blackboxes for components;
Noneinherits the parent’s setting.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _deferredConstants: dict[str, DeferredConstant]
Deferred constants, indexed by name.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _genericItems
List of all generics, in declaration order.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _packageBody: Nullable[PackageBody]
The corresponding package body, or
Noneif none was analyzed.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.Fixed_Generic_Pkg[source]
Predefined package
ieee.fixed_generic_pkg.Inheritance
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- AddGenericItem(genericItem)
Add a generic at the end of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to add.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property AllowBlackbox: bool
Property to return whether a design supports blackboxes, inherited from the parent if not set locally (
_allowBlackbox).Algorithm
If allow blackbox property is locally set, return the local value,
Otherwise, return allow blackbox value from parent object.
- Returns:
True, if blackboxes are allowed.- Raises:
VHDLModelException – If neither a local value is set nor a parent object is available to inherit the value from.
- Setter accepts:
- property Components: dict[str, Component]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DeferredConstants: dict[str, DeferredConstant]
Read-only property to access the deferred constants (
_deferredConstants).- Returns:
Dictionary of deferred constants, indexed by normalized identifier.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- property GenericCount: int
Read-only property to return the number of generics in
_genericItems.- Returns:
The generic count.
- property GenericItems: list[GenericInterfaceItemMixin]
Read-only property to access the generic items (
_genericItems).- Returns:
List of generic items.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
A generic package’s generics share the declarative region of its declarative part.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- InsertGenericItem(index, genericItem)
Insert a generic at a position of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
index (
int) – Position, from0(first) toGenericCount(append). A negative index counts from the end, as forlist.insert():-1inserts before the last generic.genericItem (
GenericInterfaceItemMixin) – The generic to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
- IterateSingleGenericDeclarations(predicate=None)
Iterate all generics per declared identifier, in declaration order.
A generic constant yields one single declaration per identifier:
generic (A, B : positive)yields two. A generic type, subprogram or package declares exactly one identifier and is yielded itself.- Parameters:
predicate (
Callable[[SingleGenericDeclarationMixin|GenericInterfaceItemMixin],bool] |None) – Optional, filter function to select the yielded generics. Default: all.- Return type:
Generator[SingleGenericDeclarationMixin|GenericInterfaceItemMixin]- Returns:
A generator to iterate all (selected) generics.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- MoveGenericItem(genericItem, index)
Move a generic to a position of the generic clause.
The generic stays a generic of this language construct: only the order of the generic clause changes. A generic subprogram is an overload: if the language construct’s namespace is indexed, it refers to the overload declared last afterwards.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to move.index (
int) – Position of the generic after the move, from0(first) toGenericCountminus one (last). A negative index counts from the end, as for alistindex:-1moves the generic to the end.
- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
NotInNamespaceError – If the namespace is indexed, and the identifier of a generic subprogram refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property PackageBody: PackageBody | None
Read-only property to access the package body (
_packageBody).- Returns:
The package body, or
Noneif not set.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- RemoveGenericItem(genericItem)
Remove a generic from the generic clause.
The generic is detached: its parent is cleared and its identifiers are removed from the language construct’s namespace, if it has one. The generic itself is unchanged and can be added to another language construct, or inserted at another position.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to remove.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic isn’t declared in it.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic refers to another element, e.g. a duplicate declaration.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
InsertGenericItem()→ Insert a generic at a position of the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package declaration, its context clause, its generic clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION = False
Trueif it continues its parent’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>, <class 'pyVHDLModel.Object.DeferredConstant'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this package: its generics share the declarative region.
- Return type:
- Returns:
Tuple of declarations: the generics, then the declared items.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexGenericItems()
Add the generics to the host’s namespace; a generic subprogram is an overload.
- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item – The declared item.
- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package.
- Return type:
- Returns:
Tuple of the package body, if linked (
_packageBody).
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Remove a declared item, which a concurrent declaration region doesn’t handle itself.
A deferred constant is removed from
_deferredConstants. An entry referring to another deferred constant of the same identifier (a duplicate declaration) is kept:RemoveDeclaredItem()indexes the region again.- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- _VisitGenericClause(visitor)
Walk the generic clause, if there are generics, with a visitor.
The generics are separated by semicolons.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package declaration.
Format:
mylib.myPackage- Return type:
- Returns:
String representation of the package declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package declaration.
Format:
Package: 'mylib.myPackage'- Return type:
- Returns:
Formatted package declaration.
- _allowBlackbox
Allow blackboxes for components;
Noneinherits the parent’s setting.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _deferredConstants: dict[str, DeferredConstant]
Deferred constants, indexed by name.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _genericItems
List of all generics, in declaration order.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _packageBody: Nullable[PackageBody]
The corresponding package body, or
Noneif none was analyzed.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.Fixed_Generic_Pkg_Body[source]
Predefined package body of package
ieee.fixed_generic_pkg.Inheritance
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- property Components: dict[str, Any]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
Index declared items listed in the concurrent declaration region.
Algorithm
Clear all lookup tables and remove all declared items from
_namespace. Interface items and imported items stay in the namespace.Iterate all declared items:
Every declared item is added to
_namespace, except a protected type body.If the declared item is a
ProtectedTypeBody, skip it: it completes its protected type.If the declared item is a
FullType, then add an entry to_types.If the declared item is a
Subtype, then add an entry to_subtypes.If the declared item is a
Function, then add an entry to_functions.If the declared item is a
Procedure, then add an entry to_procedures.If the declared item is a
Constant, then add an entry to_constants.If the declared item is a
Signal, then add an entry to_signals.If the declared item is a
Variable, TODO.If the declared item is a
SharedVariable, then add an entry to_sharedVariables.If the declared item is a
File, then add an entry to_files.If the declared item is neither of these types, call
_IndexOtherDeclaredItem().
Derived classes may override this virtual function.
Indexing again yields the same lookup tables and namespace.
See also
pyVHDLModel.Design.IndexPackages()Iterate all packages in the design and index declared items.
pyVHDLModel.Library.IndexPackages()Iterate all packages in the library and index declared items.
pyVHDLModel.Library._IndexOtherDeclaredItem()Iterate all packages in the library and index declared items.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property Package: PackageSymbol
Read-only property to access the package (
_package).- Returns:
The package.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package body, its context clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION: ClassVar[bool] = True
A package body continues its package’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this declarative region.
A host class with interface items extends the list by its interface items, listed first.
- Return type:
- Returns:
Tuple of declarations: the declared items, in declaration order.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package body.
- Return type:
- Returns:
Tuple of the package, if linked.
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Hook to remove declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package body declaration.
Format:
mylib.myPackage(body)- Return type:
- Returns:
String representation of the package body declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package body declaration.
Format:
Package Body: mylib.myPackage(body)- Return type:
- Returns:
Formatted package body declaration.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _package: PackageSymbol
Reference to the package this body implements.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.Fixed_Pkg[source]
Predefined package
ieee.fixed_pkg.Inheritance
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- AddGenericItem(genericItem)
Add a generic at the end of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to add.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property AllowBlackbox: bool
Property to return whether a design supports blackboxes, inherited from the parent if not set locally (
_allowBlackbox).Algorithm
If allow blackbox property is locally set, return the local value,
Otherwise, return allow blackbox value from parent object.
- Returns:
True, if blackboxes are allowed.- Raises:
VHDLModelException – If neither a local value is set nor a parent object is available to inherit the value from.
- Setter accepts:
- property Components: dict[str, Component]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DeferredConstants: dict[str, DeferredConstant]
Read-only property to access the deferred constants (
_deferredConstants).- Returns:
Dictionary of deferred constants, indexed by normalized identifier.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- property GenericCount: int
Read-only property to return the number of generics in
_genericItems.- Returns:
The generic count.
- property GenericItems: list[GenericInterfaceItemMixin]
Read-only property to access the generic items (
_genericItems).- Returns:
List of generic items.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
A generic package’s generics share the declarative region of its declarative part.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- InsertGenericItem(index, genericItem)
Insert a generic at a position of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
index (
int) – Position, from0(first) toGenericCount(append). A negative index counts from the end, as forlist.insert():-1inserts before the last generic.genericItem (
GenericInterfaceItemMixin) – The generic to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
- IterateSingleGenericDeclarations(predicate=None)
Iterate all generics per declared identifier, in declaration order.
A generic constant yields one single declaration per identifier:
generic (A, B : positive)yields two. A generic type, subprogram or package declares exactly one identifier and is yielded itself.- Parameters:
predicate (
Callable[[SingleGenericDeclarationMixin|GenericInterfaceItemMixin],bool] |None) – Optional, filter function to select the yielded generics. Default: all.- Return type:
Generator[SingleGenericDeclarationMixin|GenericInterfaceItemMixin]- Returns:
A generator to iterate all (selected) generics.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- MoveGenericItem(genericItem, index)
Move a generic to a position of the generic clause.
The generic stays a generic of this language construct: only the order of the generic clause changes. A generic subprogram is an overload: if the language construct’s namespace is indexed, it refers to the overload declared last afterwards.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to move.index (
int) – Position of the generic after the move, from0(first) toGenericCountminus one (last). A negative index counts from the end, as for alistindex:-1moves the generic to the end.
- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
NotInNamespaceError – If the namespace is indexed, and the identifier of a generic subprogram refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property PackageBody: PackageBody | None
Read-only property to access the package body (
_packageBody).- Returns:
The package body, or
Noneif not set.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- RemoveGenericItem(genericItem)
Remove a generic from the generic clause.
The generic is detached: its parent is cleared and its identifiers are removed from the language construct’s namespace, if it has one. The generic itself is unchanged and can be added to another language construct, or inserted at another position.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to remove.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic isn’t declared in it.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic refers to another element, e.g. a duplicate declaration.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
InsertGenericItem()→ Insert a generic at a position of the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package declaration, its context clause, its generic clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION = False
Trueif it continues its parent’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>, <class 'pyVHDLModel.Object.DeferredConstant'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this package: its generics share the declarative region.
- Return type:
- Returns:
Tuple of declarations: the generics, then the declared items.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexGenericItems()
Add the generics to the host’s namespace; a generic subprogram is an overload.
- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item – The declared item.
- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package.
- Return type:
- Returns:
Tuple of the package body, if linked (
_packageBody).
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Remove a declared item, which a concurrent declaration region doesn’t handle itself.
A deferred constant is removed from
_deferredConstants. An entry referring to another deferred constant of the same identifier (a duplicate declaration) is kept:RemoveDeclaredItem()indexes the region again.- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- _VisitGenericClause(visitor)
Walk the generic clause, if there are generics, with a visitor.
The generics are separated by semicolons.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package declaration.
Format:
mylib.myPackage- Return type:
- Returns:
String representation of the package declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package declaration.
Format:
Package: 'mylib.myPackage'- Return type:
- Returns:
Formatted package declaration.
- _allowBlackbox
Allow blackboxes for components;
Noneinherits the parent’s setting.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _deferredConstants: dict[str, DeferredConstant]
Deferred constants, indexed by name.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _genericItems
List of all generics, in declaration order.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _packageBody: Nullable[PackageBody]
The corresponding package body, or
Noneif none was analyzed.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.Float_Generic_Pkg[source]
Predefined package
ieee.float_generic_pkg.Inheritance
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- AddGenericItem(genericItem)
Add a generic at the end of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to add.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property AllowBlackbox: bool
Property to return whether a design supports blackboxes, inherited from the parent if not set locally (
_allowBlackbox).Algorithm
If allow blackbox property is locally set, return the local value,
Otherwise, return allow blackbox value from parent object.
- Returns:
True, if blackboxes are allowed.- Raises:
VHDLModelException – If neither a local value is set nor a parent object is available to inherit the value from.
- Setter accepts:
- property Components: dict[str, Component]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DeferredConstants: dict[str, DeferredConstant]
Read-only property to access the deferred constants (
_deferredConstants).- Returns:
Dictionary of deferred constants, indexed by normalized identifier.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- property GenericCount: int
Read-only property to return the number of generics in
_genericItems.- Returns:
The generic count.
- property GenericItems: list[GenericInterfaceItemMixin]
Read-only property to access the generic items (
_genericItems).- Returns:
List of generic items.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
A generic package’s generics share the declarative region of its declarative part.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- InsertGenericItem(index, genericItem)
Insert a generic at a position of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
index (
int) – Position, from0(first) toGenericCount(append). A negative index counts from the end, as forlist.insert():-1inserts before the last generic.genericItem (
GenericInterfaceItemMixin) – The generic to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
- IterateSingleGenericDeclarations(predicate=None)
Iterate all generics per declared identifier, in declaration order.
A generic constant yields one single declaration per identifier:
generic (A, B : positive)yields two. A generic type, subprogram or package declares exactly one identifier and is yielded itself.- Parameters:
predicate (
Callable[[SingleGenericDeclarationMixin|GenericInterfaceItemMixin],bool] |None) – Optional, filter function to select the yielded generics. Default: all.- Return type:
Generator[SingleGenericDeclarationMixin|GenericInterfaceItemMixin]- Returns:
A generator to iterate all (selected) generics.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- MoveGenericItem(genericItem, index)
Move a generic to a position of the generic clause.
The generic stays a generic of this language construct: only the order of the generic clause changes. A generic subprogram is an overload: if the language construct’s namespace is indexed, it refers to the overload declared last afterwards.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to move.index (
int) – Position of the generic after the move, from0(first) toGenericCountminus one (last). A negative index counts from the end, as for alistindex:-1moves the generic to the end.
- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
NotInNamespaceError – If the namespace is indexed, and the identifier of a generic subprogram refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property PackageBody: PackageBody | None
Read-only property to access the package body (
_packageBody).- Returns:
The package body, or
Noneif not set.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- RemoveGenericItem(genericItem)
Remove a generic from the generic clause.
The generic is detached: its parent is cleared and its identifiers are removed from the language construct’s namespace, if it has one. The generic itself is unchanged and can be added to another language construct, or inserted at another position.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to remove.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic isn’t declared in it.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic refers to another element, e.g. a duplicate declaration.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
InsertGenericItem()→ Insert a generic at a position of the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package declaration, its context clause, its generic clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION = False
Trueif it continues its parent’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>, <class 'pyVHDLModel.Object.DeferredConstant'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this package: its generics share the declarative region.
- Return type:
- Returns:
Tuple of declarations: the generics, then the declared items.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexGenericItems()
Add the generics to the host’s namespace; a generic subprogram is an overload.
- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item – The declared item.
- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package.
- Return type:
- Returns:
Tuple of the package body, if linked (
_packageBody).
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Remove a declared item, which a concurrent declaration region doesn’t handle itself.
A deferred constant is removed from
_deferredConstants. An entry referring to another deferred constant of the same identifier (a duplicate declaration) is kept:RemoveDeclaredItem()indexes the region again.- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- _VisitGenericClause(visitor)
Walk the generic clause, if there are generics, with a visitor.
The generics are separated by semicolons.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package declaration.
Format:
mylib.myPackage- Return type:
- Returns:
String representation of the package declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package declaration.
Format:
Package: 'mylib.myPackage'- Return type:
- Returns:
Formatted package declaration.
- _allowBlackbox
Allow blackboxes for components;
Noneinherits the parent’s setting.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _deferredConstants: dict[str, DeferredConstant]
Deferred constants, indexed by name.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _genericItems
List of all generics, in declaration order.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _packageBody: Nullable[PackageBody]
The corresponding package body, or
Noneif none was analyzed.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.Float_Generic_Pkg_Body(packageIdentifier=None)[source]
Predefined package body of package
ieee.float_generic_pkg.Inheritance
- Parameters:
packageIdentifier (str | None)
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- property Components: dict[str, Any]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
Index declared items listed in the concurrent declaration region.
Algorithm
Clear all lookup tables and remove all declared items from
_namespace. Interface items and imported items stay in the namespace.Iterate all declared items:
Every declared item is added to
_namespace, except a protected type body.If the declared item is a
ProtectedTypeBody, skip it: it completes its protected type.If the declared item is a
FullType, then add an entry to_types.If the declared item is a
Subtype, then add an entry to_subtypes.If the declared item is a
Function, then add an entry to_functions.If the declared item is a
Procedure, then add an entry to_procedures.If the declared item is a
Constant, then add an entry to_constants.If the declared item is a
Signal, then add an entry to_signals.If the declared item is a
Variable, TODO.If the declared item is a
SharedVariable, then add an entry to_sharedVariables.If the declared item is a
File, then add an entry to_files.If the declared item is neither of these types, call
_IndexOtherDeclaredItem().
Derived classes may override this virtual function.
Indexing again yields the same lookup tables and namespace.
See also
pyVHDLModel.Design.IndexPackages()Iterate all packages in the design and index declared items.
pyVHDLModel.Library.IndexPackages()Iterate all packages in the library and index declared items.
pyVHDLModel.Library._IndexOtherDeclaredItem()Iterate all packages in the library and index declared items.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property Package: PackageSymbol
Read-only property to access the package (
_package).- Returns:
The package.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package body, its context clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION: ClassVar[bool] = True
A package body continues its package’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this declarative region.
A host class with interface items extends the list by its interface items, listed first.
- Return type:
- Returns:
Tuple of declarations: the declared items, in declaration order.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package body.
- Return type:
- Returns:
Tuple of the package, if linked.
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Hook to remove declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __init__(packageIdentifier=None)
Initializes a predefined package body.
By default the VHDL package name is the Python class name with the trailing
_Bodyremoved. PasspackageIdentifierwhen the two must differ.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package body declaration.
Format:
mylib.myPackage(body)- Return type:
- Returns:
String representation of the package body declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package body declaration.
Format:
Package Body: mylib.myPackage(body)- Return type:
- Returns:
Formatted package body declaration.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _package: PackageSymbol
Reference to the package this body implements.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.Float_Pkg[source]
Predefined package
ieee.float_pkg.Inheritance
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- AddGenericItem(genericItem)
Add a generic at the end of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to add.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property AllowBlackbox: bool
Property to return whether a design supports blackboxes, inherited from the parent if not set locally (
_allowBlackbox).Algorithm
If allow blackbox property is locally set, return the local value,
Otherwise, return allow blackbox value from parent object.
- Returns:
True, if blackboxes are allowed.- Raises:
VHDLModelException – If neither a local value is set nor a parent object is available to inherit the value from.
- Setter accepts:
- property Components: dict[str, Component]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DeferredConstants: dict[str, DeferredConstant]
Read-only property to access the deferred constants (
_deferredConstants).- Returns:
Dictionary of deferred constants, indexed by normalized identifier.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- property GenericCount: int
Read-only property to return the number of generics in
_genericItems.- Returns:
The generic count.
- property GenericItems: list[GenericInterfaceItemMixin]
Read-only property to access the generic items (
_genericItems).- Returns:
List of generic items.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
A generic package’s generics share the declarative region of its declarative part.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- InsertGenericItem(index, genericItem)
Insert a generic at a position of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
index (
int) – Position, from0(first) toGenericCount(append). A negative index counts from the end, as forlist.insert():-1inserts before the last generic.genericItem (
GenericInterfaceItemMixin) – The generic to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
- IterateSingleGenericDeclarations(predicate=None)
Iterate all generics per declared identifier, in declaration order.
A generic constant yields one single declaration per identifier:
generic (A, B : positive)yields two. A generic type, subprogram or package declares exactly one identifier and is yielded itself.- Parameters:
predicate (
Callable[[SingleGenericDeclarationMixin|GenericInterfaceItemMixin],bool] |None) – Optional, filter function to select the yielded generics. Default: all.- Return type:
Generator[SingleGenericDeclarationMixin|GenericInterfaceItemMixin]- Returns:
A generator to iterate all (selected) generics.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- MoveGenericItem(genericItem, index)
Move a generic to a position of the generic clause.
The generic stays a generic of this language construct: only the order of the generic clause changes. A generic subprogram is an overload: if the language construct’s namespace is indexed, it refers to the overload declared last afterwards.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to move.index (
int) – Position of the generic after the move, from0(first) toGenericCountminus one (last). A negative index counts from the end, as for alistindex:-1moves the generic to the end.
- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
NotInNamespaceError – If the namespace is indexed, and the identifier of a generic subprogram refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property PackageBody: PackageBody | None
Read-only property to access the package body (
_packageBody).- Returns:
The package body, or
Noneif not set.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- RemoveGenericItem(genericItem)
Remove a generic from the generic clause.
The generic is detached: its parent is cleared and its identifiers are removed from the language construct’s namespace, if it has one. The generic itself is unchanged and can be added to another language construct, or inserted at another position.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to remove.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic isn’t declared in it.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic refers to another element, e.g. a duplicate declaration.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
InsertGenericItem()→ Insert a generic at a position of the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package declaration, its context clause, its generic clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION = False
Trueif it continues its parent’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>, <class 'pyVHDLModel.Object.DeferredConstant'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this package: its generics share the declarative region.
- Return type:
- Returns:
Tuple of declarations: the generics, then the declared items.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexGenericItems()
Add the generics to the host’s namespace; a generic subprogram is an overload.
- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item – The declared item.
- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package.
- Return type:
- Returns:
Tuple of the package body, if linked (
_packageBody).
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Remove a declared item, which a concurrent declaration region doesn’t handle itself.
A deferred constant is removed from
_deferredConstants. An entry referring to another deferred constant of the same identifier (a duplicate declaration) is kept:RemoveDeclaredItem()indexes the region again.- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- _VisitGenericClause(visitor)
Walk the generic clause, if there are generics, with a visitor.
The generics are separated by semicolons.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package declaration.
Format:
mylib.myPackage- Return type:
- Returns:
String representation of the package declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package declaration.
Format:
Package: 'mylib.myPackage'- Return type:
- Returns:
Formatted package declaration.
- _allowBlackbox
Allow blackboxes for components;
Noneinherits the parent’s setting.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _deferredConstants: dict[str, DeferredConstant]
Deferred constants, indexed by name.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _genericItems
List of all generics, in declaration order.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _packageBody: Nullable[PackageBody]
The corresponding package body, or
Noneif none was analyzed.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.Std_Logic_Arith_MentorGraphics[source]
Predefined Mentor Graphics package
ieee.std_logic_arith.Inheritance
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- AddGenericItem(genericItem)
Add a generic at the end of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to add.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property AllowBlackbox: bool
Property to return whether a design supports blackboxes, inherited from the parent if not set locally (
_allowBlackbox).Algorithm
If allow blackbox property is locally set, return the local value,
Otherwise, return allow blackbox value from parent object.
- Returns:
True, if blackboxes are allowed.- Raises:
VHDLModelException – If neither a local value is set nor a parent object is available to inherit the value from.
- Setter accepts:
- property Components: dict[str, Component]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DeferredConstants: dict[str, DeferredConstant]
Read-only property to access the deferred constants (
_deferredConstants).- Returns:
Dictionary of deferred constants, indexed by normalized identifier.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- property GenericCount: int
Read-only property to return the number of generics in
_genericItems.- Returns:
The generic count.
- property GenericItems: list[GenericInterfaceItemMixin]
Read-only property to access the generic items (
_genericItems).- Returns:
List of generic items.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
A generic package’s generics share the declarative region of its declarative part.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- InsertGenericItem(index, genericItem)
Insert a generic at a position of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
index (
int) – Position, from0(first) toGenericCount(append). A negative index counts from the end, as forlist.insert():-1inserts before the last generic.genericItem (
GenericInterfaceItemMixin) – The generic to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
- IterateSingleGenericDeclarations(predicate=None)
Iterate all generics per declared identifier, in declaration order.
A generic constant yields one single declaration per identifier:
generic (A, B : positive)yields two. A generic type, subprogram or package declares exactly one identifier and is yielded itself.- Parameters:
predicate (
Callable[[SingleGenericDeclarationMixin|GenericInterfaceItemMixin],bool] |None) – Optional, filter function to select the yielded generics. Default: all.- Return type:
Generator[SingleGenericDeclarationMixin|GenericInterfaceItemMixin]- Returns:
A generator to iterate all (selected) generics.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- MoveGenericItem(genericItem, index)
Move a generic to a position of the generic clause.
The generic stays a generic of this language construct: only the order of the generic clause changes. A generic subprogram is an overload: if the language construct’s namespace is indexed, it refers to the overload declared last afterwards.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to move.index (
int) – Position of the generic after the move, from0(first) toGenericCountminus one (last). A negative index counts from the end, as for alistindex:-1moves the generic to the end.
- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
NotInNamespaceError – If the namespace is indexed, and the identifier of a generic subprogram refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property PackageBody: PackageBody | None
Read-only property to access the package body (
_packageBody).- Returns:
The package body, or
Noneif not set.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- RemoveGenericItem(genericItem)
Remove a generic from the generic clause.
The generic is detached: its parent is cleared and its identifiers are removed from the language construct’s namespace, if it has one. The generic itself is unchanged and can be added to another language construct, or inserted at another position.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to remove.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic isn’t declared in it.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic refers to another element, e.g. a duplicate declaration.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
InsertGenericItem()→ Insert a generic at a position of the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package declaration, its context clause, its generic clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION = False
Trueif it continues its parent’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>, <class 'pyVHDLModel.Object.DeferredConstant'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this package: its generics share the declarative region.
- Return type:
- Returns:
Tuple of declarations: the generics, then the declared items.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexGenericItems()
Add the generics to the host’s namespace; a generic subprogram is an overload.
- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item – The declared item.
- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package.
- Return type:
- Returns:
Tuple of the package body, if linked (
_packageBody).
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Remove a declared item, which a concurrent declaration region doesn’t handle itself.
A deferred constant is removed from
_deferredConstants. An entry referring to another deferred constant of the same identifier (a duplicate declaration) is kept:RemoveDeclaredItem()indexes the region again.- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- _VisitGenericClause(visitor)
Walk the generic clause, if there are generics, with a visitor.
The generics are separated by semicolons.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package declaration.
Format:
mylib.myPackage- Return type:
- Returns:
String representation of the package declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package declaration.
Format:
Package: 'mylib.myPackage'- Return type:
- Returns:
Formatted package declaration.
- _allowBlackbox
Allow blackboxes for components;
Noneinherits the parent’s setting.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _deferredConstants: dict[str, DeferredConstant]
Deferred constants, indexed by name.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _genericItems
List of all generics, in declaration order.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _packageBody: Nullable[PackageBody]
The corresponding package body, or
Noneif none was analyzed.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.Std_Logic_Arith_Body_MentorGraphics[source]
Predefined package body of Mentor Graphics package
ieee.std_logic_arith.Inheritance
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- property Components: dict[str, Any]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
Index declared items listed in the concurrent declaration region.
Algorithm
Clear all lookup tables and remove all declared items from
_namespace. Interface items and imported items stay in the namespace.Iterate all declared items:
Every declared item is added to
_namespace, except a protected type body.If the declared item is a
ProtectedTypeBody, skip it: it completes its protected type.If the declared item is a
FullType, then add an entry to_types.If the declared item is a
Subtype, then add an entry to_subtypes.If the declared item is a
Function, then add an entry to_functions.If the declared item is a
Procedure, then add an entry to_procedures.If the declared item is a
Constant, then add an entry to_constants.If the declared item is a
Signal, then add an entry to_signals.If the declared item is a
Variable, TODO.If the declared item is a
SharedVariable, then add an entry to_sharedVariables.If the declared item is a
File, then add an entry to_files.If the declared item is neither of these types, call
_IndexOtherDeclaredItem().
Derived classes may override this virtual function.
Indexing again yields the same lookup tables and namespace.
See also
pyVHDLModel.Design.IndexPackages()Iterate all packages in the design and index declared items.
pyVHDLModel.Library.IndexPackages()Iterate all packages in the library and index declared items.
pyVHDLModel.Library._IndexOtherDeclaredItem()Iterate all packages in the library and index declared items.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property Package: PackageSymbol
Read-only property to access the package (
_package).- Returns:
The package.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package body, its context clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION: ClassVar[bool] = True
A package body continues its package’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this declarative region.
A host class with interface items extends the list by its interface items, listed first.
- Return type:
- Returns:
Tuple of declarations: the declared items, in declaration order.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package body.
- Return type:
- Returns:
Tuple of the package, if linked.
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Hook to remove declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package body declaration.
Format:
mylib.myPackage(body)- Return type:
- Returns:
String representation of the package body declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package body declaration.
Format:
Package Body: mylib.myPackage(body)- Return type:
- Returns:
Formatted package body declaration.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _package: PackageSymbol
Reference to the package this body implements.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.VITAL_Timing[source]
Predefined package
ieee.VITAL_Timing.Inheritance
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- AddGenericItem(genericItem)
Add a generic at the end of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to add.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property AllowBlackbox: bool
Property to return whether a design supports blackboxes, inherited from the parent if not set locally (
_allowBlackbox).Algorithm
If allow blackbox property is locally set, return the local value,
Otherwise, return allow blackbox value from parent object.
- Returns:
True, if blackboxes are allowed.- Raises:
VHDLModelException – If neither a local value is set nor a parent object is available to inherit the value from.
- Setter accepts:
- property Components: dict[str, Component]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DeferredConstants: dict[str, DeferredConstant]
Read-only property to access the deferred constants (
_deferredConstants).- Returns:
Dictionary of deferred constants, indexed by normalized identifier.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- property GenericCount: int
Read-only property to return the number of generics in
_genericItems.- Returns:
The generic count.
- property GenericItems: list[GenericInterfaceItemMixin]
Read-only property to access the generic items (
_genericItems).- Returns:
List of generic items.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
A generic package’s generics share the declarative region of its declarative part.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- InsertGenericItem(index, genericItem)
Insert a generic at a position of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
index (
int) – Position, from0(first) toGenericCount(append). A negative index counts from the end, as forlist.insert():-1inserts before the last generic.genericItem (
GenericInterfaceItemMixin) – The generic to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
- IterateSingleGenericDeclarations(predicate=None)
Iterate all generics per declared identifier, in declaration order.
A generic constant yields one single declaration per identifier:
generic (A, B : positive)yields two. A generic type, subprogram or package declares exactly one identifier and is yielded itself.- Parameters:
predicate (
Callable[[SingleGenericDeclarationMixin|GenericInterfaceItemMixin],bool] |None) – Optional, filter function to select the yielded generics. Default: all.- Return type:
Generator[SingleGenericDeclarationMixin|GenericInterfaceItemMixin]- Returns:
A generator to iterate all (selected) generics.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- MoveGenericItem(genericItem, index)
Move a generic to a position of the generic clause.
The generic stays a generic of this language construct: only the order of the generic clause changes. A generic subprogram is an overload: if the language construct’s namespace is indexed, it refers to the overload declared last afterwards.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to move.index (
int) – Position of the generic after the move, from0(first) toGenericCountminus one (last). A negative index counts from the end, as for alistindex:-1moves the generic to the end.
- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
NotInNamespaceError – If the namespace is indexed, and the identifier of a generic subprogram refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property PackageBody: PackageBody | None
Read-only property to access the package body (
_packageBody).- Returns:
The package body, or
Noneif not set.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- RemoveGenericItem(genericItem)
Remove a generic from the generic clause.
The generic is detached: its parent is cleared and its identifiers are removed from the language construct’s namespace, if it has one. The generic itself is unchanged and can be added to another language construct, or inserted at another position.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to remove.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic isn’t declared in it.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic refers to another element, e.g. a duplicate declaration.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
InsertGenericItem()→ Insert a generic at a position of the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package declaration, its context clause, its generic clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION = False
Trueif it continues its parent’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>, <class 'pyVHDLModel.Object.DeferredConstant'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this package: its generics share the declarative region.
- Return type:
- Returns:
Tuple of declarations: the generics, then the declared items.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexGenericItems()
Add the generics to the host’s namespace; a generic subprogram is an overload.
- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item – The declared item.
- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package.
- Return type:
- Returns:
Tuple of the package body, if linked (
_packageBody).
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Remove a declared item, which a concurrent declaration region doesn’t handle itself.
A deferred constant is removed from
_deferredConstants. An entry referring to another deferred constant of the same identifier (a duplicate declaration) is kept:RemoveDeclaredItem()indexes the region again.- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- _VisitGenericClause(visitor)
Walk the generic clause, if there are generics, with a visitor.
The generics are separated by semicolons.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package declaration.
Format:
mylib.myPackage- Return type:
- Returns:
String representation of the package declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package declaration.
Format:
Package: 'mylib.myPackage'- Return type:
- Returns:
Formatted package declaration.
- _allowBlackbox
Allow blackboxes for components;
Noneinherits the parent’s setting.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _deferredConstants: dict[str, DeferredConstant]
Deferred constants, indexed by name.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _genericItems
List of all generics, in declaration order.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _packageBody: Nullable[PackageBody]
The corresponding package body, or
Noneif none was analyzed.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.VITAL_Timing_Body[source]
Predefined package body of package
ieee.VITAL_Timing.Inheritance
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- property Components: dict[str, Any]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
Index declared items listed in the concurrent declaration region.
Algorithm
Clear all lookup tables and remove all declared items from
_namespace. Interface items and imported items stay in the namespace.Iterate all declared items:
Every declared item is added to
_namespace, except a protected type body.If the declared item is a
ProtectedTypeBody, skip it: it completes its protected type.If the declared item is a
FullType, then add an entry to_types.If the declared item is a
Subtype, then add an entry to_subtypes.If the declared item is a
Function, then add an entry to_functions.If the declared item is a
Procedure, then add an entry to_procedures.If the declared item is a
Constant, then add an entry to_constants.If the declared item is a
Signal, then add an entry to_signals.If the declared item is a
Variable, TODO.If the declared item is a
SharedVariable, then add an entry to_sharedVariables.If the declared item is a
File, then add an entry to_files.If the declared item is neither of these types, call
_IndexOtherDeclaredItem().
Derived classes may override this virtual function.
Indexing again yields the same lookup tables and namespace.
See also
pyVHDLModel.Design.IndexPackages()Iterate all packages in the design and index declared items.
pyVHDLModel.Library.IndexPackages()Iterate all packages in the library and index declared items.
pyVHDLModel.Library._IndexOtherDeclaredItem()Iterate all packages in the library and index declared items.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property Package: PackageSymbol
Read-only property to access the package (
_package).- Returns:
The package.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package body, its context clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION: ClassVar[bool] = True
A package body continues its package’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this declarative region.
A host class with interface items extends the list by its interface items, listed first.
- Return type:
- Returns:
Tuple of declarations: the declared items, in declaration order.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package body.
- Return type:
- Returns:
Tuple of the package, if linked.
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Hook to remove declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package body declaration.
Format:
mylib.myPackage(body)- Return type:
- Returns:
String representation of the package body declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package body declaration.
Format:
Package Body: mylib.myPackage(body)- Return type:
- Returns:
Formatted package body declaration.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _package: PackageSymbol
Reference to the package this body implements.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.VITAL_Primitives[source]
Predefined package
ieee.VITAL_Primitives.Inheritance
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- AddGenericItem(genericItem)
Add a generic at the end of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to add.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property AllowBlackbox: bool
Property to return whether a design supports blackboxes, inherited from the parent if not set locally (
_allowBlackbox).Algorithm
If allow blackbox property is locally set, return the local value,
Otherwise, return allow blackbox value from parent object.
- Returns:
True, if blackboxes are allowed.- Raises:
VHDLModelException – If neither a local value is set nor a parent object is available to inherit the value from.
- Setter accepts:
- property Components: dict[str, Component]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DeferredConstants: dict[str, DeferredConstant]
Read-only property to access the deferred constants (
_deferredConstants).- Returns:
Dictionary of deferred constants, indexed by normalized identifier.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- property GenericCount: int
Read-only property to return the number of generics in
_genericItems.- Returns:
The generic count.
- property GenericItems: list[GenericInterfaceItemMixin]
Read-only property to access the generic items (
_genericItems).- Returns:
List of generic items.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
A generic package’s generics share the declarative region of its declarative part.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- InsertGenericItem(index, genericItem)
Insert a generic at a position of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
index (
int) – Position, from0(first) toGenericCount(append). A negative index counts from the end, as forlist.insert():-1inserts before the last generic.genericItem (
GenericInterfaceItemMixin) – The generic to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
- IterateSingleGenericDeclarations(predicate=None)
Iterate all generics per declared identifier, in declaration order.
A generic constant yields one single declaration per identifier:
generic (A, B : positive)yields two. A generic type, subprogram or package declares exactly one identifier and is yielded itself.- Parameters:
predicate (
Callable[[SingleGenericDeclarationMixin|GenericInterfaceItemMixin],bool] |None) – Optional, filter function to select the yielded generics. Default: all.- Return type:
Generator[SingleGenericDeclarationMixin|GenericInterfaceItemMixin]- Returns:
A generator to iterate all (selected) generics.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- MoveGenericItem(genericItem, index)
Move a generic to a position of the generic clause.
The generic stays a generic of this language construct: only the order of the generic clause changes. A generic subprogram is an overload: if the language construct’s namespace is indexed, it refers to the overload declared last afterwards.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to move.index (
int) – Position of the generic after the move, from0(first) toGenericCountminus one (last). A negative index counts from the end, as for alistindex:-1moves the generic to the end.
- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
NotInNamespaceError – If the namespace is indexed, and the identifier of a generic subprogram refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property PackageBody: PackageBody | None
Read-only property to access the package body (
_packageBody).- Returns:
The package body, or
Noneif not set.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- RemoveGenericItem(genericItem)
Remove a generic from the generic clause.
The generic is detached: its parent is cleared and its identifiers are removed from the language construct’s namespace, if it has one. The generic itself is unchanged and can be added to another language construct, or inserted at another position.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to remove.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic isn’t declared in it.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic refers to another element, e.g. a duplicate declaration.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
InsertGenericItem()→ Insert a generic at a position of the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package declaration, its context clause, its generic clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION = False
Trueif it continues its parent’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>, <class 'pyVHDLModel.Object.DeferredConstant'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this package: its generics share the declarative region.
- Return type:
- Returns:
Tuple of declarations: the generics, then the declared items.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexGenericItems()
Add the generics to the host’s namespace; a generic subprogram is an overload.
- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item – The declared item.
- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package.
- Return type:
- Returns:
Tuple of the package body, if linked (
_packageBody).
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Remove a declared item, which a concurrent declaration region doesn’t handle itself.
A deferred constant is removed from
_deferredConstants. An entry referring to another deferred constant of the same identifier (a duplicate declaration) is kept:RemoveDeclaredItem()indexes the region again.- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- _VisitGenericClause(visitor)
Walk the generic clause, if there are generics, with a visitor.
The generics are separated by semicolons.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package declaration.
Format:
mylib.myPackage- Return type:
- Returns:
String representation of the package declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package declaration.
Format:
Package: 'mylib.myPackage'- Return type:
- Returns:
Formatted package declaration.
- _allowBlackbox
Allow blackboxes for components;
Noneinherits the parent’s setting.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _deferredConstants: dict[str, DeferredConstant]
Deferred constants, indexed by name.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _genericItems
List of all generics, in declaration order.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _packageBody: Nullable[PackageBody]
The corresponding package body, or
Noneif none was analyzed.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.VITAL_Primitives_Body[source]
Predefined package body of package
ieee.VITAL_Primitives.Inheritance
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- property Components: dict[str, Any]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
Index declared items listed in the concurrent declaration region.
Algorithm
Clear all lookup tables and remove all declared items from
_namespace. Interface items and imported items stay in the namespace.Iterate all declared items:
Every declared item is added to
_namespace, except a protected type body.If the declared item is a
ProtectedTypeBody, skip it: it completes its protected type.If the declared item is a
FullType, then add an entry to_types.If the declared item is a
Subtype, then add an entry to_subtypes.If the declared item is a
Function, then add an entry to_functions.If the declared item is a
Procedure, then add an entry to_procedures.If the declared item is a
Constant, then add an entry to_constants.If the declared item is a
Signal, then add an entry to_signals.If the declared item is a
Variable, TODO.If the declared item is a
SharedVariable, then add an entry to_sharedVariables.If the declared item is a
File, then add an entry to_files.If the declared item is neither of these types, call
_IndexOtherDeclaredItem().
Derived classes may override this virtual function.
Indexing again yields the same lookup tables and namespace.
See also
pyVHDLModel.Design.IndexPackages()Iterate all packages in the design and index declared items.
pyVHDLModel.Library.IndexPackages()Iterate all packages in the library and index declared items.
pyVHDLModel.Library._IndexOtherDeclaredItem()Iterate all packages in the library and index declared items.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property Package: PackageSymbol
Read-only property to access the package (
_package).- Returns:
The package.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package body, its context clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION: ClassVar[bool] = True
A package body continues its package’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this declarative region.
A host class with interface items extends the list by its interface items, listed first.
- Return type:
- Returns:
Tuple of declarations: the declared items, in declaration order.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package body.
- Return type:
- Returns:
Tuple of the package, if linked.
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Hook to remove declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package body declaration.
Format:
mylib.myPackage(body)- Return type:
- Returns:
String representation of the package body declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package body declaration.
Format:
Package Body: mylib.myPackage(body)- Return type:
- Returns:
Formatted package body declaration.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _package: PackageSymbol
Reference to the package this body implements.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.VITAL_Memory[source]
Predefined package
ieee.VITAL_Memory.Inheritance
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- AddGenericItem(genericItem)
Add a generic at the end of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to add.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property AllowBlackbox: bool
Property to return whether a design supports blackboxes, inherited from the parent if not set locally (
_allowBlackbox).Algorithm
If allow blackbox property is locally set, return the local value,
Otherwise, return allow blackbox value from parent object.
- Returns:
True, if blackboxes are allowed.- Raises:
VHDLModelException – If neither a local value is set nor a parent object is available to inherit the value from.
- Setter accepts:
- property Components: dict[str, Component]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DeferredConstants: dict[str, DeferredConstant]
Read-only property to access the deferred constants (
_deferredConstants).- Returns:
Dictionary of deferred constants, indexed by normalized identifier.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- property GenericCount: int
Read-only property to return the number of generics in
_genericItems.- Returns:
The generic count.
- property GenericItems: list[GenericInterfaceItemMixin]
Read-only property to access the generic items (
_genericItems).- Returns:
List of generic items.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
A generic package’s generics share the declarative region of its declarative part.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- InsertGenericItem(index, genericItem)
Insert a generic at a position of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
index (
int) – Position, from0(first) toGenericCount(append). A negative index counts from the end, as forlist.insert():-1inserts before the last generic.genericItem (
GenericInterfaceItemMixin) – The generic to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
- IterateSingleGenericDeclarations(predicate=None)
Iterate all generics per declared identifier, in declaration order.
A generic constant yields one single declaration per identifier:
generic (A, B : positive)yields two. A generic type, subprogram or package declares exactly one identifier and is yielded itself.- Parameters:
predicate (
Callable[[SingleGenericDeclarationMixin|GenericInterfaceItemMixin],bool] |None) – Optional, filter function to select the yielded generics. Default: all.- Return type:
Generator[SingleGenericDeclarationMixin|GenericInterfaceItemMixin]- Returns:
A generator to iterate all (selected) generics.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- MoveGenericItem(genericItem, index)
Move a generic to a position of the generic clause.
The generic stays a generic of this language construct: only the order of the generic clause changes. A generic subprogram is an overload: if the language construct’s namespace is indexed, it refers to the overload declared last afterwards.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to move.index (
int) – Position of the generic after the move, from0(first) toGenericCountminus one (last). A negative index counts from the end, as for alistindex:-1moves the generic to the end.
- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
NotInNamespaceError – If the namespace is indexed, and the identifier of a generic subprogram refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property PackageBody: PackageBody | None
Read-only property to access the package body (
_packageBody).- Returns:
The package body, or
Noneif not set.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- RemoveGenericItem(genericItem)
Remove a generic from the generic clause.
The generic is detached: its parent is cleared and its identifiers are removed from the language construct’s namespace, if it has one. The generic itself is unchanged and can be added to another language construct, or inserted at another position.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to remove.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic isn’t declared in it.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic refers to another element, e.g. a duplicate declaration.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
InsertGenericItem()→ Insert a generic at a position of the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package declaration, its context clause, its generic clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION = False
Trueif it continues its parent’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>, <class 'pyVHDLModel.Object.DeferredConstant'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this package: its generics share the declarative region.
- Return type:
- Returns:
Tuple of declarations: the generics, then the declared items.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexGenericItems()
Add the generics to the host’s namespace; a generic subprogram is an overload.
- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item – The declared item.
- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package.
- Return type:
- Returns:
Tuple of the package body, if linked (
_packageBody).
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Remove a declared item, which a concurrent declaration region doesn’t handle itself.
A deferred constant is removed from
_deferredConstants. An entry referring to another deferred constant of the same identifier (a duplicate declaration) is kept:RemoveDeclaredItem()indexes the region again.- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- _VisitGenericClause(visitor)
Walk the generic clause, if there are generics, with a visitor.
The generics are separated by semicolons.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package declaration.
Format:
mylib.myPackage- Return type:
- Returns:
String representation of the package declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package declaration.
Format:
Package: 'mylib.myPackage'- Return type:
- Returns:
Formatted package declaration.
- _allowBlackbox
Allow blackboxes for components;
Noneinherits the parent’s setting.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _deferredConstants: dict[str, DeferredConstant]
Deferred constants, indexed by name.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _genericItems
List of all generics, in declaration order.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _packageBody: Nullable[PackageBody]
The corresponding package body, or
Noneif none was analyzed.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.VITAL_Memory_Body[source]
Predefined package body of package
ieee.VITAL_Memory.Inheritance
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- property Components: dict[str, Any]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
Index declared items listed in the concurrent declaration region.
Algorithm
Clear all lookup tables and remove all declared items from
_namespace. Interface items and imported items stay in the namespace.Iterate all declared items:
Every declared item is added to
_namespace, except a protected type body.If the declared item is a
ProtectedTypeBody, skip it: it completes its protected type.If the declared item is a
FullType, then add an entry to_types.If the declared item is a
Subtype, then add an entry to_subtypes.If the declared item is a
Function, then add an entry to_functions.If the declared item is a
Procedure, then add an entry to_procedures.If the declared item is a
Constant, then add an entry to_constants.If the declared item is a
Signal, then add an entry to_signals.If the declared item is a
Variable, TODO.If the declared item is a
SharedVariable, then add an entry to_sharedVariables.If the declared item is a
File, then add an entry to_files.If the declared item is neither of these types, call
_IndexOtherDeclaredItem().
Derived classes may override this virtual function.
Indexing again yields the same lookup tables and namespace.
See also
pyVHDLModel.Design.IndexPackages()Iterate all packages in the design and index declared items.
pyVHDLModel.Library.IndexPackages()Iterate all packages in the library and index declared items.
pyVHDLModel.Library._IndexOtherDeclaredItem()Iterate all packages in the library and index declared items.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property Package: PackageSymbol
Read-only property to access the package (
_package).- Returns:
The package.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package body, its context clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION: ClassVar[bool] = True
A package body continues its package’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this declarative region.
A host class with interface items extends the list by its interface items, listed first.
- Return type:
- Returns:
Tuple of declarations: the declared items, in declaration order.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package body.
- Return type:
- Returns:
Tuple of the package, if linked.
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Hook to remove declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package body declaration.
Format:
mylib.myPackage(body)- Return type:
- Returns:
String representation of the package body declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package body declaration.
Format:
Package Body: mylib.myPackage(body)- Return type:
- Returns:
Formatted package body declaration.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _package: PackageSymbol
Reference to the package this body implements.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.Std_Logic_Arith_Synopsys[source]
Predefined Synopsys package
ieee.std_logic_arith.Inheritance
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- AddGenericItem(genericItem)
Add a generic at the end of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to add.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property AllowBlackbox: bool
Property to return whether a design supports blackboxes, inherited from the parent if not set locally (
_allowBlackbox).Algorithm
If allow blackbox property is locally set, return the local value,
Otherwise, return allow blackbox value from parent object.
- Returns:
True, if blackboxes are allowed.- Raises:
VHDLModelException – If neither a local value is set nor a parent object is available to inherit the value from.
- Setter accepts:
- property Components: dict[str, Component]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DeferredConstants: dict[str, DeferredConstant]
Read-only property to access the deferred constants (
_deferredConstants).- Returns:
Dictionary of deferred constants, indexed by normalized identifier.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- property GenericCount: int
Read-only property to return the number of generics in
_genericItems.- Returns:
The generic count.
- property GenericItems: list[GenericInterfaceItemMixin]
Read-only property to access the generic items (
_genericItems).- Returns:
List of generic items.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
A generic package’s generics share the declarative region of its declarative part.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- InsertGenericItem(index, genericItem)
Insert a generic at a position of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
index (
int) – Position, from0(first) toGenericCount(append). A negative index counts from the end, as forlist.insert():-1inserts before the last generic.genericItem (
GenericInterfaceItemMixin) – The generic to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
- IterateSingleGenericDeclarations(predicate=None)
Iterate all generics per declared identifier, in declaration order.
A generic constant yields one single declaration per identifier:
generic (A, B : positive)yields two. A generic type, subprogram or package declares exactly one identifier and is yielded itself.- Parameters:
predicate (
Callable[[SingleGenericDeclarationMixin|GenericInterfaceItemMixin],bool] |None) – Optional, filter function to select the yielded generics. Default: all.- Return type:
Generator[SingleGenericDeclarationMixin|GenericInterfaceItemMixin]- Returns:
A generator to iterate all (selected) generics.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- MoveGenericItem(genericItem, index)
Move a generic to a position of the generic clause.
The generic stays a generic of this language construct: only the order of the generic clause changes. A generic subprogram is an overload: if the language construct’s namespace is indexed, it refers to the overload declared last afterwards.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to move.index (
int) – Position of the generic after the move, from0(first) toGenericCountminus one (last). A negative index counts from the end, as for alistindex:-1moves the generic to the end.
- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
NotInNamespaceError – If the namespace is indexed, and the identifier of a generic subprogram refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property PackageBody: PackageBody | None
Read-only property to access the package body (
_packageBody).- Returns:
The package body, or
Noneif not set.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- RemoveGenericItem(genericItem)
Remove a generic from the generic clause.
The generic is detached: its parent is cleared and its identifiers are removed from the language construct’s namespace, if it has one. The generic itself is unchanged and can be added to another language construct, or inserted at another position.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to remove.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic isn’t declared in it.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic refers to another element, e.g. a duplicate declaration.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
InsertGenericItem()→ Insert a generic at a position of the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package declaration, its context clause, its generic clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION = False
Trueif it continues its parent’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>, <class 'pyVHDLModel.Object.DeferredConstant'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this package: its generics share the declarative region.
- Return type:
- Returns:
Tuple of declarations: the generics, then the declared items.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexGenericItems()
Add the generics to the host’s namespace; a generic subprogram is an overload.
- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item – The declared item.
- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package.
- Return type:
- Returns:
Tuple of the package body, if linked (
_packageBody).
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Remove a declared item, which a concurrent declaration region doesn’t handle itself.
A deferred constant is removed from
_deferredConstants. An entry referring to another deferred constant of the same identifier (a duplicate declaration) is kept:RemoveDeclaredItem()indexes the region again.- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- _VisitGenericClause(visitor)
Walk the generic clause, if there are generics, with a visitor.
The generics are separated by semicolons.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package declaration.
Format:
mylib.myPackage- Return type:
- Returns:
String representation of the package declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package declaration.
Format:
Package: 'mylib.myPackage'- Return type:
- Returns:
Formatted package declaration.
- _allowBlackbox
Allow blackboxes for components;
Noneinherits the parent’s setting.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _deferredConstants: dict[str, DeferredConstant]
Deferred constants, indexed by name.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _genericItems
List of all generics, in declaration order.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _packageBody: Nullable[PackageBody]
The corresponding package body, or
Noneif none was analyzed.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.Std_Logic_Misc[source]
Predefined Synopsys package
ieee.std_logic_misc.Inheritance
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- AddGenericItem(genericItem)
Add a generic at the end of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to add.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property AllowBlackbox: bool
Property to return whether a design supports blackboxes, inherited from the parent if not set locally (
_allowBlackbox).Algorithm
If allow blackbox property is locally set, return the local value,
Otherwise, return allow blackbox value from parent object.
- Returns:
True, if blackboxes are allowed.- Raises:
VHDLModelException – If neither a local value is set nor a parent object is available to inherit the value from.
- Setter accepts:
- property Components: dict[str, Component]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DeferredConstants: dict[str, DeferredConstant]
Read-only property to access the deferred constants (
_deferredConstants).- Returns:
Dictionary of deferred constants, indexed by normalized identifier.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- property GenericCount: int
Read-only property to return the number of generics in
_genericItems.- Returns:
The generic count.
- property GenericItems: list[GenericInterfaceItemMixin]
Read-only property to access the generic items (
_genericItems).- Returns:
List of generic items.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
A generic package’s generics share the declarative region of its declarative part.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- InsertGenericItem(index, genericItem)
Insert a generic at a position of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
index (
int) – Position, from0(first) toGenericCount(append). A negative index counts from the end, as forlist.insert():-1inserts before the last generic.genericItem (
GenericInterfaceItemMixin) – The generic to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
- IterateSingleGenericDeclarations(predicate=None)
Iterate all generics per declared identifier, in declaration order.
A generic constant yields one single declaration per identifier:
generic (A, B : positive)yields two. A generic type, subprogram or package declares exactly one identifier and is yielded itself.- Parameters:
predicate (
Callable[[SingleGenericDeclarationMixin|GenericInterfaceItemMixin],bool] |None) – Optional, filter function to select the yielded generics. Default: all.- Return type:
Generator[SingleGenericDeclarationMixin|GenericInterfaceItemMixin]- Returns:
A generator to iterate all (selected) generics.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- MoveGenericItem(genericItem, index)
Move a generic to a position of the generic clause.
The generic stays a generic of this language construct: only the order of the generic clause changes. A generic subprogram is an overload: if the language construct’s namespace is indexed, it refers to the overload declared last afterwards.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to move.index (
int) – Position of the generic after the move, from0(first) toGenericCountminus one (last). A negative index counts from the end, as for alistindex:-1moves the generic to the end.
- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
NotInNamespaceError – If the namespace is indexed, and the identifier of a generic subprogram refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property PackageBody: PackageBody | None
Read-only property to access the package body (
_packageBody).- Returns:
The package body, or
Noneif not set.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- RemoveGenericItem(genericItem)
Remove a generic from the generic clause.
The generic is detached: its parent is cleared and its identifiers are removed from the language construct’s namespace, if it has one. The generic itself is unchanged and can be added to another language construct, or inserted at another position.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to remove.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic isn’t declared in it.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic refers to another element, e.g. a duplicate declaration.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
InsertGenericItem()→ Insert a generic at a position of the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package declaration, its context clause, its generic clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION = False
Trueif it continues its parent’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>, <class 'pyVHDLModel.Object.DeferredConstant'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this package: its generics share the declarative region.
- Return type:
- Returns:
Tuple of declarations: the generics, then the declared items.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexGenericItems()
Add the generics to the host’s namespace; a generic subprogram is an overload.
- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item – The declared item.
- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package.
- Return type:
- Returns:
Tuple of the package body, if linked (
_packageBody).
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Remove a declared item, which a concurrent declaration region doesn’t handle itself.
A deferred constant is removed from
_deferredConstants. An entry referring to another deferred constant of the same identifier (a duplicate declaration) is kept:RemoveDeclaredItem()indexes the region again.- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- _VisitGenericClause(visitor)
Walk the generic clause, if there are generics, with a visitor.
The generics are separated by semicolons.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package declaration.
Format:
mylib.myPackage- Return type:
- Returns:
String representation of the package declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package declaration.
Format:
Package: 'mylib.myPackage'- Return type:
- Returns:
Formatted package declaration.
- _allowBlackbox
Allow blackboxes for components;
Noneinherits the parent’s setting.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _deferredConstants: dict[str, DeferredConstant]
Deferred constants, indexed by name.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _genericItems
List of all generics, in declaration order.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _packageBody: Nullable[PackageBody]
The corresponding package body, or
Noneif none was analyzed.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.Std_Logic_Misc_Body(packageIdentifier=None)[source]
Predefined package body of Synopsys package
ieee.std_logic_misc.Inheritance
- Parameters:
packageIdentifier (str | None)
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- property Components: dict[str, Any]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
Index declared items listed in the concurrent declaration region.
Algorithm
Clear all lookup tables and remove all declared items from
_namespace. Interface items and imported items stay in the namespace.Iterate all declared items:
Every declared item is added to
_namespace, except a protected type body.If the declared item is a
ProtectedTypeBody, skip it: it completes its protected type.If the declared item is a
FullType, then add an entry to_types.If the declared item is a
Subtype, then add an entry to_subtypes.If the declared item is a
Function, then add an entry to_functions.If the declared item is a
Procedure, then add an entry to_procedures.If the declared item is a
Constant, then add an entry to_constants.If the declared item is a
Signal, then add an entry to_signals.If the declared item is a
Variable, TODO.If the declared item is a
SharedVariable, then add an entry to_sharedVariables.If the declared item is a
File, then add an entry to_files.If the declared item is neither of these types, call
_IndexOtherDeclaredItem().
Derived classes may override this virtual function.
Indexing again yields the same lookup tables and namespace.
See also
pyVHDLModel.Design.IndexPackages()Iterate all packages in the design and index declared items.
pyVHDLModel.Library.IndexPackages()Iterate all packages in the library and index declared items.
pyVHDLModel.Library._IndexOtherDeclaredItem()Iterate all packages in the library and index declared items.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property Package: PackageSymbol
Read-only property to access the package (
_package).- Returns:
The package.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package body, its context clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION: ClassVar[bool] = True
A package body continues its package’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this declarative region.
A host class with interface items extends the list by its interface items, listed first.
- Return type:
- Returns:
Tuple of declarations: the declared items, in declaration order.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package body.
- Return type:
- Returns:
Tuple of the package, if linked.
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Hook to remove declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __init__(packageIdentifier=None)
Initializes a predefined package body.
By default the VHDL package name is the Python class name with the trailing
_Bodyremoved. PasspackageIdentifierwhen the two must differ.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package body declaration.
Format:
mylib.myPackage(body)- Return type:
- Returns:
String representation of the package body declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package body declaration.
Format:
Package Body: mylib.myPackage(body)- Return type:
- Returns:
Formatted package body declaration.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _package: PackageSymbol
Reference to the package this body implements.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.Std_Logic_Signed[source]
Predefined Synopsys package
ieee.std_logic_signed.Inheritance
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- AddGenericItem(genericItem)
Add a generic at the end of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to add.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property AllowBlackbox: bool
Property to return whether a design supports blackboxes, inherited from the parent if not set locally (
_allowBlackbox).Algorithm
If allow blackbox property is locally set, return the local value,
Otherwise, return allow blackbox value from parent object.
- Returns:
True, if blackboxes are allowed.- Raises:
VHDLModelException – If neither a local value is set nor a parent object is available to inherit the value from.
- Setter accepts:
- property Components: dict[str, Component]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DeferredConstants: dict[str, DeferredConstant]
Read-only property to access the deferred constants (
_deferredConstants).- Returns:
Dictionary of deferred constants, indexed by normalized identifier.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- property GenericCount: int
Read-only property to return the number of generics in
_genericItems.- Returns:
The generic count.
- property GenericItems: list[GenericInterfaceItemMixin]
Read-only property to access the generic items (
_genericItems).- Returns:
List of generic items.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
A generic package’s generics share the declarative region of its declarative part.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- InsertGenericItem(index, genericItem)
Insert a generic at a position of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
index (
int) – Position, from0(first) toGenericCount(append). A negative index counts from the end, as forlist.insert():-1inserts before the last generic.genericItem (
GenericInterfaceItemMixin) – The generic to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
- IterateSingleGenericDeclarations(predicate=None)
Iterate all generics per declared identifier, in declaration order.
A generic constant yields one single declaration per identifier:
generic (A, B : positive)yields two. A generic type, subprogram or package declares exactly one identifier and is yielded itself.- Parameters:
predicate (
Callable[[SingleGenericDeclarationMixin|GenericInterfaceItemMixin],bool] |None) – Optional, filter function to select the yielded generics. Default: all.- Return type:
Generator[SingleGenericDeclarationMixin|GenericInterfaceItemMixin]- Returns:
A generator to iterate all (selected) generics.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- MoveGenericItem(genericItem, index)
Move a generic to a position of the generic clause.
The generic stays a generic of this language construct: only the order of the generic clause changes. A generic subprogram is an overload: if the language construct’s namespace is indexed, it refers to the overload declared last afterwards.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to move.index (
int) – Position of the generic after the move, from0(first) toGenericCountminus one (last). A negative index counts from the end, as for alistindex:-1moves the generic to the end.
- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
NotInNamespaceError – If the namespace is indexed, and the identifier of a generic subprogram refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property PackageBody: PackageBody | None
Read-only property to access the package body (
_packageBody).- Returns:
The package body, or
Noneif not set.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- RemoveGenericItem(genericItem)
Remove a generic from the generic clause.
The generic is detached: its parent is cleared and its identifiers are removed from the language construct’s namespace, if it has one. The generic itself is unchanged and can be added to another language construct, or inserted at another position.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to remove.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic isn’t declared in it.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic refers to another element, e.g. a duplicate declaration.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
InsertGenericItem()→ Insert a generic at a position of the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package declaration, its context clause, its generic clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION = False
Trueif it continues its parent’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>, <class 'pyVHDLModel.Object.DeferredConstant'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this package: its generics share the declarative region.
- Return type:
- Returns:
Tuple of declarations: the generics, then the declared items.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexGenericItems()
Add the generics to the host’s namespace; a generic subprogram is an overload.
- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item – The declared item.
- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package.
- Return type:
- Returns:
Tuple of the package body, if linked (
_packageBody).
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Remove a declared item, which a concurrent declaration region doesn’t handle itself.
A deferred constant is removed from
_deferredConstants. An entry referring to another deferred constant of the same identifier (a duplicate declaration) is kept:RemoveDeclaredItem()indexes the region again.- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- _VisitGenericClause(visitor)
Walk the generic clause, if there are generics, with a visitor.
The generics are separated by semicolons.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package declaration.
Format:
mylib.myPackage- Return type:
- Returns:
String representation of the package declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package declaration.
Format:
Package: 'mylib.myPackage'- Return type:
- Returns:
Formatted package declaration.
- _allowBlackbox
Allow blackboxes for components;
Noneinherits the parent’s setting.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _deferredConstants: dict[str, DeferredConstant]
Deferred constants, indexed by name.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _genericItems
List of all generics, in declaration order.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _packageBody: Nullable[PackageBody]
The corresponding package body, or
Noneif none was analyzed.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.Std_Logic_TextIO_Synopsys[source]
Predefined Synopsys package
ieee.std_logic_textio.Inheritance
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- AddGenericItem(genericItem)
Add a generic at the end of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to add.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property AllowBlackbox: bool
Property to return whether a design supports blackboxes, inherited from the parent if not set locally (
_allowBlackbox).Algorithm
If allow blackbox property is locally set, return the local value,
Otherwise, return allow blackbox value from parent object.
- Returns:
True, if blackboxes are allowed.- Raises:
VHDLModelException – If neither a local value is set nor a parent object is available to inherit the value from.
- Setter accepts:
- property Components: dict[str, Component]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DeferredConstants: dict[str, DeferredConstant]
Read-only property to access the deferred constants (
_deferredConstants).- Returns:
Dictionary of deferred constants, indexed by normalized identifier.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- property GenericCount: int
Read-only property to return the number of generics in
_genericItems.- Returns:
The generic count.
- property GenericItems: list[GenericInterfaceItemMixin]
Read-only property to access the generic items (
_genericItems).- Returns:
List of generic items.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
A generic package’s generics share the declarative region of its declarative part.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- InsertGenericItem(index, genericItem)
Insert a generic at a position of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
index (
int) – Position, from0(first) toGenericCount(append). A negative index counts from the end, as forlist.insert():-1inserts before the last generic.genericItem (
GenericInterfaceItemMixin) – The generic to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
- IterateSingleGenericDeclarations(predicate=None)
Iterate all generics per declared identifier, in declaration order.
A generic constant yields one single declaration per identifier:
generic (A, B : positive)yields two. A generic type, subprogram or package declares exactly one identifier and is yielded itself.- Parameters:
predicate (
Callable[[SingleGenericDeclarationMixin|GenericInterfaceItemMixin],bool] |None) – Optional, filter function to select the yielded generics. Default: all.- Return type:
Generator[SingleGenericDeclarationMixin|GenericInterfaceItemMixin]- Returns:
A generator to iterate all (selected) generics.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- MoveGenericItem(genericItem, index)
Move a generic to a position of the generic clause.
The generic stays a generic of this language construct: only the order of the generic clause changes. A generic subprogram is an overload: if the language construct’s namespace is indexed, it refers to the overload declared last afterwards.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to move.index (
int) – Position of the generic after the move, from0(first) toGenericCountminus one (last). A negative index counts from the end, as for alistindex:-1moves the generic to the end.
- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
NotInNamespaceError – If the namespace is indexed, and the identifier of a generic subprogram refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property PackageBody: PackageBody | None
Read-only property to access the package body (
_packageBody).- Returns:
The package body, or
Noneif not set.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- RemoveGenericItem(genericItem)
Remove a generic from the generic clause.
The generic is detached: its parent is cleared and its identifiers are removed from the language construct’s namespace, if it has one. The generic itself is unchanged and can be added to another language construct, or inserted at another position.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to remove.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic isn’t declared in it.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic refers to another element, e.g. a duplicate declaration.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
InsertGenericItem()→ Insert a generic at a position of the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package declaration, its context clause, its generic clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION = False
Trueif it continues its parent’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>, <class 'pyVHDLModel.Object.DeferredConstant'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this package: its generics share the declarative region.
- Return type:
- Returns:
Tuple of declarations: the generics, then the declared items.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexGenericItems()
Add the generics to the host’s namespace; a generic subprogram is an overload.
- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item – The declared item.
- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package.
- Return type:
- Returns:
Tuple of the package body, if linked (
_packageBody).
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Remove a declared item, which a concurrent declaration region doesn’t handle itself.
A deferred constant is removed from
_deferredConstants. An entry referring to another deferred constant of the same identifier (a duplicate declaration) is kept:RemoveDeclaredItem()indexes the region again.- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- _VisitGenericClause(visitor)
Walk the generic clause, if there are generics, with a visitor.
The generics are separated by semicolons.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package declaration.
Format:
mylib.myPackage- Return type:
- Returns:
String representation of the package declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package declaration.
Format:
Package: 'mylib.myPackage'- Return type:
- Returns:
Formatted package declaration.
- _allowBlackbox
Allow blackboxes for components;
Noneinherits the parent’s setting.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _deferredConstants: dict[str, DeferredConstant]
Deferred constants, indexed by name.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _genericItems
List of all generics, in declaration order.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _packageBody: Nullable[PackageBody]
The corresponding package body, or
Noneif none was analyzed.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.
- class pyVHDLModel.IEEE.Std_Logic_Unsigned[source]
Predefined Synopsys package
ieee.std_logic_unsigned.Inheritance
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- AddDeclaredItem(declaredItem)
Add a declared item at the end of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to add.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- AddGenericItem(genericItem)
Add a generic at the end of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to add.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property AllowBlackbox: bool
Property to return whether a design supports blackboxes, inherited from the parent if not set locally (
_allowBlackbox).Algorithm
If allow blackbox property is locally set, return the local value,
Otherwise, return allow blackbox value from parent object.
- Returns:
True, if blackboxes are allowed.- Raises:
VHDLModelException – If neither a local value is set nor a parent object is available to inherit the value from.
- Setter accepts:
- property Components: dict[str, Component]
Read-only property to access the components (
_components).- Returns:
Dictionary of components, indexed by normalized identifier.
- property Constants: dict[str, Constant]
Read-only property to access the constants (
_constants).- Returns:
Dictionary of constants, indexed by normalized identifier.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- property DeclaredItems: list
Read-only property to access the declared items (
_declaredItems).- Returns:
List of declared items.
- property DeferredConstants: dict[str, DeferredConstant]
Read-only property to access the deferred constants (
_deferredConstants).- Returns:
Dictionary of deferred constants, indexed by normalized identifier.
- property DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Files: dict[str, File]
Read-only property to access the files (
_files).- Returns:
Dictionary of files, indexed by normalized identifier.
- property Functions: dict[str, list[Function]]
Read-only property to access the functions (
_functions).- Returns:
Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.
- property GenericCount: int
Read-only property to return the number of generics in
_genericItems.- Returns:
The generic count.
- property GenericItems: list[GenericInterfaceItemMixin]
Read-only property to access the generic items (
_genericItems).- Returns:
List of generic items.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- IndexDeclaredItems()
A generic package’s generics share the declarative region of its declarative part.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- InsertDeclaredItem(index, declaredItem)
Insert a declared item at a position of the declarative region.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
An identifier is declared once per declarative region: interface items and declared items count, including those of the language construct sharing the declarative region (an entity and its architecture, a package and its body). Subprograms are overloadable: a subprogram may share its identifier with other subprograms. A protected type body may share its identifier with its protected type, a full type with its incomplete type declaration, and a constant with its deferred constant. Items imported into the namespace (e.g. by a use clause) are hidden.
- Parameters:
index (
int) – Position, from0(first) to the number of declared items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last declared item.declaredItem (
ModelEntity) – The declared item to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- InsertDeclaredItemAfter(declaredItem, after)
Insert a declared item after another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.after (
ModelEntity) – The declared item of this declarative region to insert after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemBefore()→ Insert a declared item before another declared item.
- InsertDeclaredItemBefore(declaredItem, before)
Insert a declared item before another declared item.
The declared item’s parent is set to this declarative region. If the region is indexed, its identifiers are added to the region’s namespace and to the lookup table matching its kind.
- Parameters:
declaredItem (
ModelEntity) – The declared item to insert.before (
ModelEntity) – The declared item of this declarative region to insert before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not a declaration allowed in this declarative region.
AlreadyInDesignError – If parameter ‘declaredItem’ already has a parent.
DuplicateDeclarationError – If an existing declaration of the declarative region shares an identifier with the declared item.
- Return type:
See also
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
InsertDeclaredItemAfter()→ Insert a declared item after another declared item.
- InsertGenericItem(index, genericItem)
Insert a generic at a position of the generic clause.
The generic’s parent is set to this language construct, and its identifiers are added to the language construct’s namespace, if it has one.
- Parameters:
index (
int) – Position, from0(first) toGenericCount(append). A negative index counts from the end, as forlist.insert():-1inserts before the last generic.genericItem (
GenericInterfaceItemMixin) – The generic to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.AlreadyInDesignError – If parameter ‘genericItem’ already has a parent.
DuplicateGenericError – If an existing declaration of the language construct shares an identifier with the generic.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
- IterateSingleGenericDeclarations(predicate=None)
Iterate all generics per declared identifier, in declaration order.
A generic constant yields one single declaration per identifier:
generic (A, B : positive)yields two. A generic type, subprogram or package declares exactly one identifier and is yielded itself.- Parameters:
predicate (
Callable[[SingleGenericDeclarationMixin|GenericInterfaceItemMixin],bool] |None) – Optional, filter function to select the yielded generics. Default: all.- Return type:
Generator[SingleGenericDeclarationMixin|GenericInterfaceItemMixin]- Returns:
A generator to iterate all (selected) generics.
- property LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- MoveDeclaredItem(declaredItem, index)
Move a declared item to a position of the declarative region.
The declared item stays a declared item of this declarative region: only the order of the declared items changes.
If the region is indexed, the lookup tables and the namespace follow the new order: a list of overloads (e.g. in
Functions) follows the declaration order, and the namespace refers to the overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (IndexDeclaredItems()) after the move.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.index (
int) – Position of the declared item after the move, from0(first) to the number of declared items minus one (last). A negative index counts from the end, as for alistindex:-1moves the declared item to the end.
- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
RemoveDeclaredItem()→ Remove a declared item from the declarative region.
- MoveDeclaredItemAfter(declaredItem, after)
Move a declared item after another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item after itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.after (
ModelEntity) – The declared item of this declarative region to move after.
- Raises:
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemBefore()→ Move a declared item before another declared item.
- MoveDeclaredItemBefore(declaredItem, before)
Move a declared item before another declared item.
The declared item stays a declared item of this declarative region: only the order of the declared items changes, as for
MoveDeclaredItem(). Moving a declared item before itself keeps it in place.- Parameters:
declaredItem (
ModelEntity) – The declared item to move.before (
ModelEntity) – The declared item of this declarative region to move before.
- Raises:
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a declared item of this declarative region.
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
- Return type:
See also
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
MoveDeclaredItemAfter()→ Move a declared item after another declared item.
- MoveGenericItem(genericItem, index)
Move a generic to a position of the generic clause.
The generic stays a generic of this language construct: only the order of the generic clause changes. A generic subprogram is an overload: if the language construct’s namespace is indexed, it refers to the overload declared last afterwards.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to move.index (
int) – Position of the generic after the move, from0(first) toGenericCountminus one (last). A negative index counts from the end, as for alistindex:-1moves the generic to the end.
- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
NotInNamespaceError – If the namespace is indexed, and the identifier of a generic subprogram refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
See also
InsertGenericItem()→ Insert a generic at a position of the generic clause.
RemoveGenericItem()→ Remove a generic from the generic clause.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).- Returns:
Normalized name of a model entity.
- property PackageBody: PackageBody | None
Read-only property to access the package body (
_packageBody).- Returns:
The package body, or
Noneif not set.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Procedures: dict[str, list[Procedure]]
Read-only property to access the procedures (
_procedures).- Returns:
Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.
- property ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- RemoveDeclaredItem(declaredItem)
Remove a declared item from the declarative region.
The declared item is detached: its parent is cleared. If the region is indexed, the declared item’s identifiers are removed from the region’s namespace and from the lookup table matching its kind first; they are checked before anything is changed. The declared item itself is unchanged and can be added to another declarative region, or inserted at another position.
The namespace refers to the overload declared last: removing it, the namespace refers to the remaining overload declared last. If another declaration shares an identifier with the declared item (e.g. a duplicate declaration read by a parser), the region is indexed again (
IndexDeclaredItems()) after the removal.- Parameters:
declaredItem (
ModelEntity) – The declared item to remove.- Raises:
ValueError – If parameter ‘declaredItem’ is
None.TypeError – If parameter ‘declaredItem’ is not of type
ModelEntity.NotAChildError – If parameter ‘declaredItem’ is not a declared item of this declarative region.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item isn’t declared in its namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the declared item refers to another declaration, e.g. a duplicate declaration.
- Return type:
See also
AddDeclaredItem()→ Add a declared item at the end of the declarative region.
InsertDeclaredItem()→ Insert a declared item at a position of the declarative region.
MoveDeclaredItem()→ Move a declared item to a position of the declarative region.
- RemoveGenericItem(genericItem)
Remove a generic from the generic clause.
The generic is detached: its parent is cleared and its identifiers are removed from the language construct’s namespace, if it has one. The generic itself is unchanged and can be added to another language construct, or inserted at another position.
- Parameters:
genericItem (
GenericInterfaceItemMixin) – The generic to remove.- Raises:
ValueError – If parameter ‘genericItem’ is
None.TypeError – If parameter ‘genericItem’ is not of type
GenericInterfaceItemMixin.NotAChildError – If parameter ‘genericItem’ is not a generic of this language construct.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic isn’t declared in it.
NotInNamespaceError – If the namespace is indexed, and an identifier of the generic refers to another element, e.g. a duplicate declaration.
- Return type:
See also
AddGenericItem()→ Add a generic at the end of the generic clause.
InsertGenericItem()→ Insert a generic at a position of the generic clause.
MoveGenericItem()→ Move a generic to a position of the generic clause.
Read-only property to access the shared variables (
_sharedVariables).- Returns:
Dictionary of shared variables, indexed by normalized identifier.
- property Signals: dict[str, Signal]
Read-only property to access the signals (
_signals).- Returns:
Dictionary of signals, indexed by normalized identifier.
- property Subtypes: dict[str, Subtype]
Read-only property to access the subtypes (
_subtypes).- Returns:
Dictionary of subtypes, indexed by normalized identifier.
- property Types: dict[str, FullType]
Read-only property to access the types (
_types).- Returns:
Dictionary of types, indexed by normalized identifier.
- Visit(visitor)
Walk this package declaration, its context clause, its generic clause and its declared items with a visitor.
- _AddOverloadToNamespace(item)
Add a function or procedure to the namespace, if it’s the overload declared last.
The namespace keeps one entry per identifier: the overload declared last, as after
IndexDeclaredItems(), which adds interface items first, then declared items (_Declarations()).- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, already an interface item or declared item of this region.- Return type:
- _AddToNamespace(element)
Add an element’s identifiers to this region’s namespace.
Nothing is added to a region not indexed yet:
IndexDeclaredItems()adds the element later. A generic subprogram is an overload (_AddOverloadToNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to add, e.g. an interface item.- Return type:
- _CONTINUES_PARENT_REGION = False
Trueif it continues its parent’s declarative region.
- _ClashingDeclarations(item)
Return the declarations sharing an identifier with the given item, which may not share it.
The declarations (
_Declarations()) and the labeled statements (_Labels()) of this declarative region and of the language constructs sharing it (_SharedRegions()) are searched: a statement label is declared implicitly. Items imported into the namespace (e.g. by a use clause) are no declarations.- Parameters:
item (
ModelEntity) – The new declaration, or the new labeled statement.- Return type:
- Returns:
Tuple of clashing declarations, interface items first, then declared items in declaration order, then labeled statements.
- _DECLARED_ITEM_TYPES = (<class 'pyVHDLModel.Type.BaseType'>, <class 'pyVHDLModel.Subprogram.Subprogram'>, <class 'pyVHDLModel.DesignUnit.Package'>, <class 'pyVHDLModel.DesignUnit.PackageBody'>, <class 'pyVHDLModel.Object.Constant'>, <class 'pyVHDLModel.Object.Signal'>, <class 'pyVHDLModel.Object.SharedVariable'>, <class 'pyVHDLModel.Object.File'>, <class 'pyVHDLModel.Declaration.Alias'>, <class 'pyVHDLModel.DesignUnit.Component'>, <class 'pyVHDLModel.Declaration.Attribute'>, <class 'pyVHDLModel.Declaration.AttributeSpecification'>, <class 'pyVHDLModel.Configuration.ComponentConfiguration'>, <class 'pyVHDLModel.Interface.ModeViewDeclaration'>, <class 'pyVHDLModel.DesignUnit.UseClause'>, <class 'pyVHDLModel.PSLModel.PSLEntity'>, <class 'pyVHDLModel.Object.DeferredConstant'>)
Accepted classes of declared items (
pyVHDLModel).
- _Declarations()
Return all declarations of this package: its generics share the declarative region.
- Return type:
- Returns:
Tuple of declarations: the generics, then the declared items.
- _DeclaredItemsSharingIdentifiers(declaredItem)
Return the other declared items of this region sharing an identifier with the given declared item.
- Parameters:
declaredItem (
ModelEntity) – The declared item.- Return type:
- Returns:
List of declared items, in declaration order.
- _IndexDeclaredItem(item)
Add a declared item to the namespace and to the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _IndexGenericItems()
Add the generics to the host’s namespace; a generic subprogram is an overload.
- Return type:
- _IndexOtherDeclaredItem(item)
Hook for declared items the region doesn’t handle itself. Derived classes may override it.
- Parameters:
item – The declared item.
- Return type:
- _IndexOverload(item)
Add an inserted function or procedure to its lookup table and to the namespace.
The list of overloads follows the declaration order. The namespace is updated by
_AddOverloadToNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The inserted function or procedure.- Return type:
- _Labels()
Return the labeled statements, whose labels are declared in this declarative region.
- Return type:
- Returns:
An empty tuple.
Check if two declarations may share an identifier in one declarative region.
Subprograms are overloadable. A protected type body completes its protected type, a full type completes its incomplete type, and a constant completes its deferred constant.
- Parameters:
item (
ModelEntity) – The new declaration.existing (
ModelEntity) – The existing declaration.
- Return type:
- Returns:
True, if both declarations may share an identifier.
- _RemoveDeclaredItemEntries(lookupTable, item)
Remove a declared item’s entries from a lookup table and from the namespace.
Every identifier is checked before anything is removed.
- Parameters:
lookupTable (
dict[str,Any]) – The lookup table matching the declared item’s kind.item (
NamedEntityMixin|MultipleNamedEntityMixin) – The declared item.
- Raises:
NotInNamespaceError – If an identifier of the declared item isn’t declared in the namespace.
NotInNamespaceError – If an identifier of the declared item refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveDeclaredItemsFromNamespace()
Remove all declared items of this region from its namespace.
Interface items of this region and items imported from elsewhere (e.g. by a use clause) are kept.
- Return type:
- _RemoveFromNamespace(element)
Remove an element’s identifiers from this region’s namespace.
Nothing is removed from a region not indexed yet, as its namespace doesn’t contain the element. A generic subprogram is an overload (
_RemoveOverloadFromNamespace()).- Parameters:
element (
NamedEntityMixin|MultipleNamedEntityMixin) – The named element to remove, e.g. an interface item.- Raises:
NotInNamespaceError – If the region is indexed, and an identifier of the element isn’t declared in the namespace.
NotInNamespaceError – If the region is indexed, and an identifier of the element refers to another element, e.g. a duplicate declaration.
- Return type:
- _RemoveOverloadFromNamespace(item)
Remove a function or procedure from the namespace.
Removing the overload the namespace refers to, the namespace refers to the remaining overload declared last (
_Declarations()), or the identifier is removed, if no overload remains. Removing another overload leaves the namespace unchanged. The namespace is checked before it’s changed.- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure, still an interface item or declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
Return the other language constructs forming one declarative region with this package.
- Return type:
- Returns:
Tuple of the package body, if linked (
_packageBody).
- _UnindexDeclaredItem(item)
Remove a declared item from the namespace and from the lookup table matching its kind.
- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOtherDeclaredItem(item)
Remove a declared item, which a concurrent declaration region doesn’t handle itself.
A deferred constant is removed from
_deferredConstants. An entry referring to another deferred constant of the same identifier (a duplicate declaration) is kept:RemoveDeclaredItem()indexes the region again.- Parameters:
item (
ModelEntity) – The declared item.- Return type:
- _UnindexOverload(item)
Remove a function or procedure from its lookup table and from the namespace.
The namespace is updated first, by
_RemoveOverloadFromNamespace().- Parameters:
item (
NamedEntityMixin|MultipleNamedEntityMixin) – The function or procedure to remove, still a declared item of this region.- Raises:
NotInNamespaceError – If the identifier isn’t declared in the namespace.
NotInNamespaceError – If the identifier refers to an element, which is no overload, e.g. a duplicate declaration.
- Return type:
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- _VisitDeclaredItems(visitor)
Walk the declared items in declaration order with a visitor.
- _VisitGenericClause(visitor)
Walk the generic clause, if there are generics, with a visitor.
The generics are separated by semicolons.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the package declaration.
Format:
mylib.myPackage- Return type:
- Returns:
String representation of the package declaration.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the package declaration.
Format:
Package: 'mylib.myPackage'- Return type:
- Returns:
Formatted package declaration.
- _allowBlackbox
Allow blackboxes for components;
Noneinherits the parent’s setting.
- _areDeclaredItemsIndexed
TrueifIndexDeclaredItems()filled the namespace.
- _components
Dictionary of all components declared in this concurrent declaration region.
- _constants
Dictionary of all constants declared in this concurrent declaration region.
- _contextItems
List of all context items (library, use and context clauses).
- _contextReferences
List of context clauses.
- _declaredItems
List of all declared items in this concurrent declaration region.
- _deferredConstants: dict[str, DeferredConstant]
Deferred constants, indexed by name.
- _dependencyVertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _document
The VHDL library, the design unit was analyzed into.
- _documentation
The associated documentation of a model entity.
- _files
Dictionary of all files declared in this concurrent declaration region.
- _functions
Dictionary of all functions declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _genericItems
List of all generics, in declaration order.
- _hierarchyVertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences
List of library clauses.
- _namespace
The namespace of this concurrent declaration region.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _packageBody: Nullable[PackageBody]
The corresponding package body, or
Noneif none was analyzed.
- _packageReferences
List of use clauses.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _procedures
Dictionary of all procedures declared in this concurrent declaration region, indexed by name; each entry is a list of overloads.
- _referencedContexts
Referenced contexts based on explicit context references or implicit inheritance
- _referencedLibraries
Referenced libraries based on explicit library clauses or implicit inheritance
- _referencedPackages
Referenced packages based on explicit use clauses or implicit inheritance
Dictionary of all shared variables declared in this concurrent declaration region.
- _signals
Dictionary of all signals declared in this concurrent declaration region.
- _subtypes
Dictionary of all subtypes declared in this concurrent declaration region.
- _types
Dictionary of all types declared in this concurrent declaration region.