pyGHDL.dom.Subprogram

This module implements derived subprogram classes from pyVHDLModel.Subprogram.

Classes


Classes

class pyGHDL.dom.Subprogram.Function(node, functionName, returnType, isPure=True, genericItems=None, parameterItems=None, declaredItems=None, statements=None, documentation=None)[source]

Represents a function.

A function returns a value of its return type (ReturnType) and is either pure or impure (IsPure). Besides its parameters, it has its own declarative part (DeclaredItems) and statements (Statements).

Example

function fun(constant c : in positive) return integer is
--       ^^^                                               <- Identifier
--           ^^^^^^^^^^^^^^^^^^^^^^^^                      <- ParameterItems
--                                            ^^^^^^^      <- ReturnType
  variable tmp : integer;
--^^^^^^^^^^^^^^^^^^^^^^^                                  <- DeclaredItems
begin
  tmp := c;
--^^^^^^^^^                                                <- Statements
  return tmp;
end function;

This class implements a pyGHDL.dom object derived from pyVHDLModel.Subprogram.Function.

Inheritance

Inheritance diagram of Function

Parameters:
__init__(node, functionName, returnType, isPure=True, genericItems=None, parameterItems=None, declaredItems=None, statements=None, documentation=None)[source]

Initializes a function.

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

  • functionName (str) – The function’s identifier.

  • returnType (Symbol) – Reference to the subtype of the function’s return value.

  • isPure (bool) – True if the subprogram was declared pure.

  • genericItems (List[GenericInterfaceItemMixin]) – List of all generics, in declaration order.

  • parameterItems (List[ParameterInterfaceItemMixin]) – List of all parameters, in declaration order.

  • declaredItems (List) – List of all declared items in this sequential declaration region.

  • statements (List[SequentialStatement]) – List of all sequential statements in the subprogram’s body.

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

Return type:

None

classmethod parse(functionNode)[source]

Translates the IIR node of the function declaration to a Function.

Parameters:

functionNode (TypeVar(Iir, bound= c_int)) – The IIR node of the function declaration.

Return type:

Function

Returns:

The translated function declaration.

_iirNode

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

_position

The IIR node’s position in the source file, resolved on first access and then cached.

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.

property GenericItems: List[GenericInterfaceItemMixin]

Read-only property to access the generic items (_genericItems).

Returns:

List of generic items.

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

A subprogram’s generics and parameters share the declarative region of its declarative part.

Return type:

None

property IsPure: bool

Check if the subprogram is pure (_isPure).

Returns:

True, if the subprogram is pure.

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

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 ParameterItems: List[ParameterInterfaceItemMixin]

Read-only property to access the parameter items (_parameterItems).

Returns:

List of parameter items.

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 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 ReturnType: SubtypeSymbol

Read-only property to access the return type (_returnType).

Returns:

The return type.

property Statements: List[SequentialStatement]

Read-only property to access the statements (_statements).

Returns:

List of statements.

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 subprogram declaration.

Format: procedure myProcedure(a, b)

Return type:

str

Returns:

Formatted subprogram 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.

_genericItems

List of all generics, in declaration order.

_identifier

The identifier of a model entity.

_isPure

True if the subprogram was declared pure.

_namespace

The namespace of this sequential declaration region.

_normalizedIdentifier

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

_parameterItems

List of all parameters, in declaration order.

_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.

_returnType

Reference to the subtype of the function’s return value.

_statements

List of all sequential statements in the subprogram’s body.

_subprogramKeyword = 'function'

The VHDL keyword introducing this subprogram kind.

_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.Subprogram.Procedure(node, procedureName, genericItems=None, parameterItems=None, declaredItems=None, statements=None, documentation=None)[source]

Represents a procedure.

Unlike a function, a procedure returns no value. Besides its parameters, it has its own declarative part (DeclaredItems) and statements (Statements).

Example

procedure proc(signal s : in bit; variable v : out bit) is
--        ^^^^                                               <- Identifier
--             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^       <- ParameterItems
  variable tmp : bit;
--^^^^^^^^^^^^^^^^^^^                                        <- DeclaredItems
begin
  tmp := s;
--^^^^^^^^^                                                  <- Statements
  v := tmp;
end procedure;

