pyGHDL.dom.Type

This module implements derived type classes from pyVHDLModel.Type.

Classes


Classes

class pyGHDL.dom.Type.IncompleteType(node, identifier, documentation=None)[source]

Inheritance

Inheritance diagram of IncompleteType

Parameters:
  • node (Iir)

  • identifier (str)

  • documentation (str)

__init__(node, identifier, documentation=None)[source]

Initializes underlying BaseType.

Parameters:
  • identifier (str) – Name of the type.

  • documentation (str) – The documentation comment associated with this declaration.

  • parent – Reference to the logical parent in the model hierarchy.

  • node (Iir)

Return type:

None

property Documentation: str | None

Read-only property to access the model entity’s documentation (_documentation).

Returns:

Associated documentation of a model entity.

GetAncestor(type)

Return the closest ancestor of the given 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 Identifier: str

Read-only property to access the model entity’s identifier (_identifier).

Returns:

Name of a model entity.

property NormalizedIdentifier: str

Read-only property to access the model entity’s normalized identifier (_normalizedIdentifier).

Returns:

Normalized name of a model entity.

property Parent: ModelEntity

Property to access the model entity’s parent element reference in a logical hierarchy (_parent).

Returns:

Reference to the parent entity.

property Position: <pyTooling.Decorators.readonly object at 0x7c526738b7d0>

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__()

Formats the type declaration.

Format: type myType

Return type:

str

Returns:

Formatted type declaration.

_documentation: str | None

The associated documentation of a model entity.

_identifier: str

The identifier of a model entity.

_normalizedIdentifier: str

The normalized (lower case) identifier of a model entity.

_objectVertex: Vertex

The vertex representing this type in the design’s object graph.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

class pyGHDL.dom.Type.EnumeratedType(node, identifier, literals, documentation=None)[source]

Represents an enumerated type.

This class implements a pyGHDL.dom object derived from pyVHDLModel.Type.EnumeratedType.

Example

type integer is (lit_1, lit2, ...);

Inheritance

Inheritance diagram of EnumeratedType

Parameters:
__init__(node, identifier, literals, documentation=None)[source]

Initializes an enumerated type definition.

Parameters:
  • identifier (str) – The identifier of a model entity.

  • literals (List[EnumerationLiteral]) – List of all enumeration literals, in declaration order.

  • documentation (str) – The documentation comment associated with this declaration.

  • parent – The parent model entity of this entity.

  • node (Iir)

Return type:

None

classmethod parse(typeName, typeDefinitionNode, documentation=None)[source]

Parses an enumerated type IIR and returns an EnumeratedType instance.

Parameters:
  • typeName (str) – The identifier of the type.

  • typeDefinitionNode (TypeVar(Iir, bound= c_int)) – The IIR node to parse.

  • documentation (str) – The documentation comment on the type declaration.

Return type:

EnumeratedType

Returns:

The enumerated type instance.

property Documentation: str | None

Read-only property to access the model entity’s documentation (_documentation).

Returns:

Associated documentation of a model entity.

GetAncestor(type)

Return the closest ancestor of the given 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 Identifier: str

Read-only property to access the model entity’s identifier (_identifier).

Returns:

Name of a model entity.

property Literals: List[EnumerationLiteral]

Read-only property to access the literals (_literals).

Returns:

List of literals.

property NormalizedIdentifier: str

Read-only property to access the model entity’s normalized identifier (_normalizedIdentifier).

Returns:

Normalized name of a model entity.

property Parent: ModelEntity

Property to access the model entity’s parent element reference in a logical hierarchy (_parent).

Returns:

Reference to the parent entity.

property Position: <pyTooling.Decorators.readonly object at 0x7c526738b7d0>

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 enumerated type definition.

Format: state is (idle, run)

Return type:

str

Returns:

Formatted enumerated type definition.

_documentation: str | None

The associated documentation of a model entity.

_identifier: str

The identifier of a model entity.

_literals: List[EnumerationLiteral]

List of all enumeration literals, in declaration order.

_normalizedIdentifier: str

The normalized (lower case) identifier of a model entity.

_objectVertex: Vertex

The vertex representing this type in the design’s object graph.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

