pyVHDLModel.IEEE

This module contains library and package declarations for VHDL library IEEE.

Classes


Classes

class pyVHDLModel.IEEE.Ieee(flavor=None)[source]

Predefined VHDL library ieee.

The following predefined packages are in this library:

See also

Other predefined libraries:

Inheritance

Inheritance diagram of Ieee

Parameters:

flavor (IEEEFlavor | None)

__init__(flavor=None)[source]

Initializes the ieee library.

Parameters:

flavor (IEEEFlavor | None) – The flavor of the ieee library this instance provides.

Raises:

VHDLModelException – If the given IEEE library flavor is unknown.

Return type:

None

_flavor: IEEEFlavor

The flavor of the ieee library 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

  1. If allow blackbox property is locally set, return the local value,

  2. 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:

bool | None

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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

  1. Iterate all architectures:

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

IndexEntities()

Index declared items in all entities.

Algorithm

  1. Iterate all entities:

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

IndexPackageBodies()

Index declared items in all package bodies.

Algorithm

  1. Iterate all package bodies:

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

IndexPackages()

Index declared items in all packages.

Algorithm

  1. Iterate all packages:

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

IterateDesignUnits(filter=<DesignUnitKind.All: 63>)

Iterate all design units in the library.

A union of DesignUnitKind values can be given to filter the returned result for suitable design units.

Algorithm

  1. Iterate all contexts in that library.

  2. Iterate all packages in that library.

  3. Iterate all package bodies in that library.

  4. Iterate all entities in that library.

  5. Iterate all architectures in that library.

  6. Iterate all configurations in that library.

Parameters:

filter (DesignUnitKind) – An enumeration with possibly multiple flags to filter the returned design units.

Return type:

Generator[DesignUnit]

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

  1. Iterate all architecture groups (grouped per entity symbol’s name).

    • Check if entity symbol’s name exists as an entity in this library.

    1. For each architecture in the same architecture group:

Raises:
Return type:

None

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

  1. 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._package

    • Set 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:

None

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

  1. 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._package

    • Set 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:

None

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:

None

__annotate_func__()

The type of the None singleton.

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__new__(**kwargs)
__repr__()

Formats a representation of the library.

Format: Library: 'my_library'

Return type:

str

Returns:

String representation of the library.

__setstate__(state)

Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats a representation of the library.

Format: Library: 'my_library'

Return type:

str

Returns:

String representation of the library.

_allowBlackbox

Allow blackboxes for components; None inherits the parent’s setting.

_architectures: dict[str, dict[str, Architecture]]

Dictionary of all architectures defined in a library.

_configurations: dict[str, Configuration]

Dictionary of all configurations defined in a library.

_contexts: dict[str, Context]

Dictionary of all contexts defined in a library.

_dependencyVertex: Vertex

Reference to the vertex in the dependency graph representing the library.
This reference is set by CreateDependencyGraph().

_documentation

The associated documentation of a model entity.

_entities: dict[str, Entity]

Dictionary of all entities defined in a library.

_identifier

The identifier of a model entity.

_normalizedIdentifier

The normalized (lower case) identifier of a model entity.

_packageBodies: dict[str, PackageBody]

Dictionary of all package bodies defined in a library.

_packages: dict[str, Package]

Dictionary of all packages defined in a library.

_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

Inheritance diagram of Math_Real

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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:
Return type:

None

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

  1. If allow blackbox property is locally set, return the local value,

  2. 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:

bool | None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

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:
Raises:
Return type:

None

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 Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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, from 0 (first) to GenericCount minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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 None if 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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_CONTINUES_PARENT_REGION = False

True if 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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_IndexGenericItems()

Add the generics to the host’s namespace; a generic subprogram is an overload.

Return type:

None

_IndexOtherDeclaredItem(item)

Hook for declared items the region doesn’t handle itself. Derived classes may override it.

Parameters:

item – The declared item.

Return type:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitGenericClause(visitor)

Walk the generic clause, if there are generics, with a visitor.

The generics are separated by semicolons.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__init__(identifier=None)

Initializes a predefined package.

By default the VHDL package name is the Python class name. Pass identifier when the two must differ - e.g. when two vendor flavors of the same VHDL package need distinct Python classes.

Parameters:

identifier (str | None) – The VHDL package name, or None to use the class name.

Return type:

None

__new__(**kwargs)
__repr__()

Formats a representation of the package declaration.

Format: mylib.myPackage

Return type:

str

Returns:

String representation of the package declaration.

__setstate__(state)

Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package declaration.

Format: Package: 'mylib.myPackage'

Return type:

str

Returns:

Formatted package declaration.

_allowBlackbox

Allow blackboxes for components; None inherits the parent’s setting.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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 None if 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

_sharedVariables

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

Inheritance diagram of Math_Real_Body

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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

  1. Clear all lookup tables and remove all declared items from _namespace. Interface items and imported items stay in the namespace.

  2. Iterate all declared items:

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

See also

InsertDeclaredItem()

→ Insert a declared item at a position of the declarative region.

InsertDeclaredItemAfter()

→ Insert a declared item after another declared item.

property Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_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:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package body.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__init__(packageIdentifier=None)

Initializes a predefined package body.

By default the VHDL package name is the Python class name with the trailing _Body removed. Pass packageIdentifier when the two must differ.

Parameters:

packageIdentifier (str | None) – The VHDL name of the package this body implements, or None to derive it from the class name.

Return type:

None

__new__(**kwargs)
__repr__()

Formats a representation of the package body declaration.

Format: mylib.myPackage(body)

Return type:

str

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.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package body declaration.

Format: Package Body: mylib.myPackage(body)

Return type:

str

Returns:

Formatted package body declaration.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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

_sharedVariables

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

Inheritance diagram of Math_Complex

__init__()[source]

