pyGHDL.dom.Expression

This module implements derived expression classes from pyVHDLModel.Expression.

Classes


Classes

class pyGHDL.dom.Expression.InverseExpression(node, operand)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.InverseExpression.

Represents a logical inversion expression (not).

The operand is available as Operand.

Example

res := not operand;
--     ^^^^^^^^^^^    <- the expression
--         ^^^^^^^    <- Operand

Inheritance

Inheritance diagram of InverseExpression

Parameters:
  • node (Iir)

  • operand (ExpressionUnion)

__init__(node, operand)[source]

Initializes an inverse expression.

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

  • operand (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression the operator is applied to.

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.

Copy()

Create a copy of this unary expression.

The copy has no parent. Its operand is a copy of this expression’s operand.

Return type:

Self

Returns:

The new unary expression.

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 Operand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the operand (_operand).

Returns:

The operand.

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)

Walk this unary expression and its operand with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str]] = ('not ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 7

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord] = 'not'

The operator’s reserved word.

__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

__str__()

Formats the unary expression.

Format: not operand

Return type:

str

Returns:

Formatted unary expression.

_operand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression the operator is applied to.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

classmethod parse(node)

Translates an IIR node to a _ParseUnaryExpressionMixin.

Parameters:

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

Return type:

UnaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.ConditionExpression(node, operand)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.ConditionExpression.

Represents a condition operator expression (??), converting its operand to boolean.

The operand is available as Operand; it is a primary.

Example

if ?? enable then
-- ^^^^^^^^^    <- the expression
--    ^^^^^^    <- Operand

Inheritance

Inheritance diagram of ConditionExpression

Parameters:
  • node (Iir)

  • operand (ExpressionUnion)

__init__(node, operand)[source]

Initializes a condition expression.

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

  • operand (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression the operator is applied to.

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.

Copy()

Create a copy of this unary expression.

The copy has no parent. Its operand is a copy of this expression’s operand.

Return type:

Self

Returns:

The new unary expression.

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 Operand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the operand (_operand).

Returns:

The operand.

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 condition operator expression and its operand with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str]] = ('?? ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 1

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord | None] = None

The operator’s reserved word; None for a symbol (_FORMAT).

__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

__str__()

Formats the unary expression.

Format: not operand

Return type:

str

Returns:

Formatted unary expression.

_operand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression the operator is applied to.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

classmethod parse(node)

Translates an IIR node to a _ParseUnaryExpressionMixin.

Parameters:

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

Return type:

UnaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.IdentityExpression(node, operand)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.IdentityExpression.

Represents an identity (unary plus) expression.

The operand is available as Operand.

Example

res := + operand;
--     ^^^^^^^^^    <- the expression
--       ^^^^^^^    <- Operand

Inheritance

Inheritance diagram of IdentityExpression

Parameters:
  • node (Iir)

  • operand (ExpressionUnion)

__init__(node, operand)[source]

Initializes an identity expression.

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

  • operand (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression the operator is applied to.

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.

Copy()

Create a copy of this unary expression.

The copy has no parent. Its operand is a copy of this expression’s operand.

Return type:

Self

Returns:

The new unary expression.

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 Operand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the operand (_operand).

Returns:

The operand.

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 identity and its operand with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str]] = ('+', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 5

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord | None] = None

The operator’s reserved word; None for a symbol (_FORMAT).

__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

__str__()

Formats the unary expression.

Format: not operand

Return type:

str

Returns:

Formatted unary expression.

_operand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression the operator is applied to.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

classmethod parse(node)

Translates an IIR node to a _ParseUnaryExpressionMixin.

Parameters:

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

Return type:

UnaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.NegationExpression(node, operand)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.NegationExpression.

Represents a negation (unary minus) expression.

The operand is available as Operand.

Example

res := - operand;
--     ^^^^^^^^^    <- the expression
--       ^^^^^^^    <- Operand

Inheritance

Inheritance diagram of NegationExpression

Parameters:
  • node (Iir)

  • operand (ExpressionUnion)

__init__(node, operand)[source]

Initializes a negation expression.

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

  • operand (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression the operator is applied to.

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.

Copy()

Create a copy of this unary expression.

The copy has no parent. Its operand is a copy of this expression’s operand.

Return type:

Self

Returns:

The new unary expression.

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 Operand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the operand (_operand).

Returns:

The operand.

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 negation and its operand with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str]] = ('-', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 5

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord | None] = None

The operator’s reserved word; None for a symbol (_FORMAT).

__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

__str__()

Formats the unary expression.

Format: not operand

Return type:

str

Returns:

Formatted unary expression.

_operand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression the operator is applied to.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

classmethod parse(node)

Translates an IIR node to a _ParseUnaryExpressionMixin.

Parameters:

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

Return type:

UnaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.AbsoluteExpression(node, operand)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.AbsoluteExpression.

Represents an absolute value expression (abs).

The operand is available as Operand.

Example

res := abs operand;
--     ^^^^^^^^^^^    <- the expression
--         ^^^^^^^    <- Operand

Inheritance

Inheritance diagram of AbsoluteExpression

Parameters:
  • node (Iir)

  • operand (ExpressionUnion)

__init__(node, operand)[source]

