pyGHDL.dom.Sequential
This module implements derived sequential statement classes from pyVHDLModel.Sequential.
Classes
IfBranch: This class implements apyGHDL.domobject derived frompyVHDLModel.Sequential.IfBranch.ElsifBranch: This class implements apyGHDL.domobject derived frompyVHDLModel.Sequential.ElsifBranch.ElseBranch: This class implements apyGHDL.domobject derived frompyVHDLModel.Sequential.ElseBranch.IfStatement: This class implements apyGHDL.domobject derived frompyVHDLModel.Sequential.IfStatement.IndexedChoice: This class implements apyGHDL.domobject derived frompyVHDLModel.Sequential.IndexedChoice.RangedChoice: This class implements apyGHDL.domobject derived frompyVHDLModel.Sequential.RangedChoice.Case: This class implements apyGHDL.domobject derived frompyVHDLModel.Sequential.Case.OthersCase: This class implements apyGHDL.domobject derived frompyVHDLModel.Sequential.OthersCase.CaseStatement: This class implements apyGHDL.domobject derived frompyVHDLModel.Sequential.CaseStatement.EndlessLoopStatement: This class implements apyGHDL.domobject derived frompyVHDLModel.Sequential.EndlessLoopStatement.ForLoopStatement: This class implements apyGHDL.domobject derived frompyVHDLModel.Sequential.ForLoopStatement.WhileLoopStatement: This class implements apyGHDL.domobject derived frompyVHDLModel.Sequential.WhileLoopStatement.SequentialSimpleSignalAssignment: This class implements apyGHDL.domobject derived frompyVHDLModel.Sequential.SequentialSimpleSignalAssignment.ConditionalExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Common.ConditionalExpression.SelectedExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Common.SelectedExpression.OthersSelectedExpression: This class implements apyGHDL.domobject derived frompyVHDLModel.Common.OthersSelectedExpression.SequentialVariableAssignment: This class implements apyGHDL.domobject derived frompyVHDLModel.Sequential.SequentialVariableAssignment.SequentialConditionalVariableAssignment: This class implements apyGHDL.domobject derived frompyVHDLModel.Sequential.SequentialConditionalVariableAssignment.SequentialConditionalSignalAssignment: This class implements apyGHDL.domobject derived frompyVHDLModel.Sequential.SequentialConditionalSignalAssignment.SequentialSelectedVariableAssignment: This class implements apyGHDL.domobject derived frompyVHDLModel.Sequential.SequentialSelectedVariableAssignment.SequentialSelectedSignalAssignment: This class implements apyGHDL.domobject derived frompyVHDLModel.Sequential.SequentialSelectedSignalAssignment.SignalForceAssignment: This class implements apyGHDL.domobject derived frompyVHDLModel.Sequential.SignalForceAssignment.SignalReleaseAssignment: This class implements apyGHDL.domobject derived frompyVHDLModel.Sequential.SignalReleaseAssignment.SequentialProcedureCall: This class implements apyGHDL.domobject derived frompyVHDLModel.Sequential.SequentialProcedureCall.SequentialAssertStatement: This class implements apyGHDL.domobject derived frompyVHDLModel.Sequential.SequentialAssertStatement.SequentialReportStatement: This class implements apyGHDL.domobject derived frompyVHDLModel.Sequential.SequentialReportStatement.ReturnStatement: This class implements apyGHDL.domobject derived frompyVHDLModel.Sequential.ReturnStatement.NullStatement: This class implements apyGHDL.domobject derived frompyVHDLModel.Sequential.NullStatement.NextStatement: This class implements apyGHDL.domobject derived frompyVHDLModel.Sequential.NextStatement.ExitStatement: This class implements apyGHDL.domobject derived frompyVHDLModel.Sequential.ExitStatement.WaitStatement: This class implements apyGHDL.domobject derived frompyVHDLModel.Sequential.WaitStatement.
Classes
- class pyGHDL.dom.Sequential.IfBranch(branchNode, condition, statements=None)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Sequential.IfBranch.Represents the
ifbranch of an if statement.The branch’s condition is available as
Condition, its body asStatements.Example
The whole if statement is shown; the bracket marks the part this class represents.
if sel = '0' then -- ┐ IfBranch -- ^^^^^^^^^ -- │ <- Condition s <= '0'; -- │ --^^^^^^^^^ -- ┘ <- Statements elsif sel = '1' then s <= '1'; else s <= '0'; end if;
Inheritance
- Parameters:
branchNode (Iir)
condition (ExpressionUnion)
statements (Iterable[SequentialStatement])
- __init__(branchNode, condition, statements=None)[source]
Initializes an if branch.
- Parameters:
branchNode (
Iir) – The IIR node of the branch this object represents.condition (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The condition under which this branch’s statements are executed.
statements (
Iterable[SequentialStatement]) – Optional, list of all sequential statements in this construct.
- Return type:
None
- _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.
- AddStatement(statement)
Add a sequential statement at the end of this construct.
The statement’s parent is set to this construct.
- Parameters:
statement (
SequentialStatement) – The sequential statement to add.- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
InsertStatement()→ Insert a sequential statement at a position of this construct.
RemoveStatement()→ Remove a sequential statement from this construct.
- property Condition: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal
Read-only property to access the condition of a statement (
_condition).- Returns:
The expression representing the condition of a statement.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- 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
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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.
- InsertStatement(index, statement)
Insert a sequential statement at a position of this construct.
The statement’s parent is set to this construct.
Every label of a process or subprogram body is declared in the process’ or subprogram’s declarative region: the statement’s label and the labels of statements nested in it (in branches, case alternatives and loops) may neither repeat another label of the body, nor an identifier declared in the region. A construct not in a process or subprogram (yet) checks the labels of its own statements. An unlabeled statement declares nothing.
- Parameters:
index (
int) – Position, from0(first) to the number of statements (append). A negative index counts from the end, as forlist.insert():-1inserts before the last statement.statement (
SequentialStatement) – The sequential statement to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
AddStatement()→ Add a sequential statement at the end of this construct.
InsertStatementBefore()→ Insert a sequential statement before another statement.
InsertStatementAfter()→ Insert a sequential statement after another statement.
RemoveStatement()→ Remove a sequential statement from this construct.
MoveStatement()→ Move a sequential statement to a position of this construct.
- InsertStatementAfter(statement, after)
Insert a sequential statement after another statement of this construct.
The statement’s parent is set to this construct.
- Parameters:
statement (
SequentialStatement) – The sequential statement to insert.after (
SequentialStatement) – The statement of this construct to insert after.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a statement of this construct.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
InsertStatement()→ Insert a sequential statement at a position of this construct.
InsertStatementBefore()→ Insert a sequential statement before another statement.
- InsertStatementBefore(statement, before)
Insert a sequential statement before another statement of this construct.
The statement’s parent is set to this construct.
- Parameters:
statement (
SequentialStatement) – The sequential statement to insert.before (
SequentialStatement) – The statement of this construct to insert before.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a statement of this construct.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
InsertStatement()→ Insert a sequential statement at a position of this construct.
InsertStatementAfter()→ Insert a sequential statement after another statement.
- property IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- MoveStatement(statement, index)
Move a sequential statement to a position of this construct.
The statement stays a statement of this construct: only the order of the statements changes.
- Parameters:
statement (
SequentialStatement) – The sequential statement to move.index (
int) – Position of the statement after the move, from0(first) to the number of statements minus one (last). A negative index counts from the end, as for alistindex:-1moves the statement to the end.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveStatementBefore()→ Move a sequential statement before another statement.
MoveStatementAfter()→ Move a sequential statement after another statement.
InsertStatement()→ Insert a sequential statement at a position of this construct.
RemoveStatement()→ Remove a sequential statement from this construct.
- MoveStatementAfter(statement, after)
Move a sequential statement after another statement of this construct.
The statement stays a statement of this construct: only the order of the statements changes, as for
MoveStatement(). Moving a statement after itself keeps it in place.- Parameters:
statement (
SequentialStatement) – The sequential statement to move.after (
SequentialStatement) – The statement of this construct to move after.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a statement of this construct.
- Return type:
See also
MoveStatement()→ Move a sequential statement to a position of this construct.
MoveStatementBefore()→ Move a sequential statement before another statement.
- MoveStatementBefore(statement, before)
Move a sequential statement before another statement of this construct.
The statement stays a statement of this construct: only the order of the statements changes, as for
MoveStatement(). Moving a statement before itself keeps it in place.- Parameters:
statement (
SequentialStatement) – The sequential statement to move.before (
SequentialStatement) – The statement of this construct to move before.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a statement of this construct.
- Return type:
See also
MoveStatement()→ Move a sequential statement to a position of this construct.
MoveStatementAfter()→ Move a sequential statement after another statement.
- 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- RemoveStatement(statement)
Remove a sequential statement from this construct.
The statement is detached: its parent is cleared. The statement itself is unchanged and can be added to another construct, or inserted at another position; its labels are free again in this construct’s declarative region.
- Parameters:
statement (
SequentialStatement) – The sequential statement to remove.- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
- Return type:
See also
AddStatement()→ Add a sequential statement at the end of this construct.
InsertStatement()→ Insert a sequential statement at a position of this construct.
MoveStatement()→ Move a sequential statement to a position of this construct.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- property Statements: list[SequentialStatement]
Read-only property to access the list of sequential statements (
_statements).- Returns:
A list of sequential statements.
- _IterateStatementRegions()
Iterate the declarative regions nested in the sequential statements of this construct.
- Return type:
- Returns:
An empty generator: a sequential statement has no declarative region.
- _LabelRegion()
Return the process or subprogram declaring the labels of this branch’s statements.
It’s the region of the construct holding the if statement.
- Return type:
- Returns:
The process or subprogram, or
Noneif the branch isn’t part of one (yet).
- _Labels()
Return the labeled statements of this construct, including the statements nested in compound statements.
Every label of a process or subprogram body is declared in the process’ or subprogram’s declarative region, also a label inside an if branch, a case alternative or a loop.
- Return type:
- Returns:
Tuple of labeled statements, depth-first in statement order.
- static _LabelsOf(statement)
Return a statement, if it’s labeled, and the labeled statements nested in it.
- Parameters:
statement (
SequentialStatement) – The sequential statement.- Return type:
- Returns:
Tuple of labeled statements, depth-first in statement order.
- _VisitStatements(visitor)
Walk the sequential statements in statement order with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _condition
The condition guarding this statement.
- _documentation
The associated documentation of a model entity.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- _statements
List of all sequential statements in this construct.
- class pyGHDL.dom.Sequential.ElsifBranch(branchNode, condition, statements=None)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Sequential.ElsifBranch.Represents an
elsifbranch of an if statement.The branch’s condition is available as
Condition, its body asStatements. An if statement may have any number of them.Example
The whole if statement is shown; the bracket marks the part this class represents.
if sel = '0' then s <= '0'; elsif sel = '1' then -- ┐ ElsifBranch -- ^^^^^^^^^ -- │ <- Condition s <= '1'; -- │ --^^^^^^^^^ -- ┘ <- Statements else s <= '0'; end if;
Inheritance
- Parameters:
branchNode (Iir)
condition (ExpressionUnion)
statements (Iterable[SequentialStatement])
- __init__(branchNode, condition, statements=None)[source]
Initializes an elsif branch of an if statement.
- Parameters:
branchNode (
Iir) – The IIR node of the branch this object represents.condition (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The condition under which this branch’s statements are executed.
statements (
Iterable[SequentialStatement]) – Optional, list of all sequential statements in this construct.
- Return type:
None
- classmethod parse(branchNode, condition, label)[source]
Translates the IIR node of the branch to an
ElsifBranch.
- _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.
- AddStatement(statement)
Add a sequential statement at the end of this construct.
The statement’s parent is set to this construct.
- Parameters:
statement (
SequentialStatement) – The sequential statement to add.- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
InsertStatement()→ Insert a sequential statement at a position of this construct.
RemoveStatement()→ Remove a sequential statement from this construct.
- property Condition: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal
Read-only property to access the condition of a statement (
_condition).- Returns:
The expression representing the condition of a statement.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- 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
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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.
- InsertStatement(index, statement)
Insert a sequential statement at a position of this construct.
The statement’s parent is set to this construct.
Every label of a process or subprogram body is declared in the process’ or subprogram’s declarative region: the statement’s label and the labels of statements nested in it (in branches, case alternatives and loops) may neither repeat another label of the body, nor an identifier declared in the region. A construct not in a process or subprogram (yet) checks the labels of its own statements. An unlabeled statement declares nothing.
- Parameters:
index (
int) – Position, from0(first) to the number of statements (append). A negative index counts from the end, as forlist.insert():-1inserts before the last statement.statement (
SequentialStatement) – The sequential statement to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
AddStatement()→ Add a sequential statement at the end of this construct.
InsertStatementBefore()→ Insert a sequential statement before another statement.
InsertStatementAfter()→ Insert a sequential statement after another statement.
RemoveStatement()→ Remove a sequential statement from this construct.
MoveStatement()→ Move a sequential statement to a position of this construct.
- InsertStatementAfter(statement, after)
Insert a sequential statement after another statement of this construct.
The statement’s parent is set to this construct.
- Parameters:
statement (
SequentialStatement) – The sequential statement to insert.after (
SequentialStatement) – The statement of this construct to insert after.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a statement of this construct.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
InsertStatement()→ Insert a sequential statement at a position of this construct.
InsertStatementBefore()→ Insert a sequential statement before another statement.
- InsertStatementBefore(statement, before)
Insert a sequential statement before another statement of this construct.
The statement’s parent is set to this construct.
- Parameters:
statement (
SequentialStatement) – The sequential statement to insert.before (
SequentialStatement) – The statement of this construct to insert before.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a statement of this construct.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
InsertStatement()→ Insert a sequential statement at a position of this construct.
InsertStatementAfter()→ Insert a sequential statement after another statement.
- property IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- MoveStatement(statement, index)
Move a sequential statement to a position of this construct.
The statement stays a statement of this construct: only the order of the statements changes.
- Parameters:
statement (
SequentialStatement) – The sequential statement to move.index (
int) – Position of the statement after the move, from0(first) to the number of statements minus one (last). A negative index counts from the end, as for alistindex:-1moves the statement to the end.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveStatementBefore()→ Move a sequential statement before another statement.
MoveStatementAfter()→ Move a sequential statement after another statement.
InsertStatement()→ Insert a sequential statement at a position of this construct.
RemoveStatement()→ Remove a sequential statement from this construct.
- MoveStatementAfter(statement, after)
Move a sequential statement after another statement of this construct.
The statement stays a statement of this construct: only the order of the statements changes, as for
MoveStatement(). Moving a statement after itself keeps it in place.- Parameters:
statement (
SequentialStatement) – The sequential statement to move.after (
SequentialStatement) – The statement of this construct to move after.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a statement of this construct.
- Return type:
See also
MoveStatement()→ Move a sequential statement to a position of this construct.
MoveStatementBefore()→ Move a sequential statement before another statement.
- MoveStatementBefore(statement, before)
Move a sequential statement before another statement of this construct.
The statement stays a statement of this construct: only the order of the statements changes, as for
MoveStatement(). Moving a statement before itself keeps it in place.- Parameters:
statement (
SequentialStatement) – The sequential statement to move.before (
SequentialStatement) – The statement of this construct to move before.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a statement of this construct.
- Return type:
See also
MoveStatement()→ Move a sequential statement to a position of this construct.
MoveStatementAfter()→ Move a sequential statement after another statement.
- 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- RemoveStatement(statement)
Remove a sequential statement from this construct.
The statement is detached: its parent is cleared. The statement itself is unchanged and can be added to another construct, or inserted at another position; its labels are free again in this construct’s declarative region.
- Parameters:
statement (
SequentialStatement) – The sequential statement to remove.- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
- Return type:
See also
AddStatement()→ Add a sequential statement at the end of this construct.
InsertStatement()→ Insert a sequential statement at a position of this construct.
MoveStatement()→ Move a sequential statement to a position of this construct.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- property Statements: list[SequentialStatement]
Read-only property to access the list of sequential statements (
_statements).- Returns:
A list of sequential statements.
- _IterateStatementRegions()
Iterate the declarative regions nested in the sequential statements of this construct.
- Return type:
- Returns:
An empty generator: a sequential statement has no declarative region.
- _LabelRegion()
Return the process or subprogram declaring the labels of this branch’s statements.
It’s the region of the construct holding the if statement.
- Return type:
- Returns:
The process or subprogram, or
Noneif the branch isn’t part of one (yet).
- _Labels()
Return the labeled statements of this construct, including the statements nested in compound statements.
Every label of a process or subprogram body is declared in the process’ or subprogram’s declarative region, also a label inside an if branch, a case alternative or a loop.
- Return type:
- Returns:
Tuple of labeled statements, depth-first in statement order.
- static _LabelsOf(statement)
Return a statement, if it’s labeled, and the labeled statements nested in it.
- Parameters:
statement (
SequentialStatement) – The sequential statement.- Return type:
- Returns:
Tuple of labeled statements, depth-first in statement order.
- _VisitStatements(visitor)
Walk the sequential statements in statement order with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _condition
The condition guarding this statement.
- _documentation
The associated documentation of a model entity.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- _statements
List of all sequential statements in this construct.
- class pyGHDL.dom.Sequential.ElseBranch(branchNode, statements=None)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Sequential.ElseBranch.Represents the
elsebranch of an if statement.Unlike the other branches, an else branch has no condition; it only has a body (
Statements). An if statement has at most one.Example
The whole if statement is shown; the bracket marks the part this class represents.
if sel = '0' then s <= '0'; elsif sel = '1' then s <= '1'; else -- ┐ ElseBranch s <= '0'; -- │ --^^^^^^^^^ -- ┘ <- Statements end if;
Inheritance
- Parameters:
branchNode (Iir)
statements (Iterable[SequentialStatement])
- __init__(branchNode, statements=None)[source]
Initializes an else branch.
- Parameters:
branchNode (
Iir) – The IIR node of the branch this object represents.statements (
Iterable[SequentialStatement]) – Optional, list of all sequential statements in this construct.
- Return type:
None
- classmethod parse(branchNode, label)[source]
Translates the IIR node of the branch to an
ElseBranch.
- _position: Position
The IIR node’s position in the source file, resolved on first access and then cached.
- AddStatement(statement)
Add a sequential statement at the end of this construct.
The statement’s parent is set to this construct.
- Parameters:
statement (
SequentialStatement) – The sequential statement to add.- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
InsertStatement()→ Insert a sequential statement at a position of this construct.
RemoveStatement()→ Remove a sequential statement from this construct.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- 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
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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.
- InsertStatement(index, statement)
Insert a sequential statement at a position of this construct.
The statement’s parent is set to this construct.
Every label of a process or subprogram body is declared in the process’ or subprogram’s declarative region: the statement’s label and the labels of statements nested in it (in branches, case alternatives and loops) may neither repeat another label of the body, nor an identifier declared in the region. A construct not in a process or subprogram (yet) checks the labels of its own statements. An unlabeled statement declares nothing.
- Parameters:
index (
int) – Position, from0(first) to the number of statements (append). A negative index counts from the end, as forlist.insert():-1inserts before the last statement.statement (
SequentialStatement) – The sequential statement to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
AddStatement()→ Add a sequential statement at the end of this construct.
InsertStatementBefore()→ Insert a sequential statement before another statement.
InsertStatementAfter()→ Insert a sequential statement after another statement.
RemoveStatement()→ Remove a sequential statement from this construct.
MoveStatement()→ Move a sequential statement to a position of this construct.
- InsertStatementAfter(statement, after)
Insert a sequential statement after another statement of this construct.
The statement’s parent is set to this construct.
- Parameters:
statement (
SequentialStatement) – The sequential statement to insert.after (
SequentialStatement) – The statement of this construct to insert after.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a statement of this construct.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
InsertStatement()→ Insert a sequential statement at a position of this construct.
InsertStatementBefore()→ Insert a sequential statement before another statement.
- InsertStatementBefore(statement, before)
Insert a sequential statement before another statement of this construct.
The statement’s parent is set to this construct.
- Parameters:
statement (
SequentialStatement) – The sequential statement to insert.before (
SequentialStatement) – The statement of this construct to insert before.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a statement of this construct.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
InsertStatement()→ Insert a sequential statement at a position of this construct.
InsertStatementAfter()→ Insert a sequential statement after another statement.
- property IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- MoveStatement(statement, index)
Move a sequential statement to a position of this construct.
The statement stays a statement of this construct: only the order of the statements changes.
- Parameters:
statement (
SequentialStatement) – The sequential statement to move.index (
int) – Position of the statement after the move, from0(first) to the number of statements minus one (last). A negative index counts from the end, as for alistindex:-1moves the statement to the end.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveStatementBefore()→ Move a sequential statement before another statement.
MoveStatementAfter()→ Move a sequential statement after another statement.
InsertStatement()→ Insert a sequential statement at a position of this construct.
RemoveStatement()→ Remove a sequential statement from this construct.
- MoveStatementAfter(statement, after)
Move a sequential statement after another statement of this construct.
The statement stays a statement of this construct: only the order of the statements changes, as for
MoveStatement(). Moving a statement after itself keeps it in place.- Parameters:
statement (
SequentialStatement) – The sequential statement to move.after (
SequentialStatement) – The statement of this construct to move after.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a statement of this construct.
- Return type:
See also
MoveStatement()→ Move a sequential statement to a position of this construct.
MoveStatementBefore()→ Move a sequential statement before another statement.
- MoveStatementBefore(statement, before)
Move a sequential statement before another statement of this construct.
The statement stays a statement of this construct: only the order of the statements changes, as for
MoveStatement(). Moving a statement before itself keeps it in place.- Parameters:
statement (
SequentialStatement) – The sequential statement to move.before (
SequentialStatement) – The statement of this construct to move before.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a statement of this construct.
- Return type:
See also
MoveStatement()→ Move a sequential statement to a position of this construct.
MoveStatementAfter()→ Move a sequential statement after another statement.
- 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- RemoveStatement(statement)
Remove a sequential statement from this construct.
The statement is detached: its parent is cleared. The statement itself is unchanged and can be added to another construct, or inserted at another position; its labels are free again in this construct’s declarative region.
- Parameters:
statement (
SequentialStatement) – The sequential statement to remove.- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
- Return type:
See also
AddStatement()→ Add a sequential statement at the end of this construct.
InsertStatement()→ Insert a sequential statement at a position of this construct.
MoveStatement()→ Move a sequential statement to a position of this construct.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- property Statements: list[SequentialStatement]
Read-only property to access the list of sequential statements (
_statements).- Returns:
A list of sequential statements.
- _IterateStatementRegions()
Iterate the declarative regions nested in the sequential statements of this construct.
- Return type:
- Returns:
An empty generator: a sequential statement has no declarative region.
- _LabelRegion()
Return the process or subprogram declaring the labels of this branch’s statements.
It’s the region of the construct holding the if statement.
- Return type:
- Returns:
The process or subprogram, or
Noneif the branch isn’t part of one (yet).
- _Labels()
Return the labeled statements of this construct, including the statements nested in compound statements.
Every label of a process or subprogram body is declared in the process’ or subprogram’s declarative region, also a label inside an if branch, a case alternative or a loop.
- Return type:
- Returns:
Tuple of labeled statements, depth-first in statement order.
- static _LabelsOf(statement)
Return a statement, if it’s labeled, and the labeled statements nested in it.
- Parameters:
statement (
SequentialStatement) – The sequential statement.- Return type:
- Returns:
Tuple of labeled statements, depth-first in statement order.
- _VisitStatements(visitor)
Walk the sequential statements in statement order with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- _statements: list[SequentialStatement]
List of all sequential statements in this construct.
- class pyGHDL.dom.Sequential.IfStatement(ifNode, ifBranch, elsifBranches=None, elseBranch=None, label=None)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Sequential.IfStatement.Represents an if statement.
An if statement has one
ifbranch (IfBranch), any number ofelsifbranches (ElsIfBranches) and an optionalelsebranch (ElseBranch).Example
Only an
ifbranch:lbl : if sel = '0' then --^^^ <- optional Label s <= '0'; end if;
With
elsifandelsebranches:lbl : if sel = '0' then --^^^ <- optional Label -- ^^^^^^^^^^^^^^^^^ <- IfBranch s <= '0'; elsif sel = '1' then --^^^^^^^^^^^^^^^^^^^^ <- ElsIfBranches[0] s <= '1'; else --^^^^ <- ElseBranch s <= '0'; end if;
See also
Inheritance
- Parameters:
ifNode (Iir)
ifBranch (IfBranch)
elsifBranches (Iterable[ElsifBranch])
elseBranch (ElseBranch)
label (str)
- __init__(ifNode, ifBranch, elsifBranches=None, elseBranch=None, label=None)[source]
Initializes an if statement.
- Parameters:
ifNode (
Iir) – The IIR node of the if statement.ifBranch (
IfBranch) – The mandatory if branch.elsifBranches (
Iterable[ElsifBranch]) – Optional, list of all elsif branches, in the order they were written.elseBranch (
ElseBranch) – Optional, the else branch, orNoneif none was given.label (
str) – Optional, the label of the if statement, orNoneif it has none.
- Return type:
None
- classmethod parse(ifNode, label)[source]
Translates the IIR node of the if statement to an
IfStatement.
- _position: Position
The IIR node’s position in the source file, resolved on first access and then cached.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- property ElsIfBranches: list[ElsifBranch]
Read-only property to access the elsif-branches of the if-statement (
_elsifBranches).- Returns:
List of elsif-branches, in the order they were written.
- property ElseBranch: ElseBranch | None
Read-only property to access the else-branch of the if-statement (
_elseBranch).- Returns:
The else-branch.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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 IfBranch: IfBranch
Read-only property to access the if-branch of the if-statement (
_ifBranch).- Returns:
The if-branch.
- property IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- property Label: str | None
Read-only property to access the model entity’s label (
_label).- Returns:
Label of a model entity.
- property NormalizedLabel: str | None
Read-only property to access the model entity’s normalized label (
_normalizedLabel).See also
- Returns:
Normalized label 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- _END_KEYWORDS: ClassVar[tuple[ReservedWord, ...]] = (ReservedWord.If,)
Reserved words after
end.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _elseBranch: ElseBranch | None
The optional
elsebranch, orNoneif none was given.
- _elsifBranches: list[ElsifBranch]
List of all
elsifbranches, in the order they were written.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Sequential.IndexedChoice(node, expression)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Sequential.IndexedChoice.Represents a case choice given by a single value.
The value is available as
Expression.Example
when 0 => v := '1'; -- ^ <- Expression
Inheritance
- Parameters:
node (Iir)
expression (ExpressionUnion)
- __init__(node, expression)[source]
Initializes a case choice given by a single value.
- Parameters:
node (
Iir) – The IIR node this object was translated from.expression (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression this choice selects on.
- Return type:
None
- _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.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- 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
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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 IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()[source]
Formats the indexed case choice.
Format:
0- Return type:
- Returns:
Formatted indexed case choice.
- _expression: ExpressionUnion
The expression this choice selects on.
- _parent
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Sequential.RangedChoice(node, rng)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Sequential.RangedChoice.Represents a case choice given by a range.
The range is available as
Range.Example
when 1 to 2 => v := '0'; -- ^^^^^^ <- Range
Inheritance
- _position: Position
The IIR node’s position in the source file, resolved on first access and then cached.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- GetAncestor(type)
Return the closest ancestor of the given
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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 IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()[source]
Formats the ranged case choice.
Format:
0 to 3- Return type:
- Returns:
Formatted ranged case choice.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Sequential.Case(node, choices, statements=None)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Sequential.Case.Represents one alternative of a case statement, selected by its choices.
Example
when 1 to 2 => v := '0'; -- ^^^^^^ <- Choices -- ^^^^^^^^^ <- the statements
Inheritance
- Parameters:
node (Iir)
choices (Iterable[SequentialChoice])
statements (Iterable[SequentialStatement])
- __init__(node, choices, statements=None)[source]
Initializes a case.
- Parameters:
node (
Iir) – The IIR node this object was translated from.choices (
Iterable[SequentialChoice]) – List of all choices selecting this alternative.statements (
Iterable[SequentialStatement]) – Optional, list of all sequential statements in this construct.
- Return type:
None
- classmethod parse(caseNode, choices, label)[source]
Translates the IIR node of the alternative to a
Case.- Parameters:
caseNode (
Iir) – The IIR node of the alternative.choices (
Iterable[SequentialChoice]) – List of all choices selecting this alternative.label (
str) – The statement’s label, orNoneif it has none.
- Return type:
- Returns:
The translated alternative.
- _position: Position
The IIR node’s position in the source file, resolved on first access and then cached.
- AddStatement(statement)
Add a sequential statement at the end of this construct.
The statement’s parent is set to this construct.
- Parameters:
statement (
SequentialStatement) – The sequential statement to add.- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
InsertStatement()→ Insert a sequential statement at a position of this construct.
RemoveStatement()→ Remove a sequential statement from this construct.
- property Choices: list[BaseChoice]
Read-only property to access the choices (
_choices).- Returns:
List of choices.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- 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
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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.
- InsertStatement(index, statement)
Insert a sequential statement at a position of this construct.
The statement’s parent is set to this construct.
Every label of a process or subprogram body is declared in the process’ or subprogram’s declarative region: the statement’s label and the labels of statements nested in it (in branches, case alternatives and loops) may neither repeat another label of the body, nor an identifier declared in the region. A construct not in a process or subprogram (yet) checks the labels of its own statements. An unlabeled statement declares nothing.
- Parameters:
index (
int) – Position, from0(first) to the number of statements (append). A negative index counts from the end, as forlist.insert():-1inserts before the last statement.statement (
SequentialStatement) – The sequential statement to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
AddStatement()→ Add a sequential statement at the end of this construct.
InsertStatementBefore()→ Insert a sequential statement before another statement.
InsertStatementAfter()→ Insert a sequential statement after another statement.
RemoveStatement()→ Remove a sequential statement from this construct.
MoveStatement()→ Move a sequential statement to a position of this construct.
- InsertStatementAfter(statement, after)
Insert a sequential statement after another statement of this construct.
The statement’s parent is set to this construct.
- Parameters:
statement (
SequentialStatement) – The sequential statement to insert.after (
SequentialStatement) – The statement of this construct to insert after.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a statement of this construct.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
InsertStatement()→ Insert a sequential statement at a position of this construct.
InsertStatementBefore()→ Insert a sequential statement before another statement.
- InsertStatementBefore(statement, before)
Insert a sequential statement before another statement of this construct.
The statement’s parent is set to this construct.
- Parameters:
statement (
SequentialStatement) – The sequential statement to insert.before (
SequentialStatement) – The statement of this construct to insert before.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a statement of this construct.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
InsertStatement()→ Insert a sequential statement at a position of this construct.
InsertStatementAfter()→ Insert a sequential statement after another statement.
- property IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- MoveStatement(statement, index)
Move a sequential statement to a position of this construct.
The statement stays a statement of this construct: only the order of the statements changes.
- Parameters:
statement (
SequentialStatement) – The sequential statement to move.index (
int) – Position of the statement after the move, from0(first) to the number of statements minus one (last). A negative index counts from the end, as for alistindex:-1moves the statement to the end.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveStatementBefore()→ Move a sequential statement before another statement.
MoveStatementAfter()→ Move a sequential statement after another statement.
InsertStatement()→ Insert a sequential statement at a position of this construct.
RemoveStatement()→ Remove a sequential statement from this construct.
- MoveStatementAfter(statement, after)
Move a sequential statement after another statement of this construct.
The statement stays a statement of this construct: only the order of the statements changes, as for
MoveStatement(). Moving a statement after itself keeps it in place.- Parameters:
statement (
SequentialStatement) – The sequential statement to move.after (
SequentialStatement) – The statement of this construct to move after.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a statement of this construct.
- Return type:
See also
MoveStatement()→ Move a sequential statement to a position of this construct.
MoveStatementBefore()→ Move a sequential statement before another statement.
- MoveStatementBefore(statement, before)
Move a sequential statement before another statement of this construct.
The statement stays a statement of this construct: only the order of the statements changes, as for
MoveStatement(). Moving a statement before itself keeps it in place.- Parameters:
statement (
SequentialStatement) – The sequential statement to move.before (
SequentialStatement) – The statement of this construct to move before.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a statement of this construct.
- Return type:
See also
MoveStatement()→ Move a sequential statement to a position of this construct.
MoveStatementAfter()→ Move a sequential statement after another statement.
- 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- RemoveStatement(statement)
Remove a sequential statement from this construct.
The statement is detached: its parent is cleared. The statement itself is unchanged and can be added to another construct, or inserted at another position; its labels are free again in this construct’s declarative region.
- Parameters:
statement (
SequentialStatement) – The sequential statement to remove.- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
- Return type:
See also
AddStatement()→ Add a sequential statement at the end of this construct.
InsertStatement()→ Insert a sequential statement at a position of this construct.
MoveStatement()→ Move a sequential statement to a position of this construct.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- property Statements: list[SequentialStatement]
Read-only property to access the list of sequential statements (
_statements).- Returns:
A list of sequential statements.
- _IterateStatementRegions()
Iterate the declarative regions nested in the sequential statements of this construct.
- Return type:
- Returns:
An empty generator: a sequential statement has no declarative region.
- _LabelRegion()
Return the process or subprogram declaring the labels of this case alternative’s statements.
It’s the region of the construct holding the case statement.
- Return type:
- Returns:
The process or subprogram, or
Noneif the case alternative isn’t part of one (yet).
- _Labels()
Return the labeled statements of this construct, including the statements nested in compound statements.
Every label of a process or subprogram body is declared in the process’ or subprogram’s declarative region, also a label inside an if branch, a case alternative or a loop.
- Return type:
- Returns:
Tuple of labeled statements, depth-first in statement order.
- static _LabelsOf(statement)
Return a statement, if it’s labeled, and the labeled statements nested in it.
- Parameters:
statement (
SequentialStatement) – The sequential statement.- Return type:
- Returns:
Tuple of labeled statements, depth-first in statement order.
- _VisitStatements(visitor)
Walk the sequential statements in statement order with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()[source]
Formats the case alternative.
Format:
when 0 | 1 =>- Return type:
- Returns:
Formatted case alternative.
- _choices: list[BaseChoice]
List of all choices selecting this alternative.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- _statements: list[SequentialStatement]
List of all sequential statements in this construct.
- class pyGHDL.dom.Sequential.OthersCase(caseNode, statements=None)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Sequential.OthersCase.Represents the
othersalternative of a case statement.It covers every choice not named explicitly.
Example
when others => null; -- ^^^^^^ <- the choice
Inheritance
- Parameters:
caseNode (Iir)
statements (Iterable[SequentialStatement])
- __init__(caseNode, statements=None)[source]
Initializes an others alternative.
- Parameters:
caseNode (
Iir) – The IIR node of the case statement.statements (
Iterable[SequentialStatement]) – Optional, list of all sequential statements in this construct.
- Return type:
None
- classmethod parse(caseNode, label=None)[source]
Translates the IIR node of the alternative to an
OthersCase.
- _position: Position
The IIR node’s position in the source file, resolved on first access and then cached.
- AddStatement(statement)
Add a sequential statement at the end of this construct.
The statement’s parent is set to this construct.
- Parameters:
statement (
SequentialStatement) – The sequential statement to add.- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
InsertStatement()→ Insert a sequential statement at a position of this construct.
RemoveStatement()→ Remove a sequential statement from this construct.
- property Choices: list[BaseChoice]
Read-only property to access the choices (
_choices).- Returns:
List of choices.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- 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
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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.
- InsertStatement(index, statement)
Insert a sequential statement at a position of this construct.
The statement’s parent is set to this construct.
Every label of a process or subprogram body is declared in the process’ or subprogram’s declarative region: the statement’s label and the labels of statements nested in it (in branches, case alternatives and loops) may neither repeat another label of the body, nor an identifier declared in the region. A construct not in a process or subprogram (yet) checks the labels of its own statements. An unlabeled statement declares nothing.
- Parameters:
index (
int) – Position, from0(first) to the number of statements (append). A negative index counts from the end, as forlist.insert():-1inserts before the last statement.statement (
SequentialStatement) – The sequential statement to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
AddStatement()→ Add a sequential statement at the end of this construct.
InsertStatementBefore()→ Insert a sequential statement before another statement.
InsertStatementAfter()→ Insert a sequential statement after another statement.
RemoveStatement()→ Remove a sequential statement from this construct.
MoveStatement()→ Move a sequential statement to a position of this construct.
- InsertStatementAfter(statement, after)
Insert a sequential statement after another statement of this construct.
The statement’s parent is set to this construct.
- Parameters:
statement (
SequentialStatement) – The sequential statement to insert.after (
SequentialStatement) – The statement of this construct to insert after.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a statement of this construct.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
InsertStatement()→ Insert a sequential statement at a position of this construct.
InsertStatementBefore()→ Insert a sequential statement before another statement.
- InsertStatementBefore(statement, before)
Insert a sequential statement before another statement of this construct.
The statement’s parent is set to this construct.
- Parameters:
statement (
SequentialStatement) – The sequential statement to insert.before (
SequentialStatement) – The statement of this construct to insert before.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a statement of this construct.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
InsertStatement()→ Insert a sequential statement at a position of this construct.
InsertStatementAfter()→ Insert a sequential statement after another statement.
- property IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- MoveStatement(statement, index)
Move a sequential statement to a position of this construct.
The statement stays a statement of this construct: only the order of the statements changes.
- Parameters:
statement (
SequentialStatement) – The sequential statement to move.index (
int) – Position of the statement after the move, from0(first) to the number of statements minus one (last). A negative index counts from the end, as for alistindex:-1moves the statement to the end.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveStatementBefore()→ Move a sequential statement before another statement.
MoveStatementAfter()→ Move a sequential statement after another statement.
InsertStatement()→ Insert a sequential statement at a position of this construct.
RemoveStatement()→ Remove a sequential statement from this construct.
- MoveStatementAfter(statement, after)
Move a sequential statement after another statement of this construct.
The statement stays a statement of this construct: only the order of the statements changes, as for
MoveStatement(). Moving a statement after itself keeps it in place.- Parameters:
statement (
SequentialStatement) – The sequential statement to move.after (
SequentialStatement) – The statement of this construct to move after.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a statement of this construct.
- Return type:
See also
MoveStatement()→ Move a sequential statement to a position of this construct.
MoveStatementBefore()→ Move a sequential statement before another statement.
- MoveStatementBefore(statement, before)
Move a sequential statement before another statement of this construct.
The statement stays a statement of this construct: only the order of the statements changes, as for
MoveStatement(). Moving a statement before itself keeps it in place.- Parameters:
statement (
SequentialStatement) – The sequential statement to move.before (
SequentialStatement) – The statement of this construct to move before.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a statement of this construct.
- Return type:
See also
MoveStatement()→ Move a sequential statement to a position of this construct.
MoveStatementAfter()→ Move a sequential statement after another statement.
- 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- RemoveStatement(statement)
Remove a sequential statement from this construct.
The statement is detached: its parent is cleared. The statement itself is unchanged and can be added to another construct, or inserted at another position; its labels are free again in this construct’s declarative region.
- Parameters:
statement (
SequentialStatement) – The sequential statement to remove.- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
- Return type:
See also
AddStatement()→ Add a sequential statement at the end of this construct.
InsertStatement()→ Insert a sequential statement at a position of this construct.
MoveStatement()→ Move a sequential statement to a position of this construct.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- property Statements: list[SequentialStatement]
Read-only property to access the list of sequential statements (
_statements).- Returns:
A list of sequential statements.
- _IterateStatementRegions()
Iterate the declarative regions nested in the sequential statements of this construct.
- Return type:
- Returns:
An empty generator: a sequential statement has no declarative region.
- _LabelRegion()
Return the process or subprogram declaring the labels of this case alternative’s statements.
It’s the region of the construct holding the case statement.
- Return type:
- Returns:
The process or subprogram, or
Noneif the case alternative isn’t part of one (yet).
- _Labels()
Return the labeled statements of this construct, including the statements nested in compound statements.
Every label of a process or subprogram body is declared in the process’ or subprogram’s declarative region, also a label inside an if branch, a case alternative or a loop.
- Return type:
- Returns:
Tuple of labeled statements, depth-first in statement order.
- static _LabelsOf(statement)
Return a statement, if it’s labeled, and the labeled statements nested in it.
- Parameters:
statement (
SequentialStatement) – The sequential statement.- Return type:
- Returns:
Tuple of labeled statements, depth-first in statement order.
- _VisitStatements(visitor)
Walk the sequential statements in statement order with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- __str__()[source]
Formats the
otherscase alternative.Format:
when others =>- Return type:
- Returns:
Formatted
otherscase alternative.
- _choices: list[BaseChoice]
List of all choices selecting this alternative.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- _statements: list[SequentialStatement]
List of all sequential statements in this construct.
- class pyGHDL.dom.Sequential.CaseStatement(caseNode, label, expression, cases)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Sequential.CaseStatement.Represents a case statement.
The expression being tested is available as
SelectExpression, the alternatives asCases.Example
lbl : case sel is --^^^ <- optional Label -- ^^^ <- SelectExpression when '0' => s <= '1'; -- ^^^^^^^^^^^^^^^^^^^^^^^^ <- Cases[0] when others => null; -- ^^^^^^^^^^^^^^^^^^^^ <- Cases[1] end case;
See also
Inheritance
- Parameters:
- __init__(caseNode, label, expression, cases)[source]
Initializes a case statement.
- Parameters:
caseNode (
Iir) – The IIR node of the case statement.label (
str) – The label of the case statement, orNoneif it has none.expression (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The expression being tested.
cases (
Iterable[SequentialCase]) – List of all alternatives, in the order they were written.
- Return type:
None
- classmethod parse(caseNode, label)[source]
Translates the IIR node of the alternative to a
CaseStatement.
- _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 Cases: list[SequentialCase]
Read-only property to access the cases (
_cases).- Returns:
List of cases.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- 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
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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 IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- property Label: str | None
Read-only property to access the model entity’s label (
_label).- Returns:
Label of a model entity.
- property NormalizedLabel: str | None
Read-only property to access the model entity’s normalized label (
_normalizedLabel).See also
- Returns:
Normalized label 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- property SelectExpression: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal
Read-only property to access the select expression (
_expression).- Returns:
The select expression.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _documentation
The associated documentation of a model entity.
- _expression: ExpressionUnion
The expression being tested.
- _label
The label of a model entity.
- _normalizedLabel
The normalized (lower case) label of a model entity.
- _parent
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Sequential.EndlessLoopStatement(loopNode, statements=None, label=None)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Sequential.EndlessLoopStatement.Represents an endless loop statement.
The loop body is available as
Statements. The loop has no iteration scheme, so it is left with an exit or return statement.Example
lbl : loop --^^^ <- optional Label exit; -- ^^^^^ <- Statements end loop;
See also
Inheritance
- __init__(loopNode, statements=None, label=None)[source]
Initializes a loop statement without iteration scheme.
- Parameters:
loopNode (
Iir) – The IIR node of the loop statement.statements (
Iterable[SequentialStatement]) – Optional, list of all sequential statements in this construct.label (
str) – Optional, the label of the loop statement, orNoneif it has none.
- Return type:
None
- classmethod parse(loopNode, label)[source]
Translates the IIR node of the loop statement to an
EndlessLoopStatement.libghdl represents a loop statement without iteration scheme as a
While_Loop_Statementwithout condition.
- _position: Position
The IIR node’s position in the source file, resolved on first access and then cached.
- AddStatement(statement)
Add a sequential statement at the end of this construct.
The statement’s parent is set to this construct.
- Parameters:
statement (
SequentialStatement) – The sequential statement to add.- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
InsertStatement()→ Insert a sequential statement at a position of this construct.
RemoveStatement()→ Remove a sequential statement from this construct.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- 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
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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.
- InsertStatement(index, statement)
Insert a sequential statement at a position of this construct.
The statement’s parent is set to this construct.
Every label of a process or subprogram body is declared in the process’ or subprogram’s declarative region: the statement’s label and the labels of statements nested in it (in branches, case alternatives and loops) may neither repeat another label of the body, nor an identifier declared in the region. A construct not in a process or subprogram (yet) checks the labels of its own statements. An unlabeled statement declares nothing.
- Parameters:
index (
int) – Position, from0(first) to the number of statements (append). A negative index counts from the end, as forlist.insert():-1inserts before the last statement.statement (
SequentialStatement) – The sequential statement to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
AddStatement()→ Add a sequential statement at the end of this construct.
InsertStatementBefore()→ Insert a sequential statement before another statement.
InsertStatementAfter()→ Insert a sequential statement after another statement.
RemoveStatement()→ Remove a sequential statement from this construct.
MoveStatement()→ Move a sequential statement to a position of this construct.
- InsertStatementAfter(statement, after)
Insert a sequential statement after another statement of this construct.
The statement’s parent is set to this construct.
- Parameters:
statement (
SequentialStatement) – The sequential statement to insert.after (
SequentialStatement) – The statement of this construct to insert after.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a statement of this construct.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
InsertStatement()→ Insert a sequential statement at a position of this construct.
InsertStatementBefore()→ Insert a sequential statement before another statement.
- InsertStatementBefore(statement, before)
Insert a sequential statement before another statement of this construct.
The statement’s parent is set to this construct.
- Parameters:
statement (
SequentialStatement) – The sequential statement to insert.before (
SequentialStatement) – The statement of this construct to insert before.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a statement of this construct.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
InsertStatement()→ Insert a sequential statement at a position of this construct.
InsertStatementAfter()→ Insert a sequential statement after another statement.
- property IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- property Label: str | None
Read-only property to access the model entity’s label (
_label).- Returns:
Label of a model entity.
- MoveStatement(statement, index)
Move a sequential statement to a position of this construct.
The statement stays a statement of this construct: only the order of the statements changes.
- Parameters:
statement (
SequentialStatement) – The sequential statement to move.index (
int) – Position of the statement after the move, from0(first) to the number of statements minus one (last). A negative index counts from the end, as for alistindex:-1moves the statement to the end.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveStatementBefore()→ Move a sequential statement before another statement.
MoveStatementAfter()→ Move a sequential statement after another statement.
InsertStatement()→ Insert a sequential statement at a position of this construct.
RemoveStatement()→ Remove a sequential statement from this construct.
- MoveStatementAfter(statement, after)
Move a sequential statement after another statement of this construct.
The statement stays a statement of this construct: only the order of the statements changes, as for
MoveStatement(). Moving a statement after itself keeps it in place.- Parameters:
statement (
SequentialStatement) – The sequential statement to move.after (
SequentialStatement) – The statement of this construct to move after.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a statement of this construct.
- Return type:
See also
MoveStatement()→ Move a sequential statement to a position of this construct.
MoveStatementBefore()→ Move a sequential statement before another statement.
- MoveStatementBefore(statement, before)
Move a sequential statement before another statement of this construct.
The statement stays a statement of this construct: only the order of the statements changes, as for
MoveStatement(). Moving a statement before itself keeps it in place.- Parameters:
statement (
SequentialStatement) – The sequential statement to move.before (
SequentialStatement) – The statement of this construct to move before.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a statement of this construct.
- Return type:
See also
MoveStatement()→ Move a sequential statement to a position of this construct.
MoveStatementAfter()→ Move a sequential statement after another statement.
- property NormalizedLabel: str | None
Read-only property to access the model entity’s normalized label (
_normalizedLabel).See also
- Returns:
Normalized label 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- RemoveStatement(statement)
Remove a sequential statement from this construct.
The statement is detached: its parent is cleared. The statement itself is unchanged and can be added to another construct, or inserted at another position; its labels are free again in this construct’s declarative region.
- Parameters:
statement (
SequentialStatement) – The sequential statement to remove.- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
- Return type:
See also
AddStatement()→ Add a sequential statement at the end of this construct.
InsertStatement()→ Insert a sequential statement at a position of this construct.
MoveStatement()→ Move a sequential statement to a position of this construct.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- property Statements: list[SequentialStatement]
Read-only property to access the list of sequential statements (
_statements).- Returns:
A list of sequential statements.
- _END_KEYWORDS: ClassVar[tuple[ReservedWord, ...]] = (ReservedWord.Loop,)
Reserved words after
end.
- _IterateStatementRegions()
Iterate the declarative regions nested in the sequential statements of this construct.
- Return type:
- Returns:
An empty generator: a sequential statement has no declarative region.
- _LabelRegion()
Return the process or subprogram declaring the labels of this loop’s statements.
It’s the region of the construct holding the loop.
- Return type:
- Returns:
The process or subprogram, or
Noneif the loop isn’t part of one (yet).
- _Labels()
Return the labeled statements of this construct, including the statements nested in compound statements.
Every label of a process or subprogram body is declared in the process’ or subprogram’s declarative region, also a label inside an if branch, a case alternative or a loop.
- Return type:
- Returns:
Tuple of labeled statements, depth-first in statement order.
- static _LabelsOf(statement)
Return a statement, if it’s labeled, and the labeled statements nested in it.
- Parameters:
statement (
SequentialStatement) – The sequential statement.- Return type:
- Returns:
Tuple of labeled statements, depth-first in statement order.
- _VisitStatements(visitor)
Walk the sequential statements in statement order with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- _statements: list[SequentialStatement]
List of all sequential statements in this construct.
- class pyGHDL.dom.Sequential.ForLoopStatement(loopNode, loopIndex, rng, statements=None, label=None)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Sequential.ForLoopStatement.Represents a for-loop statement.
The loop index is available as
LoopIndex, the iteration range asRangeand the loop body asStatements.Example
lbl : for k in 0 to 3 loop --^^^ <- optional Label -- ^ <- LoopIndex -- ^^^^^^ <- Range null; -- ^^^^^ <- Statements end loop;
Inheritance
- Parameters:
- __init__(loopNode, loopIndex, rng, statements=None, label=None)[source]
Initializes a for..loop statement.
- Parameters:
loopNode (
Iir) – The IIR node of the loop statement.loopIndex (
str) – The name of the loop’s index.rng (
Range) – The range the loop iterates over.statements (
Iterable[SequentialStatement]) – Optional, list of all sequential statements in this construct.label (
str) – Optional, the label of the for..loop statement, orNoneif it has none.
- Return type:
None
- classmethod parse(loopNode, label)[source]
Translates the IIR node of the loop statement to a
ForLoopStatement.
- _position: Position
The IIR node’s position in the source file, resolved on first access and then cached.
- AddStatement(statement)
Add a sequential statement at the end of this construct.
The statement’s parent is set to this construct.
- Parameters:
statement (
SequentialStatement) – The sequential statement to add.- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
InsertStatement()→ Insert a sequential statement at a position of this construct.
RemoveStatement()→ Remove a sequential statement from this construct.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- 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
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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.
- InsertStatement(index, statement)
Insert a sequential statement at a position of this construct.
The statement’s parent is set to this construct.
Every label of a process or subprogram body is declared in the process’ or subprogram’s declarative region: the statement’s label and the labels of statements nested in it (in branches, case alternatives and loops) may neither repeat another label of the body, nor an identifier declared in the region. A construct not in a process or subprogram (yet) checks the labels of its own statements. An unlabeled statement declares nothing.
- Parameters:
index (
int) – Position, from0(first) to the number of statements (append). A negative index counts from the end, as forlist.insert():-1inserts before the last statement.statement (
SequentialStatement) – The sequential statement to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
AddStatement()→ Add a sequential statement at the end of this construct.
InsertStatementBefore()→ Insert a sequential statement before another statement.
InsertStatementAfter()→ Insert a sequential statement after another statement.
RemoveStatement()→ Remove a sequential statement from this construct.
MoveStatement()→ Move a sequential statement to a position of this construct.
- InsertStatementAfter(statement, after)
Insert a sequential statement after another statement of this construct.
The statement’s parent is set to this construct.
- Parameters:
statement (
SequentialStatement) – The sequential statement to insert.after (
SequentialStatement) – The statement of this construct to insert after.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a statement of this construct.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
InsertStatement()→ Insert a sequential statement at a position of this construct.
InsertStatementBefore()→ Insert a sequential statement before another statement.
- InsertStatementBefore(statement, before)
Insert a sequential statement before another statement of this construct.
The statement’s parent is set to this construct.
- Parameters:
statement (
SequentialStatement) – The sequential statement to insert.before (
SequentialStatement) – The statement of this construct to insert before.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a statement of this construct.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
InsertStatement()→ Insert a sequential statement at a position of this construct.
InsertStatementAfter()→ Insert a sequential statement after another statement.
- property IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- property Label: str | None
Read-only property to access the model entity’s label (
_label).- Returns:
Label of a model entity.
- property LoopIndex: str
Read-only property to access the loop index (
_loopIndex).- Returns:
The loop index.
- MoveStatement(statement, index)
Move a sequential statement to a position of this construct.
The statement stays a statement of this construct: only the order of the statements changes.
- Parameters:
statement (
SequentialStatement) – The sequential statement to move.index (
int) – Position of the statement after the move, from0(first) to the number of statements minus one (last). A negative index counts from the end, as for alistindex:-1moves the statement to the end.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveStatementBefore()→ Move a sequential statement before another statement.
MoveStatementAfter()→ Move a sequential statement after another statement.
InsertStatement()→ Insert a sequential statement at a position of this construct.
RemoveStatement()→ Remove a sequential statement from this construct.
- MoveStatementAfter(statement, after)
Move a sequential statement after another statement of this construct.
The statement stays a statement of this construct: only the order of the statements changes, as for
MoveStatement(). Moving a statement after itself keeps it in place.- Parameters:
statement (
SequentialStatement) – The sequential statement to move.after (
SequentialStatement) – The statement of this construct to move after.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a statement of this construct.
- Return type:
See also
MoveStatement()→ Move a sequential statement to a position of this construct.
MoveStatementBefore()→ Move a sequential statement before another statement.
- MoveStatementBefore(statement, before)
Move a sequential statement before another statement of this construct.
The statement stays a statement of this construct: only the order of the statements changes, as for
MoveStatement(). Moving a statement before itself keeps it in place.- Parameters:
statement (
SequentialStatement) – The sequential statement to move.before (
SequentialStatement) – The statement of this construct to move before.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a statement of this construct.
- Return type:
See also
MoveStatement()→ Move a sequential statement to a position of this construct.
MoveStatementAfter()→ Move a sequential statement after another statement.
- property NormalizedLabel: str | None
Read-only property to access the model entity’s normalized label (
_normalizedLabel).See also
- Returns:
Normalized label 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- RemoveStatement(statement)
Remove a sequential statement from this construct.
The statement is detached: its parent is cleared. The statement itself is unchanged and can be added to another construct, or inserted at another position; its labels are free again in this construct’s declarative region.
- Parameters:
statement (
SequentialStatement) – The sequential statement to remove.- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
- Return type:
See also
AddStatement()→ Add a sequential statement at the end of this construct.
InsertStatement()→ Insert a sequential statement at a position of this construct.
MoveStatement()→ Move a sequential statement to a position of this construct.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- property Statements: list[SequentialStatement]
Read-only property to access the list of sequential statements (
_statements).- Returns:
A list of sequential statements.
- _END_KEYWORDS: ClassVar[tuple[ReservedWord, ...]] = (ReservedWord.Loop,)
Reserved words after
end.
- _IterateStatementRegions()
Iterate the declarative regions nested in the sequential statements of this construct.
- Return type:
- Returns:
An empty generator: a sequential statement has no declarative region.
- _LabelRegion()
Return the process or subprogram declaring the labels of this loop’s statements.
It’s the region of the construct holding the loop.
- Return type:
- Returns:
The process or subprogram, or
Noneif the loop isn’t part of one (yet).
- _Labels()
Return the labeled statements of this construct, including the statements nested in compound statements.
Every label of a process or subprogram body is declared in the process’ or subprogram’s declarative region, also a label inside an if branch, a case alternative or a loop.
- Return type:
- Returns:
Tuple of labeled statements, depth-first in statement order.
- static _LabelsOf(statement)
Return a statement, if it’s labeled, and the labeled statements nested in it.
- Parameters:
statement (
SequentialStatement) – The sequential statement.- Return type:
- Returns:
Tuple of labeled statements, depth-first in statement order.
- _VisitStatements(visitor)
Walk the sequential statements in statement order with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- _statements: list[SequentialStatement]
List of all sequential statements in this construct.
- class pyGHDL.dom.Sequential.WhileLoopStatement(loopNode, condition, statements=None, label=None)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Sequential.WhileLoopStatement.Represents a while-loop statement.
The loop condition is available as
Condition, the loop body asStatements.Example
lbl : while i < 4 loop --^^^ <- optional Label -- ^^^^^ <- Condition null; -- ^^^^^ <- Statements end loop;
See also
Inheritance
- Parameters:
- __init__(loopNode, condition, statements=None, label=None)[source]
Initializes a while..loop statement.
- Parameters:
loopNode (
Iir) – The IIR node of the loop statement.condition (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The condition tested before each iteration; the loop ends when it is false.
statements (
Iterable[SequentialStatement]) – Optional, list of all sequential statements in this construct.label (
str) – Optional, the label of the while..loop statement, orNoneif it has none.
- Return type:
None
- classmethod parse(loopNode, label)[source]
Translates the IIR node of the loop statement to a
WhileLoopStatement.
- _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.
- AddStatement(statement)
Add a sequential statement at the end of this construct.
The statement’s parent is set to this construct.
- Parameters:
statement (
SequentialStatement) – The sequential statement to add.- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
InsertStatement()→ Insert a sequential statement at a position of this construct.
RemoveStatement()→ Remove a sequential statement from this construct.
- property Condition: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal
Read-only property to access the condition of a statement (
_condition).- Returns:
The expression representing the condition of a statement.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- 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
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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.
- InsertStatement(index, statement)
Insert a sequential statement at a position of this construct.
The statement’s parent is set to this construct.
Every label of a process or subprogram body is declared in the process’ or subprogram’s declarative region: the statement’s label and the labels of statements nested in it (in branches, case alternatives and loops) may neither repeat another label of the body, nor an identifier declared in the region. A construct not in a process or subprogram (yet) checks the labels of its own statements. An unlabeled statement declares nothing.
- Parameters:
index (
int) – Position, from0(first) to the number of statements (append). A negative index counts from the end, as forlist.insert():-1inserts before the last statement.statement (
SequentialStatement) – The sequential statement to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
AddStatement()→ Add a sequential statement at the end of this construct.
InsertStatementBefore()→ Insert a sequential statement before another statement.
InsertStatementAfter()→ Insert a sequential statement after another statement.
RemoveStatement()→ Remove a sequential statement from this construct.
MoveStatement()→ Move a sequential statement to a position of this construct.
- InsertStatementAfter(statement, after)
Insert a sequential statement after another statement of this construct.
The statement’s parent is set to this construct.
- Parameters:
statement (
SequentialStatement) – The sequential statement to insert.after (
SequentialStatement) – The statement of this construct to insert after.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a statement of this construct.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
InsertStatement()→ Insert a sequential statement at a position of this construct.
InsertStatementBefore()→ Insert a sequential statement before another statement.
- InsertStatementBefore(statement, before)
Insert a sequential statement before another statement of this construct.
The statement’s parent is set to this construct.
- Parameters:
statement (
SequentialStatement) – The sequential statement to insert.before (
SequentialStatement) – The statement of this construct to insert before.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
SequentialStatement.AlreadyInDesignError – If parameter ‘statement’ already has a parent.
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a statement of this construct.
DuplicateLabelError – If the declarative region already declares a label of the statement.
- Return type:
See also
InsertStatement()→ Insert a sequential statement at a position of this construct.
InsertStatementAfter()→ Insert a sequential statement after another statement.
- property IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- property Label: str | None
Read-only property to access the model entity’s label (
_label).- Returns:
Label of a model entity.
- MoveStatement(statement, index)
Move a sequential statement to a position of this construct.
The statement stays a statement of this construct: only the order of the statements changes.
- Parameters:
statement (
SequentialStatement) – The sequential statement to move.index (
int) – Position of the statement after the move, from0(first) to the number of statements minus one (last). A negative index counts from the end, as for alistindex:-1moves the statement to the end.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
- Return type:
See also
MoveStatementBefore()→ Move a sequential statement before another statement.
MoveStatementAfter()→ Move a sequential statement after another statement.
InsertStatement()→ Insert a sequential statement at a position of this construct.
RemoveStatement()→ Remove a sequential statement from this construct.
- MoveStatementAfter(statement, after)
Move a sequential statement after another statement of this construct.
The statement stays a statement of this construct: only the order of the statements changes, as for
MoveStatement(). Moving a statement after itself keeps it in place.- Parameters:
statement (
SequentialStatement) – The sequential statement to move.after (
SequentialStatement) – The statement of this construct to move after.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
ValueError – If parameter ‘after’ is
None.TypeError – If parameter ‘after’ is not of type
ModelEntity.NotAChildError – If parameter ‘after’ is not a statement of this construct.
- Return type:
See also
MoveStatement()→ Move a sequential statement to a position of this construct.
MoveStatementBefore()→ Move a sequential statement before another statement.
- MoveStatementBefore(statement, before)
Move a sequential statement before another statement of this construct.
The statement stays a statement of this construct: only the order of the statements changes, as for
MoveStatement(). Moving a statement before itself keeps it in place.- Parameters:
statement (
SequentialStatement) – The sequential statement to move.before (
SequentialStatement) – The statement of this construct to move before.
- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
ValueError – If parameter ‘before’ is
None.TypeError – If parameter ‘before’ is not of type
ModelEntity.NotAChildError – If parameter ‘before’ is not a statement of this construct.
- Return type:
See also
MoveStatement()→ Move a sequential statement to a position of this construct.
MoveStatementAfter()→ Move a sequential statement after another statement.
- property NormalizedLabel: str | None
Read-only property to access the model entity’s normalized label (
_normalizedLabel).See also
- Returns:
Normalized label 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- RemoveStatement(statement)
Remove a sequential statement from this construct.
The statement is detached: its parent is cleared. The statement itself is unchanged and can be added to another construct, or inserted at another position; its labels are free again in this construct’s declarative region.
- Parameters:
statement (
SequentialStatement) – The sequential statement to remove.- Raises:
ValueError – If parameter ‘statement’ is
None.TypeError – If parameter ‘statement’ is not of type
ModelEntity.NotAChildError – If parameter ‘statement’ is not a statement of this construct.
- Return type:
See also
AddStatement()→ Add a sequential statement at the end of this construct.
InsertStatement()→ Insert a sequential statement at a position of this construct.
MoveStatement()→ Move a sequential statement to a position of this construct.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- property Statements: list[SequentialStatement]
Read-only property to access the list of sequential statements (
_statements).- Returns:
A list of sequential statements.
- _IterateStatementRegions()
Iterate the declarative regions nested in the sequential statements of this construct.
- Return type:
- Returns:
An empty generator: a sequential statement has no declarative region.
- _LabelRegion()
Return the process or subprogram declaring the labels of this loop’s statements.
It’s the region of the construct holding the loop.
- Return type:
- Returns:
The process or subprogram, or
Noneif the loop isn’t part of one (yet).
- _Labels()
Return the labeled statements of this construct, including the statements nested in compound statements.
Every label of a process or subprogram body is declared in the process’ or subprogram’s declarative region, also a label inside an if branch, a case alternative or a loop.
- Return type:
- Returns:
Tuple of labeled statements, depth-first in statement order.
- static _LabelsOf(statement)
Return a statement, if it’s labeled, and the labeled statements nested in it.
- Parameters:
statement (
SequentialStatement) – The sequential statement.- Return type:
- Returns:
Tuple of labeled statements, depth-first in statement order.
- _VisitStatements(visitor)
Walk the sequential statements in statement order with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _condition
The condition guarding this statement.
- _documentation
The associated documentation of a model entity.
- _label
The label of a model entity.
- _normalizedLabel
The normalized (lower case) label of a model entity.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _statements
List of all sequential statements in this construct.
- class pyGHDL.dom.Sequential.SequentialSimpleSignalAssignment(assignmentNode, target, waveform, label=None)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Sequential.SequentialSimpleSignalAssignment.Represents a simple sequential signal assignment.
The assignment’s destination is available as
Target, its value asWaveform.Example
lbl : s <= '1'; --^^^ <- optional Label -- ^ <- Target -- ^^^ <- Waveform
See also
Inheritance
- Parameters:
assignmentNode (Iir)
target (SignalSymbol)
waveform (Iterable[WaveformElement])
label (str)
- __init__(assignmentNode, target, waveform, label=None)[source]
Initializes a simple sequential signal assignment.
- Parameters:
assignmentNode (
Iir) – The IIR node of the assignment statement.target (
SignalSymbol) – Reference to the assignment’s destination.waveform (
Iterable[WaveformElement]) – List of all waveform elements, in the order they were written.label (
str) – Optional, the label of the sequential signal assignment, orNoneif it has none.
- Return type:
None
- classmethod parse(assignmentNode, label=None)[source]
Translates the IIR node of the assignment statement to a
SequentialSimpleSignalAssignment.
- _position: Position
The IIR node’s position in the source file, resolved on first access and then cached.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- 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
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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 IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- property Label: str | None
Read-only property to access the model entity’s label (
_label).- Returns:
Label of a model entity.
- property NormalizedLabel: str | None
Read-only property to access the model entity’s normalized label (
_normalizedLabel).See also
- Returns:
Normalized label 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- property Target: SignalSymbol
Read-only property to access the target (
_target).- Returns:
The target.
- property Waveform: list[WaveformElement]
Read-only property to access the waveform (
_waveform).- Returns:
List of waveform.
- _VisitWaveform(visitor)
Walk the waveform elements, separated by commas, with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- _waveform: list[WaveformElement]
List of all waveform elements, in the order they were written.
- class pyGHDL.dom.Sequential.ConditionalExpression(node, expression, condition=None)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Common.ConditionalExpression.Represents one branch of a conditional variable assignment.
Each branch pairs an expression (
Expression) with a condition (Condition). The final branch has nowhen, so its condition isNone.Example
v := '1' when cond else '0'; -- ^^^^^^^^^^^^^ <- this branch: Expression='1', Condition=cond -- ^^^ <- final branch (no ``when``): Expression='0', Condition=None
See also
Inheritance
- Parameters:
node (Iir)
expression (ExpressionUnion)
condition (ExpressionUnion)
- __init__(node, expression, condition=None)[source]
Initializes a conditional expression.
- Parameters:
node (
Iir) – The IIR node this object was translated from.expression (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The value assigned when the condition holds.
condition (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – Optional, the condition selecting this alternative.
- Return type:
None
- classmethod parse(node)[source]
Translates an IIR node to a
ConditionalExpression.
- _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 Condition: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal
Read-only property to access the condition of a statement (
_condition).- Returns:
The expression representing the condition of a statement.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- 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
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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 IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- Visit(visitor)[source]
Walk this conditional expression, its value and its condition (if any) with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _condition
The condition guarding this statement.
- _expression
The expression held by this construct.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Sequential.SelectedExpression(node, choices, expression)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Common.SelectedExpression.Represents one alternative of a selected variable assignment.
Each alternative pairs an expression (
Expression) with the choices selecting it (Choices).Example
with sel select v := '1' when '0', '0' when others; -- ^^^^^^^^^^^^ <- this alternative: Choices=['0'], Expression='1'
See also
Inheritance
- Parameters:
node (Iir)
choices (Iterable)
expression (ExpressionUnion)
- _position: Position
The IIR node’s position in the source file, resolved on first access and then cached.
- property Choices: list[BaseChoice]
Read-only property to access the choices (
_choices).- Returns:
List of choices.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- 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
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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 IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _choices: list[BaseChoice]
List of all choices selecting this alternative.
- _expression: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal
The expression held by this construct.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Sequential.OthersSelectedExpression(node, expression)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Common.OthersSelectedExpression.Represents the
othersalternative of a selected variable assignment.It supplies the expression (
Expression) for every choice not named explicitly.Example
with sel select v := '1' when '0', '0' when others; -- ^^^^^^^^^^^^^^^ <- the others alternative
Inheritance
- Parameters:
node (Iir)
expression (ExpressionUnion)
- __init__(node, expression)[source]
Initializes an others selected expression.
- Parameters:
node (
Iir) – The IIR node this object was translated from.expression (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The value assigned for every unnamed choice.
- Return type:
None
- _position: Position
The IIR node’s position in the source file, resolved on first access and then cached.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- 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
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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 IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _expression: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal
The expression held by this construct.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Sequential.SequentialVariableAssignment(assignmentNode, target, expression, label=None)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Sequential.SequentialVariableAssignment.Represents a simple sequential variable assignment.
The assignment’s destination is available as
Target, its value asExpression.Example
lbl : v := '1'; --^^^ <- optional Label -- ^ <- Target -- ^^^ <- Expression
Inheritance
- Parameters:
assignmentNode (Iir)
target (VariableSymbol)
expression (ExpressionUnion)
label (str)
- __init__(assignmentNode, target, expression, label=None)[source]
Initializes a simple sequential variable assignment.
- Parameters:
assignmentNode (
Iir) – The IIR node of the assignment statement.target (
VariableSymbol) – Reference to the assignment’s destination.expression (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The assigned expression.
label (
str) – Optional, the label of the variable assignment, orNoneif it has none.
- Return type:
None
- classmethod parse(assignmentNode, label=None)[source]
Translates the IIR node of the assignment statement to a
SequentialVariableAssignment.
- _position: Position
The IIR node’s position in the source file, resolved on first access and then cached.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- 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
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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 IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- property Label: str | None
Read-only property to access the model entity’s label (
_label).- Returns:
Label of a model entity.
- property NormalizedLabel: str | None
Read-only property to access the model entity’s normalized label (
_normalizedLabel).See also
- Returns:
Normalized label 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- property Target: VariableSymbol
Read-only property to access the target (
_target).- Returns:
The target.
- Visit(visitor)[source]
Walk this variable assignment, its target and its expression with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _expression: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal
The assigned expression.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Sequential.SequentialConditionalVariableAssignment(assignmentNode, target, conditionalExpressions, label=None)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Sequential.SequentialConditionalVariableAssignment.Represents a conditional sequential variable assignment.
The alternatives are available as
ConditionalExpressions, a list ofConditionalExpression. The model holds them in a list and has no distinct field per alternative, so the markers below name list elements.Example
lbl : v := '1' when sel = '0' else '0'; --^^^ <- optional Label -- ^ <- Target -- ^^^^^^^^^^^^^^^^^^ <- ConditionalExpressions[0] -- ^^^ <- ConditionalExpressions[1]
See also
Inheritance
- Parameters:
assignmentNode (Iir)
target (VariableSymbol)
conditionalExpressions (Iterable[ConditionalExpression])
label (str)
- __init__(assignmentNode, target, conditionalExpressions, label=None)[source]
Initializes a conditional sequential variable assignment.
- Parameters:
assignmentNode (
Iir) – The IIR node of the assignment statement.target (
VariableSymbol) – Reference to the assignment’s destination.conditionalExpressions (
Iterable[ConditionalExpression]) – List of all alternatives, in the order they were written.label (
str) – Optional, the label of the conditional variable assignment, orNoneif it has none.
- Return type:
None
- classmethod parse(assignmentNode, label=None)[source]
Translates the IIR node of the assignment statement to a
SequentialConditionalVariableAssignment.
- _position: Position
The IIR node’s position in the source file, resolved on first access and then cached.
- property ConditionalExpressions: list[ConditionalExpression]
Read-only property to access the conditional expressions (
_conditionalExpressions).- Returns:
List of conditional expressions.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- 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
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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 IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- property Label: str | None
Read-only property to access the model entity’s label (
_label).- Returns:
Label of a model entity.
- property NormalizedLabel: str | None
Read-only property to access the model entity’s normalized label (
_normalizedLabel).See also
- Returns:
Normalized label 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- Visit(visitor)[source]
Walk this conditional variable assignment, its target and its alternatives with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _conditionalExpressions: list[ConditionalExpression]
List of all alternatives, in the order they were written.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Sequential.SequentialConditionalSignalAssignment(assignmentNode, target, conditionalWaveforms, label=None)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Sequential.SequentialConditionalSignalAssignment.Represents a conditional sequential signal assignment.
The alternatives are available as
ConditionalWaveforms, a list ofConditionalWaveform. The model holds them in a list and has no distinct field per alternative, so the markers below name list elements.Example
lbl : s <= '1' when sel = '0' else '0'; --^^^ <- optional Label -- ^ <- Target -- ^^^^^^^^^^^^^^^^^^ <- ConditionalWaveforms[0] -- ^^^ <- ConditionalWaveforms[1]
Inheritance
- Parameters:
assignmentNode (Iir)
target (SignalSymbol)
conditionalWaveforms (Iterable)
label (str)
- __init__(assignmentNode, target, conditionalWaveforms, label=None)[source]
Initializes a conditional sequential signal assignment.
- Parameters:
assignmentNode (
Iir) – The IIR node of the assignment statement.target (
SignalSymbol) – Reference to the assignment’s destination.conditionalWaveforms (
Iterable) – All alternatives, in order.label (
str) – Optional, the label of the conditional sequential signal assignment, orNoneif it has none.
- Return type:
None
- classmethod parse(assignmentNode, label=None)[source]
Translates the IIR node of the assignment statement to a
SequentialConditionalSignalAssignment.
- _position: Position
The IIR node’s position in the source file, resolved on first access and then cached.
- property ConditionalWaveforms: list[ConditionalWaveform]
Read-only property to access the conditional waveforms (
_conditionalWaveforms).- Returns:
List of conditional waveforms.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- 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
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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 IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- property Label: str | None
Read-only property to access the model entity’s label (
_label).- Returns:
Label of a model entity.
- property NormalizedLabel: str | None
Read-only property to access the model entity’s normalized label (
_normalizedLabel).See also
- Returns:
Normalized label 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- property Target: SignalSymbol
Read-only property to access the target (
_target).- Returns:
The target.
- Visit(visitor)[source]
Walk this conditional signal assignment, its target and its alternatives with a visitor.
- _VisitConditionalWaveforms(visitor)
Walk the conditional waveforms, separated by the reserved word
else, with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _conditionalWaveforms: list[ConditionalWaveform]
All alternatives, in order.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Sequential.SequentialSelectedVariableAssignment(assignmentNode, target, expression, selectedExpressions, label=None)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Sequential.SequentialSelectedVariableAssignment.Represents a selected sequential variable assignment.
The selector is available as
Expression, the alternatives asSelectedExpressions, a list ofSelectedExpression. The model holds them in a list and has no distinct field per alternative, so the markers below name list elements.Example
lbl : with sel select v := '1' when '0', '0' when others; --^^^ <- optional Label -- ^^^ <- Expression -- ^ <- Target -- ^^^^^^^^^^^^ <- SelectedExpressions[0] -- ^^^^^^^^^^^^^^^ <- SelectedExpressions[1]
See also
Inheritance
- Parameters:
assignmentNode (Iir)
target (VariableSymbol)
expression (ExpressionUnion)
selectedExpressions (Iterable)
label (str)
- __init__(assignmentNode, target, expression, selectedExpressions, label=None)[source]
Initializes a selected sequential variable assignment.
- Parameters:
assignmentNode (
Iir) – The IIR node of the assignment statement.target (
VariableSymbol) – Reference to the assignment’s destination.expression (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The selector expression.
selectedExpressions (
Iterable) – All alternatives, in order.label (
str) – Optional, the label of the selected variable assignment, orNoneif it has none.
- Return type:
None
- classmethod parse(assignmentNode, label=None)[source]
Translates the IIR node of the assignment statement to a
SequentialSelectedVariableAssignment.
- _position: Position
The IIR node’s position in the source file, resolved on first access and then cached.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- 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
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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 IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- property Label: str | None
Read-only property to access the model entity’s label (
_label).- Returns:
Label of a model entity.
- property NormalizedLabel: str | None
Read-only property to access the model entity’s normalized label (
_normalizedLabel).See also
- Returns:
Normalized label 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- property SelectedExpressions: list[SelectedExpression | OthersSelectedExpression]
Read-only property to access the selected expressions (
_selectedExpressions).- Returns:
List of selected expressions.
- Visit(visitor)[source]
Walk this selected variable assignment, its selector, its target and its alternatives with a visitor.
- _VisitSelectedExpressions(visitor)
Walk the selected expressions, separated by commas, with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _expression: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal
The expression held by this construct.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- _selectedExpressions: list[SelectedExpression | OthersSelectedExpression]
All alternatives, in order.
- class pyGHDL.dom.Sequential.SequentialSelectedSignalAssignment(assignmentNode, target, expression, selectedWaveforms, label=None)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Sequential.SequentialSelectedSignalAssignment.Represents a selected sequential signal assignment.
The selector is available as
Expression, the alternatives asSelectedWaveforms, a list ofSelectedWaveform. The model holds them in a list and has no distinct field per alternative, so the markers below name list elements.Example
lbl : with sel select s <= '1' when '0', '0' when others; --^^^ <- optional Label -- ^^^ <- Expression -- ^ <- Target -- ^^^^^^^^^^^^ <- SelectedWaveforms[0] -- ^^^^^^^^^^^^^^^ <- SelectedWaveforms[1]
See also
Inheritance
- Parameters:
assignmentNode (Iir)
target (SignalSymbol)
expression (ExpressionUnion)
selectedWaveforms (Iterable)
label (str)
- __init__(assignmentNode, target, expression, selectedWaveforms, label=None)[source]
Initializes a selected sequential signal assignment.
- Parameters:
assignmentNode (
Iir) – The IIR node of the assignment statement.target (
SignalSymbol) – Reference to the assignment’s destination.expression (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The selector expression.
selectedWaveforms (
Iterable) – All alternatives, in order.label (
str) – Optional, the label of the selected sequential signal assignment, orNoneif it has none.
- Return type:
None
- classmethod parse(assignmentNode, label=None)[source]
Translates the IIR node of the assignment statement to a
SequentialSelectedSignalAssignment.
- _position: Position
The IIR node’s position in the source file, resolved on first access and then cached.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- 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
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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 IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- property Label: str | None
Read-only property to access the model entity’s label (
_label).- Returns:
Label of a model entity.
- property NormalizedLabel: str | None
Read-only property to access the model entity’s normalized label (
_normalizedLabel).See also
- Returns:
Normalized label 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- property SelectedWaveforms: list[SelectedWaveform | OthersSelectedWaveform]
Read-only property to access the selected waveforms (
_selectedWaveforms).- Returns:
List of selected waveforms.
- property Target: SignalSymbol
Read-only property to access the target (
_target).- Returns:
The target.
- Visit(visitor)[source]
Walk this selected signal assignment, its selector, its target and its alternatives with a visitor.
- _VisitSelectedWaveforms(visitor)
Walk the selected waveforms, separated by commas, with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _expression: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal
The expression held by this construct.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- _selectedWaveforms: list[SelectedWaveform | OthersSelectedWaveform]
All alternatives, in order.
- class pyGHDL.dom.Sequential.SignalForceAssignment(assignmentNode, target, expression, label=None)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Sequential.SignalForceAssignment.Represents a signal force assignment.
A force assignment overrides a signal’s driver until it is released.
Example
lbl : s <= force '1'; --^^^ <- optional Label -- ^ <- Target -- ^^^ <- Expression
Inheritance
- Parameters:
assignmentNode (Iir)
target (SignalSymbol)
expression (ExpressionUnion)
label (str)
- __init__(assignmentNode, target, expression, label=None)[source]
Initializes a signal force assignment.
- Parameters:
assignmentNode (
Iir) – The IIR node of the assignment statement.target (
SignalSymbol) – Reference to the assignment’s destination.expression (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The value forced onto the signal.
label (
str) – Optional, the label of the signal force assignment, orNoneif it has none.
- Return type:
None
- classmethod parse(assignmentNode, label=None)[source]
Translates the IIR node of the assignment statement to a
SignalForceAssignment.
- _position: Position
The IIR node’s position in the source file, resolved on first access and then cached.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- property Documentation: str | None
Read-only property to access the model entity’s documentation (
_documentation).- Returns:
Associated documentation of a model entity.
- 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
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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 IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- property Label: str | None
Read-only property to access the model entity’s label (
_label).- Returns:
Label of a model entity.
- property NormalizedLabel: str | None
Read-only property to access the model entity’s normalized label (
_normalizedLabel).See also
- Returns:
Normalized label 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- property Target: SignalSymbol
Read-only property to access the target (
_target).- Returns:
The target.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _expression: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal
The expression held by this construct.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Sequential.SignalReleaseAssignment(assignmentNode, target, label=None)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Sequential.SignalReleaseAssignment.Represents a signal release assignment.
A release assignment ends a previously applied force.
Example
lbl : s <= release; --^^^ <- optional Label -- ^ <- Target
Inheritance
- Parameters:
assignmentNode (Iir)
target (SignalSymbol)
label (str)
- __init__(assignmentNode, target, label=None)[source]
Initializes a signal release assignment.
- Parameters:
assignmentNode (
Iir) – The IIR node of the assignment statement.target (
SignalSymbol) – Reference to the assignment’s destination.label (
str) – Optional, the label of the signal release assignment, orNoneif it has none.
- Return type:
None
- classmethod parse(assignmentNode, label=None)[source]
Translates the IIR node of the assignment statement to a
SignalReleaseAssignment.
- _position: Position
The IIR node’s position in the source file, resolved on first access and then cached.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- 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
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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 IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- property Label: str | None
Read-only property to access the model entity’s label (
_label).- Returns:
Label of a model entity.
- property NormalizedLabel: str | None
Read-only property to access the model entity’s normalized label (
_normalizedLabel).See also
- Returns:
Normalized label 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- property Target: SignalSymbol
Read-only property to access the target (
_target).- Returns:
The target.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Sequential.SequentialProcedureCall(callNode, procedureName, parameterAssociationItems, label=None)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Sequential.SequentialProcedureCall.Represents a procedure call as a sequential statement.
Like every sequential statement, it can carry an optional label (
Label).Example
lbl : log("hello"); --^^^ <- optional Label -- ^^^^^^^^^^^^ <- the call
See also
Inheritance
- Parameters:
callNode (Iir)
procedureName (Symbol)
parameterAssociationItems (Iterable[ParameterAssociationItem])
label (str)
- __init__(callNode, procedureName, parameterAssociationItems, label=None)[source]
Initializes a procedure call as a sequential statement.
- Parameters:
callNode (
Iir) – The IIR node of the subprogram call.procedureName (
Symbol) – Reference to the called procedure.parameterAssociationItems (
Iterable[ParameterAssociationItem]) – List of all parameter associations of the call.label (
str) – Optional, the label of the procedure call, orNoneif it has none.
- Return type:
None
- classmethod parse(callNode, label)[source]
Translates the IIR node of the procedure call to a
SequentialProcedureCall.
- _position: Position
The IIR node’s position in the source file, resolved on first access and then cached.
- AddParameterAssociationItem(parameterAssociationItem)
Add a parameter association at the end of the parameter association list.
The association’s parent is set to this procedure call.
- Parameters:
parameterAssociationItem (
ParameterAssociationItem) – The parameter association to add.- Raises:
ValueError – If parameter ‘parameterAssociationItem’ is
None.TypeError – If parameter ‘parameterAssociationItem’ is not of type
ParameterAssociationItem.AlreadyInDesignError – If parameter ‘parameterAssociationItem’ already has a parent.
DuplicateParameterAssociationError – If the association is named, and another named association of the parameter association list has the same formal.
AssociationOrderError – If the association is positional, and the parameter association list has a named association.
- Return type:
See also
InsertParameterAssociationItem()→ Insert a parameter association at a position of the parameter association list.
RemoveParameterAssociationItem()→ Remove a parameter association from the parameter association list.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- 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
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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.
- InsertParameterAssociationItem(index, parameterAssociationItem)
Insert a parameter association at a position of the parameter association list.
The association’s parent is set to this procedure call.
A named association (
formal => actual) can’t repeat the formal of another named association of the parameter association list. Only formals given as a simple name are compared: a partial association (a(0) => x) or a conversion function (to_integer(a) => x) is accepted. All positional associations precede the named associations.- Parameters:
index (
int) – Position, from0(first) to the number of parameter associations (append). A negative index counts from the end, as forlist.insert():-1inserts before the last parameter association.parameterAssociationItem (
ParameterAssociationItem) – The parameter association to insert.
- Raises:
ValueError – If parameter ‘index’ is
None.ValueError – If parameter ‘index’ is out of range.
ValueError – If parameter ‘parameterAssociationItem’ is
None.TypeError – If parameter ‘parameterAssociationItem’ is not of type
ParameterAssociationItem.AlreadyInDesignError – If parameter ‘parameterAssociationItem’ already has a parent.
DuplicateParameterAssociationError – If the association is named, and another named association of the parameter association list has the same formal.
AssociationOrderError – If the association is positional, and a named association precedes the position.
AssociationOrderError – If the association is named, and a positional association follows the position.
- Return type:
See also
AddParameterAssociationItem()→ Add a parameter association at the end of the parameter association list.
RemoveParameterAssociationItem()→ Remove a parameter association from the parameter association list.
- property IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- property Label: str | None
Read-only property to access the model entity’s label (
_label).- Returns:
Label of a model entity.
- property NormalizedLabel: str | None
Read-only property to access the model entity’s normalized label (
_normalizedLabel).See also
- Returns:
Normalized label of a model entity.
- property ParameterAssociationItems: list[ParameterAssociationItem]
Read-only property to access the parameter association items (
_parameterAssociationItems).- Returns:
List of parameter association 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- property Procedure: Symbol
Read-only property to access the procedure (
_procedure).- Returns:
The procedure.
- RemoveParameterAssociationItem(parameterAssociationItem)
Remove a parameter association from the parameter association list.
The association is detached: its parent is cleared. The association itself is unchanged and can be added to another procedure call, or inserted at another position.
- Parameters:
parameterAssociationItem (
ParameterAssociationItem) – The parameter association to remove.- Raises:
ValueError – If parameter ‘parameterAssociationItem’ is
None.TypeError – If parameter ‘parameterAssociationItem’ is not of type
ParameterAssociationItem.NotAChildError – If parameter ‘parameterAssociationItem’ is not a parameter association of this procedure call.
- Return type:
See also
AddParameterAssociationItem()→ Add a parameter association at the end of the parameter association list.
InsertParameterAssociationItem()→ Insert a parameter association at a position of the parameter association list.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- _VisitProcedureCall(visitor)
Walk the called procedure and the actual parameter part, if there are parameters, with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _parameterAssociationItems: list[ParameterAssociationItem]
List of all parameter associations of the call.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Sequential.SequentialAssertStatement(assertNode, condition, message=None, severity=None, label=None)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Sequential.SequentialAssertStatement.Represents a sequential assertion statement.
The checked condition is available as
Condition, the optional report string asMessageand the optional severity asSeverity.Example
lbl : assert sel = '0' report "bad" severity error; --^^^ <- optional Label -- ^^^^^^^^^ <- Condition -- ^^^^^ <- optional Message -- ^^^^^ <- optional Severity
See also
Inheritance
- Parameters:
- __init__(assertNode, condition, message=None, severity=None, label=None)[source]
Initializes a sequential assertion statement.
- Parameters:
assertNode (
Iir) – The IIR node of the assertion.condition (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The condition that must hold; the report is issued when it is false.
message (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – Optional, the reported message, or
Noneif none was given.severity (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – Optional, the reported severity level, or
Noneif none was given.label (
str) – Optional, the label of the assertion statement, orNoneif it has none.
- Return type:
None
- classmethod parse(assertNode, label)[source]
Translates the IIR node of the assertion to a
SequentialAssertStatement.
- _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 Condition: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal
Read-only property to access the condition of a statement (
_condition).- Returns:
The expression representing the condition of a statement.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- 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
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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 IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- property Label: str | None
Read-only property to access the model entity’s label (
_label).- Returns:
Label of a model entity.
- property Message: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal | None
Read-only property to access the message (
_message).- Returns:
The message, or
Noneif not set.
- property NormalizedLabel: str | None
Read-only property to access the model entity’s normalized label (
_normalizedLabel).See also
- Returns:
Normalized label 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- property Severity: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal | None
Read-only property to access the severity (
_severity).- Returns:
The severity, or
Noneif not set.
- Visit(visitor)[source]
Walk this assertion, its condition, its message and its severity with a visitor.
- _VisitAssertion(visitor)
Walk the condition, the message and the severity of an assertion with a visitor.
- _VisitReportAndSeverity(visitor)
Walk the message and the severity, if given, each after its reserved word, with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _condition
The condition guarding this statement.
- _documentation
The associated documentation of a model entity.
- _label
The label of a model entity.
- _message
The reported message, or
Noneif none was given.
- _normalizedLabel
The normalized (lower case) label of a model entity.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- _severity
The reported severity level, or
Noneif none was given.
- class pyGHDL.dom.Sequential.SequentialReportStatement(reportNode, message, severity=None, label=None)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Sequential.SequentialReportStatement.Represents a sequential report statement.
The report string is available as
Message, the optional severity asSeverity.Example
lbl : report "message" severity note; --^^^ <- optional Label -- ^^^^^^^^^ <- Message -- ^^^^ <- optional Severity
Inheritance
- __init__(reportNode, message, severity=None, label=None)[source]
Initializes a sequential report statement.
- Parameters:
reportNode (
Iir) – The IIR node of the report statement.message (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – The reported message, or
Noneif none was given.severity (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – Optional, the reported severity level, or
Noneif none was given.label (
str) – Optional, the label of the report statement, orNoneif it has none.
- Return type:
None
- classmethod parse(reportNode, label)[source]
Translates the IIR node of the report statement to a
SequentialReportStatement.
- _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.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- 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
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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 IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- property Label: str | None
Read-only property to access the model entity’s label (
_label).- Returns:
Label of a model entity.
- property Message: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal | None
Read-only property to access the message (
_message).- Returns:
The message, or
Noneif not set.
- property NormalizedLabel: str | None
Read-only property to access the model entity’s normalized label (
_normalizedLabel).See also
- Returns:
Normalized label 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- property Severity: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal | None
Read-only property to access the severity (
_severity).- Returns:
The severity, or
Noneif not set.
- _VisitReportAndSeverity(visitor)
Walk the message and the severity, if given, each after its reserved word, with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _documentation
The associated documentation of a model entity.
- _label
The label of a model entity.
- _message
The reported message, or
Noneif none was given.
- _normalizedLabel
The normalized (lower case) label of a model entity.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- _severity
The reported severity level, or
Noneif none was given.
- class pyGHDL.dom.Sequential.ReturnStatement(returnNode, returnValue=None, label=None)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Sequential.ReturnStatement.Represents a return statement.
The optionally returned value is available as
ReturnValue; a procedure returns nothing.Example
lbl : return x; --^^^ <- optional Label -- ^ <- optional ReturnValue
Inheritance
- __init__(returnNode, returnValue=None, label=None)[source]
Initializes a return statement.
- Parameters:
- Return type:
None
- classmethod parse(returnNode, label)[source]
Translates the IIR node of the return statement to a
ReturnStatement.
- _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.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- 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
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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 IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- property Label: str | None
Read-only property to access the model entity’s label (
_label).- Returns:
Label of a model entity.
- property NormalizedLabel: str | None
Read-only property to access the model entity’s normalized label (
_normalizedLabel).See also
- Returns:
Normalized label 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- property ReturnValue: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal | None
Read-only property to access the return value (
_returnValue).- Returns:
The return value, or
Noneif not set.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _documentation
The associated documentation of a model entity.
- _label
The label of a model entity.
- _normalizedLabel
The normalized (lower case) label of a model entity.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _returnValue: Nullable[ExpressionUnion]
The returned expression, or
Nonefor a procedure.
- class pyGHDL.dom.Sequential.NullStatement(waitNode, label=None)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Sequential.NullStatement.Represents a null statement.
A null statement does nothing. Like every sequential statement, it can carry an optional label (
Label).Example
lbl : null; --^^^ <- optional Label -- ^^^^ <- the statement
Inheritance
- _position: Position
The IIR node’s position in the source file, resolved on first access and then cached.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- 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
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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 IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- property Label: str | None
Read-only property to access the model entity’s label (
_label).- Returns:
Label of a model entity.
- property NormalizedLabel: str | None
Read-only property to access the model entity’s normalized label (
_normalizedLabel).See also
- Returns:
Normalized label 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _parent: ModelEntity
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Sequential.NextStatement(node, condition=None, loopLabel=None, label=None)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Sequential.NextStatement.Represents a next statement.
A next statement skips to the next iteration of the named loop (
LoopReference), optionally only when a condition (Condition) holds.Example
lbl : next outer when k = 1; --^^^ <- optional Label -- ^^^^^ <- optional LoopReference -- ^^^^^ <- optional Condition
Inheritance
- Parameters:
node (Iir)
condition (ExpressionUnion)
loopLabel (LoopSymbol)
label (str)
- __init__(node, condition=None, loopLabel=None, label=None)[source]
Initializes a next statement.
- Parameters:
node (
Iir) – The IIR node of the next statement.condition (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – Optional, the condition under which the iteration is skipped, or
Noneif unconditional.loopLabel (
LoopSymbol) – Optional, the label of the loop this statement applies to, orNonefor the enclosing loop.label (
str) – Optional, the statement’s own label.
- Return type:
None
- classmethod parse(exitNode, label)[source]
Translates the IIR node of the exit statement to a
NextStatement.
- _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 Condition: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal
Read-only property to access the condition of a statement (
_condition).- Returns:
The expression representing the condition of a statement.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- 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
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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 IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- property Label: str | None
Read-only property to access the model entity’s label (
_label).- Returns:
Label of a model entity.
- property LoopReference: LoopSymbol | None
Read-only property to access the reference to the controlled loop (
_loopReference).- Returns:
The reference to the controlled loop, or
Noneif not set (the innermost loop).
- property NormalizedLabel: str | None
Read-only property to access the model entity’s normalized label (
_normalizedLabel).See also
- Returns:
Normalized label 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- Visit(visitor)[source]
Walk this next statement, its loop label (if any) and its condition (if any) with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _condition
The condition guarding this statement.
- _documentation
The associated documentation of a model entity.
- _label
The label of a model entity.
- _loopReference: Nullable[LoopSymbol]
Reference to the controlled loop, or
Nonefor the innermost loop.
- _normalizedLabel
The normalized (lower case) label of a model entity.
- _parent
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Sequential.ExitStatement(node, condition=None, loopLabel=None, label=None)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Sequential.ExitStatement.Represents an exit statement.
An exit statement leaves the named loop (
LoopReference), optionally only when a condition (Condition) holds.Example
lbl : exit outer when k = 1; --^^^ <- optional Label -- ^^^^^ <- optional LoopReference -- ^^^^^ <- optional Condition
Inheritance
- Parameters:
node (Iir)
condition (ExpressionUnion)
loopLabel (LoopSymbol)
label (str)
- __init__(node, condition=None, loopLabel=None, label=None)[source]
Initializes an exit statement.
- Parameters:
node (
Iir) – The IIR node of the exit statement.condition (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – Optional, the condition under which the loop is left, or
Noneif unconditional.loopLabel (
LoopSymbol) – Optional, the label of the loop this statement applies to, orNonefor the enclosing loop.label (
str) – Optional, the statement’s own label.
- Return type:
None
- classmethod parse(exitNode, label)[source]
Translates the IIR node of the exit statement to an
ExitStatement.
- _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 Condition: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal
Read-only property to access the condition of a statement (
_condition).- Returns:
The expression representing the condition of a statement.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- 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
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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 IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- property Label: str | None
Read-only property to access the model entity’s label (
_label).- Returns:
Label of a model entity.
- property LoopReference: LoopSymbol | None
Read-only property to access the reference to the controlled loop (
_loopReference).- Returns:
The reference to the controlled loop, or
Noneif not set (the innermost loop).
- property NormalizedLabel: str | None
Read-only property to access the model entity’s normalized label (
_normalizedLabel).See also
- Returns:
Normalized label 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- Visit(visitor)[source]
Walk this exit statement, its loop label (if any) and its condition (if any) with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _condition
The condition guarding this statement.
- _documentation
The associated documentation of a model entity.
- _label
The label of a model entity.
- _loopReference: Nullable[LoopSymbol]
Reference to the controlled loop, or
Nonefor the innermost loop.
- _normalizedLabel
The normalized (lower case) label of a model entity.
- _parent
Reference to a parent entity in the logical model hierarchy.
- class pyGHDL.dom.Sequential.WaitStatement(waitNode, sensitivityList=None, condition=None, timeout=None, label=None)[source]
This class implements a
pyGHDL.domobject derived frompyVHDLModel.Sequential.WaitStatement.Represents a wait statement.
A wait statement may name a sensitivity list (
SensitivityList), a condition (Condition) and a timeout (Timeout); all three are optional.Example
lbl : wait until clock = '1' for 10 ns; --^^^ <- optional Label -- ^^^^^^^^^^^ <- optional Condition -- ^^^^^ <- optional Timeout
Inheritance
- Parameters:
- __init__(waitNode, sensitivityList=None, condition=None, timeout=None, label=None)[source]
Initializes a wait statement.
- Parameters:
waitNode (
Iir) – The IIR node of the wait statement.sensitivityList (
Iterable[Symbol]) – Optional, list of all signal names of the on clause, orNoneif none was given.condition (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – Optional, the condition of the until clause, or
Noneif none was given.timeout (BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal) – Optional, the timeout expression of the for clause, or
Noneif none was given.label (
str) – Optional, the label of the wait statement, orNoneif it has none.
- Return type:
None
- classmethod parse(waitNode, label)[source]
Translates the IIR node of the wait statement to a
WaitStatement.
- _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 Condition: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal
Read-only property to access the condition of a statement (
_condition).- Returns:
The expression representing the condition of a statement.
- DenoteBy(name, region, place, symbol)
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (
Name.Denote).A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
- Parameters:
name (
Name) – The name denoting this declaration, a part of the type mark.region (
DeclarativeRegionMixin) – The declarative region containing the type mark.place (
ModelEntity) – The declaration containing the type mark.symbol (
Symbol) – The type mark.
- Return type:
- Returns:
None, as a name in a type mark can’t denote this declaration (reported as a warning).- Raises:
UnhandledCriticalWarningError – Always, if no
WarningCollectorcollects theUnresolvedTypeMarkWarning.
- 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
typefound 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:
- Returns:
The closest ancestor of the requested type.
- Raises:
AncestorNotFoundError – If the root of the model is reached without finding an ancestor of the requested type.
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- 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 IsOverloadable: bool
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable declarations.
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this property.
- Returns:
True, if this model entity is an overloadable declaration.
- IterateImplicitDeclarations()
Iterate the declarations this declaration implies.
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
- Return type:
- Returns:
A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
- IterateTypeMarks(region)
Iterate the type marks of this declaration, each with the region and the place to look it up.
The place of a type mark is the declaration containing it. Declarations with type marks override this method, e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
- Parameters:
region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.- Return type:
Generator[tuple[DeclarativeRegionMixin,ModelEntity,SubtypeSymbol]]- Returns:
A generator to iterate (region, place, type mark) tuples, in declaration order: none.
- property Label: str | None
Read-only property to access the model entity’s label (
_label).- Returns:
Label of a model entity.
- property NormalizedLabel: str | None
Read-only property to access the model entity’s normalized label (
_normalizedLabel).See also
- Returns:
Normalized label 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: Position
Cached read-only property to access an IIR’s position in source code (
_position).If
_positionis None, resolve the position object from_iirNode- Returns:
The IIR’s position in the source file.
- ResetReferences(designUnit, region)
Reset the references
ResolveReferences()derived: the references of this declaration’s type marks.A use clause, an alias and a subtype extend this method.
- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Return type:
- ResolveReferences(designUnit, region)
Resolve the references of this declaration: its type marks (
IterateTypeMarks()).Each type mark is resolved at its place by the region it is looked up in (
ResolveTypeMark()). An incomplete type, an alias and a subtype extend this method.- Parameters:
designUnit (
DesignUnit) – The design unit containing this declaration.region (
DeclarativeRegionMixin) – The declarative region declaring this declaration.
- Raises:
UnhandledCriticalWarningError – If a type mark can’t be resolved, and no
WarningCollectorcollects theUnresolvedTypeMarkWarning.- Return type:
- property SensitivityList: list[Symbol]
Read-only property to access the sensitivity list (
_sensitivityList).- Returns:
List of sensitivity list.
- property Timeout: BaseExpression | QualifiedExpression | FunctionCall | TypeConversion | Literal
Read-only property to access the timeout (
_timeout).- Returns:
The timeout.
- Visit(visitor)[source]
Walk this wait statement, its sensitivity clause, its condition clause and its timeout clause with a visitor.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __new__(**kwargs)
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.
- _condition
The condition guarding this statement.
- _documentation
The associated documentation of a model entity.
- _label
The label of a model entity.
- _normalizedLabel
The normalized (lower case) label of a model entity.
- _parent
Reference to a parent entity in the logical model hierarchy.
- _sensitivityList: Nullable[list[Symbol]]
List of all signal names to wait on, or
Noneif none was given.
- _timeout: ExpressionUnion
The timeout expression, or
Noneif none was given.