Initializes the math_complex package.

Return type:

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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:
Return type:

None

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

  1. If allow blackbox property is locally set, return the local value,

  2. 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:

bool | None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

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:
Raises:
Return type:

None

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 Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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, from 0 (first) to GenericCount minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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 None if 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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_CONTINUES_PARENT_REGION = False

True if 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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_IndexGenericItems()

Add the generics to the host’s namespace; a generic subprogram is an overload.

Return type:

None

_IndexOtherDeclaredItem(item)

Hook for declared items the region doesn’t handle itself. Derived classes may override it.

Parameters:

item – The declared item.

Return type:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitGenericClause(visitor)

Walk the generic clause, if there are generics, with a visitor.

The generics are separated by semicolons.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__new__(**kwargs)
__repr__()

Formats a representation of the package declaration.

Format: mylib.myPackage

Return type:

str

Returns:

String representation of the package declaration.

__setstate__(state)

Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package declaration.

Format: Package: 'mylib.myPackage'

Return type:

str

Returns:

Formatted package declaration.

_allowBlackbox

Allow blackboxes for components; None inherits the parent’s setting.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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 None if 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

_sharedVariables

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

Inheritance diagram of Math_Complex_Body

__init__()[source]

Initializes the math_complex package body.

Return type:

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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

  1. Clear all lookup tables and remove all declared items from _namespace. Interface items and imported items stay in the namespace.

  2. Iterate all declared items:

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

See also

InsertDeclaredItem()

→ Insert a declared item at a position of the declarative region.

InsertDeclaredItemAfter()

→ Insert a declared item after another declared item.

property Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_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:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package body.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__new__(**kwargs)
__repr__()

Formats a representation of the package body declaration.

Format: mylib.myPackage(body)

Return type:

str

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.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package body declaration.

Format: Package Body: mylib.myPackage(body)

Return type:

str

Returns:

Formatted package body declaration.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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

_sharedVariables

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_vector

  • std_logic, std_logic_vector

Inheritance

Inheritance diagram of Std_Logic_1164

__init__()[source]

Initializes the std_logic_1164 package.

Return type:

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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:
Return type:

None

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

  1. If allow blackbox property is locally set, return the local value,

  2. 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:

bool | None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

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:
Raises:
Return type:

None

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 Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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, from 0 (first) to GenericCount minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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 None if 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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_CONTINUES_PARENT_REGION = False

True if 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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_IndexGenericItems()

Add the generics to the host’s namespace; a generic subprogram is an overload.

Return type:

None

_IndexOtherDeclaredItem(item)

Hook for declared items the region doesn’t handle itself. Derived classes may override it.

Parameters:

item – The declared item.

Return type:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitGenericClause(visitor)

Walk the generic clause, if there are generics, with a visitor.

The generics are separated by semicolons.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__new__(**kwargs)
__repr__()

Formats a representation of the package declaration.

Format: mylib.myPackage

Return type:

str

Returns:

String representation of the package declaration.

__setstate__(state)

Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package declaration.

Format: Package: 'mylib.myPackage'

Return type:

str

Returns:

Formatted package declaration.

_allowBlackbox

Allow blackboxes for components; None inherits the parent’s setting.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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 None if 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

_sharedVariables

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

Inheritance diagram of Std_Logic_1164_Body

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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

  1. Clear all lookup tables and remove all declared items from _namespace. Interface items and imported items stay in the namespace.

  2. Iterate all declared items:

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

See also

InsertDeclaredItem()

→ Insert a declared item at a position of the declarative region.

InsertDeclaredItemAfter()

→ Insert a declared item after another declared item.

property Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_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:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package body.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__init__(packageIdentifier=None)

Initializes a predefined package body.

By default the VHDL package name is the Python class name with the trailing _Body removed. Pass packageIdentifier when the two must differ.

Parameters:

packageIdentifier (str | None) – The VHDL name of the package this body implements, or None to derive it from the class name.

Return type:

None

__new__(**kwargs)
__repr__()

Formats a representation of the package body declaration.

Format: mylib.myPackage(body)

Return type:

str

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.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package body declaration.

Format: Package Body: mylib.myPackage(body)

Return type:

str

Returns:

Formatted package body declaration.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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

_sharedVariables

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

Inheritance diagram of Std_Logic_TextIO

__init__()[source]

Initializes the std_logic_textio package.

Return type:

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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:
Return type:

None

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

  1. If allow blackbox property is locally set, return the local value,

  2. 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:

bool | None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

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:
Raises:
Return type:

None

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 Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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, from 0 (first) to GenericCount minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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 None if 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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_CONTINUES_PARENT_REGION = False

True if 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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_IndexGenericItems()

Add the generics to the host’s namespace; a generic subprogram is an overload.

Return type:

None

_IndexOtherDeclaredItem(item)

Hook for declared items the region doesn’t handle itself. Derived classes may override it.

Parameters:

item – The declared item.

Return type:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitGenericClause(visitor)

Walk the generic clause, if there are generics, with a visitor.

The generics are separated by semicolons.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__new__(**kwargs)
__repr__()

Formats a representation of the package declaration.

Format: mylib.myPackage

Return type:

str

Returns:

String representation of the package declaration.

__setstate__(state)

Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package declaration.

Format: Package: 'mylib.myPackage'

Return type:

str

Returns:

Formatted package declaration.

_allowBlackbox

Allow blackboxes for components; None inherits the parent’s setting.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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 None if 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

_sharedVariables

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

Inheritance diagram of Numeric_Bit

__init__()[source]

Initializes the numeric_bit package.

Return type:

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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:
Return type:

None

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

  1. If allow blackbox property is locally set, return the local value,

  2. 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:

bool | None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

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:
Raises:
Return type:

None

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 Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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, from 0 (first) to GenericCount minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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 None if 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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_CONTINUES_PARENT_REGION = False

