Skip to content

netlist_carpentry.routines.check.comb_loops

Functions:

  • has_comb_loops

    Checks whether the given module or circuit contains combinational loops and prints a warning if found.

  • module_has_comb_loops

    Checks whether the given module contains combinational loops and prints a warning if found.

  • find_comb_loops

    Returns all combinational loops of this module.

  • module_find_comb_loops

    Returns all combinational loops of this module.

  • combinational_subgraph

    Returns a subgraph of the given module's graph that only contains combinational elements (and submodule instances).

has_comb_loops

has_comb_loops(module_or_circuit: Union[Module, Circuit]) -> bool

Checks whether the given module or circuit contains combinational loops and prints a warning if found.

Parameters:

  • module_or_circuit

    (Union[Module, Circuit]) –

    The module to check for combinational loops. Alternatively, a circuit object, where each module is checked for combinational loops.

Returns:

  • bool ( bool ) –

    True if at least one combinational loop was found, False otherwise.

module_has_comb_loops

module_has_comb_loops(module: Module) -> bool

Checks whether the given module contains combinational loops and prints a warning if found.

Parameters:

  • module

    (Module) –

    The module to check for combinational loops.

Returns:

  • bool ( bool ) –

    True if at least one combinational loop was found, False otherwise.

find_comb_loops

find_comb_loops(module_or_circuit: Module) -> COMB_LOOPS
find_comb_loops(module_or_circuit: Circuit) -> Dict[str, COMB_LOOPS]
find_comb_loops(
    module_or_circuit: Union[Module, Circuit],
) -> Union[Dict[str, COMB_LOOPS], COMB_LOOPS]

Returns all combinational loops of this module.

In case the actual loops or the amound of loops does not matter, use the function has_comb_loops instead. The function has_comb_loops is faster (especially for very large modules) as it only checks if the graph is acyclic and does not bother to find all loops.

Parameters:

  • module_or_circuit

    (Union[Module, Circuit]) –

    The module to return all combinational loops from. Alternatively, a circuit object, where each module is checked for combinational loops.

Returns:

  • Union[Dict[str, COMB_LOOPS], COMB_LOOPS]

    Union[Dict[str, COMB_LOOPS], COMB_LOOPS]: A list of combinational loops, where each loop again is a list, containing the node names that form the combinational loop, ordered by occurence in the loop. This means, the last element in the list drives the first element. If this list is empty, no combinational loops were found. If a circuit is provided, returns a dictionary with module names as keys and lists of combinational loops as values.

module_find_comb_loops

module_find_comb_loops(module: Module) -> COMB_LOOPS

Returns all combinational loops of this module.

In case the actual loops or the amound of loops does not matter, use the function has_comb_loops instead. The function has_comb_loops is faster (especially for very large modules) as it only checks if the graph is acyclic and does not bother to find all loops.

Parameters:

  • module

    (Module) –

    The module to return all combinational loops from.

Returns:

  • COMB_LOOPS ( COMB_LOOPS ) –

    A list of combinational loops, where each loop again is a list, containing the node names that form the combinational loop, ordered by occurence in the loop. This means, the last element in the list drives the first element. If this list is empty, no combinational loops were found.

combinational_subgraph

combinational_subgraph(module: Module) -> ModuleGraph

Returns a subgraph of the given module's graph that only contains combinational elements (and submodule instances).

Parameters:

  • module

    (Module) –

    The module to get the combinational subgraph from.

Returns:

  • ModuleGraph ( ModuleGraph ) –

    A subgraph that only contains combinational elements (and possibly submodule instances).