pyGHDL.dom.Literal

This module implements derived literal classes from pyVHDLModel.Expression.

Classes


Classes

class pyGHDL.dom.Literal.NullLiteral(node)[source]

Represents a null literal.

A null literal denotes the null value of an access type.

Example

p := null;
--   ^^^^    <- the literal

This class implements a pyGHDL.dom object derived from pyVHDLModel.Expression.NullLiteral.

Inheritance

Inheritance diagram of NullLiteral

Parameters:

node (Iir)

__init__(node)[source]

Initializes a null literal.

Parameters:

node (TypeVar(Iir, bound= c_int)) – The IIR node this object was translated from.

Return type:

None

classmethod parse(node)[source]

Translates an IIR node to a NullLiteral.

Parameters:

node (TypeVar(Iir, bound= c_int)) – The IIR node this object is translated from.

Return type:

NullLiteral

Returns:

The translated object.

_iirNode: Iir

The IIR node in libghdl’s tree this DOM object was translated from.

_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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

Dict[Callable, Tuple[Attribute, ...]]

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 _position is None, resolve the position object from _iirNode

Returns:

The IIR’s position in the source file.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

__str__()[source]

Formats the null literal.

Format: null

Return type:

str

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.dom object derived from pyVHDLModel.Expression.EnumerationLiteral.

Inheritance

Inheritance diagram of EnumerationLiteral

Parameters:
__init__(node, value)[source]

Initializes an enumeration literal.

Parameters:
  • node (TypeVar(Iir, bound= c_int)) – The IIR node this object was translated from.

  • value (str) – The enumeration literal’s name.

Return type:

None

classmethod parse(literalNode)[source]

Translates the IIR node of the literal to an EnumerationLiteral.

Parameters:

literalNode (TypeVar(Iir, bound= c_int)) – The IIR node of the literal.

Return type:

EnumerationLiteral

Returns:

The translated literal.

_iirNode: Iir

The IIR node in libghdl’s tree this DOM object was translated from.

_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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

Dict[Callable, Tuple[Attribute, ...]]

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 _position is None, resolve the position object from _iirNode

Returns:

The IIR’s position in the source file.

property Value: str

Read-only property to access the value (_value).

Returns:

The value.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

__str__()[source]

Formats the enumeration literal.

Format: idle

Return type:

str

Returns:

Formatted enumeration literal.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_value: str

The enumeration literal’s name.

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.dom object derived from pyVHDLModel.Expression.IntegerLiteral.

Inheritance

Inheritance diagram of IntegerLiteral

Parameters:
__init__(node, value)[source]

Initializes an integer literal.

Parameters:
  • node (TypeVar(Iir, bound= c_int)) – The IIR node this object was translated from.

  • value (int) – The literal’s integer value.

Return type:

None

classmethod parse(literalNode)[source]

Translates the IIR node of the literal to an IntegerLiteral.

Parameters:

literalNode (TypeVar(Iir, bound= c_int)) – The IIR node of the literal.

Return type:

IntegerLiteral

Returns:

The translated literal.

_iirNode: Iir

The IIR node in libghdl’s tree this DOM object was translated from.

_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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

Dict[Callable, Tuple[Attribute, ...]]

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 _position is None, resolve the position object from _iirNode

Returns:

The IIR’s position in the source file.

property Value: int

Read-only property to access the value (_value).

Returns:

The value.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

__str__()[source]

Formats the integer literal.

Format: 42

Return type:

str

Returns:

Formatted integer literal.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_value: int

The literal’s integer value.

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.dom object derived from pyVHDLModel.Expression.FloatingPointLiteral.

Inheritance

Inheritance diagram of FloatingPointLiteral

Parameters:
__init__(node, value)[source]

Initializes a floating-point literal.

Parameters:
  • node (TypeVar(Iir, bound= c_int)) – The IIR node this object was translated from.

  • value (float) – The literal’s floating-point value.

Return type:

None

classmethod parse(literalNode)[source]

Translates the IIR node of the literal to a FloatingPointLiteral.

Parameters:

literalNode (TypeVar(Iir, bound= c_int)) – The IIR node of the literal.

Return type:

FloatingPointLiteral

Returns:

The translated literal.

_iirNode: Iir

The IIR node in libghdl’s tree this DOM object was translated from.

_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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

Dict[Callable, Tuple[Attribute, ...]]

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 _position is None, resolve the position object from _iirNode

Returns:

The IIR’s position in the source file.

property Value: float

Read-only property to access the value (_value).

Returns:

The value.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

__str__()[source]

Formats the floating-point literal.

Format: 3.5

Return type:

str

Returns:

Formatted floating-point literal.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_value: float

The literal’s floating-point value.

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.dom object derived from pyVHDLModel.Expression.PhysicalIntegerLiteral.

Inheritance

Inheritance diagram of PhysicalIntegerLiteral

Parameters:
__init__(node, value, unitName)[source]

Initializes a physical literal with an integer value.

