hwt.hdl.statements.utils package¶
Submodules¶
hwt.hdl.statements.utils.comparison module¶
- hwt.hdl.statements.utils.comparison.isSameStatementList(stmListA: ListOfHdlStatement, stmListB: ListOfHdlStatement) bool[source]¶
- Returns:
True if two lists of HdlStatement instances are same
- hwt.hdl.statements.utils.comparison.statementsAreSame(statements: ListOfHdlStatement) bool[source]¶
- Returns:
True if all statements are same
hwt.hdl.statements.utils.ioDiscovery module¶
- hwt.hdl.statements.utils.ioDiscovery.HdlStatement_discover_enclosure_for_statements(statements: ListOfHdlStatement, outputs: List[RtlSignalBase]) Set[RtlSignalBase][source]¶
Discover enclosure for list of statements
- Parameters:
statements – list of statements in one code branch
outputs – list of outputs which should be driven from this statement list
- Returns:
set of signals for which this statement list have always some driver (is enclosed)
hwt.hdl.statements.utils.listOfHdlStatements module¶
- class hwt.hdl.statements.utils.listOfHdlStatements.ListOfHdlStatement(*args)[source]¶
Bases:
listA list of hdl statements used in statements to keep track of children
- _registerOutput(o: RtlSignalBase, stm: HdlStatement)[source]¶
- _unregisterOutput(o: RtlSignalBase, stm: HdlStatement)[source]¶
- append(v: HdlStatement)[source]¶
Append object to the end of the list.
- extend(stms: Sequence[HdlStatement])[source]¶
Extend list by appending elements from the iterable.
- insert(i: int, v: HdlStatement)[source]¶
Insert object before index.
- iterStatementsWithOutput(out: RtlSignalBase)[source]¶
- pop()[source]¶
Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
- remove(item)[source]¶
Remove first occurrence of value.
Raises ValueError if the value is not present.
- replace(parentStm: HdlStatement, toReplaceStm: HdlStatement, index: int, replacement: List[HdlStatement])[source]¶
Replace a single statement in this list with the list of statements while updating all cached values.
- sort(*args, **kwargs)[source]¶
Sort the list in ascending order and return None.
The sort is in-place (i.e. the list itself is modified) and stable (i.e. the order of two equal elements is maintained).
If a key function is given, apply it once to each list item and sort them, ascending or descending, according to their function values.
The reverse flag can be set to sort in descending order.
hwt.hdl.statements.utils.reduction module¶
- hwt.hdl.statements.utils.reduction.HdlStatement_merge_statement_lists(stmsA: ListOfHdlStatement, stmsB: ListOfHdlStatement) ListOfHdlStatement[source]¶
Merge two lists of statements into one
- Returns:
list of merged statements
- hwt.hdl.statements.utils.reduction.HdlStatement_merge_statements(statements: ListOfHdlStatement) Tuple[ListOfHdlStatement, int][source]¶
Merge statements in list to remove duplicated if-then-else trees
- Returns:
tuple (list of merged statements, rank decrease due merging)
- Note:
rank decrease is sum of ranks of reduced statements
- Attention:
statement list has to me mergable
- hwt.hdl.statements.utils.reduction.HdlStatement_reduce_overridden_assignments(statements: ListOfHdlStatement) Tuple[ListOfHdlStatement, bool, int][source]¶
- hwt.hdl.statements.utils.reduction.HdlStatement_try_reduce_list(statements: ListOfHdlStatement) Tuple[ListOfHdlStatement, int, bool][source]¶
Simplify statements in the list
- hwt.hdl.statements.utils.reduction.is_mergable_statement_list(stmsA: ListOfHdlStatement, stmsB: ListOfHdlStatement)[source]¶
Walk statements and compare if they can be merged into one statement list
hwt.hdl.statements.utils.signalCut module¶
- hwt.hdl.statements.utils.signalCut.HdlStatement_cut_off_drivers_of_list(sig: RtlSignalBase, statements: ListOfHdlStatement, keep_mask: List[bool], new_statements: ListOfHdlStatement) bool[source]¶
Cut all logic from statements which drives signal sig.
- Parameters:
sig – signal which drivers should be removed
statements – list of statements to filter
keep_mask – list of flags if True statements was driver only of sig
new_statements – output list of filtered statements
- Returns:
True if all input statements were reduced