pyGHDL.dom.Range

Classes

  • SimpleRange: A range with both bounds given as expressions, e.g. 0 to 7.

  • RangeFromName: A range denoted by a name, so its bounds are inferred from whatever that name references.


Classes

class pyGHDL.dom.Range.SimpleRange(node, leftBound, rightBound, direction)[source]

Inheritance

Inheritance diagram of SimpleRange

Parameters:
__init__(node, leftBound, rightBound, direction)[source]

Initialize a simple range.

Parameters:
  • leftBound (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The range’s left bound.

  • rightBound (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The range’s right bound.

  • direction (Direction) – The range’s direction (to or downto).

  • parent – The parent model entity.

  • node (Iir)

Return type:

None

property Direction: <pyTooling.Decorators.readonly object at 0x7c5266cb9550>

Read-only property to access the range’s direction (_direction).

Returns:

The direction.

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 LeftBound: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the range’s left bound (_leftBound).

Returns:

The left bound.

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 RightBound: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal

Read-only property to access the range’s right bound (_rightBound).

Returns:

The right bound.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

__str__()[source]

Formats the simple range.

Format: 0 to 7

Return type:

str

Returns:

Formatted simple range.

_direction

The range’s direction, either ascending (to) or descending (downto).

_leftBound

The range’s left bound.

_parent

Reference to a parent entity in the logical model hierarchy.

_rightBound

The range’s right bound.

class pyGHDL.dom.Range.RangeFromName(node, symbol)[source]

Inheritance

Inheritance diagram of RangeFromName

Parameters:
__init__(node, symbol)[source]

Initialize a range denoted by a name.

Parameters:
  • symbol (Symbol) – The symbol referencing the range attribute or discrete subtype.

  • parent – The parent model entity.

  • node (Iir)

Return type:

None

GetAncestor(type)

Return the closest ancestor of the given type found by walking the parent chain upwards.

Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an ancestor of the requested type is found.

Parameters:

type (Type) – Class (type) of the ancestor to find.

Return type:

ModelEntity

Returns:

The closest ancestor of the requested type.

Raises:

VHDLModelException – If the root of the model is reached without finding an ancestor of the requested type.

classmethod GetMethodsWithAttributes(predicate: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
Parameters:

predicate (TypeVar(TAttr) | Iterable[TypeVar(TAttr)] | None) – An attribute class, an iterable of attribute classes, or None to accept every attribute.

Return type:

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

Returns:

Dictionary of methods and the matching attributes attached to them.

Raises:
  • ValueError – If an element of parameter ‘predicate’ is not a sub-class of Attribute.

  • ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.

property Parent: ModelEntity

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

Returns:

Reference to the parent entity.

property Position: <pyTooling.Decorators.readonly object at 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 Symbol: Symbol

Read-only property to access the referenced symbol (_symbol).

Returns:

The symbol.

__getstate__() Dict[str, Any]

Helper for pickle.

Return type:

Dict[str, Any]

__str__()[source]

Formats the range denoted by a name.

Format: v'range

Return type:

str

Returns:

Formatted range denoted by a name.

_parent

Reference to a parent entity in the logical model hierarchy.

_symbol

Reference to the name the range’s bounds are inferred from.