Parameters:
  • node (TypeVar(Iir, bound= c_int)) – The IIR node this object was translated from.

  • value (int) – The literal’s integer value, in units of _unitName.

  • unitName (str) – The name of the physical unit the value is given in.

Return type:

None

classmethod parse(literalNode)[source]

Translates the IIR node of the literal to a PhysicalIntegerLiteral.

Parameters:

literalNode (TypeVar(Iir, bound= c_int)) – The IIR node of the literal.

Return type:

PhysicalIntegerLiteral

Returns:

The translated literal.

_iirNode: Iir

The IIR node in libghdl’s tree this DOM object was translated from.

_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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

Dict[Callable, Tuple[Attribute, ...]]

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 _position is 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.

property Value: int

Read-only property to access the value (_value).

Returns:

The value.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

__str__()

Formats the physical literal.

Format: 10 ns

Return type:

str

Returns:

Formatted physical literal.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_unitName: str

The name of the physical unit the value is given in.

_value: int

The literal’s integer value, in units of _unitName.

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.dom object derived from pyVHDLModel.Expression.PhysicalFloatingLiteral.

Inheritance

Inheritance diagram of PhysicalFloatingLiteral

Parameters:
__init__(node, value, unitName)[source]

Initializes a physical literal with a floating-point value.

Parameters:
  • node (TypeVar(Iir, bound= c_int)) – The IIR node this object was translated from.

  • value (int) – The literal’s floating-point value, in units of _unitName.

  • unitName (float) – The name of the physical unit the value is given in.

Return type:

None

classmethod parse(literalNode)[source]

Translates the IIR node of the literal to a PhysicalFloatingLiteral.

Parameters:

literalNode (TypeVar(Iir, bound= c_int)) – The IIR node of the literal.

Return type:

PhysicalFloatingLiteral

Returns:

The translated literal.

_iirNode: Iir

The IIR node in libghdl’s tree this DOM object was translated from.

_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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

Dict[Callable, Tuple[Attribute, ...]]

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 _position is 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.

property Value: float

Read-only property to access the value (_value).

Returns:

The value.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

__str__()

Formats the physical literal.

Format: 10 ns

Return type:

str

Returns:

Formatted physical literal.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_unitName: str

The name of the physical unit the value is given in.

_value: float

The literal’s floating-point value, in units of _unitName.

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.dom object derived from pyVHDLModel.Expression.CharacterLiteral.

Inheritance

Inheritance diagram of CharacterLiteral

Parameters:
__init__(node, value)[source]

Initializes a character literal.

Parameters:
  • node (TypeVar(Iir, bound= c_int)) – The IIR node this object was translated from.

  • value (str) – The literal’s character value.

Return type:

None

classmethod parse(literalNode)[source]

Translates the IIR node of the literal to a CharacterLiteral.

Parameters:

literalNode (TypeVar(Iir, bound= c_int)) – The IIR node of the literal.

Return type:

CharacterLiteral

Returns:

The translated literal.

_iirNode: Iir

The IIR node in libghdl’s tree this DOM object was translated from.

_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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

Dict[Callable, Tuple[Attribute, ...]]

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 _position is None, resolve the position object from _iirNode

Returns:

The IIR’s position in the source file.

property Value: str

Read-only property to access the value (_value).

Returns:

The value.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

__str__()[source]

Formats the character literal.

Format: a

Return type:

str

Returns:

Formatted character literal.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_value: str

The literal’s character value.

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.dom object derived from pyVHDLModel.Expression.BinaryBitStringLiteral.

Inheritance

Inheritance diagram of BinaryBitStringLiteral

Parameters:
  • node (Iir)

  • value (str)

  • length (int | None)

  • isSigned (bool | None)

__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, or None if the literal has no length specification.

  • isSigned (bool | None) – True if signed, False if unsigned, None if unspecified.

Return type:

None

_iirNode: Iir

The IIR node in libghdl’s tree this DOM object was translated from.

_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 None if not set.

GetAncestor(type)

Return the closest ancestor of the given type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

Dict[Callable, Tuple[Attribute, ...]]

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 None if 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 _position is None, resolve the position object from _iirNode

Returns:

The IIR’s position in the source file.

property Value: str

Read-only property to access the value (_value).

Returns:

The value.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

__str__()

Formats the bit string literal.

Format: 8ub"10100000"

The length and the signedness marker (s/u) are omitted when unspecified.

Return type:

str

Returns:

Formatted bit string literal.

_base: ClassVar[BitStringBase] = 2

The base this literal is written in.

_binaryValue: str

The literal’s value expanded to base 2, one character per bit.

_bits: int

The number of bits the literal represents.

_isSigned: bool | None

True if signed, False if unsigned, None if unspecified.

_length: int | None

The explicitly given length, or None if the literal has no length specification.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_value: str

The literal as written in the source, without the enclosing double quotes.

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.dom object derived from pyVHDLModel.Expression.OctalBitStringLiteral.

Inheritance

Inheritance diagram of OctalBitStringLiteral

Parameters:
  • node (Iir)

  • value (str)

  • length (int | None)

  • isSigned (bool | None)