class pyGHDL.dom.Type.IntegerType(node, typeName, rng, documentation=None)[source]

Represents an integer type.

This class implements a pyGHDL.dom object derived from pyVHDLModel.Type.IntegerType.

Example

type integer is range -2147483648 to 2147483647;

Inheritance

Inheritance diagram of IntegerType

Parameters:
__init__(node, typeName, rng, documentation=None)[source]

Initializes an integer type definition.

Parameters:
  • identifier – The identifier of a model entity.

  • rng (Range | Name) – The range constraining this scalar type.

  • documentation (str) – The documentation comment associated with this declaration.

  • parent – The parent model entity of this entity.

  • node (Iir)

  • typeName (str)

Return type:

None

property Documentation: str | None

Read-only property to access the model entity’s documentation (_documentation).

Returns:

Associated documentation of a model entity.

GetAncestor(type)

Return the closest ancestor of the given 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 Identifier: str

Read-only property to access the model entity’s identifier (_identifier).

Returns:

Name of a model entity.

property NormalizedIdentifier: str

Read-only property to access the model entity’s normalized identifier (_normalizedIdentifier).

Returns:

Normalized name of a model entity.

property Parent: ModelEntity

Property to access the model entity’s parent element reference in a logical hierarchy (_parent).

Returns:

Reference to the parent entity.

property Position: <pyTooling.Decorators.readonly object at 0x7c526738b7d0>

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 Range: <pyTooling.Decorators.readonly object at 0x7c5266bf6e50>

Read-only property to access the type’s range (_range).

Returns:

The range.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

__str__()[source]

Formats the integer type definition.

Format: byte_count is range 0 to 7

Return type:

str

Returns:

Formatted integer type definition.

_documentation: str | None

The associated documentation of a model entity.

_identifier: str

The identifier of a model entity.

_normalizedIdentifier: str

The normalized (lower case) identifier of a model entity.

_objectVertex: Vertex

The vertex representing this type in the design’s object graph.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_range: <pyTooling.Decorators.readonly object at 0x7c5266bf6e50>

The range constraining this scalar type.

class pyGHDL.dom.Type.PhysicalType(node, typeName, rng, primaryUnit, units, documentation=None)[source]

Represents a physical type.

This class implements a pyGHDL.dom object derived from pyVHDLModel.Type.PhysicalType.

Example

type time is range integer'low to integer'high units
  fs;
  ps = 1000 fs;
  -- ...
end units;

Inheritance

Inheritance diagram of PhysicalType

Parameters:
__init__(node, typeName, rng, primaryUnit, units, documentation=None)[source]

Initializes a physical type definition.

Parameters:
  • identifier – The identifier of a model entity.

  • rng (Range | Name) – The range constraining this scalar type.

  • primaryUnit (str) – The name of the type’s primary unit.

  • units (List[Tuple[str, PhysicalIntegerLiteral]]) – Iterable of the secondary units as (name, value) pairs.

  • documentation (str) – The documentation comment associated with this declaration.

  • parent – The parent model entity of this entity.

  • node (Iir)

  • typeName (str)

Return type:

None

classmethod parse(typeName, typeDefinitionNode, documentation=None)[source]

Parses an physical type IIR and returns an PhysicalType instance.

Parameters:
  • typeName (str) – The identifier of the type.

  • typeDefinitionNode (TypeVar(Iir, bound= c_int)) – The IIR node to parse.

  • documentation (str) – The documentation comment on the type declaration.

Return type:

PhysicalType

Returns:

The physical type instance.

property Documentation: str | None

Read-only property to access the model entity’s documentation (_documentation).

Returns:

Associated documentation of a model entity.

GetAncestor(type)

Return the closest ancestor of the given 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 Identifier: str

Read-only property to access the model entity’s identifier (_identifier).

Returns:

Name of a model entity.

property NormalizedIdentifier: str

Read-only property to access the model entity’s normalized identifier (_normalizedIdentifier).

Returns:

Normalized name of a model entity.

property Parent: ModelEntity

Property to access the model entity’s parent element reference in a logical hierarchy (_parent).

Returns:

Reference to the parent entity.

property Position: <pyTooling.Decorators.readonly object at 0x7c526738b7d0>

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 PrimaryUnit: str