This class implements a pyGHDL.dom object derived from pyVHDLModel.Subprogram.Procedure.

Inheritance

Inheritance diagram of Procedure

Parameters:
__init__(node, procedureName, genericItems=None, parameterItems=None, declaredItems=None, statements=None, documentation=None)[source]

Initializes a procedure.

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

  • procedureName (str) – The procedure’s identifier.

  • genericItems (List[GenericInterfaceItemMixin]) – List of all generics, in declaration order.

  • parameterItems (List[ParameterInterfaceItemMixin]) – List of all parameters, in declaration order.

  • declaredItems (List) – List of all declared items in this sequential declaration region.

  • statements (List[SequentialStatement]) – List of all sequential statements in the subprogram’s body.

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

Return type:

None

classmethod parse(procedureNode)[source]

Translates the IIR node of the procedure declaration to a Procedure.

Parameters:

procedureNode (TypeVar(Iir, bound= c_int)) – The IIR node of the procedure declaration.

Return type:

Procedure

Returns:

The translated procedure declaration.

_iirNode

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

_position

The IIR node’s position in the source file, resolved on first access and then cached.

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.

property GenericItems: List[GenericInterfaceItemMixin]

Read-only property to access the generic items (_genericItems).

Returns:

List of generic items.

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

A subprogram’s generics and parameters share the declarative region of its declarative part.

Return type:

None

property IsPure: bool

Check if the subprogram is pure (_isPure).

Returns:

True, if the subprogram is pure.

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

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 ParameterItems: List[ParameterInterfaceItemMixin]

Read-only property to access the parameter items (_parameterItems).

Returns:

List of parameter items.

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 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 Statements: List[SequentialStatement]

Read-only property to access the statements (_statements).

Returns:

List of statements.

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 subprogram declaration.

Format: procedure myProcedure(a, b)

Return type:

str

Returns:

Formatted subprogram 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.

_genericItems

List of all generics, in declaration order.

_identifier

The identifier of a model entity.

_isPure

True if the subprogram was declared pure.

_namespace

The namespace of this sequential declaration region.

_normalizedIdentifier

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

_parameterItems

List of all parameters, in declaration order.

_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.

_statements

List of all sequential statements in the subprogram’s body.

_subprogramKeyword = 'procedure'

The VHDL keyword introducing this subprogram kind.

_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.Subprogram.FunctionInstantiation(node, functionName, subprogramReference, genericAssociationItems=None, documentation=None)[source]

Example

function add_int is new work.pkg.generic_add generic map (T => integer);

Note

Neither ReturnType nor IsPure can be read here: verified against real GHDL that Get_Return_Type/Get_Pure_Flag on a Function_Instantiation_Declaration are not resolved at the parse-only level this project operates at (Get_Pure_Flag returns False even for an actually-pure referenced function) - both are properties of the referenced uninstantiated function, not the instantiation itself, and can only be known by resolving it.

Inheritance

Inheritance diagram of FunctionInstantiation

Parameters:
  • node (Iir)

  • functionName (str)

  • subprogramReference (Symbol)

  • genericAssociationItems (List)

  • documentation (str)

__init__(node, functionName, subprogramReference, genericAssociationItems=None, documentation=None)[source]

Initializes a function instantiation.

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

  • functionName (str) – The function’s identifier.

  • subprogramReference (Symbol) – Reference to the instantiated generic subprogram.

  • genericAssociationItems (List) – List of all generic associations in the generic map aspect.

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

Return type:

None

classmethod parse(functionNode)[source]

Translates the IIR node of the function declaration to a FunctionInstantiation.

Parameters:

functionNode (TypeVar(Iir, bound= c_int)) – The IIR node of the function declaration.

Return type:

FunctionInstantiation

Returns:

The translated function declaration.

_iirNode

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

_position

The IIR node’s position in the source file, resolved on first access and then cached.

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.

property GenericAssociationItems: List[GenericAssociationItem]

Read-only property to access the generic associations (_genericAssociationItems).

Returns:

List of generic association items.

property GenericItems: List[GenericInterfaceItemMixin]

Read-only property to access the generic items (_genericItems).

Returns:

List of generic items.

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

A subprogram’s generics and parameters share the declarative region of its declarative part.

Return type:

None

