pyGHDL.dom.Literal
This module implements derived literal classes from pyVHDLModel.Expression.
Classes
NullLiteral: Represents anullliteral.EnumerationLiteral: Represents an enumeration literal.IntegerLiteral: Represents an integer literal.FloatingPointLiteral: Represents a floating-point literal.PhysicalIntegerLiteral: Represents a physical literal with an integer value.PhysicalFloatingLiteral: Represents a physical literal with a floating-point value.CharacterLiteral: Represents a character literal.BinaryBitStringLiteral: Represents a bit string literal written in base 2.OctalBitStringLiteral: Represents a bit string literal written in base 8.DecimalBitStringLiteral: Represents a bit string literal written in base 10.HexadecimalBitStringLiteral: Represents a bit string literal written in base 16.StringLiteral: Represents a string literal.
Classes
- class pyGHDL.dom.Literal.NullLiteral(node)[source]
Represents a
nullliteral.A null literal denotes the null value of an access type.
Example
p := null; -- ^^^^ <- the literal
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.NullLiteral.Inheritance
- Parameters:
node (Iir)
- classmethod parse(node)[source]
Translates an IIR node to a
NullLiteral.
- _position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
The IIR node’s position in the source file, resolved on first access and then cached.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
- Parameters:
predicate (
TypeVar(TAttr) |Iterable[TypeVar(TAttr)] |None) – An attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- __str__()[source]
Formats the null literal.
Format:
null- Return type:
- Returns:
Formatted null literal.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Literal.EnumerationLiteral(node, value)[source]
Represents an enumeration literal.
The literal’s name is available as
Value.Example
st <= Idle; -- ^^^^ <- Value
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.EnumerationLiteral.Inheritance
- classmethod parse(literalNode)[source]
Translates the IIR node of the literal to an
EnumerationLiteral.
- _position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
The IIR node’s position in the source file, resolved on first access and then cached.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
- Parameters:
predicate (
TypeVar(TAttr) |Iterable[TypeVar(TAttr)] |None) – An attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- __str__()[source]
Formats the enumeration literal.
Format:
idle- Return type:
- Returns:
Formatted enumeration literal.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Literal.IntegerLiteral(node, value)[source]
Represents an integer literal.
The literal’s value is available as
Value.Example
res := a + 42; -- ^^ <- Value
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.IntegerLiteral.Inheritance
- classmethod parse(literalNode)[source]
Translates the IIR node of the literal to an
IntegerLiteral.
- _position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
The IIR node’s position in the source file, resolved on first access and then cached.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
- Parameters:
predicate (
TypeVar(TAttr) |Iterable[TypeVar(TAttr)] |None) – An attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- __str__()[source]
Formats the integer literal.
Format:
42- Return type:
- Returns:
Formatted integer literal.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Literal.FloatingPointLiteral(node, value)[source]
Represents a floating-point literal.
The literal’s value is available as
Value.Example
r <= 3.14; -- ^^^^ <- Value
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.FloatingPointLiteral.Inheritance
- classmethod parse(literalNode)[source]
Translates the IIR node of the literal to a
FloatingPointLiteral.
- _position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
The IIR node’s position in the source file, resolved on first access and then cached.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
- Parameters:
predicate (
TypeVar(TAttr) |Iterable[TypeVar(TAttr)] |None) – An attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- __str__()[source]
Formats the floating-point literal.
Format:
3.5- Return type:
- Returns:
Formatted floating-point literal.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Literal.PhysicalIntegerLiteral(node, value, unitName)[source]
Represents a physical literal with an integer value.
Value (
Value) and unit name (UnitName) are available separately.Example
t <= 10 ns; -- ^^ <- Value -- ^^ <- UnitName
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.PhysicalIntegerLiteral.Inheritance
- classmethod parse(literalNode)[source]
Translates the IIR node of the literal to a
PhysicalIntegerLiteral.
- _position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
The IIR node’s position in the source file, resolved on first access and then cached.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
- Parameters:
predicate (
TypeVar(TAttr) |Iterable[TypeVar(TAttr)] |None) – An attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- property UnitName: str
Read-only property to access the unit name (
_unitName).- Returns:
The unit name.
- __str__()
Formats the physical literal.
Format:
10 ns- Return type:
- Returns:
Formatted physical literal.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Literal.PhysicalFloatingLiteral(node, value, unitName)[source]
Represents a physical literal with a floating-point value.
Value (
Value) and unit name (UnitName) are available separately.Example
t <= 1.5 ns; -- ^^^ <- Value -- ^^ <- UnitName
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.PhysicalFloatingLiteral.Inheritance
- __init__(node, value, unitName)[source]
Initializes a physical literal with a floating-point value.
- classmethod parse(literalNode)[source]
Translates the IIR node of the literal to a
PhysicalFloatingLiteral.
- _position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
The IIR node’s position in the source file, resolved on first access and then cached.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
- Parameters:
predicate (
TypeVar(TAttr) |Iterable[TypeVar(TAttr)] |None) – An attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- property UnitName: str
Read-only property to access the unit name (
_unitName).- Returns:
The unit name.
- __str__()
Formats the physical literal.
Format:
10 ns- Return type:
- Returns:
Formatted physical literal.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Literal.CharacterLiteral(node, value)[source]
Represents a character literal.
The literal’s character is available as
Value.Example
ch <= 'a'; -- ^^^ <- Value
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.CharacterLiteral.Inheritance
- classmethod parse(literalNode)[source]
Translates the IIR node of the literal to a
CharacterLiteral.
- _position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
The IIR node’s position in the source file, resolved on first access and then cached.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
- Parameters:
predicate (
TypeVar(TAttr) |Iterable[TypeVar(TAttr)] |None) – An attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- __str__()[source]
Formats the character literal.
Format:
a- Return type:
- Returns:
Formatted character literal.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Literal.BinaryBitStringLiteral(node, value, length=None, isSigned=None)[source]
Represents a bit string literal written in base 2.
Example
res := b"10100000"; -- ^^^^^^^^^^^ <- Value
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.BinaryBitStringLiteral.Inheritance
- __init__(node, value, length=None, isSigned=None)[source]
Initializes a binary bit string literal.
- Parameters:
node (
TypeVar(Iir, bound=c_int)) – The IIR node this object was translated from.value (
str) – The literal as written in the source, without the enclosing double quotes.length (
int|None) – The explicitly given length, orNoneif the literal has no length specification.isSigned (
bool|None) –Trueif signed,Falseif unsigned,Noneif unspecified.
- Return type:
None
- _position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
The IIR node’s position in the source file, resolved on first access and then cached.
- property BinaryValue: str
Read-only property to access the binary value (
_binaryValue).- Returns:
The binary value.
- property Bits: int | None
Read-only property to access the bits (
_bits).- Returns:
The bits, or
Noneif not set.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
- Parameters:
predicate (
TypeVar(TAttr) |Iterable[TypeVar(TAttr)] |None) – An attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property IsSigned: bool | None
Check if the bit string literal is signed (
_isSigned).- Returns:
True, if the literal is signed;None, if unspecified.
- property Length: int | None
Read-only property to access the length (
_length).- Returns:
The length, or
Noneif not set.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- __str__()
Formats the bit string literal.
Format:
8ub"10100000"The length and the signedness marker (
s/u) are omitted when unspecified.- Return type:
- Returns:
Formatted bit string literal.
- _base: ClassVar[BitStringBase] = 2
The base this literal is written in.
- _length: int | None
The explicitly given length, or
Noneif the literal has no length specification.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Literal.OctalBitStringLiteral(node, value, length=None, isSigned=None)[source]
Represents a bit string literal written in base 8.
Each digit contributes three bits.
Example
nine := o"240"; -- ^^^^^^ <- Value
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.OctalBitStringLiteral.Inheritance
- __init__(node, value, length=None, isSigned=None)[source]
Initializes an octal bit string literal.
- Parameters:
node (
TypeVar(Iir, bound=c_int)) – The IIR node this object was translated from.value (
str) – The literal as written in the source, without the enclosing double quotes.length (
int|None) – The explicitly given length, orNoneif the literal has no length specification.isSigned (
bool|None) –Trueif signed,Falseif unsigned,Noneif unspecified.
- Return type:
None
- _position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
The IIR node’s position in the source file, resolved on first access and then cached.
- property BinaryValue: str
Read-only property to access the binary value (
_binaryValue).- Returns:
The binary value.
- property Bits: int | None
Read-only property to access the bits (
_bits).- Returns:
The bits, or
Noneif not set.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
- Parameters:
predicate (
TypeVar(TAttr) |Iterable[TypeVar(TAttr)] |None) – An attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property IsSigned: bool | None
Check if the bit string literal is signed (
_isSigned).- Returns:
True, if the literal is signed;None, if unspecified.
- property Length: int | None
Read-only property to access the length (
_length).- Returns:
The length, or
Noneif not set.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- __str__()
Formats the bit string literal.
Format:
8ub"10100000"The length and the signedness marker (
s/u) are omitted when unspecified.- Return type:
- Returns:
Formatted bit string literal.
- _base: ClassVar[BitStringBase] = 8
The base this literal is written in.
- _length: int | None
The explicitly given length, or
Noneif the literal has no length specification.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Literal.DecimalBitStringLiteral(node, value, length=None, isSigned=None)[source]
Represents a bit string literal written in base 10.
Example
res := d"160"; -- ^^^^^^ <- Value
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.DecimalBitStringLiteral.Inheritance
- __init__(node, value, length=None, isSigned=None)[source]
Initializes a decimal bit string literal.
- Parameters:
node (
TypeVar(Iir, bound=c_int)) – The IIR node this object was translated from.value (
str) – The literal as written in the source, without the enclosing double quotes.length (
int|None) – The explicitly given length, orNoneif the literal has no length specification.isSigned (
bool|None) –Trueif signed,Falseif unsigned,Noneif unspecified.
- Return type:
None
- _position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
The IIR node’s position in the source file, resolved on first access and then cached.
- property BinaryValue: str
Read-only property to access the binary value (
_binaryValue).- Returns:
The binary value.
- property Bits: int | None
Read-only property to access the bits (
_bits).- Returns:
The bits, or
Noneif not set.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
- Parameters:
predicate (
TypeVar(TAttr) |Iterable[TypeVar(TAttr)] |None) – An attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property IsSigned: bool | None
Check if the bit string literal is signed (
_isSigned).- Returns:
True, if the literal is signed;None, if unspecified.
- property Length: int | None
Read-only property to access the length (
_length).- Returns:
The length, or
Noneif not set.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- __str__()
Formats the bit string literal.
Format:
8ub"10100000"The length and the signedness marker (
s/u) are omitted when unspecified.- Return type:
- Returns:
Formatted bit string literal.
- _base: ClassVar[BitStringBase] = 10
The base this literal is written in.
- _length: int | None
The explicitly given length, or
Noneif the literal has no length specification.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Literal.HexadecimalBitStringLiteral(node, value, length=None, isSigned=None)[source]
Represents a bit string literal written in base 16.
Each digit contributes four bits.
Example
res := x"A0"; -- ^^^^^ <- Value
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.HexadecimalBitStringLiteral.Inheritance
- __init__(node, value, length=None, isSigned=None)[source]
Initializes a hexadecimal bit string literal.
- Parameters:
node (
TypeVar(Iir, bound=c_int)) – The IIR node this object was translated from.value (
str) – The literal as written in the source, without the enclosing double quotes.length (
int|None) – The explicitly given length, orNoneif the literal has no length specification.isSigned (
bool|None) –Trueif signed,Falseif unsigned,Noneif unspecified.
- Return type:
None
- _position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
The IIR node’s position in the source file, resolved on first access and then cached.
- property BinaryValue: str
Read-only property to access the binary value (
_binaryValue).- Returns:
The binary value.
- property Bits: int | None
Read-only property to access the bits (
_bits).- Returns:
The bits, or
Noneif not set.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
- Parameters:
predicate (
TypeVar(TAttr) |Iterable[TypeVar(TAttr)] |None) – An attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property IsSigned: bool | None
Check if the bit string literal is signed (
_isSigned).- Returns:
True, if the literal is signed;None, if unspecified.
- property Length: int | None
Read-only property to access the length (
_length).- Returns:
The length, or
Noneif not set.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- __str__()
Formats the bit string literal.
Format:
8ub"10100000"The length and the signedness marker (
s/u) are omitted when unspecified.- Return type:
- Returns:
Formatted bit string literal.
- _base: ClassVar[BitStringBase] = 16
The base this literal is written in.
- _length: int | None
The explicitly given length, or
Noneif the literal has no length specification.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Literal.StringLiteral(node, value)[source]
Represents a string literal.
The literal’s text is available as
Value.Example
txt <= "text"; -- ^^^^^^ <- Value
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Expression.StringLiteral.Inheritance
- classmethod parse(literalNode)[source]
Translates the IIR node of the literal to a
StringLiteral.- Parameters:
literalNode (
TypeVar(Iir, bound=c_int)) – The IIR node of the literal.- Return type:
StringLiteral|BinaryBitStringLiteral|OctalBitStringLiteral|DecimalBitStringLiteral|HexadecimalBitStringLiteral- Returns:
The translated literal.
- _position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
The IIR node’s position in the source file, resolved on first access and then cached.
- GetAncestor(type)
Return the closest ancestor of the given
typefound by walking the parent chain upwards.Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.
- Parameters:
type (
Type) – Class (type) of the ancestor to find.- Return type:
- Returns:
The closest ancestor of the requested type.
- Raises:
VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
- Parameters:
predicate (
TypeVar(TAttr) |Iterable[TypeVar(TAttr)] |None) – An attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- property Parent: ModelEntity
Property to access the model entity’s parent element reference in a logical hierarchy (
_parent).- Returns:
Reference to the parent entity.
- property Position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- __str__()[source]
Formats the string literal.
Format:
"hello"- Return type:
- Returns:
Formatted string literal.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.