pyGHDL.dom.PSL
This module contains all DOM classes for VHDL’s design units (context,
architecture, package,
package body, context and
configuration.
Classes
VerificationUnit: This class implements apyGHDL.domobject derived frompyVHDLModel.PSLModel.VerificationUnit.VerificationProperty: This class implements apyGHDL.domobject derived frompyVHDLModel.PSLModel.VerificationProperty.VerificationMode: This class implements apyGHDL.domobject derived frompyVHDLModel.PSLModel.VerificationMode.DefaultClock: This class implements apyGHDL.domobject derived frompyVHDLModel.PSLModel.DefaultClock.
Classes
- class pyGHDL.dom.PSL.VerificationUnit(node, identifier)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.PSLModel.VerificationUnit.Represents a PSL verification unit (
vunit).Inheritance
- classmethod parse(vunitNode)[source]
Translates the IIR node of the verification unit to a
VerificationUnit.- Parameters:
vunitNode (
Iir) – The IIR node of the verification unit.- Returns:
The translated verification unit.
- _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.
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- 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 DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- 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:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- GetIdentifier(normalizedIdentifier)
Return the identifier as declared, for the model entity’s normalized identifier.
- 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 HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- IsLibraryVisible(libraryIdentifier)
Check if the logical name of a library is visible in this design unit.
The name
workis implicitly visible, the namestdtoo, except in a context declaration. Every other name needs a library clause, also the real name of the working library. The library clause is searched in this design unit’s context clause, in the context clause of its primary unit, and in the contexts these reference, also in nested ones. The design unit must be in a library of a design.
- 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 LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).See also
- Returns:
Normalized name of a model entity.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- 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 ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- 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:
- _CONTINUES_PARENT_REGION: ClassVar[bool] = False
Trueif it continues its parent’s declarative region.
- _ContextClauseUnits()
Return the design units whose context clause applies to this design unit.
- Return type:
- Returns:
Tuple of this design unit.
- _IMPLICIT_LIBRARIES: ClassVar[tuple[str, ...]] = ('work', 'std')
Library names visible without a library clause.
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- __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 verification unit declaration.
Format:
vunit myUnit- Return type:
- Returns:
Formatted verification unit declaration.
- _contextReferences: list[ContextReference]
List of context clauses.
- _dependencyVertex: Vertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _documentation
The associated documentation of a model entity.
- _hierarchyVertex: Vertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences: list[LibraryClause]
List of library clauses.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _referencedContexts: dict[str, Context]
Referenced contexts based on explicit context references or implicit inheritance
- class pyGHDL.dom.PSL.VerificationProperty(node, identifier)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.PSLModel.VerificationProperty.Represents a PSL verification property (
vprop).Inheritance
- classmethod parse(vpropNode)[source]
Translates the IIR node of the verification property to a
VerificationProperty.- Parameters:
vpropNode (
Iir) – The IIR node of the verification property.- Returns:
The translated verification property.
- _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.
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- 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 DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- 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:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- GetIdentifier(normalizedIdentifier)
Return the identifier as declared, for the model entity’s normalized identifier.
- 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 HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- IsLibraryVisible(libraryIdentifier)
Check if the logical name of a library is visible in this design unit.
The name
workis implicitly visible, the namestdtoo, except in a context declaration. Every other name needs a library clause, also the real name of the working library. The library clause is searched in this design unit’s context clause, in the context clause of its primary unit, and in the contexts these reference, also in nested ones. The design unit must be in a library of a design.
- 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 LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).See also
- Returns:
Normalized name of a model entity.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- 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 ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- 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:
- _CONTINUES_PARENT_REGION: ClassVar[bool] = False
Trueif it continues its parent’s declarative region.
- _ContextClauseUnits()
Return the design units whose context clause applies to this design unit.
- Return type:
- Returns:
Tuple of this design unit.
- _IMPLICIT_LIBRARIES: ClassVar[tuple[str, ...]] = ('work', 'std')
Library names visible without a library clause.
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- __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 verification property declaration.
Format:
vprop myUnit- Return type:
- Returns:
Formatted verification property declaration.
- _contextReferences: list[ContextReference]
List of context clauses.
- _dependencyVertex: Vertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _documentation
The associated documentation of a model entity.
- _hierarchyVertex: Vertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences: list[LibraryClause]
List of library clauses.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _referencedContexts: dict[str, Context]
Referenced contexts based on explicit context references or implicit inheritance
- class pyGHDL.dom.PSL.VerificationMode(node, identifier)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.PSLModel.VerificationMode.Represents a PSL verification mode (
vmode).Inheritance
- classmethod parse(vmodeNode)[source]
Translates the IIR node of the verification mode to a
VerificationMode.- Parameters:
vmodeNode (
Iir) – The IIR node of the verification mode.- Returns:
The translated verification mode.
- _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.
- AddContextItem(contextItem)
Add a context item at the end of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to add.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
InsertContextItem()→ Insert a context item at a position of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- property ContextItems: list[LibraryClause | UseClause | ContextReference]
Read-only property to access the sequence of all context items comprising library, use and context clauses (
_contextItems).- Returns:
Sequence of context items.
- property ContextReferences: list[ContextReference]
Read-only property to access the sequence of context clauses (
_contextReferences).- Returns:
Sequence of context clauses.
- 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 DependencyVertex: Vertex
Read-only property to access the corresponding dependency vertex (
_dependencyVertex).The dependency vertex references this design unit by its value field.
- Returns:
The corresponding dependency vertex.
- 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:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- GetIdentifier(normalizedIdentifier)
Return the identifier as declared, for the model entity’s normalized identifier.
- 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 HierarchyVertex: Vertex
Read-only property to access the corresponding hierarchy vertex (
_hierarchyVertex).The hierarchy vertex references this design unit by its value field.
- Returns:
The corresponding hierarchy vertex.
- property Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- InsertContextItem(index, contextItem)
Insert a context item at a position of the context clause.
The context item’s parent is set to this design unit. A library clause is also added to
LibraryReferences, a use clause toPackageReferencesand a context reference toContextReferences, in the order ofContextItems. A context item may repeat an earlier one.- Parameters:
index (
int) – Position, from0(first) to the number of context items (append). A negative index counts from the end, as forlist.insert():-1inserts before the last context item.contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.AlreadyInDesignError – If parameter ‘contextItem’ already has a parent.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
RemoveContextItem()→ Remove a context item from the context clause.
- IsLibraryVisible(libraryIdentifier)
Check if the logical name of a library is visible in this design unit.
The name
workis implicitly visible, the namestdtoo, except in a context declaration. Every other name needs a library clause, also the real name of the working library. The library clause is searched in this design unit’s context clause, in the context clause of its primary unit, and in the contexts these reference, also in nested ones. The design unit must be in a library of a design.
- 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 LibraryReferences: list[LibraryClause]
Read-only property to access the sequence of library clauses (
_libraryReferences).- Returns:
Sequence of library clauses.
- property NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).See also
- Returns:
Normalized name of a model entity.
- property PackageReferences: list[UseClause]
Read-only property to access the sequence of use clauses (
_packageReferences).- Returns:
Sequence of use clauses.
- 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 ReferencedContexts: dict[str, Context]
Read-only property to access the referenced contexts (
_referencedContexts).- Returns:
Dictionary of referenced contexts, indexed by normalized identifier.
- property ReferencedLibraries: dict[str, Library]
Read-only property to access the referenced libraries (
_referencedLibraries).- Returns:
Dictionary of referenced libraries, indexed by normalized identifier.
- property ReferencedPackages: dict[str, Package]
Read-only property to access the referenced packages (
_referencedPackages).- Returns:
Dictionary of referenced packages, indexed by normalized identifier.
- RemoveContextItem(contextItem)
Remove a context item from the context clause.
The context item is detached: its parent is cleared, and it’s removed from
ContextItemsand fromLibraryReferences,PackageReferencesorContextReferences. The context item itself is unchanged and can be added to another design unit, or inserted at another position.- Parameters:
contextItem (
LibraryClause|UseClause|ContextReference) – The library clause, use clause or context reference to remove.- Raises:
ValueError – If parameter ‘contextItem’ is
None.TypeError – If parameter ‘contextItem’ is not of type
LibraryClause,UseClauseorContextReference.NotAChildError – If parameter ‘contextItem’ is not a context item of this design unit.
- Return type:
Attention
The mutator doesn’t update what
Analyze()derived from the context items: the referenced libraries, packages and contexts (ReferencedLibraries,ReferencedPackages,ReferencedContexts), the namespace entries of a use clause, the edges of the dependency graph, and the references of the symbols. A design changed after its analysis needs a new analysis.See also
AddContextItem()→ Add a context item at the end of the context clause.
InsertContextItem()→ Insert a context item at a position of the context clause.
- 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:
- _CONTINUES_PARENT_REGION: ClassVar[bool] = False
Trueif it continues its parent’s declarative region.
- _ContextClauseUnits()
Return the design units whose context clause applies to this design unit.
- Return type:
- Returns:
Tuple of this design unit.
- _IMPLICIT_LIBRARIES: ClassVar[tuple[str, ...]] = ('work', 'std')
Library names visible without a library clause.
- _VisitContextClause(visitor)
Walk the context clause, i.e. the context items preceding the design unit, with a visitor.
The context clause is reported, even if it has no context items.
- __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 verification mode declaration.
Format:
vmode myUnit- Return type:
- Returns:
Formatted verification mode declaration.
- _contextReferences: list[ContextReference]
List of context clauses.
- _dependencyVertex: Vertex
Reference to the vertex in the dependency graph representing the design unit.
This reference is set byCreateDependencyGraph().
- _documentation
The associated documentation of a model entity.
- _hierarchyVertex: Vertex
The vertex in the hierarchy graph
- _identifier
The identifier of a model entity.
- _libraryReferences: list[LibraryClause]
List of library clauses.
- _normalizedIdentifier
The normalized (lower case) identifier of a model entity.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _referencedContexts: dict[str, Context]
Referenced contexts based on explicit context references or implicit inheritance
- class pyGHDL.dom.PSL.DefaultClock(node, identifier, documentation=None)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.PSLModel.DefaultClock.Represents a PSL default clock declaration.
It names the clock expression used by PSL directives that do not state one themselves.
Inheritance
- __init__(node, identifier, documentation=None)[source]
Initializes a PSL default clock declaration.
- classmethod parse(defaultClockNode)[source]
Translates the IIR node of the PSL default clock to a
DefaultClock.A PSL default clock declaration (
default clock is rising_edge(clk);) has no identifier. libghdl keeps the clock expression as a PSL node, which has no Python binding, so the clock expression’s source text (comments removed, whitespace collapsed) becomes the identifier:rising_edge(clk).- Parameters:
defaultClockNode (
Iir) – The IIR node of the PSL default clock.- Returns:
The translated PSL default clock.
- Raises:
DOMException – If the source text at the node’s location is no PSL default clock declaration.
- _position: Position
The IIR node’s position in the source file, resolved on first access and then cached.
- 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 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:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- GetIdentifier(normalizedIdentifier)
Return the identifier as declared, for the model entity’s normalized identifier.
- 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 Identifier: str
Read-only property to access the model entity’s identifier (
_identifier).- Returns:
Name of a model entity.
- 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 NormalizedIdentifier: str
Read-only property to access the model entity’s normalized identifier (
_normalizedIdentifier).See also
- Returns:
Normalized name of a model entity.
- 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.
- __str__()[source]
Formats the default clock declaration.
Format:
default clock myClock- Return type:
- Returns:
Formatted default clock declaration.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.