Read-only property to access the primary unit (_primaryUnit).

Returns:

The primary unit.

property Range: <pyTooling.Decorators.readonly object at 0x7c5266bf6e50>

Read-only property to access the type’s range (_range).

Returns:

The range.

property SecondaryUnits: List[Tuple[str, PhysicalIntegerLiteral]]

Read-only property to access the secondary units (_secondaryUnits).

Returns:

List of secondary units.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

__str__()[source]

Formats the physical type definition.

Format: distance is range 0 to 1000 units um; mm = 1000 um;

Return type:

str

Returns:

Formatted physical type definition.

_documentation: str | None

The associated documentation of a model entity.

_identifier: str

The identifier of a model entity.

_normalizedIdentifier: str

The normalized (lower case) identifier of a model entity.

_objectVertex: Vertex

The vertex representing this type in the design’s object graph.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_primaryUnit: str

The name of the type’s primary unit.

_range: <pyTooling.Decorators.readonly object at 0x7c5266bf6e50>

The range constraining this scalar type.

_secondaryUnits: List[Tuple[str, PhysicalIntegerLiteral]]

Secondary units as (name, value) pairs.

class pyGHDL.dom.Type.ArrayType(node, identifier, indices, elementSubtype, documentation=None)[source]

Represents an array type.

This class implements a pyGHDL.dom object derived from pyVHDLModel.Type.ArrayType.

Example

type bit_vector is array(natural range <>) of bit;

Inheritance

Inheritance diagram of ArrayType

Parameters:
__init__(node, identifier, indices, elementSubtype, documentation=None)[source]

Initializes an array type definition.

Parameters:
  • identifier (str) – The identifier of a model entity.

  • indices (List) – List of all index ranges, one per dimension.

  • elementSubtype (Symbol) – Reference to the subtype of the array’s elements.

  • documentation (str) – The documentation comment associated with this declaration.

  • parent – The parent model entity of this entity.

  • node (Iir)

Return type:

None

classmethod parse(typeName, typeDefinitionNode, documentation=None)[source]

Parses an array type IIR and returns an ArrayType instance.

Parameters:
  • typeName (str) – The identifier of the type.

  • typeDefinitionNode (TypeVar(Iir, bound= c_int)) – The IIR node to parse.

  • documentation (str) – The documentation comment on the type declaration.

Return type:

ArrayType

Returns:

The array type instance.

property Dimensions: List[Range]

Read-only property to access the dimensions (_dimensions).

Returns:

List of dimensions.

property Documentation: str | None

Read-only property to access the model entity’s documentation (_documentation).

Returns:

Associated documentation of a model entity.

property ElementType: Symbol

Read-only property to access the element type (_elementType).

Returns:

The element type.

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 Identifier: str

Read-only property to access the model entity’s identifier (_identifier).

Returns:

Name of a model entity.

property NormalizedIdentifier: str

Read-only property to access the model entity’s normalized identifier (_normalizedIdentifier).

Returns:

Normalized name of a model entity.

property Parent: ModelEntity

Property to access the model entity’s parent element reference in a logical hierarchy (_parent).

Returns:

Reference to the parent entity.

property Position: <pyTooling.Decorators.readonly object at 0x7c526738b7d0>

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 array type definition.

Format: memory is array(0 to 7) of bit

Return type:

str

Returns:

Formatted array type definition.

_dimensions: List[Range]

List of all index ranges, one per dimension.

_documentation: str | None

The associated documentation of a model entity.

_elementType: Symbol

Reference to the subtype of the array’s elements.

_identifier: str

The identifier of a model entity.

_normalizedIdentifier: str

The normalized (lower case) identifier of a model entity.

_objectVertex: Vertex

The vertex representing this type in the design’s object graph.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

class pyGHDL.dom.Type.RecordTypeElement(node, identifiers, subtype, documentation=None)[source]

Represents a record element.

This class implements a pyGHDL.dom object derived from pyVHDLModel.Type.RecordTypeElement.

Example

-- type pt is record
  element : std_logic;
  -- ...
-- end record;

Inheritance

Inheritance diagram of RecordTypeElement