Initializes an absolute expression.

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

  • operand (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression the operator is applied to.

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.

Copy()

Create a copy of this unary expression.

The copy has no parent. Its operand is a copy of this expression’s operand.

Return type:

Self

Returns:

The new unary expression.

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 Operand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the operand (_operand).

Returns:

The operand.

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)

Walk this unary expression and its operand with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str]] = ('abs ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 7

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord] = 'abs'

The operator’s reserved word.

__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

__str__()

Formats the unary expression.

Format: not operand

Return type:

str

Returns:

Formatted unary expression.

_operand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression the operator is applied to.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

classmethod parse(node)

Translates an IIR node to a _ParseUnaryExpressionMixin.

Parameters:

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

Return type:

UnaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.ParenthesisExpression(node, operand)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.SubExpression.

Represents a parenthesized sub-expression.

The operand is available as Operand.

Example

res := (lhs + rhs);
--     ^^^^^^^^^^^    <- the sub-expression
--      ^^^^^^^^^     <- Operand

Inheritance

Inheritance diagram of ParenthesisExpression

Parameters:
  • node (Iir)

  • operand (ExpressionUnion)

__init__(node, operand)[source]

Initializes a parenthesis expression.

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

  • operand (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression the operator is applied to.

Return type:

None

classmethod parse(node)[source]

Translates an IIR node to a ParenthesisExpression.

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.

Copy()

Create a copy of this unary expression.

The copy has no parent. Its operand is a copy of this expression’s operand.

Return type:

Self

Returns:

The new unary expression.

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 Operand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the operand (_operand).

Returns:

The operand.

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)

Walk this sub-expression and its operand with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str]] = ('(', ')')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 8

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord | None] = None

The operator’s reserved word; None for a symbol (_FORMAT).

__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

__str__()

Formats the unary expression.

Format: not operand

Return type:

str

Returns:

Formatted unary expression.

_operand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression the operator is applied to.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

class pyGHDL.dom.Expression.TypeConversion(node, targetSubtype, operand)[source]

Represents a type conversion, e.g. integer(x).

Note

Not reachable from this translator today. GHDL’s parser cannot tell a type conversion from an indexed name or a function call - integer(x), arr(x) and f(x) are all parsed as Parenthesis_Name - and only semantic analysis rewrites one into Type_Conversion. pyGHDL.dom parses without that pass, so a Type_Conversion node never arrives and Parenthesis_Name is translated to IndexedObjectOrFunctionCallSymbol, which carries the ambiguity.

The constructor is kept correct so this class works if semantic analysis is ever run.

Inheritance

Inheritance diagram of TypeConversion

Parameters:
  • node (Iir)

  • targetSubtype (SubtypeSymbol)

  • operand (ExpressionUnion)

__init__(node, targetSubtype, operand)[source]

Initializes a type conversion.

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

  • targetSubtype (SubtypeSymbol) – Reference to the subtype the expression is converted to.

  • operand (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression the operator is applied to.

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.

Copy()[source]

Create a copy of this type conversion.

The copy has no parent. Its target subtype and operand are copies of this conversion’s target subtype and operand.

Return type:

Self

Returns:

The new type conversion.

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 Operand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the operand (_operand).

Returns:

The operand.

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

property TargetSubtype: SubtypeSymbol

Read-only property to access the target subtype (_targetSubtype).

Returns:

The target subtype.

Visit(visitor)[source]

Walk this type conversion, its target subtype and its operand with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_PRECEDENCE: ClassVar[OperatorPrecedence] = 8

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord | None] = None

The operator’s reserved word; None for a symbol (_FORMAT).

__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

__str__()[source]

Formats the type conversion.

Format: integer(val)

Return type:

str

Returns:

Formatted type conversion.

_operand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression the operator is applied to.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_targetSubtype: SubtypeSymbol

Reference to the subtype the expression is converted to.

_FORMAT: ClassVar[tuple[str, str]]

The operator’s string representation as (prefix, suffix) of the operand.

class pyGHDL.dom.Expression.FunctionCall(node, operand)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.FunctionCall.

Represents a call to a function.

Example

res := maximum(a, b);
--     ^^^^^^^^^^^^^    <- the call

Inheritance

Inheritance diagram of FunctionCall

Parameters:
  • node (Iir)

  • operand (ExpressionUnion)

__init__(node, operand)[source]

Initializes a function call.

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

  • operand (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression the function is applied to.

Return type:

None

Todo

The operand is not forwarded to the base-class, because pyVHDLModel.Expression.FunctionCall does not model a call’s operands yet.

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

Copy()[source]

Create a copy of this function call.

The copy has no parent.

Return type:

Self

Returns:

The new function call.

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)

Walk this model element with a visitor.

A model class implements its walk; a class without one raises.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Raises:

NotImplementedError – Always, because the element’s class has no walk of its own.

Return type:

None

__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.Expression.AscendingRangeExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.AscendingRangeExpression.

Represents an ascending range expression (to).

Both operands are available as LeftOperand and RightOperand.

Example

res := v(0 to 3);
--       ^^^^^^     <- the range
--       ^          <- LeftOperand
--            ^     <- RightOperand

Inheritance

Inheritance diagram of AscendingRangeExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes an ascending range expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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

