pyGHDL.dom.Configuration

This module implements derived configuration classes from pyVHDLModel.Configuration.

Classes


Classes

class pyGHDL.dom.Configuration.EntityAspectEntity(node, entity, architecture=None)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Configuration.EntityAspectEntity.

Represents an entity aspect naming an entity, optionally with an architecture.

Example

use entity work.e_rest(rtl);
--         ^^^^^^^^^^^         <- Entity
--                     ^^^     <- Architecture

Inheritance

Inheritance diagram of EntityAspectEntity

Parameters:
__init__(node, entity, architecture=None)[source]

Initializes an entity aspect naming an entity, optionally with an architecture.

Parameters:
  • node (Iir) – The IIR node this object was translated from.

  • entity (EntitySymbol) – Reference to the named entity.

  • architecture (ArchitectureSymbol) – Optional, reference to the selected architecture, or None if none was given.

Return type:

None

classmethod parse(entityAspectNode)[source]

Translates the IIR node of the entity aspect to an EntityAspectEntity.

Parameters:

entityAspectNode (Iir) – The IIR node of the entity aspect.

Return type:

Self

Returns:

The translated entity aspect.

_iirNode: Iir

The IIR node in libghdl’s tree this DOM object was translated from.

_position: Position

The IIR node’s position in the source file, resolved on first access and then cached.

property Architecture: ArchitectureSymbol | None

Read-only property to access the architecture (_architecture).

Returns:

The architecture, or None if not set.

DenoteBy(name, region, place, symbol)

Determine the model entity a name denoting this declaration denotes, as a part of a type mark (Name.Denote).

A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.

Parameters:
  • name (Name) – The name denoting this declaration, a part of the type mark.

  • region (DeclarativeRegionMixin) – The declarative region containing the type mark.

  • place (ModelEntity) – The declaration containing the type mark.

  • symbol (Symbol) – The type mark.

Return type:

ModelEntity | None

Returns:

None, as a name in a type mark can’t denote this declaration (reported as a warning).

Raises:

UnhandledCriticalWarningError – Always, if no WarningCollector collects the UnresolvedTypeMarkWarning.

property Entity: EntitySymbol

Read-only property to access the entity (_entity).

Returns:

The entity.

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:

AncestorNotFoundError – 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 IsOverloadable: bool

Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.

Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.

Returns:

True, if this model entity is an overloadable declaration.

IterateImplicitDeclarations()

Iterate the declarations this declaration implies.

An enumerated type implies its enumeration literals, a physical type its units; they override this method.

Return type:

Generator[tuple[str, ModelEntity]]

Returns:

A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.

IterateTypeMarks(region)

Iterate the type marks of this declaration, each with the region and the place to look it up.

The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.

Parameters:

region (DeclarativeRegionMixin) – The declarative region declaring this declaration.

Return type:

Generator[tuple[DeclarativeRegionMixin, ModelEntity, SubtypeSymbol]]

Returns:

A generator to iterate (region, place, type mark) tuples, in declaration order: none.

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

Cached read-only property to access an IIR’s position in source code (_position).

If _position is None, resolve the position object from _iirNode

Returns:

The IIR’s position in the source file.

ResetReferences(designUnit, region)

Reset the references ResolveReferences() derived: the references of this declaration’s type marks.

A use clause, an alias and a subtype extend this method.

Parameters:
  • designUnit (DesignUnit) – The design unit containing this declaration.

  • region (DeclarativeRegionMixin) – The declarative region declaring this declaration.

Return type:

None

ResolveReferences(designUnit, region)

Resolve the references of this declaration: its type marks (IterateTypeMarks()).

Each type mark is resolved at its place by the region it is looked up in (ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.

Parameters:
  • designUnit (DesignUnit) – The design unit containing this declaration.

  • region (DeclarativeRegionMixin) – The declarative region declaring this declaration.

Raises:

UnhandledCriticalWarningError – If a type mark can’t be resolved, and no WarningCollector collects the UnresolvedTypeMarkWarning.

Return type:

None

Visit(visitor)[source]

Walk this entity aspect, its entity and its architecture (if any) 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)
__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

_architecture: ArchitectureSymbol | None

Reference to the selected architecture, or None if none was given.

_entity: EntitySymbol

Reference to the named entity.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

class pyGHDL.dom.Configuration.EntityAspectConfiguration(node, configuration)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Configuration.EntityAspectConfiguration.

Represents an entity aspect naming a configuration.

Example

use configuration work.cfg;
--                ^^^^^^^^    <- Configuration

Inheritance