Parameters:
__init__(node, identifiers, subtype, documentation=None)[source]

Initializes a record type element.

Parameters:
  • identifiers (List[str]) – A list of identifiers.

  • subtype (Symbol) – Reference to the subtype shared by all identifiers of this element declaration.

  • documentation (str) – The documentation comment associated with this declaration.

  • parent – The parent model entity of this entity.

  • node (Iir)

Return type:

None

classmethod parse(elementDeclarationNode, furtherIdentifiers=None)[source]

Parses a record element IIR and returns an RecordTypeElement instance.

Parameters:
  • elementDeclarationNode (TypeVar(Iir, bound= c_int)) – The IIR node to parse.

  • furtherIdentifiers (Iterable[str]) – The list of record element identifiers.

Return type:

RecordTypeElement

Returns:

The record element instance.

property Documentation: str | None

Read-only property to access the model entity’s documentation (_documentation).

Returns:

Associated documentation of a model entity.

GetAncestor(type)

Return the closest ancestor of the given 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 Identifiers: Tuple[str]

Read-only property to access the model entity’s identifiers (_identifiers).

Returns:

Tuple of identifiers.

property NormalizedIdentifiers: Tuple[str]

Read-only property to access the model entity’s normalized identifiers (_normalizedIdentifiers).

Returns:

Tuple of normalized identifiers.

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 0x7c526738b7d0>

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 Subtype: Symbol

Read-only property to access the subtype (_subtype).

Returns:

The subtype.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

__str__()[source]

Formats the record element declaration.

Format: a, b : bit

Return type:

str

Returns:

Formatted record element declaration.

_documentation: str | None

The associated documentation of a model entity.

_identifiers: Tuple[str]

A list of identifiers.

_normalizedIdentifiers: Tuple[str]

A list of normalized (lower case) identifiers.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_subtype: Symbol

Reference to the subtype shared by all identifiers of this element declaration.

class pyGHDL.dom.Type.RecordType(node, identifier, elements=None, documentation=None)[source]

Represents a record type.

This class implements a pyGHDL.dom object derived from pyVHDLModel.Type.RecordType.

Example

type pt is record
  -- elements
end record;

Inheritance

Inheritance diagram of RecordType

Parameters:
__init__(node, identifier, elements=None, documentation=None)[source]

Initializes a record type definition.

Parameters:
  • identifier (str) – The identifier of a model entity.

  • elements (List[RecordTypeElement]) – List of all element declarations, in declaration order.

  • documentation (str) – The documentation comment associated with this declaration.

  • parent – The parent model entity of this entity.

  • node (Iir)

Return type:

None

classmethod parse(typeName, typeDefinitionNode, documentation=None)[source]

Parses a record type IIR and returns an RecordType instance.

Parameters:
  • typeName (str) – The identifier of the type.

  • typeDefinitionNode (TypeVar(Iir, bound= c_int)) – The IIR node to parse.

  • documentation (str) – The documentation comment on the type declaration.

Return type:

RecordType

Returns:

The record type instance.

property Documentation: str | None

Read-only property to access the model entity’s documentation (_documentation).

Returns:

Associated documentation of a model entity.

property Elements: List[RecordTypeElement]

Read-only property to access the elements (_elements).

Returns:

List of elements.

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 Identifier: str

Read-only property to access the model entity’s identifier (_identifier).

Returns:

Name of a model entity.

property NormalizedIdentifier: str

Read-only property to access the model entity’s normalized identifier (_normalizedIdentifier).

Returns:

Normalized name of a model entity.

property Parent: ModelEntity

Property to access the model entity’s parent element reference in a logical hierarchy (_parent).

Returns:

Reference to the parent entity.

property Position: <pyTooling.Decorators.readonly object at 0x7c526738b7d0>

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 record type definition.

Format: frame is record a : bit;

Return type:

str

Returns:

Formatted record type definition.

_documentation: str | None

The associated documentation of a model entity.

_elements: List[RecordTypeElement]

List of all element declarations, in declaration order.

_identifier: str

The identifier of a model entity.

_normalizedIdentifier: str

The normalized (lower case) identifier of a model entity.

_objectVertex: Vertex

The vertex representing this type in the design’s object graph.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

