pyGHDL.dom.Configuration

This module implements derived configuration classes from pyVHDLModel.Configuration.

Classes


Classes

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

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

Example

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

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

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 (TypeVar(Iir, bound= c_int)) – The IIR node this object was translated from.

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

  • architecture (ArchitectureSymbol) – 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 (TypeVar(Iir, bound= c_int)) – The IIR node of the entity aspect.

Return type:

EntityAspectEntity

Returns:

The translated entity aspect.

_iirNode: Iir

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

_position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>

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.

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:

VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.

classmethod GetMethodsWithAttributes(predicate: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
Parameters:

predicate (TypeVar(TAttr) | Iterable[TypeVar(TAttr)] | None) – An attribute class, an iterable of attribute classes, or None to accept every attribute.

Return type:

Dict[Callable, 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 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: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>

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.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

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

Represents an entity aspect naming a configuration.

Example

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

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

Inheritance

Inheritance diagram of EntityAspectConfiguration

Parameters:
__init__(node, configuration)[source]

Initializes an entity aspect naming a configuration.

Parameters:
  • node (TypeVar(Iir, bound= c_int)) – 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 (TypeVar(Iir, bound= c_int)) – The IIR node of the entity aspect.

Return type:

EntityAspectConfiguration

Returns:

The translated entity aspect.

_iirNode: Iir

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

_position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>

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.

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: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
Parameters:

predicate (TypeVar(TAttr) | Iterable[TypeVar(TAttr)] | None) – An attribute class, an iterable of attribute classes, or None to accept every attribute.

Return type:

Dict[Callable, 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 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: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>

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.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

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

Represents an open entity aspect, leaving the binding unspecified.

Example

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

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

Inheritance

Inheritance diagram of EntityAspectOpen

Parameters:

node (Iir)

__init__(node)[source]

Initializes an entity aspect denoting open.

Parameters:

node (TypeVar(Iir, bound= c_int)) – 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 (TypeVar(Iir, bound= c_int)) – The IIR node of the entity aspect.

Return type:

EntityAspectOpen

Returns:

The translated entity aspect.

_iirNode: Iir

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

_position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>

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

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: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
Parameters:

predicate (TypeVar(TAttr) | Iterable[TypeVar(TAttr)] | None) – An attribute class, an iterable of attribute classes, or None to accept every attribute.

Return type:

Dict[Callable, 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 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: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>

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.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

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

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 (GenericAssociations, PortAssociations).

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

Inheritance

Inheritance diagram of BindingIndication

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

Initializes a binding indication.

Parameters:
  • node (TypeVar(Iir, bound= c_int)) – The IIR node this object was translated from.

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

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

  • portAssociationItems (List[PortAssociationItem]) – 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 (TypeVar(Iir, bound= c_int)) – The IIR node of the binding indication.

Return type:

BindingIndication

Returns:

The translated binding indication.

_iirNode: Iir

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

_position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>

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

property EntityAspect: <pyTooling.Decorators.readonly object at 0x7f3f444d70d0> | 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:

VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.

classmethod GetMethodsWithAttributes(predicate: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
Parameters:

predicate (TypeVar(TAttr) | Iterable[TypeVar(TAttr)] | None) – An attribute class, an iterable of attribute classes, or None to accept every attribute.

Return type:

Dict[Callable, 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 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: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>

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.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

_entityAspect: <pyTooling.Decorators.readonly object at 0x7f3f444d70d0> | 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]

Represents an instantiation list naming all instances of a component.

Example

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

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

Inheritance

Inheritance diagram of AllInstantiationList

Parameters:

node (Iir)

__init__(node)[source]

Initializes an instantiation list denoting all.

Parameters:

node (TypeVar(Iir, bound= c_int)) – 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: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>

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

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: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
Parameters:

predicate (TypeVar(TAttr) | Iterable[TypeVar(TAttr)] | None) – An attribute class, an iterable of attribute classes, or None to accept every attribute.

Return type:

Dict[Callable, 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 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: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>

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.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

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

Represents an instantiation list naming all instances not configured elsewhere.

Example

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

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

Inheritance

Inheritance diagram of OthersInstantiationList

Parameters:

node (Iir)

__init__(node)[source]

Initializes an instantiation list denoting others.

Parameters:

node (TypeVar(Iir, bound= c_int)) – 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: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>

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

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: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
Parameters:

predicate (TypeVar(TAttr) | Iterable[TypeVar(TAttr)] | None) – An attribute class, an iterable of attribute classes, or None to accept every attribute.

Return type:

Dict[Callable, 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 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: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>

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.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

_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 (TypeVar(Iir, bound= c_int)) – The IIR node this object is translated from.

Return type:

ComponentConfiguration

Returns:

The translated object.

_iirNode: Iir

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

_position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>

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

property BindingIndication: <pyTooling.Decorators.readonly object at 0x7f3f444d74d0> | 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.

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: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
Parameters:

predicate (TypeVar(TAttr) | Iterable[TypeVar(TAttr)] | None) – An attribute class, an iterable of attribute classes, or None to accept every attribute.

Return type:

Dict[Callable, 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 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: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>

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.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

_bindingIndication: <pyTooling.Decorators.readonly object at 0x7f3f444d74d0> | None

The binding indication, or None if none was given.

_componentName: ComponentInstantiationSymbol

Reference to the component being configured.

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

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

Nested configurations are available as ConfigurationItems.

Example

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

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

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 (TypeVar(Iir, bound= c_int)) – The IIR node this object is translated from.

Return type:

BlockConfiguration

Returns:

The translated object.

_iirNode: Iir

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

_position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>

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.

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: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
Parameters:

predicate (TypeVar(TAttr) | Iterable[TypeVar(TAttr)] | None) – An attribute class, an iterable of attribute classes, or None to accept every attribute.

Return type:

Dict[Callable, 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 Items: List[BlockConfiguration | ComponentConfiguration]

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

Returns:

List of items.

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: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>

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.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

_blockSpecification: Symbol

The configured block.

_items: List[BlockConfiguration | ComponentConfiguration]

Nested configurations.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.