pyGHDL.dom.NonStandard
This module implements the non-standard classes Design, Library and Document.
These three are not VHDL language constructs, but the entry points of pyGHDL.dom: a document reads
and parses a source file through libghdl, a library groups documents, and a design owns the libraries.
Classes
Design: This class implements apyGHDL.domobject derived frompyVHDLModel.Design.Library: This class implements apyGHDL.domobject derived frompyVHDLModel.Library.Document: This class implements apyGHDL.domobject derived frompyVHDLModel.Document.
Classes
- class pyGHDL.dom.NonStandard.Design(name=None, vhdlVersion=2008, tabSize=8)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Design.A
Designrepresents set of VHDL libraries as well as all loaded and analysed source files (seeDocument).It’s the root of this code document-object-model (CodeDOM). It contains at least one VHDL library (see
Library). When the design is analysed (seeAnalyze()), multiple graph data structures will be created and populated with vertices and edges. As a first result, the design’s compile order and hierarchy can be iterated. As a second result, the design’s top-level is identified and referenced from the design (seeTopLevel).The design contains references to the following graphs:
Inheritance
- Parameters:
name (str)
vhdlVersion (VHDLVersion)
tabSize (int)
- _SUPPORTED_VHDL_VERSIONS = (2008, 2019)
VHDL versions currently supported by this class. Older revisions (87, 93, 2000, 2002) are not planned to be supported for now.
- _VHDL_VERSION_TO_STD_OPTION = {2008: '08', 2019: '19'}
Mapping from a supported VHDLVersion to GHDL’s ‘–std=’ option value.
- __init__(name=None, vhdlVersion=2008, tabSize=8)[source]
Initialize a VHDL design.
- Parameters:
name (
str) – Optional, name of the design.vhdlVersion (
VHDLVersion) – Optional, the VHDL version used to analyze this design.tabSize (
int) – Optional, the number of columns between two tab stops. Default:8.
- Raises:
DOMException – If parameter ‘vhdlVersion’ is not supported.
ValueError – If parameter ‘tabSize’ is None.
ValueError – If parameter ‘tabSize’ is out of range 1..120.
- Return type:
None
- _vhdlVersion: VHDLVersion
The VHDL version this design is analyzed with.
- _loadDefaultLibraryDuration: Duration | None
LoadDefaultLibraries()’ duration,Noneif not called.
- _warnings: List
Warnings raised by
pyVHDLModelwhile the design is analyzed.
- property VHDLVersion: VHDLVersion
Read-only property to access the VHDL version this design is analyzed with (
_vhdlVersion).The version is checked against
_SUPPORTED_VHDL_VERSIONSwhen the design is created and is translated to GHDL’s--std=option value via_VHDL_VERSION_TO_STD_OPTION.- Returns:
The design’s VHDL version.
- property TabSize: int
Read-only property to access the number of columns between two tab stops (
_tabSize).libghdl expands tabs with it when it computes columns, like the ones of messages and of comment continuation lines. The setting applies to libghdl as a whole, so to all documents loaded after this design was created.
- Returns:
The design’s tab size.
- __ghdl_init()
Initialization: set options and then load libraries.
- LoadDefaultLibraries(flavor=None)[source]
Loads the
stdandieeelibraries into the design.How long this took is measured and kept in
_loadDefaultLibraryDuration.- Parameters:
flavor (
IEEEFlavor|None) – Optional, the IEEE library flavor to load, orNonefor the default.
- Analyze()[source]
Analyzes all documents of this design.
How long this took is measured and kept in
_analyzeDuration, and the warningspyVHDLModelraises during the analysis are collected in_warnings.
- property LoadDefaultLibraryDuration: Duration | None
Read-only property to access the duration of
LoadDefaultLibraries()(_loadDefaultLibraryDuration).- Returns:
The duration of loading the
stdandieeelibraries, orNoneif they weren’t loaded.
- property AnalyzeDuration: Duration | None
Read-only property to access the duration of
Analyze()(_analyzeDuration).- Returns:
The duration of the design’s analysis, or
Noneif it wasn’t analyzed.
- AddDocument(document, library)[source]
Add a document (VHDL source file) to the design and register all embedded design units to the given VHDL library.
All checks are done, before the design, the document or the library is changed.
Algorithm
Check the document isn’t a document of a design, and the design contains no document of the same path.
Check none of the document’s entities, architectures, packages, package bodies, configurations and contexts exists in the library.
Add the document to the design and set the document’s library.
Add the document’s entities, architectures, packages, package bodies, configurations and contexts to the library and update their library membership.
- Parameters:
- Raises:
ValueError – If parameter ‘document’ is
None.TypeError – If parameter ‘document’ is not of type
Document.AlreadyInDesignError – If parameter ‘document’ is already a document of a design.
DuplicateDocumentError – If the design already contains a document of the same path.
ValueError – If parameter ‘library’ is
None.LibraryNotRegisteredError – If the given VHDL library is not a library in the design.
EntityExistsInLibraryError – If the processed entity’s name is already existing in the VHDL library.
ArchitectureExistsInLibraryError – If the processed architecture’s name is already existing in the VHDL library.
PackageExistsInLibraryError – If the processed package’s name is already existing in the VHDL library.
PackageBodyExistsError – If the processed package body’s name is already existing in the VHDL library.
ConfigurationExistsInLibraryError – If the processed configuration’s name is already existing in the VHDL library.
ContextExistsInLibraryError – If the processed context’s name is already existing in the VHDL library.
- Return type:
See also
RemoveDocument()→ Remove a document from the design.
- AddLibrary(library)[source]
Add a VHDL library to the design.
Ensure the libraries name doesn’t collide with existing libraries in the design.
If ok, set the libraries parent reference to the design.
- property AllowBlackbox: bool
Property to return whether a design supports blackboxes, inherited from the parent if not set locally (
_allowBlackbox).Algorithm
If allow blackbox property is locally set, return the local value,
Otherwise, return allow blackbox value from parent object.
- AnalyzeDependencies()[source]
Analyze the dependencies of design units.
Algorithm
Create all vertices of the dependency graph by iterating all design units in all libraries.
→CreateDependencyGraph()Create the compile order graph.
→CreateCompileOrderGraph()Index all packages.
→IndexPackages()Index all entities.
→IndexEntities()Link all architectures.
→LinkArchitectures()Index all architectures.
→IndexArchitectures()Link all package bodies.
→LinkPackageBodies()Index all package bodies.
→IndexPackageBodies()Link all package instances.
→LinkPackageInstances()Link all contexts.
→LinkContexts()Link all library references.
→LinkLibraryReferences()Link all package references.
→LinkPackageReferences()Link all context references.
→LinkContextReferences()Link all components.
→LinkComponents()Link all instantiations.
→LinkInstantiations()Create the hierarchy graph.
→CreateHierarchyGraph()Compute the compile order.
→ComputeCompileOrder()
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- AnalyzeObjects()[source]
Analyze the types and objects of the design.
It runs after the dependency analysis (
AnalyzeDependencies()), which links the use clauses and computes the compile order.Algorithm
Resolve the type marks of all declarations.
→ResolveTypeMarks()
Todo
Resolve the names in expressions, e.g. constants and generics in ranges and constraints, or signal attributes.
Build the type and object graph (
ObjectGraph) from these references.Wire the signals into a netlist.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.UnhandledCriticalWarningError – If the name of an alias can’t be resolved, and no
WarningCollectorcollects theUnresolvedNameWarning.UnhandledCriticalWarningError – If an incomplete type has no full type declaration, and no
WarningCollectorcollects theIncompleteTypeWarning.
- Return type:
- property CompileOrderGraph: Graph
Read-only property to access the compile-order graph (
_compileOrderGraph).- Returns:
Reference to the compile-order graph.
- CreateCompileOrderGraph()[source]
Create a compile-order graph with bidirectional references to the dependency graph.
Add vertices representing a document (VHDL source file) to the dependency graph. Each “document” vertex in dependency graph is copied into the compile-order graph and bidirectionally referenced.
In addition, each vertex of a corresponding design unit in a document is linked to the vertex representing that document to express the design unit in document relationship.
Each added vertex has the following properties:
The vertex’ ID is the document’s filename.
The vertex’ value references the document.
A key-value-pair called
kinddenotes the vertex’s kind as an enumeration value of typeDependencyGraphVertexKind.A key-value-pair called
predefineddoes not exist.
Algorithm
Iterate all documents in the design.
Create a vertex for that document with the document’s path as vertex ID and reference the document by the vertex’ value field.
In return, set the documents’s_dependencyVertexfield to reference the created vertex.Copy the vertex from dependency graph to compile-order graph and link both vertices bidirectionally.
In addition, set the documents’s_dependencyVertexfield to reference the copied vertex.Add a key-value-pair called
compileOrderVertexto the dependency graph’s vertex.Add a key-value-pair called
dependencyVertexto the compiler-order graph’s vertex.
Iterate the documents design units and create an edge from the design unit’s corresponding dependency vertex to the documents corresponding dependency vertex. This expresses a “design unit is located in document” relation.
Add a key-value-pair called kind` denoting the edge’s kind as an enumeration value of type
DependencyGraphEdgeKind.
- Return type:
- CreateDependencyGraph()[source]
Create all vertices of the dependency graph by iterating all design units in all libraries.
This method will purely create a sea of vertices without any linking between vertices. The edges will be created later by other methods.
SeeAnalyzeDependencies()for these methods and their algorithmic order.Each vertex has the following properties:
The vertex’ ID is the design unit’s identifier.
The vertex’ value references the design unit.
A key-value-pair called
kinddenotes the vertex’s kind as an enumeration value of typeDependencyGraphVertexKind.A key-value-pair called
predefineddenotes if the referenced design unit is a predefined language entity.
Algorithm
Iterate all libraries in the design.
Create a vertex for that library and reference the library by the vertex’ value field.
In return, set the library’s_dependencyVertexfield to reference the created vertex.
Iterate all contexts in that library.
Create a vertex for that context and reference the context by the vertex’ value field.
In return, set the context’s_dependencyVertexfield to reference the created vertex.
Iterate all packages in that library.
Create a vertex for that package and reference the package by the vertex’ value field.
In return, set the package’s_dependencyVertexfield to reference the created vertex.
Iterate all package bodies in that library.
Create a vertex for that package body and reference the package body by the vertex’ value field.
In return, set the package body’s_dependencyVertexfield to reference the created vertex.
Iterate all entities in that library.
Create a vertex for that entity and reference the entity by the vertex’ value field.
In return, set the entity’s_dependencyVertexfield to reference the created vertex.
Iterate all architectures in that library.
Create a vertex for that architecture and reference the architecture by the vertex’ value field.
In return, set the architecture’s_dependencyVertexfield to reference the created vertex.
Iterate all configurations in that library.
Create a vertex for that configuration and reference the configuration by the vertex’ value field.
In return, set the configuration’s_dependencyVertexfield to reference the created vertex.
- Return type:
- CreateHierarchyGraph()[source]
Create the hierarchy graph from dependency graph.
Algorithm
Iterate all vertices corresponding to entities and architectures in the dependency graph:
Copy these vertices to the hierarchy graph and create a bidirectional linking.
In addition, set the referenced design unit’s_hierarchyVertexfield to reference the copied vertex.Add a key-value-pair called
hierarchyVertexto the dependency graph’s vertex.Add a key-value-pair called
dependencyVertexto the hierarchy graph’s vertex.
Iterate all architectures …
Todo
Design::CreateHierarchyGraph describe algorithm
Iterate all outbound edges
Todo
Design::CreateHierarchyGraph describe algorithm
- Return type:
- 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 DependencyGraph: Graph
Read-only property to access the dependency graph (
_dependencyGraph).- Returns:
Reference to the dependency graph.
- property Documents: list[Document]
Read-only property to access the list of all documents (VHDL source files) loaded for this design (
_documents).- Returns:
A list of all documents.
- 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.
- GetConfiguration(libraryName, configurationName)[source]
Return the configuration named
configurationNamefrom the library namedlibraryName.The lookup is case-insensitive. Nothing is created, if the library or configuration doesn’t exist.
- Parameters:
- Return type:
- Returns:
The configuration.
- Raises:
ValueError – If parameter ‘libraryName’ is None or empty.
ValueError – If parameter ‘configurationName’ is None or empty.
TypeError – If parameter ‘configurationName’ is not of type
str.LibraryNotFoundError – If the library doesn’t exist in the design.
ConfigurationNotFoundError – If the configuration doesn’t exist in the library.
- GetContext(libraryName, contextName)[source]
Return the context named
contextNamefrom the library namedlibraryName.The lookup is case-insensitive. Nothing is created, if the library or context doesn’t exist.
- Parameters:
- Return type:
- Returns:
The context.
- Raises:
ValueError – If parameter ‘libraryName’ is None or empty.
ValueError – If parameter ‘contextName’ is None or empty.
LibraryNotFoundError – If the library doesn’t exist in the design.
ContextNotFoundError – If the context doesn’t exist in the library.
- GetEntity(libraryName, entityName)[source]
Return the entity named
entityNamefrom the library namedlibraryName.The lookup is case-insensitive. Nothing is created, if the library or entity doesn’t exist.
- Parameters:
- Return type:
- Returns:
The entity.
- Raises:
ValueError – If parameter ‘libraryName’ is None or empty.
ValueError – If parameter ‘entityName’ is None or empty.
LibraryNotFoundError – If the library doesn’t exist in the design.
EntityNotFoundError – If the entity doesn’t exist in the library.
- GetLibrary(libraryName)[source]
Return an (existing) VHDL library object of name
libraryName.If the requested VHDL library doesn’t exist, a new VHDL library with that name will be created.
- 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.
- GetPackage(libraryName, packageName)[source]
Return the package named
packageNamefrom the library namedlibraryName.The lookup is case-insensitive. Nothing is created, if the library or package doesn’t exist.
- Parameters:
- Return type:
- Returns:
The package.
- Raises:
ValueError – If parameter ‘libraryName’ is None or empty.
ValueError – If parameter ‘packageName’ is None or empty.
LibraryNotFoundError – If the library doesn’t exist in the design.
PackageNotFoundError – If the package doesn’t exist in the library.
- property HierarchyGraph: Graph
Read-only property to access the hierarchy graph (
_hierarchyGraph).- Returns:
Reference to the hierarchy graph.
- IndexArchitectures()[source]
Index all declared items in all architectures in all libraries.
Algorithm
Iterate all libraries:
Iterate all architectures
→pyVHDLModel.Library.IndexArchitectures()Index all declared items in that architecture.
→pyVHDLModel.DesignUnit.Architecture.IndexDeclaredItems()
See also
IndexPackages()Index all declared items in all packages in all libraries.
IndexPackageBodies()Index all declared items in all package bodies in all libraries.
IndexEntities()Index all declared items in all entities in all libraries.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- IndexEntities()[source]
Index all declared items in all entities in all libraries.
Algorithm
Iterate all libraries:
Iterate all entities
→pyVHDLModel.Library.IndexEntities()Index all declared items in that entity.
→pyVHDLModel.DesignUnit.Entity.IndexDeclaredItems()
See also
IndexPackages()Index all declared items in all packages in all libraries.
IndexPackageBodies()Index all declared items in all package bodies in all libraries.
IndexArchitectures()Index all declared items in all architectures in all libraries.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- IndexPackageBodies()[source]
Index all declared items in all package bodies in all libraries.
Algorithm
Iterate all libraries:
Iterate all package bodies
→pyVHDLModel.Library.IndexPackageBodies()Index all declared items in that package body.
→pyVHDLModel.DesignUnit.PackageBody.IndexDeclaredItems()
See also
IndexPackages()Index all declared items in all packages in all libraries.
IndexEntities()Index all declared items in all entities in all libraries.
IndexArchitectures()Index all declared items in all architectures in all libraries.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- IndexPackages()[source]
Index all declared items in all packages in all libraries.
Algorithm
Iterate all libraries:
Iterate all packages
→pyVHDLModel.Library.IndexPackages()Index all declared items in that package.
→pyVHDLModel.DesignUnit.Package.IndexDeclaredItems()
See also
IndexPackageBodies()Index all declared items in all package bodies in all libraries.
IndexEntities()Index all declared items in all entities in all libraries.
IndexArchitectures()Index all declared items in all architectures in all libraries.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- 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.
- IterateDesignUnits(filter=<DesignUnitKind.All: 63>)[source]
Iterate all design units in the design.
A union of
DesignUnitKindvalues can be given to filter the returned result for suitable design units.Algorithm
Iterate all VHDL libraries.
Iterate all contexts in that library.
Iterate all packages in that library.
Iterate all package bodies in that library.
Iterate all entites in that library.
Iterate all architectures in that library.
Iterate all configurations in that library.
- Parameters:
filter (
DesignUnitKind) – Optional, an enumeration with possibly multiple flags to filter the returned design units. Default:DesignUnitKind.All.- Return type:
- Returns:
A generator to iterate all matched design units in the design.
See also
pyVHDLModel.Library.IterateDesignUnits()Iterate all design units in the library.
pyVHDLModel.Document.IterateDesignUnits()Iterate all design units in the document.
- IterateDocumentsInCompileOrder()[source]
Iterate all document in compile-order.
Algorithm
Check if compile-order graph was populated with vertices and its vertices are linked by edges.
Iterate compile-order graph in topological order.
pyTooling.Graph.Graph.IterateTopologically()yield the compiler-order vertex’ referenced document.
- Return type:
- Returns:
A generator to iterate all documents in compile-order in the design.
- Raises:
CompileOrderNotComputedError – If compile-order was not computed.
CallAnalyze()orAnalyzeDependencies()before.
See also
Todo
missing text
pyVHDLModel.Design.ComputeCompileOrder()
- 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 Libraries: dict[str, Library]
Read-only property to access the dictionary of library names and VHDL libraries (
_libraries).- Returns:
A dictionary of library names and VHDL libraries.
- LinkArchitectures()[source]
Link all architectures to corresponding entities in all libraries.
Algorithm
Iterate all libraries:
Iterate all architecture groups (grouped per entity symbol’s name). →
pyVHDLModel.Library.LinkArchitectures()Check if entity symbol’s name exists as an entity in this library.
For each architecture in the same architecture group:
Add architecture to entities architecture dictionary
pyVHDLModel.DesignUnit.Entity._architectures.Assign found entity to architecture’s entity symbol
pyVHDLModel.DesignUnit.Architecture._entitySet parent namespace of architecture’s namespace to the entitie’s namespace.
Add an edge in the dependency graph from the architecture’s corresponding dependency vertex to the entity’s corresponding dependency vertex.
See also
LinkPackageBodies()Link all package bodies to corresponding packages in all libraries.
LinkPackageInstances()Link all package instances to corresponding generic packages in all libraries.
- Return type:
- LinkComponents()[source]
Link components to matching entities found in same VHDL library.
Algorithm
Iterate all design units with component declarations (packages and architectures):
Iterate all component declarations in a package or architecture:
Check if an entity with matching name can be found in the VHDL library the package is declared within. If found, set the component’s entity reference to that entity, otherwise check if blackboxes are allowed for that component. If so, mark the component as a blackbox, otherwise, raise an exception.
Iterate concurrent statements with declaration regions (block statements, generate statements) if the design unit is an architecture:
If the statement is an
IfGenerateStatement:Iterate declared components in the
IfGenerateBranch.Iterate declared components in each
ElsifGenerateBranch.Iterate declared components in the
ElseGenerateBranchif it exists.
If the statement is an
ForGenerateStatement:Iterate declared components.
If the statement is an
CaseGenerateStatement:Iterate declared components.
Iterate
- Raises:
ComponentEntityNotFoundError – If no entity is found for a component, which doesn’t allow blackboxes.
- Return type:
See also
LinkInstantiations()Link instantiations to components and entities.
AnalyzeDependencies()Analyze dependencies in a design (calls this method).
- LinkContextReferences()[source]
Link all context references (context clause) to the matching context.
Algorithm
Iterate all design units:
Iterate all context references in the design unit:
Iterate each context symbol within the context reference.
Get the library identifier from the symbol.
Get the context identifier from the symbol.
Resolve library:
If library name is
work, get library from design unit.If library name isn’t visible (
IsLibraryVisible()), raise an exception.Otherwise, lookup library by name in design.
Resolve context:
Lookup context by name in library.
Update design unit:
Update the context symbol’s target with the referenced context.
Add an entry in the design unit’s
_referencedContextsdictionary referencing the referenced context.Add an edge in the dependency graph from design unit to the referenced context.
Iterate all context vertices in the dependency graph (
_dependencyGraph) in topological order:Get the context from the context vertex.
Iterate all predecessor vertices (design unit vertices) of the context vertex:
Get the design unit from design unit vertex.
Iterate referenced libraries of the context:
Add an entry in the design unit’s
_referencedLibrariesdictionary referencing the referenced library.Add an empty dictionary in the design unit’s
_referencedPackagesdictionary.
Iterate referenced packages of the context:
Add an entry in the design unit’s
_referencedPackagesdictionary referencing the referenced package.
Iterate all design units with a namespace, the contexts they reference and, transitively, the contexts these reference: import the declarations, which
LinkContexts()imported into the namespace of a context, into the design unit’s namespace.
See also
LinkLibraryReferences()Link library clause.
LinkPackageReferences()Link use clause.
AnalyzeDependencies()Analyze dependencies and link relations.
- Raises:
ContextReferenceLibraryNotVisibleError – If a context reference references a library, whose name isn’t visible (
IsLibraryVisible()).ContextNotFoundError – If a context reference references a context, which doesn’t exist in its library.
UseClauseNotLinkedError – If a use clause of a referenced context isn’t linked.
CallLinkContexts()before.
- Return type:
- LinkContexts()[source]
Resolves and links all items (library clauses, use clauses and nested context references) in contexts.
It iterates all contexts in the design. Therefore, the library of the context is used as the working library. By default, the working library is implicitly referenced in
_referencedLibraries. In addition, a new empty dictionary is created in_referencedPackagesand_referencedContextsfor that working library.At first, all library clauses are resolved (a library clause my have multiple library reference symbols). For each referenced library an entry in
_referencedLibrariesis generated and new empty dictionaries in_referencedPackagesand_referencedContextsfor that working library. In addition, a vertex in the dependency graph is added for that relationship.The library clauses of all contexts are resolved before the use clauses of any context.
At second, all use clauses are linked as the use clauses of a design unit’s context clause (a use clause may have multiple package member reference symbols).
→_LinkUseClause()The declarations they make potentially visible are imported into the context’s namespace. The design units referencing the context import them from there (
LinkContextReferences()).- Raises:
ReferencedLibraryNotExistingError – If a library clause references a library, which doesn’t exist in the design.
UseClauseLibraryNotVisibleError – If a use clause references a library, whose name isn’t visible (
IsLibraryVisible()).PackageNotFoundError – If a use clause references a package, which doesn’t exist in its library.
UnknownSymbolKindError – If the type of a symbol in a use clause is unknown.
PackageInstantiationNotLinkedError – If a use clause names a package instantiation, which isn’t linked to its generic package.
CallLinkPackageInstances()before.UnhandledCriticalWarningError – If a use clause names a package member, which the package doesn’t declare, a primary unit, which the library doesn’t contain, a prefix, which isn’t a visible package, or an uninstantiated generic package, and no
WarningCollectorcollects theUnresolvedNameWarning.
- Return type:
- LinkLibraryReferences()[source]
Link all library references (library clause) to the matching VHDL library.
Algorithm
Iterate all design units with contexts:
If the design unit is a primary unit:
Iterate all library identifiers in
DEFAULT_LIBRARIES(std):Get the referenced library by name from the design.
Add an entry in the design unit’s
_referencedLibrariesdictionary referencing the referenced library.Add an empty dictionary in the design unit’s
_referencedPackagesdictionary.Add an empty dictionary in the design unit’s
_referencedContextsdictionary.Add an edge in the dependency graph from design unit to the referenced library.
Get the design unit’s library, unless it’s a library in
DEFAULT_LIBRARIES:Add an entry in the design unit’s
_referencedLibrariesdictionary referencing the referenced library.Add an empty dictionary in the design unit’s
_referencedPackagesdictionary.Add an empty dictionary in the design unit’s
_referencedContextsdictionary.Add an edge in the dependency graph from design unit to the referenced library.
If the design unit is a secondary unit:
If design unit is an architecture, get the corresponding entity’s referenced libraries.
If design unit is a package body, get the corresponding package’s referenced libraries.
Otherwise, raise an exception
For every referenced library create new dictionary entries in the design unit’s
_referencedLibraries.
Iterate every library reference (library clause) in the design unit:
Iterate every library symbol within the library reference:
Get the library identifier from the symbol.
Continue the inner loop, if identifier is
work.Get the referenced library from the design or raise an exception.
Update the library symbol’s target with the referenced library.
Add an entry in the design unit’s
_referencedLibrariesdictionary referencing the referenced library.Add an empty dictionary in the design unit’s
_referencedPackagesdictionary.Add an empty dictionary in the design unit’s
_referencedContextsdictionary.Add an edge in the dependency graph from design unit to the referenced library.
See also
LinkPackageReferences()Link use clause.
LinkContextReferences()Link context clause.
AnalyzeDependencies()Analyze dependencies and link relations.
- Raises:
LibraryNotFoundError – If library
stdisn’t loaded.
CallLoadStdLibrary()before.UnknownSecondaryUnitKindError – If a secondary unit is neither an architecture nor a package body.
LibraryClauseLibraryNotFoundError – If a library clause references a library, which doesn’t exist in the design.
- Return type:
- LinkPackageBodies()[source]
Link all package bodies to corresponding packages in all libraries.
Algorithm
Iterate all libraries:
Iterate all package bodies. →
pyVHDLModel.Library.LinkPackageBodies()Check if package body symbol’s name exists as a package in this library.
Add package body to package
pyVHDLModel.DesignUnit.Package._packageBody.Assign found package to package body’s package symbol
pyVHDLModel.DesignUnit.PackageBody._packageSet parent namespace of package body’s namespace to the package’s namespace.
Add an edge in the dependency graph from the package body’s corresponding dependency vertex to the package’s corresponding dependency vertex.
See also
LinkArchitectures()Link all architectures to corresponding entities in all libraries.
LinkPackageInstances()Link all package instances to corresponding generic packages in all libraries.
- Return type:
- LinkPackageInstances()[source]
Link all package instances to corresponding generic packages in all libraries.
Algorithm
Iterate all libraries:
Iterate all package instances. →
pyVHDLModel.Library.LinkPackageInstances()
Todo
Check if package instance’s symbol’s name exists as a generic package in this library.
Add generic package to package instance
pyVHDLModel.DesignUnit.Package._packageBody.Assign found package to package body’s package symbol
pyVHDLModel.DesignUnit.PackageBody._packageSet parent namespace of package body’s namespace to the package’s namespace.
Add an edge in the dependency graph from the package body’s corresponding dependency vertex to the package’s corresponding dependency vertex.
See also
LinkArchitectures()Link all architectures to corresponding entities in all libraries.
LinkPackageBodies()Link all package bodies to corresponding packages in all libraries.
- Return type:
- LinkPackageReferences()[source]
Link all package references (use clause) to the matching packages, and import the declarations they make potentially visible.
Algorithm
Iterate all design units with contexts:
If the design unit is a primary unit:
If primary unit isn’t package
std.standard:Iterate all library, packages tuples in
DEFAULT_PACKAGES(std: [standard]):Raise an exception, if library isn’t listed in design unit’s
_referencedLibraries.For every package in packages:
Get the referenced package by library name and package name from the design.
Add an entry in the design unit’s
_referencedPackagesdictionary referencing the referenced package.Add an edge in the dependency graph from design unit to the referenced package.
Import all declarations of the package into the design unit’s namespace, as by the implicit
use std.standard.all;.
If the design unit is a secondary unit:
If design unit is an architecture, get the corresponding entity’s referenced packages.
If design unit is a package body, get the corresponding package’s referenced packages.
Otherwise, raise an exception
For every referenced package create new dictionary entries in the design unit’s
_referencedPackages.
Link every use clause of the design unit’s context clause into the design unit’s namespace.
→_LinkUseClause()Link every use clause in the declarative part of the design unit and of every declarative region nested in it (e.g. a process, a subprogram or a block) into the namespace of its declarative region.
→_LinkUseClause()
See also
LinkLibraryReferences()Link library clause.
LinkContextReferences()Link context clause.
AnalyzeDependencies()Analyze dependencies and link relations.
- Raises:
LibraryReferenceNotLinkedError – If a primary unit doesn’t reference library
std.
CallLinkLibraryReferences()before.PackageNotFoundError – If library
stddoesn’t contain packagestandard.
CallLoadStdLibrary()before.UnknownSecondaryUnitKindError – If a secondary unit is neither an architecture nor a package body.
UseClauseLibraryNotVisibleError – If a use clause references a library, whose name isn’t visible (
IsLibraryVisible()).PackageNotFoundError – If a use clause references a package, which doesn’t exist in its library.
UnhandledCriticalWarningError – If a use clause names a package member, which the package doesn’t declare, a primary unit, which the library doesn’t contain, a prefix, which isn’t a visible package, or an uninstantiated generic package, and no
WarningCollectorcollects theUnresolvedNameWarning.
- Return type:
- LoadIEEELibrary(flavor=None)[source]
Load the predefined VHDL library
ieeeinto the design.This will create a virtual source code file
ieee.vhdland register VHDL design units of libraryieeeto that file.- Parameters:
flavor (
IEEEFlavor|None) – Optional, select the IEEE library flavor: IEEE, Synopsys, MentorGraphics. Default:None, the IEEE flavor.- Return type:
- Returns:
The library object of library
ieee.
- LoadStdLibrary()[source]
Load the predefined VHDL library
stdinto the design.This will create a virtual source code file
std.vhdland register VHDL design units of librarystdto that file.- Return type:
- Returns:
The library object of library
std.
- property Name: str | None
Read-only property to access the design’s name (
_name).- Returns:
The name of the design.
- property ObjectGraph: Graph
Read-only property to access the object graph (
_objectGraph).- Returns:
Reference to the object graph.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- RemoveDocument(document)[source]
Remove a document (VHDL source file) from the design.
The document is detached: its parent and library are cleared. Its entities, architectures, packages, package bodies, configurations and contexts leave the library, and their parent is cleared. The design units stay design units of the document, so the document can be added to a design again.
- Parameters:
document (
Document) – The VHDL source code file.- Raises:
ValueError – If parameter ‘document’ is
None.TypeError – If parameter ‘document’ is not of type
Document.NotAChildError – If parameter ‘document’ is not a document of this design.
- Return type:
See also
AddDocument()→ Add a document to the design.
- RemoveLibrary(library)[source]
Remove a VHDL library from the design.
The library is detached: its parent is cleared. Its design units stay design units of the library, so the library can be added to a design again (
AddLibrary()).- Parameters:
library (
Library) – The VHDL library to remove.- Raises:
ValueError – If parameter ‘library’ is
None.NotAChildError – If parameter ‘library’ is not a library of this design.
LibraryInUseError – If documents of this design still use the library.
- Return type:
See also
AddLibrary()→ Add a VHDL library to the design.
RemoveDocument()→ Remove a document from the design.
- ResetAnalysis()[source]
Reset everything an analysis (
Analyze()) derived, so the design can be analyzed again.Everything built by the user is kept: libraries, documents, design units, declarations and the declarations in namespaces. Lookup tables built by indexing (e.g.
IndexPackages()) are kept too, as indexing again yields the same lookup tables. Resetting a design, which wasn’t analyzed, changes nothing.Algorithm
Delete the dependency, compile-order, hierarchy and object graph (
Delete()), so their vertices and edges are freed at once, replace them by empty graphs, and forget the top-level.Clear the references to vertices of all libraries, documents and design units.
Clear the references of all design units: referenced libraries, packages and contexts, the symbols of library clauses, use clauses and context references, and the items imported into namespaces. Use clauses in declarative regions nested in a design unit are cleared too, as are the references of type marks and alias names (
ResolveTypeMarks()) and the base types of subtypes; a subtype of a predefined library (Library.IsPredefined) keeps its base type.Unlink architectures from entities and package bodies from packages: an entity’s architectures, a package’s body, the symbols referencing the entity or package, and the link to the parent namespace.
Unlink package instantiations from their generic package: the symbol and the components copied from it.
Unbind all components: their entity and blackbox state.
Clear the symbols of entity and component instantiations.
- Return type:
- 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:
- ResolveTypeMarks()[source]
Resolve the type marks of all declarations in the design.
It’s the first step of
AnalyzeObjects(), after the use clauses are linked. Each type mark is looked up at its place (LookupName()), so the visibility rules apply: e.g. a type declared after the place isn’t visible, and conflicting use clauses make a type mark ambiguous. A resolved type mark references the type, the subtype or the generic type (Reference); a type mark denoting an alias of a type references the type. Resolving again yields the same references, as long as the design isn’t changed; after a change,Analyze()links the use clauses again.Algorithm
Iterate the design units of the predefined libraries (
Library.IsPredefined), then the design units of all documents in compile order (the compile-order graph,ComputeCompileOrder()), so a package is resolved before its users.Iterate the declarative regions of each design unit, the outermost first (
IterateDeclarationRegions()):Index the declared items of a region not indexed yet, e.g. a process or a subprogram.
Iterate the region’s declarations in declaration order; each resolves its references (
ResolveReferences()):Every declaration resolves its type marks (
IterateTypeMarks()) by the region looking them up (ResolveTypeMark()).An incomplete type reports, if no full type declaration follows in its region (
ResolveReferences()).An alias without a subtype indication resolves its name (
ResolveReferences()).A subtype sets its base type (
BaseType): the resolved type, or the base type of the resolved subtype.
See also
ResetAnalysis()Reset everything an analysis derived, including the references of type marks.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.UnhandledCriticalWarningError – If the name of an alias can’t be resolved, and no
WarningCollectorcollects theUnresolvedNameWarning.UnhandledCriticalWarningError – If an incomplete type has no full type declaration, and no
WarningCollectorcollects theIncompleteTypeWarning.UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.
- Return type:
- SearchConfiguration(configurationName)[source]
Return all configurations named
configurationNamefrom the libraries of the design.The search is case-insensitive. Each configuration references its library by
Library.- Parameters:
configurationName (
str) – Name of the searched configuration.- Return type:
- Returns:
Tuple of configurations in the order of the design’s libraries, empty if no library contains one.
- Raises:
ValueError – If parameter ‘configurationName’ is None or empty.
TypeError – If parameter ‘configurationName’ is not of type
str.
- SearchContext(contextName)[source]
Return all contexts named
contextNamefrom the libraries of the design.The search is case-insensitive. Each context references its library by
Library.- Parameters:
contextName (
str) – Name of the searched context.- Return type:
- Returns:
Tuple of contexts in the order of the design’s libraries, empty if no library contains one.
- Raises:
ValueError – If parameter ‘contextName’ is None or empty.
- SearchEntity(entityName)[source]
Return all entities named
entityNamefrom the libraries of the design.The search is case-insensitive. Each entity references its library by
Library.- Parameters:
entityName (
str) – Name of the searched entity.- Return type:
- Returns:
Tuple of entities in the order of the design’s libraries, empty if no library contains one.
- Raises:
ValueError – If parameter ‘entityName’ is None or empty.
- SearchPackage(packageName)[source]
Return all packages named
packageNamefrom the libraries of the design.The search is case-insensitive. Each package references its library by
Library.- Parameters:
packageName (
str) – Name of the searched package.- Return type:
- Returns:
Tuple of packages in the order of the design’s libraries, empty if no library contains one.
- Raises:
ValueError – If parameter ‘packageName’ is None or empty.
- property TopLevel: Entity | Configuration
Read-only property to return the design’s top-level (
_toplevel).When called the first time, the hierarchy graph is checked for its root elements. When there is only one root element in the graph, a new field
toplevelis added to_hierarchyGraphreferencing that single element. In addition, the result is cached in_toplevel.- Returns:
Reference to the design’s top-level.
- Raises:
HierarchyNotComputedError – If the hierarchy graph is not yet computed from dependency graph.
CallAnalyze()orAnalyzeDependencies()before.AmbiguousTopLevelError – If there is more than one top-level.
- 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:
- _IterateComponents()[source]
Iterate all components of packages and architectures, including the components declared in blocks and generate statements nested in architectures.
- _LinkUseClause(designUnit, namespace, useClause, isContextItem)[source]
Link the symbols of a use clause and import the declarations they make potentially visible into a namespace.
Algorithm
Iterate every package symbol within the use clause (a use clause can have multiple comma-separated symbols):
Get the package name from the symbol: the symbol’s name for a
PackageReferenceSymbol(use lib.pkg;), else its prefix (use lib.pkg.all;,use lib.pkg.item;). Get the library name, the prefix of the package name. If the symbol is neither of the three package symbol types, raise an exception.If the use clause names a library (
use work.all;,use lib.unit;, the prefix isworkor the visible name of a library (IsLibraryVisible()), andunitisn’t a package of it):.all: import all primary units of the library (entities, packages, configurations, contexts)..unit: import the primary unit of that name; if there is none, raise anUnresolvedNameWarning.
Continue with the next symbol.
Resolve the package:
Without a library name (
use pkg.all;): lookup the directly visible package at the use clause (Lookup()), e.g. made visible byuse lib.pkg;or declared in an enclosing region. If there is none, raise anUnresolvedNameWarningand continue with the next symbol.With a library name: if library name is
work, get the library of the design unit; if library name isn’t visible (IsLibraryVisible()), raise an exception; otherwise lookup the library by name in the design. Lookup the package by name in the library; if it doesn’t exist, raise an exception.
Update the design unit:
Update the package symbol’s reference with the package.
If the package was named with its library and the use clause is an item of the design unit’s context clause, add an entry in the design unit’s
_referencedPackagesdictionary.If the package was named with its library, add an edge in the dependency graph from design unit to the package.
If the package is an uninstantiated generic package, raise an
UnresolvedNameWarningand continue with the next symbol.Import the public package members into the namespace (
AddImport()), each with the use clause as origin:AllPackageMembersReferenceSymbol(use lib.pkg.all;): every declaration of the package, incl. the enumeration literals and physical units of its types (IterateDeclarations()).PackageMemberReferenceSymbol(use lib.pkg.item;): every declaration of the package with the identifieritem, e.g. all overloads of a subprogram, and the enumeration literals and physical units of a type or of a subtype’s base type (IterateMemberDeclarations()). If there is none, raise anUnresolvedNameWarning.PackageReferenceSymbol(use lib.pkg;): the package itself.
- Parameters:
designUnit (
DesignUnit) – The design unit containing the use clause.namespace (
Namespace) – The namespace of the declarative region or of the context declaration containing the use clause.useClause (
UseClause) – The use clause.isContextItem (
bool) –True, if the use clause is an item of the design unit’s context clause.
- Raises:
UseClauseLibraryNotVisibleError – If a use clause references a library, whose name isn’t visible (
IsLibraryVisible()).PackageNotFoundError – If a use clause references a package, which doesn’t exist in its library.
UnknownSymbolKindError – If the type of a symbol in the use clause is unknown.
PackageInstantiationNotLinkedError – If a package instantiation isn’t linked to its generic package.
UnhandledCriticalWarningError – If a use clause names a package member, which the package doesn’t declare, a primary unit, which the library doesn’t contain, a prefix, which isn’t a visible package, or an uninstantiated generic package, and no
WarningCollectorcollects theUnresolvedNameWarning.
- Return type:
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()[source]
Formats a representation of the design.
Format:
Document: 'my_design'- Return type:
- Returns:
String representation of the design.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats a representation of the design.
Format:
Document: 'my_design'- Return type:
- Returns:
String representation of the design.
- _compileOrderGraph: Graph
A graph derived from dependency graph containing the order of documents for compilation.
- _dependencyGraph: Graph
The graph of all dependencies in the designs.
- _hierarchyGraph: Graph
A graph derived from dependency graph containing the design hierarchy.
- _objectGraph: Graph
The graph of all types and objects in the design.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- _toplevel: Entity | Configuration
When computed, the toplevel design unit is cached in this field.
- class pyGHDL.dom.NonStandard.Library(identifier, documentation=None, allowBlackbox=None, parent=None)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Library.A
Libraryrepresents a VHDL library. It contains all primary and secondary design units.See also
Inheritance
- Parameters:
- property AllowBlackbox: bool
Property to return whether a design supports blackboxes, inherited from the parent if not set locally (
_allowBlackbox).Algorithm
If allow blackbox property is locally set, return the local value,
Otherwise, return allow blackbox value from parent object.
- property Architectures: dict[str, dict[str, Architecture]]
Read-only property to access the dictionary of all architecture declarations in this library (
_architectures).- Returns:
Dictionary of all architectures, indexed by normalized entity identifier, then by normalized architecture identifier.
- property Configurations: dict[str, Configuration]
Read-only property to access the dictionary of all configuration declarations in this library (
_configurations).- Returns:
Dictionary of all configurations, indexed by normalized identifier.
- property Contexts: dict[str, Context]
Read-only property to access the dictionary of all context declarations in this library (
_contexts).- Returns:
Dictionary of all contexts, indexed by normalized identifier.
- 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 library by its value field.
- Returns:
The corresponding dependency vertex.
- property Documentation: str | None
Property to access the library’s documentation (
_documentation).Hint
Unlike every other documented entity, a library’s documentation cannot come from VHDL source: the language has no library declaration to attach a comment to. It is therefore settable, so a caller can supply one from elsewhere - a compile-order file, a project description, …
- Returns:
Associated documentation of this VHDL library.
- property Entities: dict[str, Entity]
Read-only property to access the dictionary of all entity declarations in this library (
_entities).- Returns:
Dictionary of all entities, indexed by normalized identifier.
- 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.
- IndexArchitectures()[source]
Index declared items in all architectures.
Algorithm
Iterate all architectures:
Index all declared items.
→pyVHDLModel.DesignUnit.Architecture.IndexDeclaredItems()
See also
IndexPackages()Index all declared items in a package.
IndexPackageBodies()Index all declared items in a package body.
IndexEntities()Index all declared items in an entity.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- IndexEntities()[source]
Index declared items in all entities.
Algorithm
Iterate all entities:
Index all declared items.
→pyVHDLModel.DesignUnit.Entity.IndexDeclaredItems()
See also
IndexPackages()Index all declared items in a package.
IndexPackageBodies()Index all declared items in a package body.
IndexArchitectures()Index all declared items in an architecture.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- IndexPackageBodies()[source]
Index declared items in all package bodies.
Algorithm
Iterate all package bodies:
Index all declared items.
→pyVHDLModel.DesignUnit.PackageBody.IndexDeclaredItems()
See also
IndexPackages()Index all declared items in a package.
IndexEntities()Index all declared items in an entity.
IndexArchitectures()Index all declared items in an architecture.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- IndexPackages()[source]
Index declared items in all packages.
Algorithm
Iterate all packages:
Index all declared items.
→pyVHDLModel.DesignUnit.Package.IndexDeclaredItems()
See also
IndexPackageBodies()Index all declared items in a package body.
IndexEntities()Index all declared items in an entity.
IndexArchitectures()Index all declared items in an architecture.
- Raises:
UnhandledCriticalWarningError – If an identifier is declared twice in a declarative region and no
WarningCollectorcollects theDuplicateDeclarationWarning.- Return type:
- 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.
- property IsPredefined: bool
Check if the library is a predefined library built by pyVHDLModel.
A predefined library is a
PredefinedLibrary, e.g.std.Its declarations are complete when constructed, e.g. a subtype has its base type, so an analysis neither resolves nor resets them. A library
stdorieeeread from VHDL source files isn’t predefined in this sense.- Returns:
False
- IterateDesignUnits(filter=<DesignUnitKind.All: 63>)[source]
Iterate all design units in the library.
A union of
DesignUnitKindvalues can be given to filter the returned result for suitable design units.Algorithm
Iterate all contexts in that library.
Iterate all packages in that library.
Iterate all package bodies in that library.
Iterate all entities in that library.
Iterate all architectures in that library.
Iterate all configurations in that library.
- Parameters:
filter (
DesignUnitKind) – Optional, an enumeration with possibly multiple flags to filter the returned design units. Default:DesignUnitKind.All.- Return type:
- Returns:
A generator to iterate all matched design units in the library.
See also
pyVHDLModel.Design.IterateDesignUnits()Iterate all design units in the design.
pyVHDLModel.Document.IterateDesignUnits()Iterate all design units in the document.
- 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.
- LinkArchitectures()[source]
Link all architectures to corresponding entities.
Algorithm
Iterate all architecture groups (grouped per entity symbol’s name).
Check if entity symbol’s name exists as an entity in this library.
For each architecture in the same architecture group:
Add architecture to entities architecture dictionary
pyVHDLModel.DesignUnit.Entity._architectures.Assign found entity to architecture’s entity symbol
pyVHDLModel.DesignUnit.Architecture._entitySet parent namespace of architecture’s namespace to the entitie’s namespace.
Add an edge in the dependency graph from the architecture’s corresponding dependency vertex to the entity’s corresponding dependency vertex.
- Raises:
ArchitectureEntityNotFoundError – If entity name doesn’t exist.
ArchitectureExistsInLibraryError – If architecture name already exists for entity.
- Return type:
See also
LinkPackageBodies()Link all package bodies to corresponding packages.
LinkPackageInstances()Link all package instances to corresponding generic packages.
- LinkPackageBodies()[source]
Link all package bodies to corresponding packages.
Algorithm
Iterate all package bodies.
Check if package body symbol’s name exists as a package in this library.
Report a
DuplicateDeclarationWarning, if the package has another package body.Add package body to package
pyVHDLModel.DesignUnit.Package._packageBody.Assign found package to package body’s package symbol
pyVHDLModel.DesignUnit.PackageBody._packageSet parent namespace of package body’s namespace to the package’s namespace.
Add an edge in the dependency graph from the package body’s corresponding dependency vertex to the package’s corresponding dependency vertex.
- Raises:
PackageBodyPackageNotFoundError – If package name doesn’t exist.
UnhandledCriticalWarningError – If a package has another package body, which is replaced, and no
WarningCollectorcollects theDuplicateDeclarationWarning.
- Return type:
See also
LinkArchitectures()Link all architectures to corresponding entities.
LinkPackageInstances()Link all package instances to corresponding generic packages.
- LinkPackageInstances()[source]
Link all package instances to corresponding generic packages.
Algorithm
Iterate all package instances.
Todo
Check if package body symbol’s name exists as a package in this library.
Add package body to package
pyVHDLModel.DesignUnit.Package._packageBody.Assign found package to package body’s package symbol
pyVHDLModel.DesignUnit.PackageBody._packageSet parent namespace of package body’s namespace to the package’s namespace.
Add an edge in the dependency graph from the package body’s corresponding dependency vertex to the package’s corresponding dependency vertex.
- Raises:
PackageInstantiationLibraryNotFoundError – If the library of the generic package doesn’t exist in the design.
PackageInstantiationLibraryNotVisibleError – If the name of that library isn’t visible (
IsLibraryVisible()).PackageNotFoundError – If generic package name doesn’t exist.
NotAGenericPackageError – If the package isn’t a generic package.
- Return type:
See also
LinkArchitectures()Link all architectures to corresponding entities.
LinkPackageBodies()Link all package bodies to corresponding packages.
- 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 PackageBodies: dict[str, PackageBody]
Read-only property to access the dictionary of all package body declarations in this library (
_packageBodies).- Returns:
Dictionary of all package bodies, indexed by normalized identifier.
- property Packages: dict[str, Package]
Read-only property to access the dictionary of all package declarations in this library (
_packages).- Returns:
Dictionary of all packages, indexed by normalized identifier.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- 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.
- __init__(identifier, documentation=None, allowBlackbox=None, parent=None)[source]
Initialize a VHDL library.
- Parameters:
identifier (
str) – Name of the VHDL library.documentation (
str|None) – Optional, documentation of this VHDL library, if the caller has one to supply. Default:None, no documentation.allowBlackbox (
bool|None) – Optional, specify if blackboxes are allowed in this design. Default:None, inherited from the parent.parent (
ModelEntity|None) – Optional, the parent model entity (design) of this VHDL library. Default:None, no parent.
- Return type:
None
- __new__(**kwargs)
- __repr__()[source]
Formats a representation of the library.
Format:
Library: 'my_library'- Return type:
- Returns:
String representation of the library.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats a representation of the library.
Format:
Library: 'my_library'- Return type:
- Returns:
String representation of the library.
- _architectures: dict[str, dict[str, Architecture]]
Dictionary of all architectures defined in a library.
- _configurations: dict[str, Configuration]
Dictionary of all configurations defined in a library.
- _dependencyVertex: Vertex
Reference to the vertex in the dependency graph representing the library.
This reference is set byCreateDependencyGraph().
- _packageBodies: dict[str, PackageBody]
Dictionary of all package bodies defined in a library.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.NonStandard.Document(path, sourceCode=None, vhdlVersion=2008, dontParse=False, dontTranslate=False)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Document.A
Documentrepresents a sourcefile. It contains primary and secondary design units.Inheritance
- Parameters:
path (Path)
sourceCode (str)
vhdlVersion (VHDLVersion)
dontParse (bool)
dontTranslate (bool)
- __init__(path, sourceCode=None, vhdlVersion=2008, dontParse=False, dontTranslate=False)[source]
Initializes a VHDL document.
- Parameters:
path (
Path) – Path to the document.Noneif in-memory document.sourceCode (
str) – Optional, the source code to analyze, orNoneto read it frompath.vhdlVersion (
VHDLVersion) – Optional, VHDL version used for analyzing this source file.dontParse (
bool) – Optional,Trueto skip parsing the source code.dontTranslate (
bool) – Optional,Trueto parse the source code, but skip translating it to the DOM.
- Return type:
None
- AddDesignUnit(designUnit)[source]
Add a design unit at the end of the document.
The design unit’s document is set to this document. If the document is registered in a design (
Design.AddDocument()), the design unit enters the document’s library too.- Parameters:
designUnit (
DesignUnit) – The design unit to add.- Raises:
ValueError – If parameter ‘designUnit’ is
None.TypeError – If parameter ‘designUnit’ is not of type
DesignUnit.AlreadyInDesignError – If parameter ‘designUnit’ is already a design unit of a document.
DuplicateDesignUnitError – If the document contains a design unit of the same kind and identifier.
EntityExistsInLibraryError – If the library already contains an entity of the same identifier.
ArchitectureExistsInLibraryError – If the library already contains an architecture of the same identifier for the same entity.
PackageExistsInLibraryError – If the library already contains a package of the same identifier.
PackageBodyExistsError – If the library already contains a package body of the same identifier.
ConfigurationExistsInLibraryError – If the library already contains a configuration of the same identifier.
ContextExistsInLibraryError – If the library already contains a context of the same identifier.
- Return type:
See also
InsertDesignUnit()→ Insert a design unit at a position of the document.
RemoveDesignUnit()→ Remove a design unit from the document.
- property Architectures: dict[str, dict[str, Architecture]]
Read-only property to access the dictionary of all architecture declarations in this document (
_architectures).- Returns:
Dictionary of all architectures, indexed by normalized entity identifier, then by normalized architecture identifier.
- property CompileOrderVertex: Vertex
Read-only property to access the corresponding compile-order vertex (
_compileOrderVertex).The compile-order vertex references this document by its value field.
- Returns:
The corresponding compile-order vertex.
- property Configurations: dict[str, Configuration]
Read-only property to access the dictionary of all configuration declarations in this document (
_configurations).- Returns:
Dictionary of all configurations, indexed by normalized identifier.
- property Contexts: dict[str, Context]
Read-only property to access the dictionary of all context declarations in this document (
_contexts).- Returns:
Dictionary of all contexts, indexed by normalized identifier.
- 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 DesignUnits: list[DesignUnit]
Read-only property to access a list of all design units declarations found in this document (
_designUnits).- Returns:
List of all design units.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property Entities: dict[str, Entity]
Read-only property to access the dictionary of all entity declarations in this document (
_entities).- Returns:
Dictionary of all entities, indexed by normalized identifier.
- 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.
- InsertDesignUnit(index, designUnit)[source]
Insert a design unit at a position of the document.
The design units of a document are in source order. The design unit’s document is set to this document. If the document is registered in a design (
Design.AddDocument()), the design unit enters the document’s library too: the library becomes its parent. PSL verification units, properties and modes enter no library.- Parameters:
index (
int) – Position, from0(first) to the number of design units (append). A negative index counts from the end, as forlist.insert().designUnit (
DesignUnit) – The design unit to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘designUnit’ is
None.TypeError – If parameter ‘designUnit’ is not of type
DesignUnit.AlreadyInDesignError – If parameter ‘designUnit’ is already a design unit of a document.
DuplicateDesignUnitError – If the document contains a design unit of the same kind and identifier.
EntityExistsInLibraryError – If the library already contains an entity of the same identifier.
ArchitectureExistsInLibraryError – If the library already contains an architecture of the same identifier for the same entity.
PackageExistsInLibraryError – If the library already contains a package of the same identifier.
PackageBodyExistsError – If the library already contains a package body of the same identifier.
ConfigurationExistsInLibraryError – If the library already contains a configuration of the same identifier.
ContextExistsInLibraryError – If the library already contains a context of the same identifier.
- Return type:
See also
AddDesignUnit()→ Add a design unit at the end of the document.
RemoveDesignUnit()→ Remove a design unit from the document.
- 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.
- IterateDesignUnits(filter=<DesignUnitKind.All: 63>)[source]
Iterate all design units in the document.
A union of
DesignUnitKindvalues can be given to filter the returned result for suitable design units.Algorithm
If contexts are selected in the filter:
Iterate all contexts in that library.
If packages are selected in the filter:
Iterate all packages in that library.
If package bodies are selected in the filter:
Iterate all package bodies in that library.
If entites are selected in the filter:
Iterate all entites in that library.
If architectures are selected in the filter:
Iterate all architectures in that library.
If configurations are selected in the filter:
Iterate all configurations in that library.
- Parameters:
filter (
DesignUnitKind) – Optional, an enumeration with possibly multiple flags to filter the returned design units. Default:DesignUnitKind.All.- Return type:
- Returns:
A generator to iterate all matched design units in the document.
See also
pyVHDLModel.Design.IterateDesignUnits()Iterate all design units in the design.
pyVHDLModel.Library.IterateDesignUnits()Iterate all design units in the library.
- 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 Library: Library
Read-only property to access the document’s VHDL library (
_library).- Returns:
VHDL library used to analyze the VHDL file’s design units into.
- property PackageBodies: dict[str, PackageBody]
Read-only property to access the dictionary of all package body declarations in this document (
_packageBodies).- Returns:
Dictionary of all package bodies, indexed by normalized identifier.
- property Packages: dict[str, Package]
Read-only property to access the dictionary of all package declarations in this document (
_packages).- Returns:
Dictionary of all packages, indexed by normalized identifier.
- 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 Path: Path
Read-only property to access the document’s path (
_path).- Returns:
The path of this document.
- RemoveDesignUnit(designUnit)[source]
Remove a design unit from the document.
The design unit is detached: its document is cleared. If the document is registered in a design (
Design.AddDocument()), the design unit leaves the document’s library too, and its parent is cleared. The design unit itself is unchanged and can be added to another document, or inserted at another position.- Parameters:
designUnit (
DesignUnit) – The design unit to remove.- Raises:
ValueError – If parameter ‘designUnit’ is
None.TypeError – If parameter ‘designUnit’ is not of type
DesignUnit.NotAChildError – If parameter ‘designUnit’ is not a design unit of this document.
- Return type:
See also
AddDesignUnit()→ Add a design unit at the end of the document.
InsertDesignUnit()→ Insert a design unit at a position of the document.
- 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 VHDLVersion: VHDLVersion
Read-only property to access the document’s VHDL version (
_vhdlVersion).- Returns:
VHDL version used to analyze this VHDL file.
- property VerificationModes: dict[str, VerificationMode]
Read-only property to access the dictionary of all verification mode declarations in this document (
_verificationModes).- Returns:
Dictionary of all verification mode declarations, indexed by normalized identifier.
- property VerificationProperties: dict[str, VerificationProperty]
Read-only property to access the dictionary of all verification property declarations in this document (
_verificationProperties).- Returns:
Dictionary of all verification properties, indexed by normalized identifier.
- property VerificationUnits: dict[str, VerificationUnit]
Read-only property to access the dictionary of all verification unit declarations in this document (
_verificationUnits).- Returns:
Dictionary of all verification units, indexed by normalized identifier.
- _AddArchitecture(item)[source]
Add an architecture to the document’s lists of design units.
- Parameters:
item (
Architecture) – Architecture object to be added to the document.- Raises:
TypeError – If parameter ‘item’ is not of type
Architecture.DuplicateDesignUnitError – If architecture name already exists for the referenced entity name in document.
- Return type:
- _AddConfiguration(item)[source]
Add a configuration to the document’s lists of design units.
- Parameters:
item (
Configuration) – Configuration object to be added to the document.- Raises:
TypeError – If parameter ‘item’ is not of type
Configuration.DuplicateDesignUnitError – If configuration name already exists in document.
- Return type:
- _AddDesignUnit(item)[source]
Add a design unit to the document’s lists of design units.
- Parameters:
item (
DesignUnit) – Design unit to be added to the document.- Raises:
TypeError – If parameter ‘item’ is not of type
DesignUnit.ValueError – If parameter ‘item’ is an unknown
DesignUnit.DuplicateDesignUnitError – If the document contains a design unit of the same kind and identifier.
- Return type:
- _AddPackageBody(item)[source]
Add a package body to the document’s lists of design units.
- Parameters:
item (
PackageBody) – Package body object to be added to the document.- Raises:
TypeError – If parameter ‘item’ is not of type
PackageBody.DuplicateDesignUnitError – If package body name already exists in document.
- Return type:
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()[source]
Formats a representation of the document.
Format:
Document: 'path/to/file.vhdl'- Return type:
- Returns:
String representation of the document.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats a representation of the document.
Format:
Document: 'path/to/file.vhdl'- Return type:
- Returns:
String representation of the document.
- _architectures: dict[str, dict[str, Architecture]]
Dictionary of all architectures defined in a document.
- _compileOrderVertex: Vertex
Reference to the vertex in the compile-order graph representing the document.
This reference is set byCreateCompileOrderGraph().
- _configurations: dict[str, Configuration]
Dictionary of all configurations defined in a document.
- _dependencyVertex: Vertex
Reference to the vertex in the dependency graph representing the document.
This reference is set byCreateCompileOrderGraph().
- _designUnits: list[DesignUnit]
List of all design units defined in a document.
- _packageBodies: dict[str, PackageBody]
Dictionary of all package bodies defined in a document.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- _verificationModes: dict[str, VerificationMode]
Dictionary of all PSL verification modes defined in a document.
- _verificationProperties: dict[str, VerificationProperty]
Dictionary of all PSL verification properties defined in a document.
- _verificationUnits: dict[str, VerificationUnit]
Dictionary of all PSL verification units defined in a document.
- _vhdlVersion: VHDLVersion
VHDL version used for analyzing this source file.
- _warnings: List
Warnings raised by
pyGHDL.domwhile this document is translated.
- __domTranslationDuration: Duration | None
Duration of the IIR to DOM translation,
Noneif it was skipped.
- __loadFromPath()
Reads the source file named by
_filenameand hands it to libghdl.- Raises:
DOMException – If the source file does not exist.
- __loadFromString(sourceCode)
Hands the given source code to libghdl under the name in
_filename.Hint
The source file itself is not read, which is how a document can be analyzed in-memory from a string.
- Parameters:
sourceCode (
str) – The source code to analyze.
- translate()[source]
Translates the design units of the parsed IIR tree to
pyGHDL.domobjects.- Raises:
DOMException – If a design unit’s kind is not handled.
UnhandledExceptionError – If a construct is not supported yet and no
WarningCollectoris active.
- property LibGHDLProcessingDuration: Duration | None
Read-only property to access the duration of libghdl’s parsing (
__ghdlProcessingDuration).The duration is measured while the document is constructed, so it is set only if
dontParsewasFalse.- Returns:
The parse duration, or
Noneif the document was constructed withdontParse=True.
- property DOMTranslationDuration: Duration | None
Read-only property to access the duration of the IIR to DOM translation (
__domTranslationDuration).The duration is measured while the document is constructed, so it is set only if neither
dontParsenordontTranslatewasTrue.- Returns:
The translation duration, or
Noneif the document was constructed withdontParse=TrueordontTranslate=True.