pyGHDL.dom.Object

This module implements derived object classes from pyVHDLModel.Object.

Classes


Classes

class pyGHDL.dom.Object.Constant(node, identifiers, subtype, defaultExpression, documentation=None)[source]

Represents a constant.

This class implements a pyGHDL.dom object derived from pyVHDLModel.Object.Constant.

Example

constant BITS : positive := 8;

Inheritance

Inheritance diagram of Constant

Parameters:
__init__(node, identifiers, subtype, defaultExpression, documentation=None)[source]

Initializes a constant.

Parameters:
  • identifiers (List[str]) – A list of identifiers.

  • subtype (Symbol) – Reference to the object’s subtype.

  • defaultExpression (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The default value, or None if none was given.

  • documentation (str) – The documentation comment associated with this declaration.

  • parent – The parent model entity of this entity.

  • node (Iir)

Return type:

None

property DefaultExpression: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal | None

Read-only property to access the default expression (_defaultExpression).

Returns:

The default expression, or None if not set.

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:

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 Identifiers: Tuple[str]

Read-only property to access the model entity’s identifiers (_identifiers).

Returns:

Tuple of identifiers.

property NormalizedIdentifiers: Tuple[str]

Read-only property to access the model entity’s normalized identifiers (_normalizedIdentifiers).

Returns:

Tuple of normalized identifiers.

property ObjectVertex: Vertex | None

Read-only property to access the corresponding object vertex (_objectVertex).

The object vertex references this Object by its value field.

Returns:

The corresponding object vertex.

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 0x7c526738b7d0>

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.

property Subtype: Symbol

Read-only property to access the subtype (_subtype).

Returns:

The subtype.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

__str__()

Formats the object declaration.

Format: signal s1, s2 : bit

Return type:

str

Returns:

Formatted object declaration.

_defaultExpression

The default value, or None if none was given.

_documentation

The associated documentation of a model entity.

_identifiers

A list of identifiers.

_normalizedIdentifiers

A list of normalized (lower case) identifiers.

_objectKeyword = 'constant'

The VHDL keyword introducing this object class.

_objectVertex

The vertex representing this object in the design’s object graph.

_parent

Reference to a parent entity in the logical model hierarchy.

_subtype

Reference to the object’s subtype.

class pyGHDL.dom.Object.DeferredConstant(node, identifiers, subtype, documentation=None)[source]

Represents a deferred constant.

This class implements a pyGHDL.dom object derived from pyVHDLModel.Object.DeferredConstant.

Example

constant BITS : positive;

Inheritance

Inheritance diagram of DeferredConstant

Parameters:
__init__(node, identifiers, subtype, documentation=None)[source]

Initializes a deferred constant.

Parameters:
  • identifiers (List[str]) – A list of identifiers.

  • subtype (Symbol) – Reference to the object’s subtype.

  • documentation (str) – The documentation comment associated with this declaration.

  • parent – The parent model entity of this entity.

  • node (Iir)

Return type:

None

property ConstantReference: Constant | None

Read-only property to access the constant reference (_constantReference).

Returns:

The constant reference, or None if not set.

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:

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 Identifiers: Tuple[str]

Read-only property to access the model entity’s identifiers (_identifiers).

Returns:

Tuple of identifiers.

property NormalizedIdentifiers: Tuple[str]

Read-only property to access the model entity’s normalized identifiers (_normalizedIdentifiers).

Returns:

Tuple of normalized identifiers.

property ObjectVertex: Vertex | None

Read-only property to access the corresponding object vertex (_objectVertex).

The object vertex references this Object by its value field.

Returns:

The corresponding object vertex.

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 0x7c526738b7d0>

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.

property Subtype: Symbol

Read-only property to access the subtype (_subtype).

Returns:

The subtype.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

__str__()

Formats the object declaration.

Format: signal s1, s2 : bit

Return type:

str

Returns:

Formatted object declaration.

_constantReference: Constant | None

The full declaration, or None if unlinked.

_documentation: str | None

The associated documentation of a model entity.

_identifiers: Tuple[str]

A list of identifiers.

_normalizedIdentifiers: Tuple[str]

A list of normalized (lower case) identifiers.

_objectKeyword: ClassVar[str] = 'constant'

The VHDL keyword introducing this object class.

_objectVertex: Vertex | None

The vertex representing this object in the design’s object graph.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_subtype: Symbol

Reference to the object’s subtype.

class pyGHDL.dom.Object.Variable(node, identifiers, subtype, defaultExpression, documentation=None)[source]

Represents a variable.

This class implements a pyGHDL.dom object derived from pyVHDLModel.Object.Variable.

Example

variable result : natural := 0;

Inheritance

Inheritance diagram of Variable

Parameters:
__init__(node, identifiers, subtype, defaultExpression, documentation=None)[source]

Initializes a variable.

Parameters:
  • identifiers (List[str]) – A list of identifiers.

  • subtype (Symbol) – Reference to the object’s subtype.

  • defaultExpression (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The default value, or None if none was given.

  • documentation (str) – The documentation comment associated with this declaration.

  • parent – The parent model entity of this entity.

  • node (Iir)

Return type:

None

property DefaultExpression: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal | None

Read-only property to access the default expression (_defaultExpression).

Returns:

The default expression, or None if not set.

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:

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 Identifiers: Tuple[str]

Read-only property to access the model entity’s identifiers (_identifiers).

Returns:

Tuple of identifiers.

property NormalizedIdentifiers: Tuple[str]

Read-only property to access the model entity’s normalized identifiers (_normalizedIdentifiers).

Returns:

Tuple of normalized identifiers.

property ObjectVertex: Vertex | None

Read-only property to access the corresponding object vertex (_objectVertex).

The object vertex references this Object by its value field.

Returns:

The corresponding object vertex.

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 0x7c526738b7d0>

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.

property Subtype: Symbol

Read-only property to access the subtype (_subtype).

Returns:

The subtype.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

__str__()

Formats the object declaration.

Format: signal s1, s2 : bit

Return type:

str

Returns:

Formatted object declaration.

_defaultExpression

The default value, or None if none was given.

_documentation

The associated documentation of a model entity.

_identifiers

A list of identifiers.

_normalizedIdentifiers

A list of normalized (lower case) identifiers.

_objectKeyword = 'variable'

The VHDL keyword introducing this object class.

_objectVertex

The vertex representing this object in the design’s object graph.

_parent

Reference to a parent entity in the logical model hierarchy.

_subtype

Reference to the object’s subtype.

class pyGHDL.dom.Object.SharedVariable(node, identifiers, subtype, documentation=None)[source]

Represents a shared variable.

This class implements a pyGHDL.dom object derived from pyVHDLModel.Object.SharedVariable.

Example

shared variable counter : counter_pt;

Inheritance

Inheritance diagram of SharedVariable

Parameters:
__init__(node, identifiers, subtype, documentation=None)[source]

Initializes an object.

Parameters:
  • identifiers (List[str]) – A list of identifiers.

  • subtype (Symbol) – Reference to the object’s subtype.

  • documentation (str) – The documentation comment associated with this declaration.

  • parent – The parent model entity of this entity.

  • node (Iir)

Return type:

None

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:

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 Identifiers: Tuple[str]

Read-only property to access the model entity’s identifiers (_identifiers).

Returns:

Tuple of identifiers.

property NormalizedIdentifiers: Tuple[str]

Read-only property to access the model entity’s normalized identifiers (_normalizedIdentifiers).

Returns:

Tuple of normalized identifiers.

property ObjectVertex: Vertex | None

Read-only property to access the corresponding object vertex (_objectVertex).

The object vertex references this Object by its value field.

Returns:

The corresponding object vertex.

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 0x7c526738b7d0>

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.

property Subtype: Symbol

Read-only property to access the subtype (_subtype).

Returns:

The subtype.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

__str__()

Formats the object declaration.

Format: signal s1, s2 : bit

Return type:

str

Returns:

Formatted object declaration.

_documentation: str | None

The associated documentation of a model entity.

_identifiers: Tuple[str]

A list of identifiers.

_normalizedIdentifiers: Tuple[str]

A list of normalized (lower case) identifiers.

_objectKeyword: ClassVar[str] = 'shared variable'

The VHDL keyword introducing this object class.

_objectVertex: Vertex | None

The vertex representing this object in the design’s object graph.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_subtype: Symbol

Reference to the object’s subtype.

class pyGHDL.dom.Object.Signal(node, identifiers, subtype, defaultExpression, documentation=None)[source]

Represents a signal.

This class implements a pyGHDL.dom object derived from pyVHDLModel.Object.Signal.

Example

signal counter : unsigned := (others => '0');

Inheritance

Inheritance diagram of Signal

Parameters:
__init__(node, identifiers, subtype, defaultExpression, documentation=None)[source]

Initializes a signal.

Parameters:
  • identifiers (List[str]) – A list of identifiers.

  • subtype (Symbol) – Reference to the object’s subtype.

  • defaultExpression (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The default value, or None if none was given.

  • documentation (str) – The documentation comment associated with this declaration.

  • parent – The parent model entity of this entity.

  • node (Iir)

Return type:

None

property DefaultExpression: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal | None

Read-only property to access the default expression (_defaultExpression).

Returns:

The default expression, or None if not set.

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:

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 Identifiers: Tuple[str]

Read-only property to access the model entity’s identifiers (_identifiers).

Returns:

Tuple of identifiers.

property NormalizedIdentifiers: Tuple[str]

Read-only property to access the model entity’s normalized identifiers (_normalizedIdentifiers).

Returns:

Tuple of normalized identifiers.

property ObjectVertex: Vertex | None

Read-only property to access the corresponding object vertex (_objectVertex).

The object vertex references this Object by its value field.

Returns:

The corresponding object vertex.

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 0x7c526738b7d0>

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.

property Subtype: Symbol

Read-only property to access the subtype (_subtype).

Returns:

The subtype.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

__str__()

Formats the object declaration.

Format: signal s1, s2 : bit

Return type:

str

Returns:

Formatted object declaration.

_defaultExpression

The default value, or None if none was given.

_documentation

The associated documentation of a model entity.

_identifiers

A list of identifiers.

_normalizedIdentifiers

A list of normalized (lower case) identifiers.

_objectKeyword = 'signal'

The VHDL keyword introducing this object class.

_objectVertex

The vertex representing this object in the design’s object graph.

_parent

Reference to a parent entity in the logical model hierarchy.

_subtype

Reference to the object’s subtype.

class pyGHDL.dom.Object.File(node, identifiers, subtype, documentation=None)[source]

Represents a file.

This class implements a pyGHDL.dom object derived from pyVHDLModel.Object.File.

Example

file INPUT : TEXT;

Inheritance

Inheritance diagram of File

Parameters:
__init__(node, identifiers, subtype, documentation=None)[source]

Initializes an object.

Parameters:
  • identifiers (List[str]) – A list of identifiers.

  • subtype (Symbol) – Reference to the object’s subtype.

  • documentation (str) – The documentation comment associated with this declaration.

  • parent – The parent model entity of this entity.

  • node (Iir)

Return type:

None

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:

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 Identifiers: Tuple[str]

Read-only property to access the model entity’s identifiers (_identifiers).

Returns:

Tuple of identifiers.

property NormalizedIdentifiers: Tuple[str]

Read-only property to access the model entity’s normalized identifiers (_normalizedIdentifiers).

Returns:

Tuple of normalized identifiers.

property ObjectVertex: Vertex | None

Read-only property to access the corresponding object vertex (_objectVertex).

The object vertex references this Object by its value field.

Returns:

The corresponding object vertex.

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 0x7c526738b7d0>

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.

property Subtype: Symbol

Read-only property to access the subtype (_subtype).

Returns:

The subtype.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

__str__()

Formats the object declaration.

Format: signal s1, s2 : bit

Return type:

str

Returns:

Formatted object declaration.

_documentation: str | None

The associated documentation of a model entity.

_identifiers: Tuple[str]

A list of identifiers.

_normalizedIdentifiers: Tuple[str]

A list of normalized (lower case) identifiers.

_objectKeyword: ClassVar[str] = 'file'

The VHDL keyword introducing this object class.

_objectVertex: Vertex | None

The vertex representing this object in the design’s object graph.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_subtype: Symbol

Reference to the object’s subtype.