Cleanup networks

Header: mockturtle/algorithms/cleanup.hpp

template<class NtkSrc, class NtkDest = NtkSrc>
NtkDest mockturtle::cleanup_dangling(NtkSrc const &ntk, bool remove_dangling_PIs = false, bool remove_redundant_POs = false)

Cleans up dangling nodes.

This method reconstructs a network and omits all dangling nodes. If the flag remove_dangling_PIs is true, dangling PIs are also omitted. If the flag remove_redundant_POs is true, redundant POs, i.e. POs connected to a PI or constant, are also omitted. The network types of the source and destination network are the same.

Required network functions:

  • get_node

  • node_to_index

  • get_constant

  • create_pi

  • create_po

  • create_not

  • is_complemented

  • foreach_node

  • foreach_pi

  • foreach_po

  • clone_node

  • is_pi

  • is_constant

Note

This method returns the cleaned up network as a return value. It does not modify the input network.

Warning

doxygenfunction: Unable to resolve function “mockturtle::cleanup_dangling” with arguments (NtkSource const&, NtkDest&, LeavesIterator, LeavesIterator) in doxygen xml output for project “mockturtle” from directory: doxyxml/xml. Potential matches:

- template<class NtkSrc, class NtkDest = NtkSrc> NtkDest cleanup_dangling(NtkSrc const &ntk, bool remove_dangling_PIs = false, bool remove_redundant_POs = false)
- template<typename NtkSrc, typename NtkDest, typename LeavesIterator> std::vector<signal<NtkDest>> cleanup_dangling(NtkSrc const &ntk, NtkDest &dest, LeavesIterator begin, LeavesIterator end)
template<class Ntk>
Ntk mockturtle::cleanup_luts(Ntk const &ntk)

Cleans up LUT nodes.

This method reconstructs a LUT network and optimizes LUTs when they do not depend on all their fanin, or when some of the fanin are constant inputs.

Constant gate inputs will be propagated.

Required network functions:

  • get_node

  • get_constant

  • foreach_pi

  • foreach_po

  • foreach_node

  • foreach_fanin

  • create_pi

  • create_po

  • create_node

  • create_not

  • is_constant

  • is_pi

  • is_complemented

  • node_function

Note

This method returns the cleaned up network as a return value. It does not modify the input network.