Read-only property to access the direction (_DIRECTION).

Returns:

The direction.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this range expression and its bounds with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_DIRECTION: ClassVar[Direction] = 0

The range’s direction.

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' to ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 0

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord | None] = None

The operator’s reserved word; None for a symbol (_FORMAT).

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

class pyGHDL.dom.Expression.DescendingRangeExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.DescendingRangeExpression.

Represents a descending range expression (downto).

Both operands are available as LeftOperand and RightOperand.

Example

res := v(7 downto 4);
--       ^^^^^^^^^^     <- the range
--       ^              <- LeftOperand
--                ^     <- RightOperand

Inheritance

Inheritance diagram of DescendingRangeExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes a descending range expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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

Read-only property to access the direction (_DIRECTION).

Returns:

The direction.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this range expression and its bounds with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_DIRECTION: ClassVar[Direction] = 1

The range’s direction.

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' downto ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 0

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord | None] = None

The operator’s reserved word; None for a symbol (_FORMAT).

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

class pyGHDL.dom.Expression.AdditionExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.AdditionExpression.

Represents an addition expression (+).

Both operands are available as LeftOperand and RightOperand.

Example

res := lhs + rhs;
--     ^^^^^^^^^    <- the expression
--     ^^^          <- LeftOperand
--           ^^^    <- RightOperand

Inheritance

Inheritance diagram of AdditionExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes an addition expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this adding expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' + ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 5

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord | None] = None

The operator’s reserved word; None for a symbol (_FORMAT).

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.SubtractionExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.SubtractionExpression.

Represents a subtraction expression (-).

Both operands are available as LeftOperand and RightOperand.

Example

res := lhs - rhs;
--     ^^^^^^^^^    <- the expression
--     ^^^          <- LeftOperand
--           ^^^    <- RightOperand

Inheritance

Inheritance diagram of SubtractionExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes a subtraction expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this adding expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' - ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 5

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord | None] = None

The operator’s reserved word; None for a symbol (_FORMAT).

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.ConcatenationExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.ConcatenationExpression.

Represents a concatenation expression (&).

Both operands are available as LeftOperand and RightOperand.

Example

res := lhs & rhs;
--     ^^^^^^^^^    <- the expression
--     ^^^          <- LeftOperand
--           ^^^    <- RightOperand

Inheritance

Inheritance diagram of ConcatenationExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes a concatenation expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this adding expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' & ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 5

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord | None] = None

The operator’s reserved word; None for a symbol (_FORMAT).

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.MultiplyExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.MultiplyExpression.

Represents a multiplication expression (*).

Both operands are available as LeftOperand and RightOperand.

Example

res := lhs * rhs;
--     ^^^^^^^^^    <- the expression
--     ^^^          <- LeftOperand
--           ^^^    <- RightOperand

Inheritance

Inheritance diagram of MultiplyExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes a multiply expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this multiplying expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' * ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 6

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord | None] = None

The operator’s reserved word; None for a symbol (_FORMAT).

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.DivisionExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.DivisionExpression.

Represents a division expression (/).

Both operands are available as LeftOperand and RightOperand.

Example

res := lhs / rhs;
--     ^^^^^^^^^    <- the expression
--     ^^^          <- LeftOperand
--           ^^^    <- RightOperand

Inheritance

Inheritance diagram of DivisionExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes a division expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this multiplying expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' / ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 6

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord | None] = None

The operator’s reserved word; None for a symbol (_FORMAT).

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.RemainderExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.RemainderExpression.

Represents a remainder expression (rem).

Both operands are available as LeftOperand and RightOperand.

Example

res := lhs rem rhs;
--     ^^^^^^^^^^^    <- the expression
--     ^^^            <- LeftOperand
--             ^^^    <- RightOperand

Inheritance

Inheritance diagram of RemainderExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes a remainder expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this multiplying expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' rem ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 6

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord] = 'rem'

The operator’s reserved word.

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.ModuloExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.ModuloExpression.

Represents a modulo expression (mod).

Both operands are available as LeftOperand and RightOperand.

Example

res := lhs mod rhs;
--     ^^^^^^^^^^^    <- the expression
--     ^^^            <- LeftOperand
--             ^^^    <- RightOperand

Inheritance

Inheritance diagram of ModuloExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes a modulo expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this multiplying expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' mod ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 6

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord] = 'mod'

The operator’s reserved word.

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.ExponentiationExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.ExponentiationExpression.

Represents an exponentiation expression (**).

Both operands are available as LeftOperand and RightOperand.

Example

res := lhs ** rhs;
--     ^^^^^^^^^^    <- the expression
--     ^^^           <- LeftOperand
--            ^^^    <- RightOperand

Inheritance

Inheritance diagram of ExponentiationExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes an exponentiation expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)[source]

Walk this exponentiation and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', '**', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 7

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord | None] = None

The operator’s reserved word; None for a symbol (_FORMAT).

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.AndExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.AndExpression.

Represents a logical and expression.

Both operands are available as LeftOperand and RightOperand.

Example

res := lhs and rhs;
--     ^^^^^^^^^^^    <- the expression
--     ^^^            <- LeftOperand
--             ^^^    <- RightOperand

