Skip to content

netlist_carpentry.routines.opt.circuit_cleanup

Optimization Methods to remove empty or uninstantiated modules from circuit perspective (top abstraction layer).

Functions:

  • clean_circuit

    Execute several optimization and cleanup tasks on the circuit, from a top-level POV.

  • clean_unused

    Removes all modules that are not instantiated anywhere (and thus considered unused) in the given circuit.

clean_circuit

clean_circuit(circuit: Circuit) -> bool

Execute several optimization and cleanup tasks on the circuit, from a top-level POV.

Currently, the only implemented optimization process removes all unused modules from the circuit. As a result, every module not instantiated anywhere in the circuit is removed.

Parameters:

  • circuit

    (Circuit) –

    The circuit to optimize.

Returns:

  • bool ( bool ) –

    True if the circuit was modified as a result of the optimization processes, False otherwise.

clean_unused

clean_unused(circuit: Circuit) -> bool

Removes all modules that are not instantiated anywhere (and thus considered unused) in the given circuit.

Parameters:

  • circuit

    (Circuit) –

    The circuit to clean and optimize.

Returns:

  • bool ( bool ) –

    True if at least one unused module was found and subsequently removed, False otherwise.