hwt.hdl.statements.utils package¶
Submodules¶
hwt.hdl.statements.utils.comparison module¶
hwt.hdl.statements.utils.ioDiscovery module¶
-
hwt.hdl.statements.utils.ioDiscovery.
HdlStatement_discover_enclosure_for_statements
(statements: hwt.hdl.statements.utils.listOfHdlStatements.ListOfHdlStatement, outputs: List[hwt.synthesizer.rtlLevel.mainBases.RtlSignalBase]) → Set[hwt.synthesizer.rtlLevel.mainBases.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:
list
A list of hdl statements used in statements to keep track of children
-
_registerOutput
(o: hwt.synthesizer.rtlLevel.mainBases.RtlSignalBase, stm: hwt.hdl.statements.statement.HdlStatement)[source]¶
-
_unregisterOutput
(o: hwt.synthesizer.rtlLevel.mainBases.RtlSignalBase, stm: hwt.hdl.statements.statement.HdlStatement)[source]¶
-
extend
(stms: Sequence[hwt.hdl.statements.statement.HdlStatement])[source]¶ Extend list by appending elements from the iterable.
-
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: hwt.hdl.statements.statement.HdlStatement, toReplaceStm: hwt.hdl.statements.statement.HdlStatement, index: int, replacement: List[hwt.hdl.statements.statement.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: hwt.hdl.statements.utils.listOfHdlStatements.ListOfHdlStatement, stmsB: hwt.hdl.statements.utils.listOfHdlStatements.ListOfHdlStatement) → hwt.hdl.statements.utils.listOfHdlStatements.ListOfHdlStatement[source]¶ Merge two lists of statements into one
Returns: list of merged statements
-
hwt.hdl.statements.utils.reduction.
HdlStatement_merge_statements
(statements: hwt.hdl.statements.utils.listOfHdlStatements.ListOfHdlStatement) → Tuple[hwt.hdl.statements.utils.listOfHdlStatements.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_overriden_assignments
(statements: hwt.hdl.statements.utils.listOfHdlStatements.ListOfHdlStatement) → Tuple[hwt.hdl.statements.utils.listOfHdlStatements.ListOfHdlStatement, bool, int][source]¶
hwt.hdl.statements.utils.signalCut module¶
-
hwt.hdl.statements.utils.signalCut.
HdlStatement_cut_off_drivers_of_list
(sig: hwt.synthesizer.rtlLevel.mainBases.RtlSignalBase, statements: hwt.hdl.statements.utils.listOfHdlStatements.ListOfHdlStatement, keep_mask: List[bool], new_statements: hwt.hdl.statements.utils.listOfHdlStatements.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