Inheritance

Inheritance diagram of AndExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes an and expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this logical expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' and ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 2

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord] = 'and'

The operator’s reserved word.

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.NandExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.NandExpression.

Represents a logical nand expression.

Both operands are available as LeftOperand and RightOperand.

Example

res := lhs nand rhs;
--     ^^^^^^^^^^^^    <- the expression
--     ^^^             <- LeftOperand
--              ^^^    <- RightOperand

Inheritance

Inheritance diagram of NandExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes a nand expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this logical expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' nand ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 2

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord] = 'nand'

The operator’s reserved word.

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.OrExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.OrExpression.

Represents a logical or expression.

Both operands are available as LeftOperand and RightOperand.

Example

res := lhs or rhs;
--     ^^^^^^^^^^    <- the expression
--     ^^^           <- LeftOperand
--            ^^^    <- RightOperand

Inheritance

Inheritance diagram of OrExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes an or expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this logical expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' or ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 2

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord] = 'or'

The operator’s reserved word.

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.NorExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.NorExpression.

Represents a logical nor expression.

Both operands are available as LeftOperand and RightOperand.

Example

res := lhs nor rhs;
--     ^^^^^^^^^^^    <- the expression
--     ^^^            <- LeftOperand
--             ^^^    <- RightOperand

Inheritance

Inheritance diagram of NorExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes a nor expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this logical expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' nor ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 2

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord] = 'nor'

The operator’s reserved word.

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.XorExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.XorExpression.

Represents a logical xor expression.

Both operands are available as LeftOperand and RightOperand.

Example

res := lhs xor rhs;
--     ^^^^^^^^^^^    <- the expression
--     ^^^            <- LeftOperand
--             ^^^    <- RightOperand

Inheritance

Inheritance diagram of XorExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes an xor expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this logical expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' xor ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 2

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord] = 'xor'

The operator’s reserved word.

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.XnorExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.XnorExpression.

Represents a logical xnor expression.

Both operands are available as LeftOperand and RightOperand.

Example

res := lhs xnor rhs;
--     ^^^^^^^^^^^^    <- the expression
--     ^^^             <- LeftOperand
--              ^^^    <- RightOperand

Inheritance

Inheritance diagram of XnorExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes an xnor expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this logical expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' xnor ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 2

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord] = 'xnor'

The operator’s reserved word.

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.UnaryAndExpression(node, operand)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.UnaryAndExpression.

Represents a and reduction expression.

A reduction operator folds all elements of an array into a single value. The operand is available as Operand.

Example

res := and operand;
--     ^^^^^^^^^^^    <- the expression
--         ^^^^^^^    <- Operand

Inheritance

Inheritance diagram of UnaryAndExpression

Parameters:
  • node (Iir)

  • operand (ExpressionUnion)

__init__(node, operand)[source]

Initializes a unary and expression.

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

  • operand (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression the operator is applied to.

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.

Copy()

Create a copy of this unary expression.

The copy has no parent. Its operand is a copy of this expression’s operand.

Return type:

Self

Returns:

The new unary expression.

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 Operand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the operand (_operand).

Returns:

The operand.

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)

Walk this unary expression and its operand with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str]] = ('and ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 7

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord] = 'and'

The operator’s reserved word.

__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

__str__()

Formats the unary expression.

Format: not operand

Return type:

str

Returns:

Formatted unary expression.

_operand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression the operator is applied to.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

classmethod parse(node)

Translates an IIR node to a _ParseUnaryExpressionMixin.

Parameters:

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

Return type:

UnaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.UnaryNandExpression(node, operand)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.UnaryNandExpression.

Represents a nand reduction expression.

A reduction operator folds all elements of an array into a single value. The operand is available as Operand.

Example

res := nand operand;
--     ^^^^^^^^^^^^    <- the expression
--          ^^^^^^^    <- Operand

Inheritance

Inheritance diagram of UnaryNandExpression

Parameters:
  • node (Iir)

  • operand (ExpressionUnion)

__init__(node, operand)[source]

Initializes a unary nand expression.

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

  • operand (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression the operator is applied to.

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.

Copy()

Create a copy of this unary expression.

The copy has no parent. Its operand is a copy of this expression’s operand.

Return type:

Self

Returns:

The new unary expression.

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 Operand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the operand (_operand).

Returns:

The operand.

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)

Walk this unary expression and its operand with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str]] = ('nand ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 7

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord] = 'nand'

The operator’s reserved word.

__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

__str__()

Formats the unary expression.

Format: not operand

Return type:

str

Returns:

Formatted unary expression.

_operand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression the operator is applied to.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

classmethod parse(node)

Translates an IIR node to a _ParseUnaryExpressionMixin.

Parameters:

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

Return type:

UnaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.UnaryOrExpression(node, operand)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.UnaryOrExpression.

Represents a or reduction expression.

A reduction operator folds all elements of an array into a single value. The operand is available as Operand.

Example

res := or operand;
--     ^^^^^^^^^^    <- the expression
--        ^^^^^^^    <- Operand

Inheritance

Inheritance diagram of UnaryOrExpression