True if 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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_IndexGenericItems()

Add the generics to the host’s namespace; a generic subprogram is an overload.

Return type:

None

_IndexOtherDeclaredItem(item)

Hook for declared items the region doesn’t handle itself. Derived classes may override it.

Parameters:

item – The declared item.

Return type:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitGenericClause(visitor)

Walk the generic clause, if there are generics, with a visitor.

The generics are separated by semicolons.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__new__(**kwargs)
__repr__()

Formats a representation of the package declaration.

Format: mylib.myPackage

Return type:

str

Returns:

String representation of the package declaration.

__setstate__(state)

Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package declaration.

Format: Package: 'mylib.myPackage'

Return type:

str

Returns:

Formatted package declaration.

_allowBlackbox

Allow blackboxes for components; None inherits the parent’s setting.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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 None if 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

_sharedVariables

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

Inheritance diagram of Numeric_Bit_Body

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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

  1. Clear all lookup tables and remove all declared items from _namespace. Interface items and imported items stay in the namespace.

  2. Iterate all declared items:

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

See also

InsertDeclaredItem()

→ Insert a declared item at a position of the declarative region.

InsertDeclaredItemAfter()

→ Insert a declared item after another declared item.

property Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_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:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package body.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__init__(packageIdentifier=None)

Initializes a predefined package body.

By default the VHDL package name is the Python class name with the trailing _Body removed. Pass packageIdentifier when the two must differ.

Parameters:

packageIdentifier (str | None) – The VHDL name of the package this body implements, or None to derive it from the class name.

Return type:

None

__new__(**kwargs)
__repr__()

Formats a representation of the package body declaration.

Format: mylib.myPackage(body)

Return type:

str

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.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package body declaration.

Format: Package Body: mylib.myPackage(body)

Return type:

str

Returns:

Formatted package body declaration.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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

_sharedVariables

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

Inheritance diagram of Numeric_Bit_Unsigned

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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:
Return type:

None

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

  1. If allow blackbox property is locally set, return the local value,

  2. 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:

bool | None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

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:
Raises:
Return type:

None

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 Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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, from 0 (first) to GenericCount minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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 None if 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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_CONTINUES_PARENT_REGION = False

True if 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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_IndexGenericItems()

Add the generics to the host’s namespace; a generic subprogram is an overload.

Return type:

None

_IndexOtherDeclaredItem(item)

Hook for declared items the region doesn’t handle itself. Derived classes may override it.

Parameters:

item – The declared item.

Return type:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitGenericClause(visitor)

Walk the generic clause, if there are generics, with a visitor.

The generics are separated by semicolons.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__init__(identifier=None)

Initializes a predefined package.

By default the VHDL package name is the Python class name. Pass identifier when the two must differ - e.g. when two vendor flavors of the same VHDL package need distinct Python classes.

Parameters:

identifier (str | None) – The VHDL package name, or None to use the class name.

Return type:

None

__new__(**kwargs)
__repr__()

Formats a representation of the package declaration.

Format: mylib.myPackage

Return type:

str

Returns:

String representation of the package declaration.

__setstate__(state)

Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package declaration.

Format: Package: 'mylib.myPackage'

Return type:

str

Returns:

Formatted package declaration.

_allowBlackbox

Allow blackboxes for components; None inherits the parent’s setting.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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 None if 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

_sharedVariables

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

Inheritance diagram of Numeric_Bit_Unsigned_Body

__init__()[source]

Initializes the numeric_bit_unsigned package body.

Return type:

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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

  1. Clear all lookup tables and remove all declared items from _namespace. Interface items and imported items stay in the namespace.

  2. Iterate all declared items:

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

See also

InsertDeclaredItem()

→ Insert a declared item at a position of the declarative region.

InsertDeclaredItemAfter()

→ Insert a declared item after another declared item.

property Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_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:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package body.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__new__(**kwargs)
__repr__()

Formats a representation of the package body declaration.

Format: mylib.myPackage(body)

Return type:

str

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.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package body declaration.

Format: Package Body: mylib.myPackage(body)

Return type:

str

Returns:

Formatted package body declaration.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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

_sharedVariables

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, unsigned

  • unresolved_signed, signed

Inheritance

Inheritance diagram of Numeric_Std

__init__()[source]

Initializes the numeric_std package.

Return type:

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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:
Return type:

None

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

  1. If allow blackbox property is locally set, return the local value,

  2. 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:

bool | None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

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:
Raises:
Return type:

None

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 Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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, from 0 (first) to GenericCount minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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 None if 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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_CONTINUES_PARENT_REGION = False

True if 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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_IndexGenericItems()

Add the generics to the host’s namespace; a generic subprogram is an overload.

Return type:

None

_IndexOtherDeclaredItem(item)

Hook for declared items the region doesn’t handle itself. Derived classes may override it.

Parameters:

item – The declared item.

Return type:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitGenericClause(visitor)

Walk the generic clause, if there are generics, with a visitor.

The generics are separated by semicolons.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__new__(**kwargs)
__repr__()

Formats a representation of the package declaration.

Format: mylib.myPackage

Return type:

str

Returns:

String representation of the package declaration.

__setstate__(state)

Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package declaration.

Format: Package: 'mylib.myPackage'

Return type:

str

Returns:

Formatted package declaration.

_allowBlackbox

Allow blackboxes for components; None inherits the parent’s setting.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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 None if 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

_sharedVariables

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

Inheritance diagram of Numeric_Std_Body

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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

  1. Clear all lookup tables and remove all declared items from _namespace. Interface items and imported items stay in the namespace.

  2. Iterate all declared items:

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

See also

InsertDeclaredItem()

→ Insert a declared item at a position of the declarative region.

InsertDeclaredItemAfter()

→ Insert a declared item after another declared item.

property Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_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:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package body.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__init__(packageIdentifier=None)

Initializes a predefined package body.

By default the VHDL package name is the Python class name with the trailing _Body removed. Pass packageIdentifier when the two must differ.

Parameters:

packageIdentifier (str | None) – The VHDL name of the package this body implements, or None to derive it from the class name.

Return type:

None

__new__(**kwargs)
__repr__()

Formats a representation of the package body declaration.

Format: mylib.myPackage(body)

Return type:

str

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.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package body declaration.

Format: Package Body: mylib.myPackage(body)

Return type:

str

Returns:

Formatted package body declaration.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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

_sharedVariables

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

Inheritance diagram of Numeric_Std_Unsigned

__init__()[source]

Initializes the numeric_std_unsigned package.

Return type:

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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:
Return type:

None

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

  1. If allow blackbox property is locally set, return the local value,

  2. 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:

bool | None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

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:
Raises:
Return type:

None

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 Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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, from 0 (first) to GenericCount minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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 None if 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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_CONTINUES_PARENT_REGION = False

True if 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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_IndexGenericItems()

Add the generics to the host’s namespace; a generic subprogram is an overload.

Return type:

None

_IndexOtherDeclaredItem(item)

Hook for declared items the region doesn’t handle itself. Derived classes may override it.

Parameters:

item – The declared item.

Return type:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitGenericClause(visitor)

Walk the generic clause, if there are generics, with a visitor.

The generics are separated by semicolons.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__new__(**kwargs)
__repr__()

Formats a representation of the package declaration.

Format: mylib.myPackage

Return type:

str

Returns:

String representation of the package declaration.

__setstate__(state)

Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package declaration.

Format: Package: 'mylib.myPackage'

Return type:

str

Returns:

Formatted package declaration.

_allowBlackbox

Allow blackboxes for components; None inherits the parent’s setting.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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 None if 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

_sharedVariables

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

Inheritance diagram of Numeric_Std_Unsigned_Body

__init__()[source]

Initializes the numeric_std_unsigned package body.

Return type:

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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

  1. Clear all lookup tables and remove all declared items from _namespace. Interface items and imported items stay in the namespace.

  2. Iterate all declared items:

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

See also

InsertDeclaredItem()

→ Insert a declared item at a position of the declarative region.

InsertDeclaredItemAfter()

→ Insert a declared item after another declared item.

property Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_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:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package body.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__new__(**kwargs)
__repr__()

Formats a representation of the package body declaration.

Format: mylib.myPackage(body)

Return type:

str

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.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package body declaration.

Format: Package Body: mylib.myPackage(body)

Return type:

str

Returns:

Formatted package body declaration.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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

_sharedVariables

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

Inheritance diagram of Fixed_Float_Types

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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:
Return type:

None

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

  1. If allow blackbox property is locally set, return the local value,

  2. 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:

bool | None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

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:
Raises:
Return type:

None

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 Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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, from 0 (first) to GenericCount minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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 None if 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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_CONTINUES_PARENT_REGION = False

True if 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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_IndexGenericItems()

Add the generics to the host’s namespace; a generic subprogram is an overload.

Return type:

None

_IndexOtherDeclaredItem(item)

Hook for declared items the region doesn’t handle itself. Derived classes may override it.

Parameters:

item – The declared item.

Return type:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitGenericClause(visitor)

Walk the generic clause, if there are generics, with a visitor.

The generics are separated by semicolons.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__init__(identifier=None)

Initializes a predefined package.

By default the VHDL package name is the Python class name. Pass identifier when the two must differ - e.g. when two vendor flavors of the same VHDL package need distinct Python classes.

Parameters:

identifier (str | None) – The VHDL package name, or None to use the class name.

Return type:

None

__new__(**kwargs)
__repr__()

Formats a representation of the package declaration.

Format: mylib.myPackage

Return type:

str

Returns:

String representation of the package declaration.

__setstate__(state)

Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package declaration.

Format: Package: 'mylib.myPackage'

Return type:

str

Returns:

Formatted package declaration.

_allowBlackbox

Allow blackboxes for components; None inherits the parent’s setting.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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 None if 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

_sharedVariables

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

Inheritance diagram of Fixed_Generic_Pkg

__init__()[source]

Initializes the fixed_generic_pkg package.

Return type:

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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:
Return type:

None

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

  1. If allow blackbox property is locally set, return the local value,

  2. 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:

bool | None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

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:
Raises:
Return type:

None

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 Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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, from 0 (first) to GenericCount minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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 None if 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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_CONTINUES_PARENT_REGION = False

True if 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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_IndexGenericItems()

Add the generics to the host’s namespace; a generic subprogram is an overload.

Return type:

None

_IndexOtherDeclaredItem(item)

Hook for declared items the region doesn’t handle itself. Derived classes may override it.

Parameters:

item – The declared item.

Return type:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitGenericClause(visitor)

Walk the generic clause, if there are generics, with a visitor.

The generics are separated by semicolons.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__new__(**kwargs)
__repr__()

Formats a representation of the package declaration.

Format: mylib.myPackage

Return type:

str

Returns:

String representation of the package declaration.

__setstate__(state)

Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package declaration.

Format: Package: 'mylib.myPackage'

Return type:

str

Returns:

Formatted package declaration.

_allowBlackbox

Allow blackboxes for components; None inherits the parent’s setting.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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 None if 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

_sharedVariables

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

Inheritance diagram of Fixed_Generic_Pkg_Body

__init__()[source]

Initializes the fixed_generic_pkg package body.

Return type:

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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

  1. Clear all lookup tables and remove all declared items from _namespace. Interface items and imported items stay in the namespace.

  2. Iterate all declared items:

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

See also

InsertDeclaredItem()

→ Insert a declared item at a position of the declarative region.

