pyGHDL.dom.Object
This module implements derived object classes from pyVHDLModel.Object.
Classes
Constant: Represents a constant.DeferredConstant: Represents a deferred constant.Variable: Represents a variable.SharedVariable: Represents a shared variable.Signal: Represents a signal.File: Represents a file.
Classes
- class pyGHDL.dom.Object.Constant(node, identifiers, subtype, defaultExpression, documentation=None)[source]
Represents a constant.
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Object.Constant.Example
constant BITS : positive := 8;
Inheritance
- Parameters:
node (Iir)
subtype (Symbol)
defaultExpression (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal)
documentation (str)
- __init__(node, identifiers, subtype, defaultExpression, documentation=None)[source]
Initializes a constant.
- Parameters:
node (
TypeVar(Iir, bound=c_int)) – The IIR node this object was translated from.subtype (
Symbol) – Reference to the object’s subtype.defaultExpression (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The default value, or
Noneif none was given.documentation (
str) – The documentation comment associated with this declaration.
- Return type:
None
- classmethod parse(constantNode, furtherIdentifiers=None)[source]
Translates the IIR node of the constant declaration to a
Constant.
- _iirNode
The IIR node in libghdl’s tree this DOM object was translated from.
- _position
The IIR node’s position in the source file, resolved on first access and then cached.
- property DefaultExpression: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal | None
Read-only property to access the default expression (
_defaultExpression).- Returns:
The default expression, or
Noneif not set.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- GetAncestor(type)
Return the closest ancestor of the given
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:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
- Parameters:
predicate (
TypeVar(TAttr) |Iterable[TypeVar(TAttr)] |None) – An attribute class, an iterable of attribute classes, 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 Identifiers: Tuple[str]
Read-only property to access the model entity’s identifiers (
_identifiers).- Returns:
Tuple of identifiers.
- property NormalizedIdentifiers: Tuple[str]
Read-only property to access the model entity’s normalized identifiers (
_normalizedIdentifiers).- Returns:
Tuple of normalized identifiers.
- property ObjectVertex: Vertex | None
Read-only property to access the corresponding object vertex (
_objectVertex).The object vertex references this Object by its value field.
- Returns:
The corresponding object vertex.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
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 Subtype: Symbol
Read-only property to access the subtype (
_subtype).- Returns:
The subtype.
- __str__()
Formats the object declaration.
Format:
signal s1, s2 : bit- Return type:
- Returns:
Formatted object declaration.
- _defaultExpression
The default value, or
Noneif none was given.
- _documentation
The associated documentation of a model entity.
- _identifiers
A list of identifiers.
- _normalizedIdentifiers
A list of normalized (lower case) identifiers.
- _objectKeyword = 'constant'
The VHDL keyword introducing this object class.
- _objectVertex
The vertex representing this object in the design’s object graph.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _subtype
Reference to the object’s subtype.
- class pyGHDL.dom.Object.DeferredConstant(node, identifiers, subtype, documentation=None)[source]
Represents a deferred constant.
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Object.DeferredConstant.Example
constant BITS : positive;
Inheritance
- classmethod parse(constantNode, furtherIdentifiers=None)[source]
Translates the IIR node of the constant declaration to a
DeferredConstant.- Parameters:
- Return type:
- Returns:
The translated constant declaration.
- _position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
The IIR node’s position in the source file, resolved on first access and then cached.
- property ConstantReference: Constant | None
Read-only property to access the constant reference (
_constantReference).- Returns:
The constant reference, or
Noneif not set.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- GetAncestor(type)
Return the closest ancestor of the given
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:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
- Parameters:
predicate (
TypeVar(TAttr) |Iterable[TypeVar(TAttr)] |None) – An attribute class, an iterable of attribute classes, 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 Identifiers: Tuple[str]
Read-only property to access the model entity’s identifiers (
_identifiers).- Returns:
Tuple of identifiers.
- property NormalizedIdentifiers: Tuple[str]
Read-only property to access the model entity’s normalized identifiers (
_normalizedIdentifiers).- Returns:
Tuple of normalized identifiers.
- property ObjectVertex: Vertex | None
Read-only property to access the corresponding object vertex (
_objectVertex).The object vertex references this Object by its value field.
- Returns:
The corresponding object vertex.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
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 Subtype: Symbol
Read-only property to access the subtype (
_subtype).- Returns:
The subtype.
- __str__()
Formats the object declaration.
Format:
signal s1, s2 : bit- Return type:
- Returns:
Formatted object declaration.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Object.Variable(node, identifiers, subtype, defaultExpression, documentation=None)[source]
Represents a variable.
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Object.Variable.Example
variable result : natural := 0;
Inheritance
- Parameters:
node (Iir)
subtype (Symbol)
defaultExpression (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal)
documentation (str)
- __init__(node, identifiers, subtype, defaultExpression, documentation=None)[source]
Initializes a variable.
- Parameters:
node (
TypeVar(Iir, bound=c_int)) – The IIR node this object was translated from.subtype (
Symbol) – Reference to the object’s subtype.defaultExpression (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The default value, or
Noneif none was given.documentation (
str) – The documentation comment associated with this declaration.
- Return type:
None
- classmethod parse(variableNode, furtherIdentifiers=None)[source]
Translates the IIR node of the variable declaration to a
Variable.
- _iirNode
The IIR node in libghdl’s tree this DOM object was translated from.
- _position
The IIR node’s position in the source file, resolved on first access and then cached.
- property DefaultExpression: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal | None
Read-only property to access the default expression (
_defaultExpression).- Returns:
The default expression, or
Noneif not set.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- GetAncestor(type)
Return the closest ancestor of the given
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:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
- Parameters:
predicate (
TypeVar(TAttr) |Iterable[TypeVar(TAttr)] |None) – An attribute class, an iterable of attribute classes, 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 Identifiers: Tuple[str]
Read-only property to access the model entity’s identifiers (
_identifiers).- Returns:
Tuple of identifiers.
- property NormalizedIdentifiers: Tuple[str]
Read-only property to access the model entity’s normalized identifiers (
_normalizedIdentifiers).- Returns:
Tuple of normalized identifiers.
- property ObjectVertex: Vertex | None
Read-only property to access the corresponding object vertex (
_objectVertex).The object vertex references this Object by its value field.
- Returns:
The corresponding object vertex.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
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 Subtype: Symbol
Read-only property to access the subtype (
_subtype).- Returns:
The subtype.
- __str__()
Formats the object declaration.
Format:
signal s1, s2 : bit- Return type:
- Returns:
Formatted object declaration.
- _defaultExpression
The default value, or
Noneif none was given.
- _documentation
The associated documentation of a model entity.
- _identifiers
A list of identifiers.
- _normalizedIdentifiers
A list of normalized (lower case) identifiers.
- _objectKeyword = 'variable'
The VHDL keyword introducing this object class.
- _objectVertex
The vertex representing this object in the design’s object graph.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _subtype
Reference to the object’s subtype.
Represents a shared variable.
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Object.SharedVariable.Example
shared variable counter : counter_pt;
Inheritance
Initializes a shared variable.
Translates the IIR node of the variable declaration to a
SharedVariable.- Parameters:
- Return type:
- Returns:
The translated variable declaration.
The IIR node in libghdl’s tree this DOM object was translated from.
The IIR node’s position in the source file, resolved on first access and then cached.
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
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:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- Parameters:
predicate (
TypeVar(TAttr) |Iterable[TypeVar(TAttr)] |None) – 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.
Read-only property to access the model entity’s identifiers (
_identifiers).- Returns:
Tuple of identifiers.
Read-only property to access the model entity’s normalized identifiers (
_normalizedIdentifiers).- Returns:
Tuple of normalized identifiers.
Read-only property to access the corresponding object vertex (
_objectVertex).The object vertex references this Object by its value field.
- Returns:
The corresponding object vertex.
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
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.
Read-only property to access the subtype (
_subtype).- Returns:
The subtype.
Formats the object declaration.
Format:
signal s1, s2 : bit- Return type:
- Returns:
Formatted object declaration.
The associated documentation of a model entity.
A list of identifiers.
A list of normalized (lower case) identifiers.
The VHDL keyword introducing this object class.
The vertex representing this object in the design’s object graph.
Reference to a parent entity in the logical model hierarchy.
Reference to the object’s subtype.
- class pyGHDL.dom.Object.Signal(node, identifiers, subtype, defaultExpression, documentation=None)[source]
Represents a signal.
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Object.Signal.Example
signal counter : unsigned := (others => '0');
Inheritance
- Parameters:
node (Iir)
subtype (Symbol)
defaultExpression (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal)
documentation (str)
- __init__(node, identifiers, subtype, defaultExpression, documentation=None)[source]
Initializes a signal.
- Parameters:
node (
TypeVar(Iir, bound=c_int)) – The IIR node this object was translated from.subtype (
Symbol) – Reference to the object’s subtype.defaultExpression (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The default value, or
Noneif none was given.documentation (
str) – The documentation comment associated with this declaration.
- Return type:
None
- classmethod parse(signalNode, furtherIdentifiers=None)[source]
Translates the IIR node of the signal declaration to a
Signal.
- _iirNode
The IIR node in libghdl’s tree this DOM object was translated from.
- _position
The IIR node’s position in the source file, resolved on first access and then cached.
- property DefaultExpression: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal | None
Read-only property to access the default expression (
_defaultExpression).- Returns:
The default expression, or
Noneif not set.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- GetAncestor(type)
Return the closest ancestor of the given
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:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
- Parameters:
predicate (
TypeVar(TAttr) |Iterable[TypeVar(TAttr)] |None) – An attribute class, an iterable of attribute classes, 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 Identifiers: Tuple[str]
Read-only property to access the model entity’s identifiers (
_identifiers).- Returns:
Tuple of identifiers.
- property NormalizedIdentifiers: Tuple[str]
Read-only property to access the model entity’s normalized identifiers (
_normalizedIdentifiers).- Returns:
Tuple of normalized identifiers.
- property ObjectVertex: Vertex | None
Read-only property to access the corresponding object vertex (
_objectVertex).The object vertex references this Object by its value field.
- Returns:
The corresponding object vertex.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
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 Subtype: Symbol
Read-only property to access the subtype (
_subtype).- Returns:
The subtype.
- __str__()
Formats the object declaration.
Format:
signal s1, s2 : bit- Return type:
- Returns:
Formatted object declaration.
- _defaultExpression
The default value, or
Noneif none was given.
- _documentation
The associated documentation of a model entity.
- _identifiers
A list of identifiers.
- _normalizedIdentifiers
A list of normalized (lower case) identifiers.
- _objectKeyword = 'signal'
The VHDL keyword introducing this object class.
- _objectVertex
The vertex representing this object in the design’s object graph.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _subtype
Reference to the object’s subtype.
- class pyGHDL.dom.Object.File(node, identifiers, subtype, documentation=None)[source]
Represents a file.
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Object.File.Example
file INPUT : TEXT;
Inheritance
- classmethod parse(fileNode, furtherIdentifiers=None)[source]
Translates the IIR node of the file declaration to a
File.
- _position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
The IIR node’s position in the source file, resolved on first access and then cached.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- GetAncestor(type)
Return the closest ancestor of the given
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:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
- Parameters:
predicate (
TypeVar(TAttr) |Iterable[TypeVar(TAttr)] |None) – An attribute class, an iterable of attribute classes, 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 Identifiers: Tuple[str]
Read-only property to access the model entity’s identifiers (
_identifiers).- Returns:
Tuple of identifiers.
- property NormalizedIdentifiers: Tuple[str]
Read-only property to access the model entity’s normalized identifiers (
_normalizedIdentifiers).- Returns:
Tuple of normalized identifiers.
- property ObjectVertex: Vertex | None
Read-only property to access the corresponding object vertex (
_objectVertex).The object vertex references this Object by its value field.
- Returns:
The corresponding object vertex.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
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 Subtype: Symbol
Read-only property to access the subtype (
_subtype).- Returns:
The subtype.
- __str__()
Formats the object declaration.
Format:
signal s1, s2 : bit- Return type:
- Returns:
Formatted object declaration.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.