property IsPure: bool

Check if the subprogram is pure (_isPure).

Returns:

True, if the subprogram is pure.

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

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 ParameterItems: List[ParameterInterfaceItemMixin]

Read-only property to access the parameter items (_parameterItems).

Returns:

List of parameter items.

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 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 ReturnType: SubtypeSymbol | None

Read-only property to access the return type (_returnType).

Returns:

The return type, or None if not set.

property Statements: List[SequentialStatement]

Read-only property to access the statements (_statements).

Returns:

List of statements.

property SubprogramReference: SubprogramReferenceSymbol

Read-only property to access the subprogram reference (_subprogramReference).

Returns:

The subprogram reference.

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 subprogram declaration.

Format: procedure myProcedure(a, b)

Return type:

str

Returns:

Formatted subprogram 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.

_genericAssociationItems

List of all generic associations.

_genericItems

List of all generics, in declaration order.

_identifier

The identifier of a model entity.

_isPure

True if the subprogram was declared pure.

_namespace

The namespace of this sequential declaration region.

_normalizedIdentifier

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

_parameterItems

List of all parameters, in declaration order.

_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.

_returnType

Reference to the subtype of the function’s return value.

_statements

List of all sequential statements in the subprogram’s body.

_subprogramKeyword = 'function'

The VHDL keyword introducing this subprogram kind.

_subprogramReference

Reference to the instantiated generic subprogram.

_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.Subprogram.ProcedureInstantiation(node, procedureName, subprogramReference, genericAssociationItems=None, documentation=None)[source]

Example

procedure my_proc is new work.pkg.generic_proc generic map (T => integer);

Inheritance

Inheritance diagram of ProcedureInstantiation

Parameters:
  • node (Iir)

  • procedureName (str)

  • subprogramReference (Symbol)

  • genericAssociationItems (List)

  • documentation (str)

__init__(node, procedureName, subprogramReference, genericAssociationItems=None, documentation=None)[source]

Initializes a procedure instantiation.

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

  • procedureName (str) – The procedure’s identifier.

  • subprogramReference (Symbol) – Reference to the instantiated generic subprogram.

  • genericAssociationItems (List) – List of all generic associations in the generic map aspect.

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

Return type:

None

classmethod parse(procedureNode)[source]

Translates the IIR node of the procedure declaration to a ProcedureInstantiation.

Parameters:

procedureNode (TypeVar(Iir, bound= c_int)) – The IIR node of the procedure declaration.

Return type:

ProcedureInstantiation

Returns:

The translated procedure declaration.

_iirNode

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

_position

The IIR node’s position in the source file, resolved on first access and then cached.

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.

property GenericAssociationItems: List[GenericAssociationItem]

Read-only property to access the generic associations (_genericAssociationItems).

Returns:

List of generic association items.

property GenericItems: List[GenericInterfaceItemMixin]

Read-only property to access the generic items (_genericItems).

Returns:

List of generic items.

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

A subprogram’s generics and parameters share the declarative region of its declarative part.

Return type:

None

property IsPure: bool

Check if the subprogram is pure (_isPure).

Returns:

True, if the subprogram is pure.

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

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 ParameterItems: List[ParameterInterfaceItemMixin]

Read-only property to access the parameter items (_parameterItems).

Returns:

List of parameter items.

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 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 Statements: List[SequentialStatement]

Read-only property to access the statements (_statements).

Returns:

List of statements.

property SubprogramReference: SubprogramReferenceSymbol

Read-only property to access the subprogram reference (_subprogramReference).

Returns:

The subprogram reference.

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 subprogram declaration.

Format: procedure myProcedure(a, b)

Return type:

str

Returns:

Formatted subprogram 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.

_genericAssociationItems

List of all generic associations.

_genericItems

List of all generics, in declaration order.

_identifier

The identifier of a model entity.

_isPure

True if the subprogram was declared pure.

_namespace

The namespace of this sequential declaration region.

_normalizedIdentifier

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

_parameterItems

List of all parameters, in declaration order.

_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.

_statements

List of all sequential statements in the subprogram’s body.

_subprogramKeyword = 'procedure'

The VHDL keyword introducing this subprogram kind.

_subprogramReference

Reference to the instantiated generic subprogram.

_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.