InsertDeclaredItemAfter()

→ Insert a declared item after another declared item.

property Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_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:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package body.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__new__(**kwargs)
__repr__()

Formats a representation of the package body declaration.

Format: mylib.myPackage(body)

Return type:

str

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.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package body declaration.

Format: Package Body: mylib.myPackage(body)

Return type:

str

Returns:

Formatted package body declaration.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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

_sharedVariables

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

Inheritance diagram of Fixed_Pkg

__init__()[source]

Initializes the fixed_pkg package.

Return type:

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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:
Return type:

None

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

  1. If allow blackbox property is locally set, return the local value,

  2. 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:

bool | None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

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:
Raises:
Return type:

None

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 Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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, from 0 (first) to GenericCount minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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 None if 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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_CONTINUES_PARENT_REGION = False

True if 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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_IndexGenericItems()

Add the generics to the host’s namespace; a generic subprogram is an overload.

Return type:

None

_IndexOtherDeclaredItem(item)

Hook for declared items the region doesn’t handle itself. Derived classes may override it.

Parameters:

item – The declared item.

Return type:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitGenericClause(visitor)

Walk the generic clause, if there are generics, with a visitor.

The generics are separated by semicolons.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__new__(**kwargs)
__repr__()

Formats a representation of the package declaration.

Format: mylib.myPackage

Return type:

str

Returns:

String representation of the package declaration.

__setstate__(state)

Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package declaration.

Format: Package: 'mylib.myPackage'

Return type:

str

Returns:

Formatted package declaration.

_allowBlackbox

Allow blackboxes for components; None inherits the parent’s setting.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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 None if 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

_sharedVariables

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

Inheritance diagram of Float_Generic_Pkg

__init__()[source]

Initializes the float_generic_pkg package.

Return type:

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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:
Return type:

None

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

  1. If allow blackbox property is locally set, return the local value,

  2. 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:

bool | None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

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:
Raises:
Return type:

None

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 Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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, from 0 (first) to GenericCount minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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 None if 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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_CONTINUES_PARENT_REGION = False

True if 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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_IndexGenericItems()

Add the generics to the host’s namespace; a generic subprogram is an overload.

Return type:

None

_IndexOtherDeclaredItem(item)

Hook for declared items the region doesn’t handle itself. Derived classes may override it.

Parameters:

item – The declared item.

Return type:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitGenericClause(visitor)

Walk the generic clause, if there are generics, with a visitor.

The generics are separated by semicolons.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__new__(**kwargs)
__repr__()

Formats a representation of the package declaration.

Format: mylib.myPackage

Return type:

str

Returns:

String representation of the package declaration.

__setstate__(state)

Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package declaration.

Format: Package: 'mylib.myPackage'

Return type:

str

Returns:

Formatted package declaration.

_allowBlackbox

Allow blackboxes for components; None inherits the parent’s setting.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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 None if 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

_sharedVariables

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

Inheritance diagram of Float_Generic_Pkg_Body

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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

  1. Clear all lookup tables and remove all declared items from _namespace. Interface items and imported items stay in the namespace.

  2. Iterate all declared items:

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

See also

InsertDeclaredItem()

→ Insert a declared item at a position of the declarative region.

InsertDeclaredItemAfter()

→ Insert a declared item after another declared item.

property Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_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:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package body.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__init__(packageIdentifier=None)

Initializes a predefined package body.

By default the VHDL package name is the Python class name with the trailing _Body removed. Pass packageIdentifier when the two must differ.

Parameters:

packageIdentifier (str | None) – The VHDL name of the package this body implements, or None to derive it from the class name.

Return type:

None

__new__(**kwargs)
__repr__()

Formats a representation of the package body declaration.

Format: mylib.myPackage(body)

Return type:

str

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.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package body declaration.

Format: Package Body: mylib.myPackage(body)

Return type:

str

Returns:

Formatted package body declaration.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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

_sharedVariables

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

Inheritance diagram of Float_Pkg

__init__()[source]

Initializes the float_pkg package.

Return type:

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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:
Return type:

None

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

  1. If allow blackbox property is locally set, return the local value,

  2. 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:

bool | None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

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:
Raises:
Return type:

None

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 Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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, from 0 (first) to GenericCount minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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 None if 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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_CONTINUES_PARENT_REGION = False

True if 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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_IndexGenericItems()

Add the generics to the host’s namespace; a generic subprogram is an overload.

Return type:

None

_IndexOtherDeclaredItem(item)

Hook for declared items the region doesn’t handle itself. Derived classes may override it.

Parameters:

item – The declared item.

Return type:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitGenericClause(visitor)

Walk the generic clause, if there are generics, with a visitor.

The generics are separated by semicolons.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__new__(**kwargs)
__repr__()

Formats a representation of the package declaration.

Format: mylib.myPackage

Return type:

str

Returns:

String representation of the package declaration.

__setstate__(state)

Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package declaration.

Format: Package: 'mylib.myPackage'

Return type:

str

Returns:

Formatted package declaration.

_allowBlackbox

Allow blackboxes for components; None inherits the parent’s setting.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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 None if 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

_sharedVariables

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

Inheritance diagram of Std_Logic_Arith_MentorGraphics

__init__()[source]

Initializes the std_logic_arith package.

Return type:

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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:
Return type:

None

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

  1. If allow blackbox property is locally set, return the local value,

  2. 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:

bool | None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

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:
Raises:
Return type:

None

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 Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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, from 0 (first) to GenericCount minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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 None if 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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_CONTINUES_PARENT_REGION = False

True if 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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_IndexGenericItems()

Add the generics to the host’s namespace; a generic subprogram is an overload.

Return type:

None

_IndexOtherDeclaredItem(item)

Hook for declared items the region doesn’t handle itself. Derived classes may override it.

Parameters:

item – The declared item.