Parameters:
  • node (Iir)

  • operand (ExpressionUnion)

__init__(node, operand)[source]

Initializes a unary or expression.

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

  • operand (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression the operator is applied to.

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.

Copy()

Create a copy of this unary expression.

The copy has no parent. Its operand is a copy of this expression’s operand.

Return type:

Self

Returns:

The new unary expression.

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 Operand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the operand (_operand).

Returns:

The operand.

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)

Walk this unary expression and its operand with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str]] = ('or ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 7

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord] = 'or'

The operator’s reserved word.

__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

__str__()

Formats the unary expression.

Format: not operand

Return type:

str

Returns:

Formatted unary expression.

_operand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression the operator is applied to.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

classmethod parse(node)

Translates an IIR node to a _ParseUnaryExpressionMixin.

Parameters:

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

Return type:

UnaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.UnaryNorExpression(node, operand)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.UnaryNorExpression.

Represents a nor reduction expression.

A reduction operator folds all elements of an array into a single value. The operand is available as Operand.

Example

res := nor operand;
--     ^^^^^^^^^^^    <- the expression
--         ^^^^^^^    <- Operand

Inheritance

Inheritance diagram of UnaryNorExpression

Parameters:
  • node (Iir)

  • operand (ExpressionUnion)

__init__(node, operand)[source]

Initializes a unary nor expression.

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

  • operand (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression the operator is applied to.

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.

Copy()

Create a copy of this unary expression.

The copy has no parent. Its operand is a copy of this expression’s operand.

Return type:

Self

Returns:

The new unary expression.

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 Operand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the operand (_operand).

Returns:

The operand.

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)

Walk this unary expression and its operand with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str]] = ('nor ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 7

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord] = 'nor'

The operator’s reserved word.

__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

__str__()

Formats the unary expression.

Format: not operand

Return type:

str

Returns:

Formatted unary expression.

_operand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression the operator is applied to.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

classmethod parse(node)

Translates an IIR node to a _ParseUnaryExpressionMixin.

Parameters:

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

Return type:

UnaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.UnaryXorExpression(node, operand)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.UnaryXorExpression.

Represents a xor reduction expression.

A reduction operator folds all elements of an array into a single value. The operand is available as Operand.

Example

res := xor operand;
--     ^^^^^^^^^^^    <- the expression
--         ^^^^^^^    <- Operand

Inheritance

Inheritance diagram of UnaryXorExpression

Parameters:
  • node (Iir)

  • operand (ExpressionUnion)

__init__(node, operand)[source]

Initializes a unary xor expression.

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

  • operand (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression the operator is applied to.

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.

Copy()

Create a copy of this unary expression.

The copy has no parent. Its operand is a copy of this expression’s operand.

Return type:

Self

Returns:

The new unary expression.

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 Operand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the operand (_operand).

Returns:

The operand.

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)

Walk this unary expression and its operand with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str]] = ('xor ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 7

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord] = 'xor'

The operator’s reserved word.

__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

__str__()

Formats the unary expression.

Format: not operand

Return type:

str

Returns:

Formatted unary expression.

_operand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression the operator is applied to.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

classmethod parse(node)

Translates an IIR node to a _ParseUnaryExpressionMixin.

Parameters:

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

Return type:

UnaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.UnaryXnorExpression(node, operand)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.UnaryXnorExpression.

Represents a xnor reduction expression.

A reduction operator folds all elements of an array into a single value. The operand is available as Operand.

Example

res := xnor operand;
--     ^^^^^^^^^^^^    <- the expression
--          ^^^^^^^    <- Operand

Inheritance

Inheritance diagram of UnaryXnorExpression

Parameters:
  • node (Iir)

  • operand (ExpressionUnion)

__init__(node, operand)[source]

Initializes a unary xnor expression.

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

  • operand (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression the operator is applied to.

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.

Copy()

Create a copy of this unary expression.

The copy has no parent. Its operand is a copy of this expression’s operand.

Return type:

Self

Returns:

The new unary expression.

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 Operand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the operand (_operand).

Returns:

The operand.

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)

Walk this unary expression and its operand with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str]] = ('xnor ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 7

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord] = 'xnor'

The operator’s reserved word.

__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

__str__()

Formats the unary expression.

Format: not operand

Return type:

str

Returns:

Formatted unary expression.

_operand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression the operator is applied to.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

classmethod parse(node)

Translates an IIR node to a _ParseUnaryExpressionMixin.

Parameters:

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

Return type:

UnaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.EqualExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.EqualExpression.

Represents an equality expression (=).

Both operands are available as LeftOperand and RightOperand.

Example

res := lhs = rhs;
--     ^^^^^^^^^    <- the expression
--     ^^^          <- LeftOperand
--           ^^^    <- RightOperand

Inheritance

Inheritance diagram of EqualExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes an equal expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this relational expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' = ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 3

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord | None] = None

The operator’s reserved word; None for a symbol (_FORMAT).

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.UnequalExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.UnequalExpression.

Represents an inequality expression (/=).

Both operands are available as LeftOperand and RightOperand.

Example

res := lhs /= rhs;
--     ^^^^^^^^^^    <- the expression
--     ^^^           <- LeftOperand
--            ^^^    <- RightOperand

Inheritance