class pyGHDL.dom.Type.ProtectedType(node, identifier, methods=None, documentation=None)[source]

Represents a protected type.

This class implements a pyGHDL.dom object derived from pyVHDLModel.Type.ProtectedType.

Example

type pt is protected
  -- public interface
end protected;

Inheritance

Inheritance diagram of ProtectedType

Parameters:
__init__(node, identifier, methods=None, documentation=None)[source]

Initializes a protected type declaration.

Parameters:
  • identifier (str) – The identifier of a model entity.

  • declaredItems – All items declared by this protected type; only subprograms are legal.

  • documentation (str) – The documentation comment associated with this declaration.

  • parent – The parent model entity of this entity.

  • node (Iir)

  • methods (List | Iterator)

Return type:

None

classmethod parse(typeName, typeDefinitionNode, documentation=None)[source]

Parses a protected type IIR and returns an ProtectedType instance.

Parameters:
  • typeName (str) – The identifier of the type.

  • typeDefinitionNode (TypeVar(Iir, bound= c_int)) – The IIR node to parse.

  • documentation (str) – The documentation comment on the type declaration.

Return type:

ProtectedType

Returns:

The protected type instance.

property DeclaredItems: List

Read-only property to access the declared items (_declaredItems).

Returns:

List of all declared items.

property Documentation: str | None

Read-only property to access the model entity’s documentation (_documentation).

Returns:

Associated documentation of a model entity.

property Functions: Dict[str, List[Function]]

Read-only property to access the declared functions (_functions).

Returns:

Dictionary of all functions, indexed by name; each entry is a list of overloads.

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 Identifier: str

Read-only property to access the model entity’s identifier (_identifier).

Returns:

Name of a model entity.

IndexDeclaredItems()

Index declared items listed in the protected type declaration.

Only subprogram declarations are legal here, so anything else is passed to _IndexOtherDeclaredItem().

See also

SequentialDeclarationRegionMixin.IndexDeclaredItems()

The same algorithm for the protected type’s body.

Return type:

None

property Methods: List[Procedure | Function]

Read-only property to access the declared methods, in declaration order.

A protected type declares nothing but subprograms, so this is every declared item (_declaredItems). It is kept as a named view because “method” is the VHDL term for a protected type’s subprograms.

Returns:

List of methods, in declaration order.

property NormalizedIdentifier: str

Read-only property to access the model entity’s normalized identifier (_normalizedIdentifier).

Returns:

Normalized name of a model entity.

property Parent: ModelEntity

Property to access the model entity’s parent element reference in a logical hierarchy (_parent).

Returns:

Reference to the parent entity.

property Position: <pyTooling.Decorators.readonly object at 0x7c526738b7d0>

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 Procedures: Dict[str, List[Procedure]]

Read-only property to access the declared procedures (_procedures).

Returns:

Dictionary of all procedures, indexed by name; each entry is a list of overloads.

_IndexGenericItems()

Add this region’s generics to its namespace.

Return type:

None

_IndexOtherDeclaredItem(item)

Hook for declared items the region doesn’t handle itself. Derived classes may override it.

Return type:

None

_IndexParameterItems()

Add this region’s parameters to its namespace.

Return type:

None

_IndexPortItems()

Add this region’s ports to its namespace.

Return type:

None

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

__str__()

Formats the type declaration.

Format: type myType

Return type:

str

Returns:

Formatted type declaration.

_declaredItems

List of all declared items in this protected type declaration.

_documentation

The associated documentation of a model entity.

_functions

All declared functions, indexed by name; each is a list of overloads.

_identifier

The identifier of a model entity.

_namespace

The namespace of this protected type declaration.

_normalizedIdentifier

The normalized (lower case) identifier of a model entity.

_objectVertex

The vertex representing this type in the design’s object graph.

_parent

Reference to a parent entity in the logical model hierarchy.

_procedures

All declared procedures by name; each is a list of overloads.

class pyGHDL.dom.Type.ProtectedTypeBody(node, identifier, declaredItems=None, documentation=None)[source]

Represents a protected type body.

This class implements a pyGHDL.dom object derived from pyVHDLModel.Type.ProtectedTypeBody.

Example

