Utility functions¶
Manipulate windows with network data types¶
Header: mockturtle/utils/network_utils.hpp
-
template<typename Ntk, typename SubNtk>
void mockturtle::clone_subnetwork(Ntk const &ntk, std::vector<typename Ntk::node> const &inputs, std::vector<typename Ntk::signal> const &outputs, std::vector<typename Ntk::node> const &gates, SubNtk &subntk)¶ Constructs a (sub-)network from a window of another network.
The window is specified by three parameters: 1.)
inputs
are the common support of all window nodes, they do not overlap withgates
(i.e., the intersection ofinputs
andgates
is the empty set). 2.)gates
are the nodes in the window, supported by theinputs
(i.e.,gates
are in the transitive fanout of theinputs
). 3.)outputs
are signals (regular or complemented nodes) pointing to nodes ingates
orinputs
. Not all fanouts of an output node are already part of the window.Required network functions for the source Ntk:
foreach_fanin
get_node
get_constant
is_complemented
Required network functions for the cloned SubNtk:
create_pi
create_po
create_not
get_constant
- Parameters
ntk – A logic network
subntk – An empty network to be constructed
-
template<typename Ntk, typename SubNtk, typename BeginIter, typename EndIter, typename Fn>
void mockturtle::insert_ntk(Ntk &ntk, BeginIter begin, EndIter end, SubNtk const &subntk, Fn &&fn)¶ Inserts a network into another network.
Required network functions for the host Ntk:
get_constant
create_not
Required network functions for the subnetwork SubNtk:
num_pis
foreach_pi
foreach_po
foreach_gate
foreach_fanin
get_node
is_complemented
- Parameters
ntk – The host logic network
begin – Begin iterator of signal inputs in the host network
end – End iterator of signal inputs in the host network
subntk – The sub-network
fn – Callback function