__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, or None if the literal has no length specification.

  • isSigned (bool | None) – True if signed, False if unsigned, None if unspecified.

Return type:

None

_iirNode: Iir

The IIR node in libghdl’s tree this DOM object was translated from.

_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 None if not set.

GetAncestor(type)

Return the closest ancestor of the given type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

Dict[Callable, Tuple[Attribute, ...]]

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 None if 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 _position is None, resolve the position object from _iirNode

Returns:

The IIR’s position in the source file.

property Value: str

Read-only property to access the value (_value).

Returns:

The value.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

__str__()

Formats the bit string literal.

Format: 8ub"10100000"

The length and the signedness marker (s/u) are omitted when unspecified.

Return type:

str

Returns:

Formatted bit string literal.

_base: ClassVar[BitStringBase] = 8

The base this literal is written in.

_binaryValue: str

The literal’s value expanded to base 2, one character per bit.

_bits: int

The number of bits the literal represents.

_isSigned: bool | None

True if signed, False if unsigned, None if unspecified.

_length: int | None

The explicitly given length, or None if the literal has no length specification.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_value: str

The literal as written in the source, without the enclosing double quotes.

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.dom object derived from pyVHDLModel.Expression.DecimalBitStringLiteral.

Inheritance

Inheritance diagram of DecimalBitStringLiteral

Parameters:
  • node (Iir)

  • value (str)

  • length (int | None)

  • isSigned (bool | None)

__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, or None if the literal has no length specification.

  • isSigned (bool | None) – True if signed, False if unsigned, None if unspecified.

Return type:

None

_iirNode: Iir

The IIR node in libghdl’s tree this DOM object was translated from.

_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 None if not set.

GetAncestor(type)

Return the closest ancestor of the given type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

Dict[Callable, Tuple[Attribute, ...]]

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 None if 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 _position is None, resolve the position object from _iirNode

Returns:

The IIR’s position in the source file.

property Value: str

Read-only property to access the value (_value).

Returns:

The value.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

__str__()

Formats the bit string literal.

Format: 8ub"10100000"

The length and the signedness marker (s/u) are omitted when unspecified.

Return type:

str

Returns:

Formatted bit string literal.

_base: ClassVar[BitStringBase] = 10

The base this literal is written in.

_binaryValue: str

The literal’s value expanded to base 2, one character per bit.

_bits: int

The number of bits the literal represents.

_isSigned: bool | None

True if signed, False if unsigned, None if unspecified.

_length: int | None

The explicitly given length, or None if the literal has no length specification.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_value: str

The literal as written in the source, without the enclosing double quotes.

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.dom object derived from pyVHDLModel.Expression.HexadecimalBitStringLiteral.

Inheritance

Inheritance diagram of HexadecimalBitStringLiteral

Parameters:
  • node (Iir)

  • value (str)

  • length (int | None)

  • isSigned (bool | None)

__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, or None if the literal has no length specification.

  • isSigned (bool | None) – True if signed, False if unsigned, None if unspecified.

Return type:

None

_iirNode: Iir

The IIR node in libghdl’s tree this DOM object was translated from.

_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 None if not set.

GetAncestor(type)

Return the closest ancestor of the given type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

Dict[Callable, Tuple[Attribute, ...]]

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 None if 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 _position is None, resolve the position object from _iirNode

Returns:

The IIR’s position in the source file.

property Value: str

Read-only property to access the value (_value).

Returns:

The value.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

__str__()

Formats the bit string literal.

Format: 8ub"10100000"

The length and the signedness marker (s/u) are omitted when unspecified.

Return type:

str

Returns:

Formatted bit string literal.

_base: ClassVar[BitStringBase] = 16

The base this literal is written in.

_binaryValue: str

The literal’s value expanded to base 2, one character per bit.

_bits: int

The number of bits the literal represents.

_isSigned: bool | None

True if signed, False if unsigned, None if unspecified.

_length: int | None

The explicitly given length, or None if the literal has no length specification.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_value: str

The literal as written in the source, without the enclosing double quotes.

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.dom object derived from pyVHDLModel.Expression.StringLiteral.

Inheritance

Inheritance diagram of StringLiteral

Parameters:
__init__(node, value)[source]

Initializes a string literal.

Parameters:
  • node (TypeVar(Iir, bound= c_int)) – The IIR node this object was translated from.

  • value (str) – The literal’s string value, without the enclosing double quotes.

Return type:

None

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.

_iirNode: Iir

The IIR node in libghdl’s tree this DOM object was translated from.

_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 type found 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:

ModelEntity

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, or None to accept every attribute.

Return type:

Dict[Callable, Tuple[Attribute, ...]]

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 _position is None, resolve the position object from _iirNode

Returns:

The IIR’s position in the source file.

property Value: str

Read-only property to access the value (_value).

Returns:

The value.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

__str__()[source]

Formats the string literal.

Format: "hello"

Return type:

str

Returns:

Formatted string literal.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_value: str

The literal’s string value, without the enclosing double quotes.