pyGHDL.dom.Name
This module implements derived name classes from pyVHDLModel.Name.
Classes
SimpleName: Represents a single name (identifier) to a language entity.ParenthesisName: Represents a parenthesis (index access or function call) following a name.IndexedName: This class implements apyGHDL.domobject derived frompyVHDLModel.Name.IndexedName.SlicedName: Represents a slice following a name.SelectedName: Represents a name following a name in dot-notation.AttributeName: Represents a name following a name in tick-notation.AllName: Represents a keyword all following a name in dot-notation.OpenName: Represents the keyword open used as a special name.
Classes
- class pyGHDL.dom.Name.SimpleName(node, identifier)[source]
Represents a single name (identifier) to a language entity.
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Name.SimpleName.Example
ieeeInheritance
- _position: Position
The IIR node’s position in the source file, resolved on first access and then cached.
- Copy()
Create a copy of this name.
The copy has no parent. Its prefix, if any, is a copy of this name’s prefix.
- Return type:
- Returns:
The new name.
- Denote(region, place, symbol)[source]
Determine the model entity this simple name denotes as a part of a type mark, which is an attribute name.
The type mark is an attribute name like
s'subtype. The logical name of a library visible in the design unit containing the place (workor a library clause,IsLibraryVisible()) denotes the library; the dependency analysis (LinkLibraryReferences()) ensured it exists in the design. Otherwise, the name is looked up at the place (LookupName()) and the declaration says what it denotes (DenoteBy()).- Parameters:
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:
The denoted model entity, or
Noneif it can’t be resolved (reported as a warning).- Raises:
UnhandledCriticalWarningError – If the name isn’t visible, is ambiguous, or denotes neither an object, a type nor a package, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HasPrefix: bool
Check if the name has a prefix, i.e.
_prefixis set.This is true for all names except
simple names.- Returns:
True, if the name has a prefix.
- property Identifier: str
Read-only property to access the identifier this name references (
_identifier).- Returns:
The referenced identifier.
- property IsExpandedName: bool
Check if the name is an expanded name
library.package.item.A selected name
x.ymay also select an element of a record object, so only a selected name, whose prefix is a selected name of a simple name, is an expanded name here. Selected names override this property.- Returns:
True, if the name is an expanded namelibrary.package.item.
- property IsOperatorSymbol: bool
Check if the name is an operator symbol (
_identifierin quotation marks).An operator symbol names an operator function, e.g.
"and"in an alias declaration.- Returns:
True, if the name is an operator symbol.
- 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 normalized identifier this name references (
_normalizedIdentifier).See also
- Returns:
The referenced identifier (normalized).
- 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 Prefix: Name | None
Read-only property to access the name’s prefix in a chain of names (
_prefix).- Returns:
The name left from current name, if not a simple name, otherwise
None.
- 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 Root: Name
Read-only property to access the root (left-most) element in a chain of names (
_root).In case the name is a
simple name, the root points to the name itself.- Returns:
The name’s root element.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the name.
Format:
Name: 'sig'- Return type:
- Returns:
String representation of the name.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Name.ParenthesisName(node, prefix, associations)[source]
Represents a parenthesis (index access or function call) following a name.
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Name.ParenthesisName.Example
arr(0) -- ^^^
Inheritance
- Parameters:
node (Iir)
prefix (VHDLModel_Name)
associations (List)
- __init__(node, prefix, associations)[source]
Initializes a name followed by a parenthesized association list.
- _position: Position
The IIR node’s position in the source file, resolved on first access and then cached.
- property Associations: list
Read-only property to access the associations (
_associations).- Returns:
List of associations.
- Copy()[source]
Create a copy of this parenthesis name.
The copy has no parent. Its prefix and associations are copies of this name’s prefix and associations.
- Return type:
- Returns:
The new parenthesis name.
- Denote(region, place, symbol)
Determine the model entity this name denotes as a part of a type mark, which is an attribute name.
The type mark is an attribute name like
rec.f'subtype. A name resolves its prefix first and applies itself to the entity the prefix denotes, which must be of a kind the name can be applied to. A kind of name, which denotes no declaration (e.g. an indexed namem(0)orptr.all), isn’t supported and is reported.- Parameters:
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:
The denoted model entity, or
Noneif it can’t be resolved (reported as a warning).- Raises:
UnhandledCriticalWarningError – If this kind of name isn’t supported as a part of a type mark, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HasPrefix: bool
Check if the name has a prefix, i.e.
_prefixis set.This is true for all names except
simple names.- Returns:
True, if the name has a prefix.
- property Identifier: str
Read-only property to access the identifier this name references (
_identifier).- Returns:
The referenced identifier.
- property IsExpandedName: bool
Check if the name is an expanded name
library.package.item.A selected name
x.ymay also select an element of a record object, so only a selected name, whose prefix is a selected name of a simple name, is an expanded name here. Selected names override this property.- Returns:
True, if the name is an expanded namelibrary.package.item.
- property IsOperatorSymbol: bool
Check if the name is an operator symbol (
_identifierin quotation marks).An operator symbol names an operator function, e.g.
"and"in an alias declaration.- Returns:
True, if the name is an operator symbol.
- 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 normalized identifier this name references (
_normalizedIdentifier).See also
- Returns:
The referenced identifier (normalized).
- 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 Prefix: Name | None
Read-only property to access the name’s prefix in a chain of names (
_prefix).- Returns:
The name left from current name, if not a simple name, otherwise
None.
- 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 Root: Name
Read-only property to access the root (left-most) element in a chain of names (
_root).In case the name is a
simple name, the root points to the name itself.- Returns:
The name’s root element.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the name.
Format:
Name: 'sig'- Return type:
- Returns:
String representation of the name.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()[source]
Formats the parenthesis name.
Format:
func(a, b)- Return type:
- Returns:
Formatted parenthesis name.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Name.IndexedName(node, identifier)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Name.IndexedName.Represents a name indexing an array by one or more values.
Example
s <= v(0); -- ^^^^ <- the indexed name
Inheritance
- _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.
- Copy()[source]
Create a copy of this indexed name.
The copy has no parent. Its prefix and indices are copies of this name’s prefix and indices.
- Return type:
- Returns:
The new indexed name.
- Denote(region, place, symbol)
Determine the model entity this name denotes as a part of a type mark, which is an attribute name.
The type mark is an attribute name like
rec.f'subtype. A name resolves its prefix first and applies itself to the entity the prefix denotes, which must be of a kind the name can be applied to. A kind of name, which denotes no declaration (e.g. an indexed namem(0)orptr.all), isn’t supported and is reported.- Parameters:
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:
The denoted model entity, or
Noneif it can’t be resolved (reported as a warning).- Raises:
UnhandledCriticalWarningError – If this kind of name isn’t supported as a part of a type mark, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HasPrefix: bool
Check if the name has a prefix, i.e.
_prefixis set.This is true for all names except
simple names.- Returns:
True, if the name has a prefix.
- property Identifier: str
Read-only property to access the identifier this name references (
_identifier).- Returns:
The referenced identifier.
- property Indices: list[BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal]
Read-only property to access the indices (
_indices).- Returns:
List of indices.
- property IsExpandedName: bool
Check if the name is an expanded name
library.package.item.A selected name
x.ymay also select an element of a record object, so only a selected name, whose prefix is a selected name of a simple name, is an expanded name here. Selected names override this property.- Returns:
True, if the name is an expanded namelibrary.package.item.
- property IsOperatorSymbol: bool
Check if the name is an operator symbol (
_identifierin quotation marks).An operator symbol names an operator function, e.g.
"and"in an alias declaration.- Returns:
True, if the name is an operator symbol.
- 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 normalized identifier this name references (
_normalizedIdentifier).See also
- Returns:
The referenced identifier (normalized).
- 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 Prefix: Name | None
Read-only property to access the name’s prefix in a chain of names (
_prefix).- Returns:
The name left from current name, if not a simple name, otherwise
None.
- 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 Root: Name
Read-only property to access the root (left-most) element in a chain of names (
_root).In case the name is a
simple name, the root points to the name itself.- Returns:
The name’s root element.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the name.
Format:
Name: 'sig'- Return type:
- Returns:
String representation of the name.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()[source]
Formats the indexed name.
Format:
arr(0)- Return type:
- Returns:
Formatted indexed name.
- _identifier
The name’s identifier.
- _normalizedIdentifier
The normalized (lower case) identifier.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _prefix
Reference to the name’s prefix, or
Nonefor a simple name.
- _root
Reference to the root of the name chain.
- class pyGHDL.dom.Name.SlicedName(node, identifier)[source]
Represents a slice following a name.
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Name.SlicedName.Example
arr(7 downto 0) -- ^^^^^^^^^^^^
Inheritance
- _position: Position
The IIR node’s position in the source file, resolved on first access and then cached.
- Copy()
Create a copy of this name.
The copy has no parent. Its prefix, if any, is a copy of this name’s prefix.
- Return type:
- Returns:
The new name.
- Denote(region, place, symbol)
Determine the model entity this name denotes as a part of a type mark, which is an attribute name.
The type mark is an attribute name like
rec.f'subtype. A name resolves its prefix first and applies itself to the entity the prefix denotes, which must be of a kind the name can be applied to. A kind of name, which denotes no declaration (e.g. an indexed namem(0)orptr.all), isn’t supported and is reported.- Parameters:
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:
The denoted model entity, or
Noneif it can’t be resolved (reported as a warning).- Raises:
UnhandledCriticalWarningError – If this kind of name isn’t supported as a part of a type mark, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HasPrefix: bool
Check if the name has a prefix, i.e.
_prefixis set.This is true for all names except
simple names.- Returns:
True, if the name has a prefix.
- property Identifier: str
Read-only property to access the identifier this name references (
_identifier).- Returns:
The referenced identifier.
- property IsExpandedName: bool
Check if the name is an expanded name
library.package.item.A selected name
x.ymay also select an element of a record object, so only a selected name, whose prefix is a selected name of a simple name, is an expanded name here. Selected names override this property.- Returns:
True, if the name is an expanded namelibrary.package.item.
- property IsOperatorSymbol: bool
Check if the name is an operator symbol (
_identifierin quotation marks).An operator symbol names an operator function, e.g.
"and"in an alias declaration.- Returns:
True, if the name is an operator symbol.
- 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 normalized identifier this name references (
_normalizedIdentifier).See also
- Returns:
The referenced identifier (normalized).
- 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 Prefix: Name | None
Read-only property to access the name’s prefix in a chain of names (
_prefix).- Returns:
The name left from current name, if not a simple name, otherwise
None.
- 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 Root: Name
Read-only property to access the root (left-most) element in a chain of names (
_root).In case the name is a
simple name, the root points to the name itself.- Returns:
The name’s root element.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the name.
Format:
Name: 'sig'- Return type:
- Returns:
String representation of the name.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Name.SelectedName(node, identifier, prefix)[source]
Represents a name following a name in dot-notation.
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Name.SelectedName.Example
rec.elem -- ^^^^^
Inheritance
- _position: Position
The IIR node’s position in the source file, resolved on first access and then cached.
- Copy()[source]
Create a copy of this selected name.
The copy has no parent. Its prefix is a copy of this name’s prefix.
- Return type:
- Returns:
The new selected name.
- Denote(region, place, symbol)[source]
Determine the model entity this selected name denotes as a part of a type mark, which is an attribute name.
The type mark is an attribute name like
p.c'subtypeorrec.f'subtype. Depending on the entity the prefix denotes, this name denotes:a library: the package of this name in the library.
a package: the declaration of this name in the package (
FindDeclarations()); the declaration says what it denotes (DenoteBy()).an object of a record type: the record element of this name (
ElementsByIdentifier).
- Parameters:
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:
The denoted model entity, or
Noneif it can’t be resolved (reported as a warning).- Raises:
UnhandledCriticalWarningError – If the library has no package of this name, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.UnhandledCriticalWarningError – If the package declares nothing of this name, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.UnhandledCriticalWarningError – If the prefix isn’t an object of a record type with an element of this name, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HasPrefix: bool
Check if the name has a prefix, i.e.
_prefixis set.This is true for all names except
simple names.- Returns:
True, if the name has a prefix.
- property Identifier: str
Read-only property to access the identifier this name references (
_identifier).- Returns:
The referenced identifier.
- property IsExpandedName: bool
Check if the name is an expanded name
library.package.item: its prefix is a selected name of a simple name.- Returns:
True, if the name is an expanded namelibrary.package.item.
- property IsOperatorSymbol: bool
Check if the name is an operator symbol (
_identifierin quotation marks).An operator symbol names an operator function, e.g.
"and"in an alias declaration.- Returns:
True, if the name is an operator symbol.
- 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 normalized identifier this name references (
_normalizedIdentifier).See also
- Returns:
The referenced identifier (normalized).
- 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 Prefix: Name | None
Read-only property to access the name’s prefix in a chain of names (
_prefix).- Returns:
The name left from current name, if not a simple name, otherwise
None.
- 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 Root: Name
Read-only property to access the root (left-most) element in a chain of names (
_root).In case the name is a
simple name, the root points to the name itself.- Returns:
The name’s root element.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the name.
Format:
Name: 'sig'- Return type:
- Returns:
String representation of the name.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()[source]
Formats the selected name.
Format:
rec.elem- Return type:
- Returns:
Formatted selected name.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Name.AttributeName(node, identifier, prefix)[source]
Represents a name following a name in tick-notation.
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Name.AttributeName.Example
arr'length -- ^^^^^^^
Inheritance
- __init__(node, identifier, prefix)[source]
Initializes a name selecting an attribute of its prefix.
- _position: Position
The IIR node’s position in the source file, resolved on first access and then cached.
- Copy()[source]
Create a copy of this attribute name.
The copy has no parent. Its prefix is a copy of this name’s prefix.
- Return type:
- Returns:
The new attribute name.
- Denote(region, place, symbol)[source]
Determine the type or subtype this attribute name denotes as a type mark or as a part of one (IEEE Std 1076-2008, 16.2).
Depending on the predefined attribute (
PredefinedAttribute), this name denotes:'subtype: the subtype of the object its prefix denotes.'element: the element subtype of the array type or subtype, or of the array object, its prefix denotes.'base: the base type of the type or subtype its prefix denotes; only allowed as the prefix of another attribute.
An object is an object declaration, a record element or an object alias (an alias with a subtype indication); a type is a type or subtype declaration. The constraint of a subtype indication isn’t represented:
s'subtypeofsignal s : bit_vector(3 downto 0)denotesbit_vector.- Parameters:
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:
The denoted type or subtype, or
Noneif it can’t be resolved (reported as a warning).- Raises:
UnhandledCriticalWarningError – If the prefix of
'subtypeisn’t an object, or the object’s subtype isn’t resolved, and noWarningCollectorcollects theUnresolvedTypeMarkWarning.UnhandledCriticalWarningError – If the prefix of
'elementisn’t an array, or the array’s element type isn’t resolved, and noWarningCollectorcollects theUnresolvedTypeMarkWarning.UnhandledCriticalWarningError – If
'baseis the type mark itself, or its prefix isn’t a type, or its base type isn’t resolved, and noWarningCollectorcollects theUnresolvedTypeMarkWarning.UnhandledCriticalWarningError – If the attribute denotes no type, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HasPrefix: bool
Check if the name has a prefix, i.e.
_prefixis set.This is true for all names except
simple names.- Returns:
True, if the name has a prefix.
- property Identifier: str
Read-only property to access the identifier this name references (
_identifier).- Returns:
The referenced identifier.
- property IsExpandedName: bool
Check if the name is an expanded name
library.package.item.A selected name
x.ymay also select an element of a record object, so only a selected name, whose prefix is a selected name of a simple name, is an expanded name here. Selected names override this property.- Returns:
True, if the name is an expanded namelibrary.package.item.
- property IsOperatorSymbol: bool
Check if the name is an operator symbol (
_identifierin quotation marks).An operator symbol names an operator function, e.g.
"and"in an alias declaration.- Returns:
True, if the name is an operator symbol.
- 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 normalized identifier this name references (
_normalizedIdentifier).See also
- Returns:
The referenced identifier (normalized).
- 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 PredefinedAttribute: PredefinedAttribute | None
Read-only property to access the predefined attribute this name selects (
_predefinedAttribute).- Returns:
The predefined attribute, or
Nonefor a user-defined attribute.
- property Prefix: Name | None
Read-only property to access the name’s prefix in a chain of names (
_prefix).- Returns:
The name left from current name, if not a simple name, otherwise
None.
- 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 Root: Name
Read-only property to access the root (left-most) element in a chain of names (
_root).In case the name is a
simple name, the root points to the name itself.- Returns:
The name’s root element.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the name.
Format:
Name: 'sig'- Return type:
- Returns:
String representation of the name.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()[source]
Formats the attribute name.
Format:
v'range- Return type:
- Returns:
Formatted attribute name.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- _predefinedAttribute: PredefinedAttribute | None
The predefined attribute, or
Noneif user-defined.
- class pyGHDL.dom.Name.AllName(node, prefix)[source]
Represents a keyword all following a name in dot-notation.
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Name.AllName.Example
ptr.all -- ^^^^
Inheritance
- Parameters:
node (Iir)
prefix (VHDLModel_Name)
- _position: Position
The IIR node’s position in the source file, resolved on first access and then cached.
- Copy()[source]
Create a copy of this
allname.The copy has no parent. Its prefix is a copy of this name’s prefix.
- Return type:
- Returns:
The new
allname.
- Denote(region, place, symbol)[source]
Report an
allname as a part of a type mark as unsupported.The type mark is an attribute name like
ptr.all'subtype:ptr.alldenotes the object an access value designates, which has no declaration.- Parameters:
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 the name isn’t supported (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HasPrefix: bool
Check if the name has a prefix, i.e.
_prefixis set.This is true for all names except
simple names.- Returns:
True, if the name has a prefix.
- property Identifier: str
Read-only property to access the identifier this name references (
_identifier).- Returns:
The referenced identifier.
- property IsExpandedName: bool
Check if the name is an expanded name
library.package.item: a name ending inallisn’t one.- Returns:
False
- property IsOperatorSymbol: bool
Check if the name is an operator symbol (
_identifierin quotation marks).An operator symbol names an operator function, e.g.
"and"in an alias declaration.- Returns:
True, if the name is an operator symbol.
- 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 normalized identifier this name references (
_normalizedIdentifier).See also
- Returns:
The referenced identifier (normalized).
- 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 Prefix: Name | None
Read-only property to access the name’s prefix in a chain of names (
_prefix).- Returns:
The name left from current name, if not a simple name, otherwise
None.
- 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 Root: Name
Read-only property to access the root (left-most) element in a chain of names (
_root).In case the name is a
simple name, the root points to the name itself.- Returns:
The name’s root element.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the name.
Format:
Name: 'sig'- Return type:
- Returns:
String representation of the name.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()
Formats the selected name.
Format:
rec.elem- Return type:
- Returns:
Formatted selected name.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Name.OpenName(node)[source]
Represents the keyword open used as a special name.
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Name.OpenName.Example
openInheritance
- Parameters:
node (Iir)
- __init__(node)[source]
Initializes an open name.
- Parameters:
node (
Iir) – The IIR node this object was translated from.- Return type:
None
- _position: Position
The IIR node’s position in the source file, resolved on first access and then cached.
- Copy()[source]
Create a copy of this
openname.The copy has no parent.
- Return type:
- Returns:
The new
openname.
- Denote(region, place, symbol)
Determine the model entity this name denotes as a part of a type mark, which is an attribute name.
The type mark is an attribute name like
rec.f'subtype. A name resolves its prefix first and applies itself to the entity the prefix denotes, which must be of a kind the name can be applied to. A kind of name, which denotes no declaration (e.g. an indexed namem(0)orptr.all), isn’t supported and is reported.- Parameters:
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:
The denoted model entity, or
Noneif it can’t be resolved (reported as a warning).- Raises:
UnhandledCriticalWarningError – If this kind of name isn’t supported as a part of a type mark, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property HasPrefix: bool
Check if the name has a prefix, i.e.
_prefixis set.This is true for all names except
simple names.- Returns:
True, if the name has a prefix.
- property Identifier: str
Read-only property to access the identifier this name references (
_identifier).- Returns:
The referenced identifier.
- property IsExpandedName: bool
Check if the name is an expanded name
library.package.item.A selected name
x.ymay also select an element of a record object, so only a selected name, whose prefix is a selected name of a simple name, is an expanded name here. Selected names override this property.- Returns:
True, if the name is an expanded namelibrary.package.item.
- property IsOperatorSymbol: bool
Check if the name is an operator symbol (
_identifierin quotation marks).An operator symbol names an operator function, e.g.
"and"in an alias declaration.- Returns:
True, if the name is an operator symbol.
- 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 normalized identifier this name references (
_normalizedIdentifier).See also
- Returns:
The referenced identifier (normalized).
- 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 Prefix: Name | None
Read-only property to access the name’s prefix in a chain of names (
_prefix).- Returns:
The name left from current name, if not a simple name, otherwise
None.
- 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 Root: Name
Read-only property to access the root (left-most) element in a chain of names (
_root).In case the name is a
simple name, the root points to the name itself.- Returns:
The name’s root element.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __repr__()
Formats a representation of the name.
Format:
Name: 'sig'- Return type:
- Returns:
String representation of the name.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.