type pt is protected body
  -- implementations
end protected body;

Inheritance

Inheritance diagram of ProtectedTypeBody

Parameters:
__init__(node, identifier, declaredItems=None, documentation=None)[source]

Initializes a protected type body.

Parameters:
  • identifier (str) – The identifier of a model entity.

  • declaredItems (List | Iterator) – Iterable of all items declared in this body.

  • documentation (str) – The documentation comment associated with this declaration.

  • parent – The parent model entity of this entity.

  • node (Iir)

Return type:

None

classmethod parse(protectedBodyNode)[source]

Parses a protected type body IIR and returns an ProtectedTypeBody instance.

Parameters:

protectedBodyNode (TypeVar(Iir, bound= c_int)) – The IIR node to parse.

Return type:

ProtectedTypeBody

Returns:

The protected type body instance.

property Constants: Dict[str, Constant]

Read-only property to access the declared constants (_constants).

Returns:

Dictionary of constants, indexed by normalized identifier.

property DeclaredItems: List

Read-only property to access the declared items (_declaredItems).

Returns:

List of declared items.

property Documentation: str | None

Read-only property to access the model entity’s documentation (_documentation).

Returns:

Associated documentation of a model entity.

property Files: Dict[str, File]

Read-only property to access the declared files (_files).

Returns:

Dictionary of files, indexed by normalized identifier.

property Functions: Dict[str, List[Function]]

Read-only property to access the declared functions (_functions).

Returns:

Dictionary of functions, indexed by normalized identifier; each entry is a list of overloads.

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 Identifier: str

Read-only property to access the model entity’s identifier (_identifier).

Returns:

Name of a model entity.

IndexDeclaredItems()

Index declared items listed in the sequential declaration region.

Every declared item is added to _namespace, and additionally to the lookup table matching its kind. Items of an unhandled kind are passed to _IndexOtherDeclaredItem().

See also

ConcurrentDeclarationRegionMixin.IndexDeclaredItems()

The same algorithm for a concurrent declaration region.

Return type:

None

property Methods: List[Procedure | Function]

Read-only property to access the implemented methods, in declaration order.

A protected type body may also declare variables, types, subtypes, aliases and files, so this is the subprogram subset of _declaredItems rather than all of them.

Returns:

List of methods, in declaration order.

property Namespace: <pyTooling.Decorators.readonly object at 0x7c5266bcf650>

Read-only property to access this region’s namespace (_namespace).

Returns:

The namespace.

property NormalizedIdentifier: str

Read-only property to access the model entity’s normalized identifier (_normalizedIdentifier).

Returns:

Normalized name of a model entity.

property Parent: ModelEntity

Property to access the model entity’s parent element reference in a logical hierarchy (_parent).

Returns:

Reference to the parent entity.

property Position: <pyTooling.Decorators.readonly object at 0x7c526738b7d0>

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 Procedures: Dict[str, List[Procedure]]

Read-only property to access the declared procedures (_procedures).

Returns:

Dictionary of procedures, indexed by normalized identifier; each entry is a list of overloads.

property Subtypes: Dict[str, Subtype]

Read-only property to access the declared subtypes (_subtypes).

Returns:

Dictionary of subtypes, indexed by normalized identifier.

property Types: Dict[str, FullType]

Read-only property to access the declared types (_types).

Returns:

Dictionary of types, indexed by normalized identifier.

property Variables: Dict[str, Variable]

Read-only property to access the declared variables (_variables).

Returns:

Dictionary of variables, indexed by normalized identifier.

_IndexGenericItems()

Add this region’s generics to its namespace.

Return type:

None

_IndexOtherDeclaredItem(item)

Hook for declared items the region doesn’t handle itself. Derived classes may override it.

Return type:

None

_IndexParameterItems()

Add this region’s parameters to its namespace.

Return type:

None

_IndexPortItems()

Add this region’s ports to its namespace.

Return type:

None

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

__str__()

Formats the type declaration.

Format: type myType

Return type:

str

Returns:

Formatted type declaration.

_constants

Dictionary of all constants declared in this sequential declaration region.

_declaredItems

List of all declared items in this sequential declaration region.

_documentation

The associated documentation of a model entity.