Inheritance diagram of EntityAspectConfiguration

Parameters:
__init__(node, configuration)[source]

Initializes an entity aspect naming a configuration.

Parameters:
  • node (Iir) – The IIR node this object was translated from.

  • configuration (ConfigurationSymbol) – Reference to the named configuration.

Return type:

None

classmethod parse(entityAspectNode)[source]

Translates the IIR node of the entity aspect to an EntityAspectConfiguration.

Parameters:

entityAspectNode (Iir) – The IIR node of the entity aspect.

Return type:

Self

Returns:

The translated entity aspect.

_iirNode: Iir

The IIR node in libghdl’s tree this DOM object was translated from.

_position: Position

The IIR node’s position in the source file, resolved on first access and then cached.

property Configuration: ConfigurationSymbol

Read-only property to access the configuration (_configuration).

Returns:

The configuration.

DenoteBy(name, region, place, symbol)

Determine the model entity a name denoting this declaration denotes, as a part of a type mark (Name.Denote).

A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.

Parameters:
  • name (Name) – The name denoting this declaration, a part of the type mark.

  • region (DeclarativeRegionMixin) – The declarative region containing the type mark.

  • place (ModelEntity) – The declaration containing the type mark.

  • symbol (Symbol) – The type mark.

Return type:

ModelEntity | None

Returns:

None, as a name in a type mark can’t denote this declaration (reported as a warning).

Raises:

UnhandledCriticalWarningError – Always, if no WarningCollector collects the UnresolvedTypeMarkWarning.

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:

AncestorNotFoundError – 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 IsOverloadable: bool

Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.

Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.

Returns:

True, if this model entity is an overloadable declaration.

IterateImplicitDeclarations()

Iterate the declarations this declaration implies.

An enumerated type implies its enumeration literals, a physical type its units; they override this method.

Return type:

Generator[tuple[str, ModelEntity]]

Returns:

A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.

IterateTypeMarks(region)

Iterate the type marks of this declaration, each with the region and the place to look it up.

The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.

Parameters:

region (DeclarativeRegionMixin) – The declarative region declaring this declaration.

Return type:

Generator[tuple[DeclarativeRegionMixin, ModelEntity, SubtypeSymbol]]

Returns:

A generator to iterate (region, place, type mark) tuples, in declaration order: none.

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

Cached read-only property to access an IIR’s position in source code (_position).

If _position is None, resolve the position object from _iirNode

Returns:

The IIR’s position in the source file.

ResetReferences(designUnit, region)

Reset the references ResolveReferences() derived: the references of this declaration’s type marks.

A use clause, an alias and a subtype extend this method.

Parameters:
  • designUnit (DesignUnit) – The design unit containing this declaration.

  • region (DeclarativeRegionMixin) – The declarative region declaring this declaration.

Return type:

None

ResolveReferences(designUnit, region)

Resolve the references of this declaration: its type marks (IterateTypeMarks()).

Each type mark is resolved at its place by the region it is looked up in (ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.

Parameters:
  • designUnit (DesignUnit) – The design unit containing this declaration.

  • region (DeclarativeRegionMixin) – The declarative region declaring this declaration.

Raises:

UnhandledCriticalWarningError – If a type mark can’t be resolved, and no WarningCollector collects the UnresolvedTypeMarkWarning.

Return type:

None

Visit(visitor)[source]

Walk this entity aspect and its configuration 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)
__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

_configuration: ConfigurationSymbol

Reference to the named configuration.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

class pyGHDL.dom.Configuration.EntityAspectOpen(node)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Configuration.EntityAspectOpen.

Represents an open entity aspect, leaving the binding unspecified.

Example

use open;
--  ^^^^    <- the aspect

Inheritance

Inheritance diagram of EntityAspectOpen

Parameters:

node (Iir)

__init__(node)[source]

Initializes an entity aspect denoting open.

Parameters:

node (Iir) – The IIR node this object was translated from.

Return type:

None

classmethod parse(entityAspectNode)[source]

Translates the IIR node of the entity aspect to an EntityAspectOpen.

Parameters:

entityAspectNode (Iir) – The IIR node of the entity aspect.

Return type:

Self

Returns:

The translated entity aspect.

_iirNode: Iir

The IIR node in libghdl’s tree this DOM object was translated from.

_position: Position

The IIR node’s position in the source file, resolved on first access and then cached.

DenoteBy(name, region, place, symbol)

Determine the model entity a name denoting this declaration denotes, as a part of a type mark (Name.Denote).

A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.