Inheritance diagram of UnequalExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes an unequal expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this relational expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' /= ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 3

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord | None] = None

The operator’s reserved word; None for a symbol (_FORMAT).

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.LessThanExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.LessThanExpression.

Represents a less-than expression (<).

Both operands are available as LeftOperand and RightOperand.

Example

res := lhs < rhs;
--     ^^^^^^^^^    <- the expression
--     ^^^          <- LeftOperand
--           ^^^    <- RightOperand

Inheritance

Inheritance diagram of LessThanExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes a less than expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this relational expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' < ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 3

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord | None] = None

The operator’s reserved word; None for a symbol (_FORMAT).

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.LessEqualExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.LessEqualExpression.

Represents a less-or-equal expression (<=).

Both operands are available as LeftOperand and RightOperand.

Example

res := lhs <= rhs;
--     ^^^^^^^^^^    <- the expression
--     ^^^           <- LeftOperand
--            ^^^    <- RightOperand

Inheritance

Inheritance diagram of LessEqualExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes a less equal expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this relational expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' <= ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 3

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord | None] = None

The operator’s reserved word; None for a symbol (_FORMAT).

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.GreaterThanExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.GreaterThanExpression.

Represents a greater-than expression (>).

Both operands are available as LeftOperand and RightOperand.

Example

res := lhs > rhs;
--     ^^^^^^^^^    <- the expression
--     ^^^          <- LeftOperand
--           ^^^    <- RightOperand

Inheritance

Inheritance diagram of GreaterThanExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes a greater than expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this relational expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' > ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 3

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord | None] = None

The operator’s reserved word; None for a symbol (_FORMAT).

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.GreaterEqualExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.GreaterEqualExpression.

Represents a greater-or-equal expression (>=).

Both operands are available as LeftOperand and RightOperand.

Example

res := lhs >= rhs;
--     ^^^^^^^^^^    <- the expression
--     ^^^           <- LeftOperand
--            ^^^    <- RightOperand

Inheritance

Inheritance diagram of GreaterEqualExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes a greater equal expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this relational expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' >= ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 3

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord | None] = None

The operator’s reserved word; None for a symbol (_FORMAT).

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.MatchingEqualExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.MatchingEqualExpression.

Represents a matching equality expression (?=).

Unlike =, a matching operator returns a bit/std_ulogic. Both operands are available as LeftOperand and RightOperand.

Example

res := lhs ?= rhs;
--     ^^^^^^^^^^    <- the expression
--     ^^^           <- LeftOperand
--            ^^^    <- RightOperand

Inheritance

Inheritance diagram of MatchingEqualExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes a matching equal expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this relational expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' ?= ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 3

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord | None] = None

The operator’s reserved word; None for a symbol (_FORMAT).

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.MatchingUnequalExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.MatchingUnequalExpression.

Represents a matching inequality expression (?/=).

Unlike /=, a matching operator returns a bit/std_ulogic. Both operands are available as LeftOperand and RightOperand.

Example

res := lhs ?/= rhs;
--     ^^^^^^^^^^^    <- the expression
--     ^^^            <- LeftOperand
--             ^^^    <- RightOperand

Inheritance

Inheritance diagram of MatchingUnequalExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes a matching unequal expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this relational expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' ?/= ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 3

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord | None] = None

The operator’s reserved word; None for a symbol (_FORMAT).

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.MatchingLessThanExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.MatchingLessThanExpression.

Represents a matching less-than expression (?<).

Unlike <, a matching operator returns a bit/std_ulogic. Both operands are available as LeftOperand and RightOperand.

Example

res := lhs ?< rhs;
--     ^^^^^^^^^^    <- the expression
--     ^^^           <- LeftOperand
--            ^^^    <- RightOperand

Inheritance

Inheritance diagram of MatchingLessThanExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes a matching less than expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this relational expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' ?< ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 3

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord | None] = None

The operator’s reserved word; None for a symbol (_FORMAT).

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.MatchingLessEqualExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.MatchingLessEqualExpression.

Represents a matching less-or-equal expression (?<=).

Unlike <=, a matching operator returns a bit/std_ulogic. Both operands are available as LeftOperand and RightOperand.

Example

res := lhs ?<= rhs;
--     ^^^^^^^^^^^    <- the expression
--     ^^^            <- LeftOperand
--             ^^^    <- RightOperand

Inheritance

Inheritance diagram of MatchingLessEqualExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes a matching less equal expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this relational expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' ?<= ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 3

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord | None] = None

The operator’s reserved word; None for a symbol (_FORMAT).

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.MatchingGreaterThanExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.MatchingGreaterThanExpression.

Represents a matching greater-than expression (?>).

Unlike >, a matching operator returns a bit/std_ulogic. Both operands are available as LeftOperand and RightOperand.

Example

res := lhs ?> rhs;
--     ^^^^^^^^^^    <- the expression
--     ^^^           <- LeftOperand
--            ^^^    <- RightOperand

Inheritance

Inheritance diagram of MatchingGreaterThanExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes a matching greater than expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this relational expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' ?> ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 3

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord | None] = None