Return type:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitGenericClause(visitor)

Walk the generic clause, if there are generics, with a visitor.

The generics are separated by semicolons.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__new__(**kwargs)
__repr__()

Formats a representation of the package declaration.

Format: mylib.myPackage

Return type:

str

Returns:

String representation of the package declaration.

__setstate__(state)

Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package declaration.

Format: Package: 'mylib.myPackage'

Return type:

str

Returns:

Formatted package declaration.

_allowBlackbox

Allow blackboxes for components; None inherits the parent’s setting.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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 None if 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

_sharedVariables

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

Inheritance diagram of Std_Logic_Arith_Body_MentorGraphics

__init__()[source]

Initializes the std_logic_arith package body.

Return type:

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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

  1. Clear all lookup tables and remove all declared items from _namespace. Interface items and imported items stay in the namespace.

  2. Iterate all declared items:

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

See also

InsertDeclaredItem()

→ Insert a declared item at a position of the declarative region.

InsertDeclaredItemAfter()

→ Insert a declared item after another declared item.

property Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_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:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package body.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__new__(**kwargs)
__repr__()

Formats a representation of the package body declaration.

Format: mylib.myPackage(body)

Return type:

str

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.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package body declaration.

Format: Package Body: mylib.myPackage(body)

Return type:

str

Returns:

Formatted package body declaration.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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

_sharedVariables

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

Inheritance diagram of VITAL_Timing

__init__()[source]

Initializes the VITAL_Timing package.

Return type:

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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:
Return type:

None

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

  1. If allow blackbox property is locally set, return the local value,

  2. 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:

bool | None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

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:
Raises:
Return type:

None

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 Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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, from 0 (first) to GenericCount minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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 None if 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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_CONTINUES_PARENT_REGION = False

True if 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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_IndexGenericItems()

Add the generics to the host’s namespace; a generic subprogram is an overload.

Return type:

None

_IndexOtherDeclaredItem(item)

Hook for declared items the region doesn’t handle itself. Derived classes may override it.

Parameters:

item – The declared item.

Return type:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitGenericClause(visitor)

Walk the generic clause, if there are generics, with a visitor.

The generics are separated by semicolons.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__new__(**kwargs)
__repr__()

Formats a representation of the package declaration.

Format: mylib.myPackage

Return type:

str

Returns:

String representation of the package declaration.

__setstate__(state)

Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package declaration.

Format: Package: 'mylib.myPackage'

Return type:

str

Returns:

Formatted package declaration.

_allowBlackbox

Allow blackboxes for components; None inherits the parent’s setting.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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 None if 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

_sharedVariables

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

Inheritance diagram of VITAL_Timing_Body

__init__()[source]

Initializes the VITAL_Timing package body.

Return type:

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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

  1. Clear all lookup tables and remove all declared items from _namespace. Interface items and imported items stay in the namespace.

  2. Iterate all declared items:

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

See also

InsertDeclaredItem()

→ Insert a declared item at a position of the declarative region.

InsertDeclaredItemAfter()

→ Insert a declared item after another declared item.

property Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_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:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package body.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__new__(**kwargs)
__repr__()

Formats a representation of the package body declaration.

Format: mylib.myPackage(body)

Return type:

str

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.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package body declaration.

Format: Package Body: mylib.myPackage(body)

Return type:

str

Returns:

Formatted package body declaration.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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

_sharedVariables

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

Inheritance diagram of VITAL_Primitives

__init__()[source]

Initializes the VITAL_Primitives package.

Return type:

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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:
Return type:

None

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

  1. If allow blackbox property is locally set, return the local value,

  2. 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:

bool | None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

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:
Raises:
Return type:

None

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 Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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, from 0 (first) to GenericCount minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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 None if 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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_CONTINUES_PARENT_REGION = False

True if 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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_IndexGenericItems()

Add the generics to the host’s namespace; a generic subprogram is an overload.

Return type:

None

_IndexOtherDeclaredItem(item)

Hook for declared items the region doesn’t handle itself. Derived classes may override it.

Parameters:

item – The declared item.

Return type:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitGenericClause(visitor)

Walk the generic clause, if there are generics, with a visitor.

The generics are separated by semicolons.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__new__(**kwargs)
__repr__()

Formats a representation of the package declaration.

Format: mylib.myPackage

Return type:

str

Returns:

String representation of the package declaration.

__setstate__(state)

Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package declaration.

Format: Package: 'mylib.myPackage'

Return type:

str

Returns:

Formatted package declaration.

_allowBlackbox

Allow blackboxes for components; None inherits the parent’s setting.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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 None if 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

_sharedVariables

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

Inheritance diagram of VITAL_Primitives_Body

__init__()[source]

Initializes the VITAL_Primitives package body.

Return type:

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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

  1. Clear all lookup tables and remove all declared items from _namespace. Interface items and imported items stay in the namespace.

  2. Iterate all declared items:

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

See also

InsertDeclaredItem()

→ Insert a declared item at a position of the declarative region.

InsertDeclaredItemAfter()

→ Insert a declared item after another declared item.

property Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_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:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package body.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__new__(**kwargs)
__repr__()

Formats a representation of the package body declaration.

Format: mylib.myPackage(body)

Return type:

str

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.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package body declaration.

Format: Package Body: mylib.myPackage(body)

Return type:

str

Returns:

Formatted package body declaration.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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

_sharedVariables

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

Inheritance diagram of VITAL_Memory

__init__()[source]

Initializes the VITAL_Memory package.

Return type:

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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:
Return type:

None

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

  1. If allow blackbox property is locally set, return the local value,

  2. 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:

bool | None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

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:
Raises:
Return type:

None

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 Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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, from 0 (first) to GenericCount minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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 None if 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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_CONTINUES_PARENT_REGION = False

True if 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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_IndexGenericItems()