Parameters:
  • name (Name) – The name denoting this declaration, a part of the type mark.

  • region (DeclarativeRegionMixin) – The declarative region containing the type mark.

  • place (ModelEntity) – The declaration containing the type mark.

  • symbol (Symbol) – The type mark.

Return type:

ModelEntity | None

Returns:

None, as a name in a type mark can’t denote this declaration (reported as a warning).

Raises:

UnhandledCriticalWarningError – Always, if no WarningCollector collects the UnresolvedTypeMarkWarning.

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:

AncestorNotFoundError – 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 IsOverloadable: bool

Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.

Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.

Returns:

True, if this model entity is an overloadable declaration.

IterateImplicitDeclarations()

Iterate the declarations this declaration implies.

An enumerated type implies its enumeration literals, a physical type its units; they override this method.

Return type:

Generator[tuple[str, ModelEntity]]

Returns:

A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.

IterateTypeMarks(region)

Iterate the type marks of this declaration, each with the region and the place to look it up.

The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.

Parameters:

region (DeclarativeRegionMixin) – The declarative region declaring this declaration.

Return type:

Generator[tuple[DeclarativeRegionMixin, ModelEntity, SubtypeSymbol]]

Returns:

A generator to iterate (region, place, type mark) tuples, in declaration order: none.

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

Cached read-only property to access an IIR’s position in source code (_position).

If _position is None, resolve the position object from _iirNode

Returns:

The IIR’s position in the source file.

ResetReferences(designUnit, region)

Reset the references ResolveReferences() derived: the references of this declaration’s type marks.

A use clause, an alias and a subtype extend this method.

Parameters:
  • designUnit (DesignUnit) – The design unit containing this declaration.

  • region (DeclarativeRegionMixin) – The declarative region declaring this declaration.

Return type:

None

ResolveReferences(designUnit, region)

Resolve the references of this declaration: its type marks (IterateTypeMarks()).

Each type mark is resolved at its place by the region it is looked up in (ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.

Parameters:
  • designUnit (DesignUnit) – The design unit containing this declaration.

  • region (DeclarativeRegionMixin) – The declarative region declaring this declaration.

Raises:

UnhandledCriticalWarningError – If a type mark can’t be resolved, and no WarningCollector collects the UnresolvedTypeMarkWarning.

Return type:

None

Visit(visitor)[source]

Walk this open entity aspect 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)
__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

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

class pyGHDL.dom.Configuration.BindingIndication(node, entityAspect=None, genericAssociationItems=None, portAssociationItems=None)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Configuration.BindingIndication.

Represents a binding indication: which design entity a component is bound to.

The entity aspect is available as EntityAspect, together with the generic and port maps (GenericAssociationItems, PortAssociationItems).

Inheritance

Inheritance diagram of BindingIndication

Parameters:
__init__(node, entityAspect=None, genericAssociationItems=None, portAssociationItems=None)[source]

Initializes a binding indication.

Parameters:
  • node (Iir) – The IIR node this object was translated from.

  • entityAspect (EntityAspect) – Optional, the bound design entity, or None if not given.

  • genericAssociationItems (List[GenericAssociationItem]) – Optional, list of all generic associations in the generic map aspect.

  • portAssociationItems (List[PortAssociationItem]) – Optional, list of all port associations in the port map aspect.

Return type:

None

classmethod parse(bindingIndicationNode)[source]

Translates the IIR node of the binding indication to a BindingIndication.

Parameters:

bindingIndicationNode (Iir) – The IIR node of the binding indication.

Return type:

Self

Returns:

The translated binding indication.

_iirNode: Iir

The IIR node in libghdl’s tree this DOM object was translated from.

_position: Position

The IIR node’s position in the source file, resolved on first access and then cached.

AddGenericAssociationItem(genericAssociationItem)

Add a generic association at the end of the generic map aspect.

The association’s parent is set to this language construct.

Parameters:

genericAssociationItem (GenericAssociationItem) – The generic association to add.

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

  • TypeError – If parameter ‘genericAssociationItem’ is not of type GenericAssociationItem.

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

  • DuplicateGenericAssociationError – If the association is named, and another named association of the generic map aspect has the same formal.

  • AssociationOrderError – If the association is positional, and the generic map aspect has a named association.

Return type:

None

See also

InsertGenericAssociationItem()

→ Insert a generic association at a position of the generic map aspect.

RemoveGenericAssociationItem()

→ Remove a generic association from the generic map aspect.

AddPortAssociationItem(portAssociationItem)

Add a port association at the end of the port map aspect.

The association’s parent is set to this language construct.

Parameters:

portAssociationItem (PortAssociationItem) – The port association to add.

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

  • TypeError – If parameter ‘portAssociationItem’ is not of type PortAssociationItem.

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

  • DuplicatePortAssociationError – If the association is named, and another named association of the port map aspect has the same formal.

  • AssociationOrderError – If the association is positional, and the port map aspect has a named association.

Return type:

None

See also

InsertPortAssociationItem()

→ Insert a port association at a position of the port map aspect.

RemovePortAssociationItem()

→ Remove a port association from the port map aspect.

DenoteBy(name, region, place, symbol)

Determine the model entity a name denoting this declaration denotes, as a part of a type mark (Name.Denote).

A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.

Parameters:
  • name (Name) – The name denoting this declaration, a part of the type mark.

  • region (DeclarativeRegionMixin) – The declarative region containing the type mark.

  • place (ModelEntity) – The declaration containing the type mark.

  • symbol (Symbol) – The type mark.

Return type:

ModelEntity | None

Returns:

None, as a name in a type mark can’t denote this declaration (reported as a warning).

Raises:

UnhandledCriticalWarningError – Always, if no WarningCollector collects the UnresolvedTypeMarkWarning.

property EntityAspect: EntityAspect | None

Read-only property to access the entity aspect (_entityAspect).

Returns:

The entity aspect, or None if not set.

property GenericAssociationItems: list[GenericAssociationItem]

Read-only property to access the generic associations (_genericAssociationItems).

Returns:

List of generic association 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:

AncestorNotFoundError – 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.

InsertGenericAssociationItem(index, genericAssociationItem)

Insert a generic association at a position of the generic map aspect.

The association’s parent is set to this language construct.

A named association (formal => actual) can’t repeat the formal of another named association of the generic map aspect. Only formals given as a simple name are compared: a partial association (a(0) => x) or a conversion function (to_integer(a) => x) is accepted. All positional associations precede the named associations.