_files

Dictionary of all files declared in this sequential declaration region.

_functions

Dictionary of all functions declared in this sequential declaration region, indexed by name; each entry is a list of overloads.

_identifier

The identifier of a model entity.

_namespace

The namespace of this sequential declaration region.

_normalizedIdentifier

The normalized (lower case) identifier of a model entity.

_objectVertex

The vertex representing this type in the design’s object graph.

_parent

Reference to a parent entity in the logical model hierarchy.

_procedures

Dictionary of all procedures declared in this sequential declaration region, indexed by name; each entry is a list of overloads.

_subtypes

Dictionary of all subtypes declared in this sequential declaration region.

_types

Dictionary of all types declared in this sequential declaration region.

_variables

Dictionary of all variables declared in this sequential declaration region.

class pyGHDL.dom.Type.AccessType(node, identifier, designatedSubtype, documentation=None)[source]

Represents an access type.

This class implements a pyGHDL.dom object derived from pyVHDLModel.Type.AccessType.

Example

type line is access string;

Inheritance

Inheritance diagram of AccessType

Parameters:
  • node (Iir)

  • identifier (str)

  • designatedSubtype (Symbol)

  • documentation (str)

__init__(node, identifier, designatedSubtype, documentation=None)[source]

Initializes an access type definition.

Parameters:
  • identifier (str) – The identifier of a model entity.

  • designatedSubtype (Symbol) – Reference to the subtype the access values designate.

  • documentation (str) – The documentation comment associated with this declaration.

  • parent – The parent model entity of this entity.

  • node (Iir)

Return type:

None

classmethod parse(typeName, typeDefinitionNode, documentation=None)[source]

Parses an access type IIR and returns an AccessType instance.

Parameters:
  • typeName (str) – The identifier of the type.

  • typeDefinitionNode (TypeVar(Iir, bound= c_int)) – The IIR node to parse.

  • documentation (str) – The documentation comment on the type declaration.

Return type:

AccessType

Returns:

The access type instance.

property DesignatedSubtype: Symbol

Read-only property to access the designated subtype (_designatedSubtype).

Returns:

The designated subtype.

property Documentation: str | None

Read-only property to access the model entity’s documentation (_documentation).

Returns:

Associated documentation of a model entity.

GetAncestor(type)

Return the closest ancestor of the given 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 Identifier: str

Read-only property to access the model entity’s identifier (_identifier).

Returns:

Name of a model entity.

property NormalizedIdentifier: str

Read-only property to access the model entity’s normalized identifier (_normalizedIdentifier).

Returns:

Normalized name of a model entity.

property Parent: ModelEntity

Property to access the model entity’s parent element reference in a logical hierarchy (_parent).

Returns:

Reference to the parent entity.

property Position: <pyTooling.Decorators.readonly object at 0x7c526738b7d0>

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 access type definition.

Format: ptr is access node

Return type:

str

Returns:

Formatted access type definition.

_designatedSubtype: Symbol

Reference to the subtype the access values designate.

_documentation: str | None

The associated documentation of a model entity.

_identifier: str

The identifier of a model entity.

_normalizedIdentifier: str

The normalized (lower case) identifier of a model entity.

_objectVertex: Vertex

The vertex representing this type in the design’s object graph.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

class pyGHDL.dom.Type.FileType(node, identifier, designatedSubtype, documentation=None)[source]

Represents a file type.

This class implements a pyGHDL.dom object derived from pyVHDLModel.Type.FileType.

Example

type text is file of string;

Inheritance

Inheritance diagram of FileType

Parameters:
  • node (Iir)

  • identifier (str)

  • designatedSubtype (Symbol)

  • documentation (str)

__init__(node, identifier, designatedSubtype, documentation=None)[source]

Initializes a file type definition.

Parameters:
  • identifier (str) – The identifier of a model entity.

  • designatedSubtype (Symbol) – Reference to the subtype of the values stored in the file.

  • documentation (str) – The documentation comment associated with this declaration.

  • parent – The parent model entity of this entity.

  • node (Iir)

Return type:

None

classmethod parse(typeName, typeDefinitionNode, documentation=None)[source]

Parses a file type IIR and returns an FileType instance.