Add the generics to the host’s namespace; a generic subprogram is an overload.

Return type:

None

_IndexOtherDeclaredItem(item)

Hook for declared items the region doesn’t handle itself. Derived classes may override it.

Parameters:

item – The declared item.

Return type:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitGenericClause(visitor)

Walk the generic clause, if there are generics, with a visitor.

The generics are separated by semicolons.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__new__(**kwargs)
__repr__()

Formats a representation of the package declaration.

Format: mylib.myPackage

Return type:

str

Returns:

String representation of the package declaration.

__setstate__(state)

Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package declaration.

Format: Package: 'mylib.myPackage'

Return type:

str

Returns:

Formatted package declaration.

_allowBlackbox

Allow blackboxes for components; None inherits the parent’s setting.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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 None if 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

_sharedVariables

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

Inheritance diagram of VITAL_Memory_Body

__init__()[source]

Initializes the VITAL_Memory package body.

Return type:

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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

  1. Clear all lookup tables and remove all declared items from _namespace. Interface items and imported items stay in the namespace.

  2. Iterate all declared items:

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

See also

InsertDeclaredItem()

→ Insert a declared item at a position of the declarative region.

InsertDeclaredItemAfter()

→ Insert a declared item after another declared item.

property Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_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:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package body.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__new__(**kwargs)
__repr__()

Formats a representation of the package body declaration.

Format: mylib.myPackage(body)

Return type:

str

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.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package body declaration.

Format: Package Body: mylib.myPackage(body)

Return type:

str

Returns:

Formatted package body declaration.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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

_sharedVariables

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

Inheritance diagram of Std_Logic_Arith_Synopsys

__init__()[source]

Initializes the std_logic_arith package.

Return type:

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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:
Return type:

None

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

  1. If allow blackbox property is locally set, return the local value,

  2. 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:

bool | None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

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:
Raises:
Return type:

None

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 Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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, from 0 (first) to GenericCount minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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 None if 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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_CONTINUES_PARENT_REGION = False

True if 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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_IndexGenericItems()

Add the generics to the host’s namespace; a generic subprogram is an overload.

Return type:

None

_IndexOtherDeclaredItem(item)

Hook for declared items the region doesn’t handle itself. Derived classes may override it.

Parameters:

item – The declared item.

Return type:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitGenericClause(visitor)

Walk the generic clause, if there are generics, with a visitor.

The generics are separated by semicolons.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__new__(**kwargs)
__repr__()

Formats a representation of the package declaration.

Format: mylib.myPackage

Return type:

str

Returns:

String representation of the package declaration.

__setstate__(state)

Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package declaration.

Format: Package: 'mylib.myPackage'

Return type:

str

Returns:

Formatted package declaration.

_allowBlackbox

Allow blackboxes for components; None inherits the parent’s setting.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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 None if 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

_sharedVariables

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

Inheritance diagram of Std_Logic_Misc

__init__()[source]

Initializes the std_logic_misc package.

Return type:

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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:
Return type:

None

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

  1. If allow blackbox property is locally set, return the local value,

  2. 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:

bool | None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

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:
Raises:
Return type:

None

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 Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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, from 0 (first) to GenericCount minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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 None if 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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_CONTINUES_PARENT_REGION = False

True if 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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_IndexGenericItems()

Add the generics to the host’s namespace; a generic subprogram is an overload.

Return type:

None

_IndexOtherDeclaredItem(item)

Hook for declared items the region doesn’t handle itself. Derived classes may override it.

Parameters:

item – The declared item.

Return type:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitGenericClause(visitor)

Walk the generic clause, if there are generics, with a visitor.

The generics are separated by semicolons.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__new__(**kwargs)
__repr__()

Formats a representation of the package declaration.

Format: mylib.myPackage

Return type:

str

Returns:

String representation of the package declaration.

__setstate__(state)

Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package declaration.

Format: Package: 'mylib.myPackage'

Return type:

str

Returns:

Formatted package declaration.

_allowBlackbox

Allow blackboxes for components; None inherits the parent’s setting.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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 None if 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

_sharedVariables

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

Inheritance diagram of Std_Logic_Misc_Body

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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

  1. Clear all lookup tables and remove all declared items from _namespace. Interface items and imported items stay in the namespace.

  2. Iterate all declared items:

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

See also

InsertDeclaredItem()

→ Insert a declared item at a position of the declarative region.

InsertDeclaredItemAfter()

→ Insert a declared item after another declared item.

property Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_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:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package body.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__init__(packageIdentifier=None)

Initializes a predefined package body.

By default the VHDL package name is the Python class name with the trailing _Body removed. Pass packageIdentifier when the two must differ.

Parameters:

packageIdentifier (str | None) – The VHDL name of the package this body implements, or None to derive it from the class name.

Return type:

None

__new__(**kwargs)
__repr__()

Formats a representation of the package body declaration.

Format: mylib.myPackage(body)

Return type:

str

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.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package body declaration.

Format: Package Body: mylib.myPackage(body)

Return type:

str

Returns:

Formatted package body declaration.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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

_sharedVariables

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

Inheritance diagram of Std_Logic_Signed

__init__()[source]

Initializes the std_logic_signed package.

Return type:

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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:
Return type:

None

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

  1. If allow blackbox property is locally set, return the local value,

  2. 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:

bool | None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

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:
Raises:
Return type:

None

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 Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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, from 0 (first) to GenericCount minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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 None if 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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_CONTINUES_PARENT_REGION = False

True if 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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_IndexGenericItems()

Add the generics to the host’s namespace; a generic subprogram is an overload.

Return type:

None

_IndexOtherDeclaredItem(item)

Hook for declared items the region doesn’t handle itself. Derived classes may override it.

Parameters:

item – The declared item.

Return type:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitGenericClause(visitor)