Parameters:
  • index (int) – Position, from 0 (first) to the number of generic associations (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last generic association.

  • genericAssociationItem (GenericAssociationItem) – The generic association 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 ‘genericAssociationItem’ is None.

  • TypeError – If parameter ‘genericAssociationItem’ is not of type GenericAssociationItem.

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

  • DuplicateGenericAssociationError – If the association is named, and another named association of the generic map aspect has the same formal.

  • AssociationOrderError – If the association is positional, and a named association precedes the position.

  • AssociationOrderError – If the association is named, and a positional association follows the position.

Return type:

None

See also

AddGenericAssociationItem()

→ Add a generic association at the end of the generic map aspect.

RemoveGenericAssociationItem()

→ Remove a generic association from the generic map aspect.

InsertPortAssociationItem(index, portAssociationItem)

Insert a port association at a position of the port map aspect.

The association’s parent is set to this language construct.

A named association (formal => actual) can’t repeat the formal of another named association of the port map aspect. Only formals given as a simple name are compared: a partial association (a(0) => x) or a conversion function (to_integer(a) => x) is accepted. All positional associations precede the named associations.

Parameters:
  • index (int) – Position, from 0 (first) to the number of port associations (append). A negative index counts from the end, as for list.insert(): -1 inserts before the last port association.

  • portAssociationItem (PortAssociationItem) – The port association 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 ‘portAssociationItem’ is None.

  • TypeError – If parameter ‘portAssociationItem’ is not of type PortAssociationItem.

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

  • DuplicatePortAssociationError – If the association is named, and another named association of the port map aspect has the same formal.

  • AssociationOrderError – If the association is positional, and a named association precedes the position.

  • AssociationOrderError – If the association is named, and a positional association follows the position.

Return type:

None

See also

AddPortAssociationItem()

→ Add a port association at the end of the port map aspect.

RemovePortAssociationItem()

→ Remove a port association from the port map aspect.

property IsOverloadable: bool

Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.

Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.

Returns:

True, if this model entity is an overloadable declaration.

IterateImplicitDeclarations()

Iterate the declarations this declaration implies.

An enumerated type implies its enumeration literals, a physical type its units; they override this method.

Return type:

Generator[tuple[str, ModelEntity]]

Returns:

A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.

IterateTypeMarks(region)

Iterate the type marks of this declaration, each with the region and the place to look it up.

The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.

Parameters:

region (DeclarativeRegionMixin) – The declarative region declaring this declaration.

Return type:

Generator[tuple[DeclarativeRegionMixin, ModelEntity, SubtypeSymbol]]

Returns:

A generator to iterate (region, place, type mark) tuples, in declaration order: none.

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 PortAssociationItems: list[PortAssociationItem]

Read-only property to access the port associations (_portAssociationItems).

Returns:

List of port association items.

property Position: Position

Cached read-only property to access an IIR’s position in source code (_position).

If _position is None, resolve the position object from _iirNode

Returns:

The IIR’s position in the source file.

RemoveGenericAssociationItem(genericAssociationItem)

Remove a generic association from the generic map aspect.

The association is detached: its parent is cleared. The association itself is unchanged and can be added to another language construct, or inserted at another position.

Parameters:

genericAssociationItem (GenericAssociationItem) – The generic association to remove.

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

  • TypeError – If parameter ‘genericAssociationItem’ is not of type GenericAssociationItem.

  • NotAChildError – If parameter ‘genericAssociationItem’ is not a generic association of this language construct.

Return type:

None

See also

AddGenericAssociationItem()

→ Add a generic association at the end of the generic map aspect.

InsertGenericAssociationItem()

→ Insert a generic association at a position of the generic map aspect.

RemovePortAssociationItem(portAssociationItem)

Remove a port association from the port map aspect.

The association is detached: its parent is cleared. The association itself is unchanged and can be added to another language construct, or inserted at another position.

Parameters:

portAssociationItem (PortAssociationItem) – The port association to remove.

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

  • TypeError – If parameter ‘portAssociationItem’ is not of type PortAssociationItem.

  • NotAChildError – If parameter ‘portAssociationItem’ is not a port association of this language construct.

Return type:

None

See also

AddPortAssociationItem()

→ Add a port association at the end of the port map aspect.

InsertPortAssociationItem()

→ Insert a port association at a position of the port map aspect.

ResetReferences(designUnit, region)

Reset the references ResolveReferences() derived: the references of this declaration’s type marks.

A use clause, an alias and a subtype extend this method.

Parameters:
  • designUnit (DesignUnit) – The design unit containing this declaration.

  • region (DeclarativeRegionMixin) – The declarative region declaring this declaration.

Return type:

None

ResolveReferences(designUnit, region)

Resolve the references of this declaration: its type marks (IterateTypeMarks()).

Each type mark is resolved at its place by the region it is looked up in (ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.

Parameters:
  • designUnit (DesignUnit) – The design unit containing this declaration.

  • region (DeclarativeRegionMixin) – The declarative region declaring this declaration.

Raises:

UnhandledCriticalWarningError – If a type mark can’t be resolved, and no WarningCollector collects the UnresolvedTypeMarkWarning.

Return type:

None

Visit(visitor)[source]

Walk this binding indication, its entity aspect and its map aspects with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitGenericMapAspect(visitor)

Walk the generic map aspect, if there are generic associations, with a visitor.

The associations are separated by commas.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_VisitPortMapAspect(visitor)

Walk the port map aspect, if there are port associations, with a visitor.

The associations are separated by commas.

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)
__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

_entityAspect: EntityAspect | None

The bound design entity, or None if not given.

_genericAssociationItems: list[GenericAssociationItem]

List of all generic associations.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_portAssociationItems: list[PortAssociationItem]

List of all port associations.

class pyGHDL.dom.Configuration.AllInstantiationList(node)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Configuration.AllInstantiationList.

Represents an instantiation list naming all instances of a component.

Example

for all : comp use entity work.sub(behav);
--  ^^^                                      <- the instantiation list

Inheritance

Inheritance diagram of AllInstantiationList

Parameters:

node (Iir)

__init__(node)[source]

Initializes an instantiation list denoting all.

Parameters:

node (Iir) – The IIR node this object was translated from.

Return type:

None

_iirNode: Iir

The IIR node in libghdl’s tree this DOM object was translated from.

_position: Position

The IIR node’s position in the source file, resolved on first access and then cached.

DenoteBy(name, region, place, symbol)

Determine the model entity a name denoting this declaration denotes, as a part of a type mark (Name.Denote).

A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.

Parameters:
  • name (Name) – The name denoting this declaration, a part of the type mark.

  • region (DeclarativeRegionMixin) – The declarative region containing the type mark.

  • place (ModelEntity) – The declaration containing the type mark.

  • symbol (Symbol) – The type mark.

Return type:

ModelEntity | None

Returns:

None, as a name in a type mark can’t denote this declaration (reported as a warning).

Raises:

UnhandledCriticalWarningError – Always, if no WarningCollector collects the UnresolvedTypeMarkWarning.

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:

AncestorNotFoundError – 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 IsOverloadable: bool

Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.

Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.

Returns:

True, if this model entity is an overloadable declaration.

IterateImplicitDeclarations()

Iterate the declarations this declaration implies.

An enumerated type implies its enumeration literals, a physical type its units; they override this method.

Return type:

Generator[tuple[str, ModelEntity]]

Returns:

A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.

IterateTypeMarks(region)

Iterate the type marks of this declaration, each with the region and the place to look it up.

The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.

Parameters:

region (DeclarativeRegionMixin) – The declarative region declaring this declaration.

Return type:

Generator[tuple[DeclarativeRegionMixin, ModelEntity, SubtypeSymbol]]

Returns:

A generator to iterate (region, place, type mark) tuples, in declaration order: none.

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

Cached read-only property to access an IIR’s position in source code (_position).

If _position is None, resolve the position object from _iirNode

Returns:

The IIR’s position in the source file.

ResetReferences(designUnit, region)

Reset the references ResolveReferences() derived: the references of this declaration’s type marks.

A use clause, an alias and a subtype extend this method.

Parameters:
  • designUnit (DesignUnit) – The design unit containing this declaration.

  • region (DeclarativeRegionMixin) – The declarative region declaring this declaration.

Return type:

None

ResolveReferences(designUnit, region)

Resolve the references of this declaration: its type marks (IterateTypeMarks()).

Each type mark is resolved at its place by the region it is looked up in (ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.

Parameters:
  • designUnit (DesignUnit) – The design unit containing this declaration.

  • region (DeclarativeRegionMixin) – The declarative region declaring this declaration.

Raises:

UnhandledCriticalWarningError – If a type mark can’t be resolved, and no WarningCollector collects the UnresolvedTypeMarkWarning.

Return type:

None

Visit(visitor)[source]

Walk this all instantiation list 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)
__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

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

class pyGHDL.dom.Configuration.OthersInstantiationList(node)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Configuration.OthersInstantiationList.

Represents an instantiation list naming all instances not configured elsewhere.

Example

for others : comp use entity work.sub(behav);
--  ^^^^^^                                      <- the instantiation list

Inheritance

Inheritance diagram of OthersInstantiationList

Parameters:

node (Iir)

__init__(node)[source]

Initializes an instantiation list denoting others.

Parameters:

node (Iir) – The IIR node this object was translated from.

Return type:

None

_iirNode: Iir

The IIR node in libghdl’s tree this DOM object was translated from.

_position: Position

The IIR node’s position in the source file, resolved on first access and then cached.

DenoteBy(name, region, place, symbol)

Determine the model entity a name denoting this declaration denotes, as a part of a type mark (Name.Denote).

A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.

Parameters:
  • name (Name) – The name denoting this declaration, a part of the type mark.

  • region (DeclarativeRegionMixin) – The declarative region containing the type mark.

  • place (ModelEntity) – The declaration containing the type mark.

  • symbol (Symbol) – The type mark.

Return type:

ModelEntity | None

Returns:

None, as a name in a type mark can’t denote this declaration (reported as a warning).

Raises:

UnhandledCriticalWarningError – Always, if no WarningCollector collects the UnresolvedTypeMarkWarning.

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:

AncestorNotFoundError – 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 IsOverloadable: bool

Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.

Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.

Returns:

True, if this model entity is an overloadable declaration.

IterateImplicitDeclarations()

Iterate the declarations this declaration implies.

An enumerated type implies its enumeration literals, a physical type its units; they override this method.

Return type:

Generator[tuple[str, ModelEntity]]

Returns:

A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.

IterateTypeMarks(region)

Iterate the type marks of this declaration, each with the region and the place to look it up.

The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.

Parameters:

region (DeclarativeRegionMixin) – The declarative region declaring this declaration.

Return type:

Generator[tuple[DeclarativeRegionMixin, ModelEntity, SubtypeSymbol]]

Returns:

A generator to iterate (region, place, type mark) tuples, in declaration order: none.

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

Cached read-only property to access an IIR’s position in source code (_position).

If _position is None, resolve the position object from _iirNode

Returns:

The IIR’s position in the source file.

ResetReferences(designUnit, region)

Reset the references ResolveReferences() derived: the references of this declaration’s type marks.

A use clause, an alias and a subtype extend this method.

Parameters:
  • designUnit (DesignUnit) – The design unit containing this declaration.

  • region (DeclarativeRegionMixin) – The declarative region declaring this declaration.

Return type:

None

ResolveReferences(designUnit, region)

Resolve the references of this declaration: its type marks (IterateTypeMarks()).

Each type mark is resolved at its place by the region it is looked up in (ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.

Parameters:
  • designUnit (DesignUnit) – The design unit containing this declaration.

  • region (DeclarativeRegionMixin) – The declarative region declaring this declaration.

Raises:

UnhandledCriticalWarningError – If a type mark can’t be resolved, and no WarningCollector collects the UnresolvedTypeMarkWarning.

Return type:

None

Visit(visitor)[source]

Walk this others instantiation list 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)
__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

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

class pyGHDL.dom.Configuration.ComponentConfiguration(node, instantiationList, componentName, bindingIndication=None)[source]

Note

Also used for configuration specifications (for U1 : comp use entity ...; declared directly in an architecture’s declarative part) - GHDL represents both with the identical field structure (Instantiation_List, Component_Name, Binding_Indication).

Inheritance

Inheritance diagram of ComponentConfiguration

Parameters:
__init__(node, instantiationList, componentName, bindingIndication=None)[source]

Initializes a component configuration.

Parameters:
Return type:

None

classmethod parse(node)[source]

Translates an IIR node to a ComponentConfiguration.

Parameters:

node (Iir) – The IIR node this object is translated from.

Return type:

Self

Returns:

The translated object.

_iirNode: Iir

The IIR node in libghdl’s tree this DOM object was translated from.

_position: Position

The IIR node’s position in the source file, resolved on first access and then cached.

property BindingIndication: BindingIndication | None

Read-only property to access the binding indication (_bindingIndication).

Returns:

The binding indication, or None if not set.

property ComponentName: ComponentInstantiationSymbol

Read-only property to access the component name (_componentName).

Returns:

The component name.

DenoteBy(name, region, place, symbol)

Determine the model entity a name denoting this declaration denotes, as a part of a type mark (Name.Denote).

A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.

Parameters:
  • name (Name) – The name denoting this declaration, a part of the type mark.

  • region (DeclarativeRegionMixin) – The declarative region containing the type mark.

  • place (ModelEntity) – The declaration containing the type mark.

  • symbol (Symbol) – The type mark.

Return type:

ModelEntity | None

Returns:

None, as a name in a type mark can’t denote this declaration (reported as a warning).

Raises:

UnhandledCriticalWarningError – Always, if no WarningCollector collects the UnresolvedTypeMarkWarning.

property Documentation: str | None

Read-only property to access the model entity’s documentation (_documentation).

Returns:

Associated documentation of a model entity.

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:

AncestorNotFoundError – 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 InstantiationList: list[Name] | AllInstantiationList | OthersInstantiationList

Read-only property to access the instantiation list (_instantiationList).

Returns:

The instantiation list.

property IsOverloadable: bool

Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.

Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.

Returns:

True, if this model entity is an overloadable declaration.

IterateImplicitDeclarations()

Iterate the declarations this declaration implies.

An enumerated type implies its enumeration literals, a physical type its units; they override this method.

Return type:

Generator[tuple[str, ModelEntity]]

Returns:

A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.

IterateTypeMarks(region)

Iterate the type marks of this declaration, each with the region and the place to look it up.

The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.

Parameters:

region (DeclarativeRegionMixin) – The declarative region declaring this declaration.

Return type:

Generator[tuple[DeclarativeRegionMixin, ModelEntity, SubtypeSymbol]]

Returns:

A generator to iterate (region, place, type mark) tuples, in declaration order: none.

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

Cached read-only property to access an IIR’s position in source code (_position).

If _position is None, resolve the position object from _iirNode

Returns:

The IIR’s position in the source file.

ResetReferences(designUnit, region)

Reset the references ResolveReferences() derived: the references of this declaration’s type marks.

A use clause, an alias and a subtype extend this method.

Parameters:
  • designUnit (DesignUnit) – The design unit containing this declaration.

  • region (DeclarativeRegionMixin) – The declarative region declaring this declaration.

Return type:

None

ResolveReferences(designUnit, region)

Resolve the references of this declaration: its type marks (IterateTypeMarks()).

Each type mark is resolved at its place by the region it is looked up in (ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.

Parameters:
  • designUnit (DesignUnit) – The design unit containing this declaration.

  • region (DeclarativeRegionMixin) – The declarative region declaring this declaration.

Raises:

UnhandledCriticalWarningError – If a type mark can’t be resolved, and no WarningCollector collects the UnresolvedTypeMarkWarning.

Return type:

None

Visit(visitor)[source]

Walk this component configuration, its component specification and its binding indication with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_END_KEYWORDS: ClassVar[tuple[ReservedWord, ...]] = (ReservedWord.For,)

Reserved words after end.

_END_KEYWORDS_OPTIONAL: ClassVar[bool] = False

The reserved words after end are optional.

__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)
__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

_bindingIndication: BindingIndication | None

The binding indication, or None if none was given.

_componentName: ComponentInstantiationSymbol

Reference to the component being configured.

_documentation: str | None

The associated documentation of a model entity.

_instantiationList: list[Name] | AllInstantiationList | OthersInstantiationList

The instances this configuration applies to.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

class pyGHDL.dom.Configuration.BlockConfiguration(node, blockSpecification, items=None)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Configuration.BlockConfiguration.

Represents the configuration of one block: an architecture, a block statement or a generate body.

Nested configurations are available as Items.

Example

for rtl
--  ^^^    <- Block
end for;

Inheritance

Inheritance diagram of BlockConfiguration

Parameters:
__init__(node, blockSpecification, items=None)[source]

Initializes a block configuration.

Parameters:
Return type:

None

classmethod parse(node)[source]

Translates an IIR node to a BlockConfiguration.

Parameters:

node (Iir) – The IIR node this object is translated from.

Return type:

Self

Returns:

The translated object.

_iirNode: Iir

The IIR node in libghdl’s tree this DOM object was translated from.

_position: Position

The IIR node’s position in the source file, resolved on first access and then cached.

property BlockSpecification: Symbol

Read-only property to access the block specification (_blockSpecification).

Returns:

The block specification.

DenoteBy(name, region, place, symbol)

Determine the model entity a name denoting this declaration denotes, as a part of a type mark (Name.Denote).

A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.

Parameters:
  • name (Name) – The name denoting this declaration, a part of the type mark.

  • region (DeclarativeRegionMixin) – The declarative region containing the type mark.

  • place (ModelEntity) – The declaration containing the type mark.

  • symbol (Symbol) – The type mark.

Return type:

ModelEntity | None

Returns:

None, as a name in a type mark can’t denote this declaration (reported as a warning).

Raises:

UnhandledCriticalWarningError – Always, if no WarningCollector collects the UnresolvedTypeMarkWarning.

property Documentation: str | None

Read-only property to access the model entity’s documentation (_documentation).

Returns:

Associated documentation of a model entity.

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:

AncestorNotFoundError – 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 IsOverloadable: bool

Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.

Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.

Returns:

True, if this model entity is an overloadable declaration.

property Items: list[BlockConfiguration | ComponentConfiguration]

Read-only property to access the items (_items).

Returns:

List of items.

IterateImplicitDeclarations()

Iterate the declarations this declaration implies.

An enumerated type implies its enumeration literals, a physical type its units; they override this method.

Return type:

Generator[tuple[str, ModelEntity]]

Returns:

A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.

IterateTypeMarks(region)

Iterate the type marks of this declaration, each with the region and the place to look it up.

The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.

Parameters:

region (DeclarativeRegionMixin) – The declarative region declaring this declaration.

Return type:

Generator[tuple[DeclarativeRegionMixin, ModelEntity, SubtypeSymbol]]

Returns:

A generator to iterate (region, place, type mark) tuples, in declaration order: none.

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

Cached read-only property to access an IIR’s position in source code (_position).

If _position is None, resolve the position object from _iirNode

Returns:

The IIR’s position in the source file.

ResetReferences(designUnit, region)

Reset the references ResolveReferences() derived: the references of this declaration’s type marks.

A use clause, an alias and a subtype extend this method.

Parameters:
  • designUnit (DesignUnit) – The design unit containing this declaration.

  • region (DeclarativeRegionMixin) – The declarative region declaring this declaration.

Return type:

None

ResolveReferences(designUnit, region)

Resolve the references of this declaration: its type marks (IterateTypeMarks()).

Each type mark is resolved at its place by the region it is looked up in (ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.

Parameters:
  • designUnit (DesignUnit) – The design unit containing this declaration.

  • region (DeclarativeRegionMixin) – The declarative region declaring this declaration.

Raises:

UnhandledCriticalWarningError – If a type mark can’t be resolved, and no WarningCollector collects the UnresolvedTypeMarkWarning.

Return type:

None

Visit(visitor)[source]

Walk this block configuration, its block specification and its nested configurations with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_END_KEYWORDS: ClassVar[tuple[ReservedWord, ...]] = (ReservedWord.For,)

Reserved words after end.

_END_KEYWORDS_OPTIONAL: ClassVar[bool] = False

The reserved words after end are optional.

__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)
__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

_blockSpecification: Symbol

The configured block.

_documentation: str | None

The associated documentation of a model entity.

_items: list[BlockConfiguration | ComponentConfiguration]

Nested configurations.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.