pyGHDL.dom.Attribute

Classes


Classes

class pyGHDL.dom.Attribute.Attribute(node, identifier, subtype, documentation=None)[source]

Inheritance

Inheritance diagram of Attribute

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

Initializes an attribute declaration.

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

  • subtype (Symbol) – Reference to the attribute’s subtype.

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

  • parent – The parent model entity of this entity.

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

property Subtype: None

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

Format: attribute myAttribute: bit

Return type:

str

Returns:

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

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.

_subtype: Symbol

Reference to the attribute’s subtype.

class pyGHDL.dom.Attribute.AttributeSpecification(node, identifiers, attribute, entityClass, expression, documentation=None)[source]

Inheritance

Inheritance diagram of AttributeSpecification

Parameters:
  • node (Iir)

  • identifiers (List[Name])

  • attribute (Name)

  • entityClass (EntityClass)

  • expression (<module 'pyGHDL.dom.Expression' from '/home/runner/work/ghdl/ghdl/pyGHDL/dom/Expression.py'>)

  • documentation (str)

__init__(node, identifiers, attribute, entityClass, expression, documentation=None)[source]

Initializes an attribute specification.

Parameters:
  • identifiers (List[Name]) – List of all names the attribute is specified for.

  • attribute (Name) – Reference to the specified attribute.

  • entityClass (EntityClass) – The entity class the named items belong to.

  • expression (<module ‘pyGHDL.dom.Expression’ from ‘/home/runner/work/ghdl/ghdl/pyGHDL/dom/Expression.py’>) – The value assigned to the attribute.

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

  • parent – The parent model entity of this entity.

  • node (Iir)

Return type:

None

property Attribute: Name

Read-only property to access the attribute (_attribute).

Returns:

The attribute.

property Documentation: str | None

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

Returns:

Associated documentation of a model entity.

property EntityClass: <pyTooling.Decorators.readonly object at 0x7c5266554ad0>

Read-only property to access the entity class (_entityClass).

Returns:

The entity class.

property Expression: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the expression (_expression).

Returns:

The expression.

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

Read-only property to access the identifiers (_identifiers).

Returns:

List of 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.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

_attribute: Name

Reference to the specified attribute.

_documentation: str | None

The associated documentation of a model entity.

_entityClass: <pyTooling.Decorators.readonly object at 0x7c5266554ad0>

The entity class the named items belong to.

_expression: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

The value assigned to the attribute.

_identifiers: List[Name]

List of all names the attribute is specified for.

_parent: ModelEntity

Reference to a parent entity in the logical model hierarchy.