pyGHDL.dom.Expression
This module implements derived expression classes from pyVHDLModel.Expression.
Classes
InverseExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.InverseExpression.ConditionExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.ConditionExpression.IdentityExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.IdentityExpression.NegationExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.NegationExpression.AbsoluteExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.AbsoluteExpression.ParenthesisExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.SubExpression.TypeConversion: Represents a type conversion, e.g.integer(x).FunctionCall: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.FunctionCall.AscendingRangeExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.AscendingRangeExpression.DescendingRangeExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.DescendingRangeExpression.AdditionExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.AdditionExpression.SubtractionExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.SubtractionExpression.ConcatenationExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.ConcatenationExpression.MultiplyExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.MultiplyExpression.DivisionExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.DivisionExpression.RemainderExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.RemainderExpression.ModuloExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.ModuloExpression.ExponentiationExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.ExponentiationExpression.AndExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.AndExpression.NandExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.NandExpression.OrExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.OrExpression.NorExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.NorExpression.XorExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.XorExpression.XnorExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.XnorExpression.UnaryAndExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.UnaryAndExpression.UnaryNandExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.UnaryNandExpression.UnaryOrExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.UnaryOrExpression.UnaryNorExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.UnaryNorExpression.UnaryXorExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.UnaryXorExpression.UnaryXnorExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.UnaryXnorExpression.EqualExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.EqualExpression.UnequalExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.UnequalExpression.LessThanExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.LessThanExpression.LessEqualExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.LessEqualExpression.GreaterThanExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.GreaterThanExpression.GreaterEqualExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.GreaterEqualExpression.MatchingEqualExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.MatchingEqualExpression.MatchingUnequalExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.MatchingUnequalExpression.MatchingLessThanExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.MatchingLessThanExpression.MatchingLessEqualExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.MatchingLessEqualExpression.MatchingGreaterThanExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.MatchingGreaterThanExpression.MatchingGreaterEqualExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.MatchingGreaterEqualExpression.ShiftRightLogicExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.ShiftRightLogicExpression.ShiftLeftLogicExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.ShiftLeftLogicExpression.ShiftRightArithmeticExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.ShiftRightArithmeticExpression.ShiftLeftArithmeticExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.ShiftLeftArithmeticExpression.RotateRightExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.RotateRightExpression.RotateLeftExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.RotateLeftExpression.QualifiedExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.QualifiedExpression.SubtypeAllocation: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.SubtypeAllocation.QualifiedExpressionAllocation: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.QualifiedExpressionAllocation.Aggregate: This class implements apyGHDL.domobject derived frompyVHDLModel.Expression.Aggregate.
Classes
- class pyGHDL.dom.Expression.InverseExpression(node, operand)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.InverseExpression.Represents a logical inversion expression (
not).The operand is available as
Operand.Example
res := not operand; -- ^^^^^^^^^^^ <- the expression -- ^^^^^^^ <- Operand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- Visit(visitor)
Walk this unary expression and its operand with a visitor.
- _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.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the unary expression.
Format:
not operand- Return type:
- 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.ConditionExpression(node, operand)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.ConditionExpression.Represents a condition operator expression (
??), converting its operand toboolean.The operand is available as
Operand; it is a primary.Example
if ?? enable then -- ^^^^^^^^^ <- the expression -- ^^^^^^ <- Operand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- _PRECEDENCE: ClassVar[OperatorPrecedence] = 1
The operator’s precedence level.
- _RESERVED_WORD: ClassVar[ReservedWord | None] = None
The operator’s reserved word;
Nonefor a symbol (_FORMAT).
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the unary expression.
Format:
not operand- Return type:
- 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.IdentityExpression(node, operand)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.IdentityExpression.Represents an identity (unary plus) expression.
The operand is available as
Operand.Example
res := + operand; -- ^^^^^^^^^ <- the expression -- ^^^^^^^ <- Operand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- _PRECEDENCE: ClassVar[OperatorPrecedence] = 5
The operator’s precedence level.
- _RESERVED_WORD: ClassVar[ReservedWord | None] = None
The operator’s reserved word;
Nonefor a symbol (_FORMAT).
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the unary expression.
Format:
not operand- Return type:
- 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.NegationExpression(node, operand)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.NegationExpression.Represents a negation (unary minus) expression.
The operand is available as
Operand.Example
res := - operand; -- ^^^^^^^^^ <- the expression -- ^^^^^^^ <- Operand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- _PRECEDENCE: ClassVar[OperatorPrecedence] = 5
The operator’s precedence level.
- _RESERVED_WORD: ClassVar[ReservedWord | None] = None
The operator’s reserved word;
Nonefor a symbol (_FORMAT).
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the unary expression.
Format:
not operand- Return type:
- 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.AbsoluteExpression(node, operand)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.AbsoluteExpression.Represents an absolute value expression (
abs).The operand is available as
Operand.Example
res := abs operand; -- ^^^^^^^^^^^ <- the expression -- ^^^^^^^ <- Operand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- Visit(visitor)
Walk this unary expression and its operand with a visitor.
- _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.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the unary expression.
Format:
not operand- Return type:
- 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.ParenthesisExpression(node, operand)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.SubExpression.Represents a parenthesized sub-expression.
The operand is available as
Operand.Example
res := (lhs + rhs); -- ^^^^^^^^^^^ <- the sub-expression -- ^^^^^^^^^ <- Operand
Inheritance
- 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.
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- Visit(visitor)
Walk this sub-expression and its operand with a visitor.
- _PRECEDENCE: ClassVar[OperatorPrecedence] = 8
The operator’s precedence level.
- _RESERVED_WORD: ClassVar[ReservedWord | None] = None
The operator’s reserved word;
Nonefor a symbol (_FORMAT).
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the unary expression.
Format:
not operand- Return type:
- 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)andf(x)are all parsed asParenthesis_Name- and only semantic analysis rewrites one intoType_Conversion.pyGHDL.domparses without that pass, so aType_Conversionnode never arrives andParenthesis_Nameis translated toIndexedObjectOrFunctionCallSymbol, which carries the ambiguity.The constructor is kept correct so this class works if semantic analysis is ever run.
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _PRECEDENCE: ClassVar[OperatorPrecedence] = 8
The operator’s precedence level.
- _RESERVED_WORD: ClassVar[ReservedWord | None] = None
The operator’s reserved word;
Nonefor a symbol (_FORMAT).
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()[source]
Formats the type conversion.
Format:
integer(val)- Return type:
- 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.
- class pyGHDL.dom.Expression.FunctionCall(node, operand)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.FunctionCall.Represents a call to a function.
Example
res := maximum(a, b); -- ^^^^^^^^^^^^^ <- the call
Inheritance
- 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.FunctionCalldoes not model a call’s operands yet.
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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:
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _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.domobject derived frompyVHDLModel.Expression.AscendingRangeExpression.Represents an ascending range expression (
to).Both operands are available as
LeftOperandandRightOperand.Example
res := v(0 to 3); -- ^^^^^^ <- the range -- ^ <- LeftOperand -- ^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- property Direction: Direction
Read-only property to access the direction (
_DIRECTION).- Returns:
The direction.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _PRECEDENCE: ClassVar[OperatorPrecedence] = 0
The operator’s precedence level.
- _RESERVED_WORD: ClassVar[ReservedWord | None] = None
The operator’s reserved word;
Nonefor a symbol (_FORMAT).
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.domobject derived frompyVHDLModel.Expression.DescendingRangeExpression.Represents a descending range expression (
downto).Both operands are available as
LeftOperandandRightOperand.Example
res := v(7 downto 4); -- ^^^^^^^^^^ <- the range -- ^ <- LeftOperand -- ^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- property Direction: Direction
Read-only property to access the direction (
_DIRECTION).- Returns:
The direction.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _PRECEDENCE: ClassVar[OperatorPrecedence] = 0
The operator’s precedence level.
- _RESERVED_WORD: ClassVar[ReservedWord | None] = None
The operator’s reserved word;
Nonefor a symbol (_FORMAT).
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.domobject derived frompyVHDLModel.Expression.AdditionExpression.Represents an addition expression (
+).Both operands are available as
LeftOperandandRightOperand.Example
res := lhs + rhs; -- ^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _PRECEDENCE: ClassVar[OperatorPrecedence] = 5
The operator’s precedence level.
- _RESERVED_WORD: ClassVar[ReservedWord | None] = None
The operator’s reserved word;
Nonefor a symbol (_FORMAT).
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.SubtractionExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.SubtractionExpression.Represents a subtraction expression (
-).Both operands are available as
LeftOperandandRightOperand.Example
res := lhs - rhs; -- ^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _PRECEDENCE: ClassVar[OperatorPrecedence] = 5
The operator’s precedence level.
- _RESERVED_WORD: ClassVar[ReservedWord | None] = None
The operator’s reserved word;
Nonefor a symbol (_FORMAT).
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.ConcatenationExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.ConcatenationExpression.Represents a concatenation expression (
&).Both operands are available as
LeftOperandandRightOperand.Example
res := lhs & rhs; -- ^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _PRECEDENCE: ClassVar[OperatorPrecedence] = 5
The operator’s precedence level.
- _RESERVED_WORD: ClassVar[ReservedWord | None] = None
The operator’s reserved word;
Nonefor a symbol (_FORMAT).
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.MultiplyExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.MultiplyExpression.Represents a multiplication expression (
*).Both operands are available as
LeftOperandandRightOperand.Example
res := lhs * rhs; -- ^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _PRECEDENCE: ClassVar[OperatorPrecedence] = 6
The operator’s precedence level.
- _RESERVED_WORD: ClassVar[ReservedWord | None] = None
The operator’s reserved word;
Nonefor a symbol (_FORMAT).
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.DivisionExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.DivisionExpression.Represents a division expression (
/).Both operands are available as
LeftOperandandRightOperand.Example
res := lhs / rhs; -- ^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _PRECEDENCE: ClassVar[OperatorPrecedence] = 6
The operator’s precedence level.
- _RESERVED_WORD: ClassVar[ReservedWord | None] = None
The operator’s reserved word;
Nonefor a symbol (_FORMAT).
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.RemainderExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.RemainderExpression.Represents a remainder expression (
rem).Both operands are available as
LeftOperandandRightOperand.Example
res := lhs rem rhs; -- ^^^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _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.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.ModuloExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.ModuloExpression.Represents a modulo expression (
mod).Both operands are available as
LeftOperandandRightOperand.Example
res := lhs mod rhs; -- ^^^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _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.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.ExponentiationExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.ExponentiationExpression.Represents an exponentiation expression (
**).Both operands are available as
LeftOperandandRightOperand.Example
res := lhs ** rhs; -- ^^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- property RightOperand: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal
Read-only property to access the right operand (
_rightOperand).- Returns:
The right operand.
- _PRECEDENCE: ClassVar[OperatorPrecedence] = 7
The operator’s precedence level.
- _RESERVED_WORD: ClassVar[ReservedWord | None] = None
The operator’s reserved word;
Nonefor a symbol (_FORMAT).
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.AndExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.AndExpression.Represents a logical
andexpression.Both operands are available as
LeftOperandandRightOperand.Example
res := lhs and rhs; -- ^^^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _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.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.NandExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.NandExpression.Represents a logical
nandexpression.Both operands are available as
LeftOperandandRightOperand.Example
res := lhs nand rhs; -- ^^^^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _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.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.OrExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.OrExpression.Represents a logical
orexpression.Both operands are available as
LeftOperandandRightOperand.Example
res := lhs or rhs; -- ^^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _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.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.NorExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.NorExpression.Represents a logical
norexpression.Both operands are available as
LeftOperandandRightOperand.Example
res := lhs nor rhs; -- ^^^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _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.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.XorExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.XorExpression.Represents a logical
xorexpression.Both operands are available as
LeftOperandandRightOperand.Example
res := lhs xor rhs; -- ^^^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _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.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.XnorExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.XnorExpression.Represents a logical
xnorexpression.Both operands are available as
LeftOperandandRightOperand.Example
res := lhs xnor rhs; -- ^^^^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _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.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.UnaryAndExpression(node, operand)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.UnaryAndExpression.Represents a
andreduction 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
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- Visit(visitor)
Walk this unary expression and its operand with a visitor.
- _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.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the unary expression.
Format:
not operand- Return type:
- 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.UnaryNandExpression(node, operand)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.UnaryNandExpression.Represents a
nandreduction 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
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- Visit(visitor)
Walk this unary expression and its operand with a visitor.
- _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.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the unary expression.
Format:
not operand- Return type:
- 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.UnaryOrExpression(node, operand)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.UnaryOrExpression.Represents a
orreduction 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
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- Visit(visitor)
Walk this unary expression and its operand with a visitor.
- _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.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the unary expression.
Format:
not operand- Return type:
- 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.UnaryNorExpression(node, operand)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.UnaryNorExpression.Represents a
norreduction 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
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- Visit(visitor)
Walk this unary expression and its operand with a visitor.
- _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.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the unary expression.
Format:
not operand- Return type:
- 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.UnaryXorExpression(node, operand)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.UnaryXorExpression.Represents a
xorreduction 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
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- Visit(visitor)
Walk this unary expression and its operand with a visitor.
- _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.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the unary expression.
Format:
not operand- Return type:
- 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.UnaryXnorExpression(node, operand)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.UnaryXnorExpression.Represents a
xnorreduction 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
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- Visit(visitor)
Walk this unary expression and its operand with a visitor.
- _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.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the unary expression.
Format:
not operand- Return type:
- 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.EqualExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.EqualExpression.Represents an equality expression (
=).Both operands are available as
LeftOperandandRightOperand.Example
res := lhs = rhs; -- ^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _PRECEDENCE: ClassVar[OperatorPrecedence] = 3
The operator’s precedence level.
- _RESERVED_WORD: ClassVar[ReservedWord | None] = None
The operator’s reserved word;
Nonefor a symbol (_FORMAT).
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.UnequalExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.UnequalExpression.Represents an inequality expression (
/=).Both operands are available as
LeftOperandandRightOperand.Example
res := lhs /= rhs; -- ^^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _PRECEDENCE: ClassVar[OperatorPrecedence] = 3
The operator’s precedence level.
- _RESERVED_WORD: ClassVar[ReservedWord | None] = None
The operator’s reserved word;
Nonefor a symbol (_FORMAT).
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.LessThanExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.LessThanExpression.Represents a less-than expression (
<).Both operands are available as
LeftOperandandRightOperand.Example
res := lhs < rhs; -- ^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _PRECEDENCE: ClassVar[OperatorPrecedence] = 3
The operator’s precedence level.
- _RESERVED_WORD: ClassVar[ReservedWord | None] = None
The operator’s reserved word;
Nonefor a symbol (_FORMAT).
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.LessEqualExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.LessEqualExpression.Represents a less-or-equal expression (
<=).Both operands are available as
LeftOperandandRightOperand.Example
res := lhs <= rhs; -- ^^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _PRECEDENCE: ClassVar[OperatorPrecedence] = 3
The operator’s precedence level.
- _RESERVED_WORD: ClassVar[ReservedWord | None] = None
The operator’s reserved word;
Nonefor a symbol (_FORMAT).
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.GreaterThanExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.GreaterThanExpression.Represents a greater-than expression (
>).Both operands are available as
LeftOperandandRightOperand.Example
res := lhs > rhs; -- ^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _PRECEDENCE: ClassVar[OperatorPrecedence] = 3
The operator’s precedence level.
- _RESERVED_WORD: ClassVar[ReservedWord | None] = None
The operator’s reserved word;
Nonefor a symbol (_FORMAT).
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.GreaterEqualExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.GreaterEqualExpression.Represents a greater-or-equal expression (
>=).Both operands are available as
LeftOperandandRightOperand.Example
res := lhs >= rhs; -- ^^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _PRECEDENCE: ClassVar[OperatorPrecedence] = 3
The operator’s precedence level.
- _RESERVED_WORD: ClassVar[ReservedWord | None] = None
The operator’s reserved word;
Nonefor a symbol (_FORMAT).
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.MatchingEqualExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.MatchingEqualExpression.Represents a matching equality expression (
?=).Unlike
=, a matching operator returns abit/std_ulogic. Both operands are available asLeftOperandandRightOperand.Example
res := lhs ?= rhs; -- ^^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _PRECEDENCE: ClassVar[OperatorPrecedence] = 3
The operator’s precedence level.
- _RESERVED_WORD: ClassVar[ReservedWord | None] = None
The operator’s reserved word;
Nonefor a symbol (_FORMAT).
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.MatchingUnequalExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.MatchingUnequalExpression.Represents a matching inequality expression (
?/=).Unlike
/=, a matching operator returns abit/std_ulogic. Both operands are available asLeftOperandandRightOperand.Example
res := lhs ?/= rhs; -- ^^^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _PRECEDENCE: ClassVar[OperatorPrecedence] = 3
The operator’s precedence level.
- _RESERVED_WORD: ClassVar[ReservedWord | None] = None
The operator’s reserved word;
Nonefor a symbol (_FORMAT).
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.MatchingLessThanExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.MatchingLessThanExpression.Represents a matching less-than expression (
?<).Unlike
<, a matching operator returns abit/std_ulogic. Both operands are available asLeftOperandandRightOperand.Example
res := lhs ?< rhs; -- ^^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _PRECEDENCE: ClassVar[OperatorPrecedence] = 3
The operator’s precedence level.
- _RESERVED_WORD: ClassVar[ReservedWord | None] = None
The operator’s reserved word;
Nonefor a symbol (_FORMAT).
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.MatchingLessEqualExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.MatchingLessEqualExpression.Represents a matching less-or-equal expression (
?<=).Unlike
<=, a matching operator returns abit/std_ulogic. Both operands are available asLeftOperandandRightOperand.Example
res := lhs ?<= rhs; -- ^^^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _PRECEDENCE: ClassVar[OperatorPrecedence] = 3
The operator’s precedence level.
- _RESERVED_WORD: ClassVar[ReservedWord | None] = None
The operator’s reserved word;
Nonefor a symbol (_FORMAT).
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.MatchingGreaterThanExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.MatchingGreaterThanExpression.Represents a matching greater-than expression (
?>).Unlike
>, a matching operator returns abit/std_ulogic. Both operands are available asLeftOperandandRightOperand.Example
res := lhs ?> rhs; -- ^^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _PRECEDENCE: ClassVar[OperatorPrecedence] = 3
The operator’s precedence level.
- _RESERVED_WORD: ClassVar[ReservedWord | None] = None
The operator’s reserved word;
Nonefor a symbol (_FORMAT).
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.MatchingGreaterEqualExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.MatchingGreaterEqualExpression.Represents a matching greater-or-equal expression (
?>=).Unlike
>=, a matching operator returns abit/std_ulogic. Both operands are available asLeftOperandandRightOperand.Example
res := lhs ?>= rhs; -- ^^^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _PRECEDENCE: ClassVar[OperatorPrecedence] = 3
The operator’s precedence level.
- _RESERVED_WORD: ClassVar[ReservedWord | None] = None
The operator’s reserved word;
Nonefor a symbol (_FORMAT).
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.ShiftRightLogicExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.ShiftRightLogicExpression.Represents a logical right shift expression (
srl).Both operands are available as
LeftOperandandRightOperand.Example
res := lhs srl rhs; -- ^^^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _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.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.ShiftLeftLogicExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.ShiftLeftLogicExpression.Represents a logical left shift expression (
sll).Both operands are available as
LeftOperandandRightOperand.Example
res := lhs sll rhs; -- ^^^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _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.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.ShiftRightArithmeticExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.ShiftRightArithmeticExpression.Represents an arithmetic right shift expression (
sra).Both operands are available as
LeftOperandandRightOperand.Example
res := lhs sra rhs; -- ^^^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _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.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.ShiftLeftArithmeticExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.ShiftLeftArithmeticExpression.Represents an arithmetic left shift expression (
sla).Both operands are available as
LeftOperandandRightOperand.Example
res := lhs sla rhs; -- ^^^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _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.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.RotateRightExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.RotateRightExpression.Represents a right rotate expression (
ror).Both operands are available as
LeftOperandandRightOperand.Example
res := lhs ror rhs; -- ^^^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _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.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.RotateLeftExpression(node, left, right)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.RotateLeftExpression.Represents a left rotate expression (
rol).Both operands are available as
LeftOperandandRightOperand.Example
res := lhs rol rhs; -- ^^^^^^^^^^^ <- the expression -- ^^^ <- LeftOperand -- ^^^ <- RightOperand
Inheritance
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- 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.
- _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.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the binary expression.
Format:
lhs + rhs- Return type:
- 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.QualifiedExpression(node, subtype, operand)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.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
- classmethod parse(node)[source]
Translates an IIR node to a
QualifiedExpression.
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- property Subtype: Symbol
Read-only property to access the subtype (
_subtype).- Returns:
The subtype.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()[source]
Formats the qualified expression.
Format:
byte'(val)- Return type:
- 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.
- class pyGHDL.dom.Expression.SubtypeAllocation(node, subtype)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.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
- classmethod parse(node)[source]
Translates an IIR node to a
SubtypeAllocation.- Parameters:
node (
Iir) – The IIR node this object is translated from.- Return type:
- Returns:
The translated object.
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- property Subtype: Symbol
Read-only property to access the subtype (
_subtype).- Returns:
The subtype.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()[source]
Formats the subtype allocation.
Format:
new node- Return type:
- Returns:
Formatted subtype allocation.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Expression.QualifiedExpressionAllocation(node, qualifiedExpression)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.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
- Parameters:
node (Iir)
qualifiedExpression (QualifiedExpression)
- __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.
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()[source]
Formats the qualified expression allocation.
Format:
new byte'(val)- Return type:
- 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.domobject derived frompyVHDLModel.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
- 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
- _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:
- 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:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- 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
typefound 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:
- 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, orNoneto accept every attribute.- Return type:
- 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:
- 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
_positionis 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:
- 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
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()[source]
Formats the aggregate.
Format:
(1, others => 0)- Return type:
- 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.