The operator’s reserved word; None for a symbol (_FORMAT).

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.MatchingGreaterEqualExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.MatchingGreaterEqualExpression.

Represents a matching greater-or-equal expression (?>=).

Unlike >=, a matching operator returns a bit/std_ulogic. Both operands are available as LeftOperand and RightOperand.

Example

res := lhs ?>= rhs;
--     ^^^^^^^^^^^    <- the expression
--     ^^^            <- LeftOperand
--             ^^^    <- RightOperand

Inheritance

Inheritance diagram of MatchingGreaterEqualExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes a matching greater equal expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this relational expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' ?>= ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 3

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord | None] = None

The operator’s reserved word; None for a symbol (_FORMAT).

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.ShiftRightLogicExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.ShiftRightLogicExpression.

Represents a logical right shift expression (srl).

Both operands are available as LeftOperand and RightOperand.

Example

res := lhs srl rhs;
--     ^^^^^^^^^^^    <- the expression
--     ^^^            <- LeftOperand
--             ^^^    <- RightOperand

Inheritance

Inheritance diagram of ShiftRightLogicExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes a shift right logic expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this shift or rotate expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' srl ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 4

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord] = 'srl'

The operator’s reserved word.

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.ShiftLeftLogicExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.ShiftLeftLogicExpression.

Represents a logical left shift expression (sll).

Both operands are available as LeftOperand and RightOperand.

Example

res := lhs sll rhs;
--     ^^^^^^^^^^^    <- the expression
--     ^^^            <- LeftOperand
--             ^^^    <- RightOperand

Inheritance

Inheritance diagram of ShiftLeftLogicExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes a shift left logic expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this shift or rotate expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' sll ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 4

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord] = 'sll'

The operator’s reserved word.

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.ShiftRightArithmeticExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.ShiftRightArithmeticExpression.

Represents an arithmetic right shift expression (sra).

Both operands are available as LeftOperand and RightOperand.

Example

res := lhs sra rhs;
--     ^^^^^^^^^^^    <- the expression
--     ^^^            <- LeftOperand
--             ^^^    <- RightOperand

Inheritance

Inheritance diagram of ShiftRightArithmeticExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes a shift right arithmetic expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this shift or rotate expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' sra ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 4

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord] = 'sra'

The operator’s reserved word.

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.ShiftLeftArithmeticExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.ShiftLeftArithmeticExpression.

Represents an arithmetic left shift expression (sla).

Both operands are available as LeftOperand and RightOperand.

Example

res := lhs sla rhs;
--     ^^^^^^^^^^^    <- the expression
--     ^^^            <- LeftOperand
--             ^^^    <- RightOperand

Inheritance

Inheritance diagram of ShiftLeftArithmeticExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes a shift left arithmetic expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this shift or rotate expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' sla ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 4

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord] = 'sla'

The operator’s reserved word.

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.RotateRightExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.RotateRightExpression.

Represents a right rotate expression (ror).

Both operands are available as LeftOperand and RightOperand.

Example

res := lhs ror rhs;
--     ^^^^^^^^^^^    <- the expression
--     ^^^            <- LeftOperand
--             ^^^    <- RightOperand

Inheritance

Inheritance diagram of RotateRightExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes a rotate right expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this shift or rotate expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' ror ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 4

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord] = 'ror'

The operator’s reserved word.

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.RotateLeftExpression(node, left, right)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.RotateLeftExpression.

Represents a left rotate expression (rol).

Both operands are available as LeftOperand and RightOperand.

Example

res := lhs rol rhs;
--     ^^^^^^^^^^^    <- the expression
--     ^^^            <- LeftOperand
--             ^^^    <- RightOperand

Inheritance

Inheritance diagram of RotateLeftExpression

Parameters:
  • node (Iir)

  • left (ExpressionUnion)

  • right (ExpressionUnion)

__init__(node, left, right)[source]