Parameters:
  • typeName (str) – The identifier of the type.

  • typeDefinitionNode (TypeVar(Iir, bound= c_int)) – The IIR node to parse.

  • documentation (str) – The documentation comment on the type declaration.

Return type:

FileType

Returns:

The file type instance.

property DesignatedSubtype: Symbol

Read-only property to access the designated subtype (_designatedSubtype).

Returns:

The designated subtype.

property Documentation: str | None

Read-only property to access the model entity’s documentation (_documentation).

Returns:

Associated documentation of a model entity.

GetAncestor(type)

Return the closest ancestor of the given 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 Identifier: str

Read-only property to access the model entity’s identifier (_identifier).

Returns:

Name of a model entity.

property NormalizedIdentifier: str

Read-only property to access the model entity’s normalized identifier (_normalizedIdentifier).

Returns:

Normalized name of a model entity.

property Parent: ModelEntity

Property to access the model entity’s parent element reference in a logical hierarchy (_parent).

Returns:

Reference to the parent entity.

property Position: <pyTooling.Decorators.readonly object at 0x7c526738b7d0>

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 file type definition.

Format: ft is file of character

Return type:

str

Returns:

Formatted file type definition.

_designatedSubtype: Symbol

Reference to the subtype of the values stored in the file.

_documentation: str | None

The associated documentation of a model entity.

_identifier: str

The identifier of a model entity.

_normalizedIdentifier: str

The normalized (lower case) identifier of a model entity.

_objectVertex: Vertex

The vertex representing this type in the design’s object graph.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

class pyGHDL.dom.Type.Subtype(node, subtypeName, symbol, documentation=None)[source]

Represents a subtype.

This class implements a pyGHDL.dom object derived from pyVHDLModel.Type.Subtype.

Inheritance

Inheritance diagram of Subtype

Parameters:
__init__(node, subtypeName, symbol, documentation=None)[source]

Initializes a subtype declaration.

Parameters:
  • identifier – The identifier of a model entity.

  • symbol (Symbol) – Reference to the type or subtype this subtype is derived from.

  • documentation (str) – The documentation comment associated with this declaration.

  • parent – The parent model entity of this entity.

  • node (Iir)

  • subtypeName (str)

Return type:

None

property BaseType: <pyTooling.Decorators.readonly object at 0x7c5266bf6450>

Read-only property to access the base type (_baseType).

Returns:

The base type.

property Documentation: str | None

Read-only property to access the model entity’s documentation (_documentation).

Returns:

Associated documentation of a model entity.

GetAncestor(type)

Return the closest ancestor of the given 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 Identifier: str

Read-only property to access the model entity’s identifier (_identifier).

Returns:

Name of a model entity.

property NormalizedIdentifier: str

Read-only property to access the model entity’s normalized identifier (_normalizedIdentifier).

Returns:

Normalized name of a model entity.

property Parent: ModelEntity

Property to access the model entity’s parent element reference in a logical hierarchy (_parent).

Returns:

Reference to the parent entity.

property Position: <pyTooling.Decorators.readonly object at 0x7c526738b7d0>

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 Range: <pyTooling.Decorators.readonly object at 0x7c5266bf6650>

Read-only property to access the range (_range).

Returns:

The range.

property ResolutionFunction: Function

Read-only property to access the resolution function (_resolutionFunction).

Returns:

The resolution function.

property Type: Symbol

Read-only property to access the type (_type).

Returns:

The type.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

__str__()[source]

Formats the subtype declaration.

Format: subtype byte is bit_vector

The base type is rendered, so an unlinked subtype shows None.

Return type:

str

Returns:

Formatted subtype declaration.

_baseType

The resolved base type of this subtype.

_documentation

The associated documentation of a model entity.

_identifier

The identifier of a model entity.

_normalizedIdentifier

The normalized (lower case) identifier of a model entity.

_objectVertex

The vertex representing this type in the design’s object graph.

_parent

Reference to a parent entity in the logical model hierarchy.

_range

The constraint narrowing the base type, or None if unconstrained.

_resolutionFunction

The resolution function, or None if the subtype is unresolved.

_type

Reference to the type or subtype this subtype is derived from.