Walk the generic clause, if there are generics, with a visitor.

The generics are separated by semicolons.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__new__(**kwargs)
__repr__()

Formats a representation of the package declaration.

Format: mylib.myPackage

Return type:

str

Returns:

String representation of the package declaration.

__setstate__(state)

Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package declaration.

Format: Package: 'mylib.myPackage'

Return type:

str

Returns:

Formatted package declaration.

_allowBlackbox

Allow blackboxes for components; None inherits the parent’s setting.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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 None if 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

_sharedVariables

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

Inheritance diagram of Std_Logic_TextIO_Synopsys

__init__()[source]

Initializes the std_logic_textio package.

Return type:

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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:
Return type:

None

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

  1. If allow blackbox property is locally set, return the local value,

  2. 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:

bool | None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

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:
Raises:
Return type:

None

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 Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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, from 0 (first) to GenericCount minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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 None if 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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_CONTINUES_PARENT_REGION = False

True if 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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_IndexGenericItems()

Add the generics to the host’s namespace; a generic subprogram is an overload.

Return type:

None

_IndexOtherDeclaredItem(item)

Hook for declared items the region doesn’t handle itself. Derived classes may override it.

Parameters:

item – The declared item.

Return type:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitGenericClause(visitor)

Walk the generic clause, if there are generics, with a visitor.

The generics are separated by semicolons.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__new__(**kwargs)
__repr__()

Formats a representation of the package declaration.

Format: mylib.myPackage

Return type:

str

Returns:

String representation of the package declaration.

__setstate__(state)

Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package declaration.

Format: Package: 'mylib.myPackage'

Return type:

str

Returns:

Formatted package declaration.

_allowBlackbox

Allow blackboxes for components; None inherits the parent’s setting.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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 None if 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

_sharedVariables

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

Inheritance diagram of Std_Logic_Unsigned

__init__()[source]

Initializes the std_logic_unsigned package.

Return type:

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. 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, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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:

None

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:
Return type:

None

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

  1. If allow blackbox property is locally set, return the local value,

  2. 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:

bool | None

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 Document: Document

Property to access the document (_document).

Returns:

The document.

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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

dict[Callable[..., Any], tuple[Attribute, ...]]

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 WarningCollector collects the DuplicateDeclarationWarning.

Return type:

None

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 to PackageReferences and a context reference to ContextReferences, in the order of ContextItems. A context item may repeat an earlier one.

Parameters:
  • index (int) – Position, from 0 (first) to the number of context items (append). A negative index counts from the end, as for list.insert(): -1 inserts 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

  • ValueError – If parameter ‘contextItem’ is None.

  • TypeError – If parameter ‘contextItem’ is not of type LibraryClause, UseClause or ContextReference.

  • AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.

Return type:

None

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, from 0 (first) to the number of declared items (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last declared item.

  • declaredItem (ModelEntity) – The declared item to insert.

Raises:
  • ValueError – If parameter ‘index’ is None.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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:

None

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:

None

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:
Raises:
Return type:

None

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 Library: Library

Property to access the library (_parent).

Returns:

The library.

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, from 0 (first) to the number of declared items minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • ValueError – If parameter ‘index’ is out of range.

Return type:

None

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:

None

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:

None

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, from 0 (first) to GenericCount minus one (last). A negative index counts from the end, as for a list index: -1 moves 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.

  • TypeError – If parameter ‘index’ is not of type int.

  • 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:

None

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 None if 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 ContextItems and from LibraryReferences, PackageReferences or ContextReferences. 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, UseClause or ContextReference.

  • NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.

Return type:

None

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:

None

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:

None

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.

property SharedVariables: dict[str, SharedVariable]

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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_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:

None

_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:

None

_CONTINUES_PARENT_REGION = False

True if 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:

tuple[ModelEntity, ...]

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:

tuple[ModelEntity, ...]

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:

list[ModelEntity]

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:

None

_IndexGenericItems()

Add the generics to the host’s namespace; a generic subprogram is an overload.

Return type:

None

_IndexOtherDeclaredItem(item)

Hook for declared items the region doesn’t handle itself. Derived classes may override it.

Parameters:

item – The declared item.

Return type:

None

_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:

None

_Labels()

Return the labeled statements, whose labels are declared in this declarative region.

Return type:

tuple[ModelEntity, ...]

Returns:

An empty tuple.

_MayShareIdentifier(item, existing)

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:
Return type:

bool

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:
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:

None

_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:

None

_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:

None

_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:

None

_SharedRegions()

Return the other language constructs forming one declarative region with this package.

Return type:

tuple[ConcurrentDeclarationRegionMixin, ...]

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:

None

_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:

None

_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:

None

_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.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitDeclaredItems(visitor)

Walk the declared items in declaration order with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitGenericClause(visitor)

Walk the generic clause, if there are generics, with a visitor.

The generics are separated by semicolons.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

__getstate__()

Return the object’s state for pickling, collecting every slot of the class hierarchy.

Return type:

dict[str, Any]

Returns:

Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If a slot was never assigned, so it has no value to serialize.

__new__(**kwargs)
__repr__()

Formats a representation of the package declaration.

Format: mylib.myPackage

Return type:

str

Returns:

String representation of the package declaration.

__setstate__(state)

Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.

Parameters:

state (dict[str, Any]) – Dictionary of slot names and their values.

Raises:

ExtendedTypeError – If the given state misses a slot or carries an unexpected one.

Return type:

None

__str__()

Formats the package declaration.

Format: Package: 'mylib.myPackage'

Return type:

str

Returns:

Formatted package declaration.

_allowBlackbox

Allow blackboxes for components; None inherits the parent’s setting.

_areDeclaredItemsIndexed

True if IndexDeclaredItems() 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 by CreateDependencyGraph().

_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 None if 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

_sharedVariables

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.