Initializes a rotate left expression.

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

  • left (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression left of the operator.

  • right (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression right of the operator.

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.

Copy()

Create a copy of this binary expression.

The copy has no parent. Its operands are copies of this expression’s operands.

Return type:

Self

Returns:

The new binary expression.

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 LeftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the left operand (_leftOperand).

Returns:

The left operand.

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

property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the right operand (_rightOperand).

Returns:

The right operand.

Visit(visitor)

Walk this shift or rotate expression and its operands with a visitor.

Parameters:

visitor (Visitor) – The visitor receiving the events.

Return type:

None

_FORMAT: ClassVar[tuple[str, str, str]] = ('', ' rol ', '')

The operator’s string fragments.

_PRECEDENCE: ClassVar[OperatorPrecedence] = 4

The operator’s precedence level.

_RESERVED_WORD: ClassVar[ReservedWord] = 'rol'

The operator’s reserved word.

__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

__str__()

Formats the binary expression.

Format: lhs + rhs

Return type:

str

Returns:

Formatted binary expression.

_leftOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression left of the operator.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_rightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression right of the operator.

classmethod parse(node)

Translates an IIR node to a _ParseBinaryExpressionMixin.

Parameters:

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

Return type:

BinaryExpression

Returns:

The translated object.

class pyGHDL.dom.Expression.QualifiedExpression(node, subtype, operand)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.QualifiedExpression.

Represents a qualified expression.

A qualified expression states the subtype (Subtype) of its operand (Operand), resolving which of several overloaded meanings is intended.

Example

res := byte'(others => '0');
--     ^^^^                    <- Subtype
--          ^^^^^^^^^^^^^^^    <- Operand

Inheritance

Inheritance diagram of QualifiedExpression

Parameters:
  • node (Iir)

  • subtype (Symbol)

  • operand (ExpressionUnion)

__init__(node, subtype, operand)[source]

Initializes a qualified expression.

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

  • subtype (Symbol) – Reference to the subtype qualifying the expression.

  • operand (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression being qualified.

Return type:

None

classmethod parse(node)[source]

Translates an IIR node to a QualifiedExpression.

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.

Copy()[source]

Create a copy of this qualified expression.

The copy has no parent. Its subtype and operand are copies of this expression’s subtype and operand.

Return type:

Self

Returns:

The new qualified expression.

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 Operand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the operand (_operand).

Returns:

The operand.

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

property Subtype: Symbol

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

Returns:

The subtype.

Visit(visitor)[source]

Walk this qualified expression, its subtype and its operand 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

__str__()[source]

Formats the qualified expression.

Format: byte'(val)

Return type:

str

Returns:

Formatted qualified expression.

_operand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The expression being qualified.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_subtype: Symbol

Reference to the subtype qualifying the expression.

class pyGHDL.dom.Expression.SubtypeAllocation(node, subtype)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.SubtypeAllocation.

Represents an allocation of a subtype via new.

The allocated subtype is available as Subtype. The allocated object is default-initialized.

Example

p := new integer;
--       ^^^^^^^    <- Subtype

Inheritance

Inheritance diagram of SubtypeAllocation

Parameters:
__init__(node, subtype)[source]

Initializes an allocation of a subtype via new.

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

  • subtype (Symbol) – Reference to the subtype being allocated.

Return type:

None

classmethod parse(node)[source]

Translates an IIR node to a SubtypeAllocation.

Parameters:

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

Return type:

QualifiedExpressionAllocation

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.

Copy()[source]

Create a copy of this subtype allocation.

The copy has no parent. Its subtype is a copy of this allocation’s subtype.

Return type:

Self

Returns:

The new subtype allocation.

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

property Subtype: Symbol

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

Returns:

The subtype.

Visit(visitor)[source]

Walk this allocation and its subtype 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

__str__()[source]

Formats the subtype allocation.

Format: new node

Return type:

str

Returns:

Formatted subtype allocation.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_subtype: Symbol

Reference to the subtype being allocated.

class pyGHDL.dom.Expression.QualifiedExpressionAllocation(node, qualifiedExpression)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.QualifiedExpressionAllocation.

Represents an allocation initialized by a qualified expression.

The qualified expression providing the initial value is available as QualifiedExpression.

Example

p := new integer'(5);
--       ^^^^^^^^^^^    <- QualifiedExpression

Inheritance

Inheritance diagram of QualifiedExpressionAllocation

Parameters:
__init__(node, qualifiedExpression)[source]

Initializes an allocation initialized by a qualified expression.

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

  • qualifiedExpression (QualifiedExpression) – The qualified expression the allocated object is initialized with.

Return type:

None

classmethod parse(node)[source]

Translates an IIR node to a QualifiedExpressionAllocation.

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.

Copy()[source]

Create a copy of this qualified expression allocation.

The copy has no parent. Its qualified expression is a copy of this allocation’s qualified expression.

Return type:

Self

Returns:

The new qualified expression allocation.

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.

property QualifiedExpression: QualifiedExpression

Read-only property to access the qualified expression (_qualifiedExpression).

Returns:

The qualified expression.

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 allocation and its qualified expression 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

__str__()[source]

Formats the qualified expression allocation.

Format: new byte'(val)

Return type:

str

Returns:

Formatted qualified expression allocation.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_qualifiedExpression: QualifiedExpression

The qualified expression the allocated object is initialized with.

class pyGHDL.dom.Expression.Aggregate(node, elements)[source]

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.Aggregate.

Represents an aggregate.

An aggregate composes a value from its elements (Elements), each of which associates a choice with a value.

Example

res := (0 => '1', 1 to 3 => '0', others => '1');
--     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^    <- Elements

Inheritance

Inheritance diagram of Aggregate

Parameters:
  • node (Iir)

  • elements (List[AggregateElement])

__init__(node, elements)[source]

Initializes an aggregate.

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

  • elements (List[AggregateElement]) – List of all elements of this aggregate, in the order they were written.

Return type:

None

classmethod parse(node)[source]

Translates an IIR node to an Aggregate.

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.

Copy()[source]

Create a copy of this aggregate.

The copy has no parent. Its elements are copies of this aggregate’s elements.

Return type:

Self

Returns:

The new aggregate.

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 Elements: list[AggregateElement]

Read-only property to access the elements (_elements).

Returns:

List of elements.

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 aggregate and its elements 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

__str__()[source]

Formats the aggregate.

Format: (1, others => 0)

Return type:

str

Returns:

Formatted aggregate.

_elements: list[AggregateElement]

List of all elements of this aggregate, in the order they were written.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.