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.)
inputsare the common support of all window nodes, they do not overlap withgates(i.e., the intersection ofinputsandgatesis the empty set). 2.)gatesare the nodes in the window, supported by theinputs(i.e.,gatesare in the transitive fanout of theinputs). 3.)outputsare signals (regular or complemented nodes) pointing to nodes ingatesorinputs. Not all fanouts of an output node are already part of the window.Required network functions for the source Ntk:
foreach_faninget_nodeget_constantis_complemented
Required network functions for the cloned SubNtk:
create_picreate_pocreate_notget_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_constantcreate_not
Required network functions for the subnetwork SubNtk:
num_pisforeach_piforeach_poforeach_gateforeach_faninget_nodeis_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
Restore network and PI/PO names
Header: mockturtle/utils/name_utils.hpp
-
template<typename NtkSrc, typename NtkDest>
void mockturtle::restore_network_name(const NtkSrc &ntk_src, NtkDest &ntk_dest) noexcept Restores the network name that might have been given to network’s former incarnation.
- Parameters:
ntk_src – The source logic network, which potentially has a name
ntk_dest – The destination logic network, whose name is to be restored
-
template<typename NtkSrc, typename NtkDest>
void mockturtle::restore_names(const NtkSrc &ntk_src, NtkDest &ntk_dest, node_map<signal<NtkDest>, NtkSrc> &old2new) noexcept Restores all names that might have been given to a network’s former incarnation.
Required network functions for the NtkSrc:
foreach_nodeforeach_faninforeach_poget_node
- Parameters:
ntk_src – The source logic network, which potentially has named signals
ntk_dest – The destination logic network, whose names are to be restored
old2new – Mapping of nodes from ntk_src to signals of ntk_dest
-
template<typename NtkSrc, typename NtkDest>
void mockturtle::restore_pio_names_by_order(const NtkSrc &ntk_src, NtkDest &ntk_dest) Restore PI and PO names, matching by order.
Required network functions for NtkSrc:
foreach_piforeach_ponum_pisnum_poshas_nameget_namemake_signalhas_output_nameget_output_name
Required network functions for NtkDest:
foreach_pinum_pisnum_posset_namemake_signalset_output_name
- Parameters:
ntk_src – The source logic network, which potentially has named signals
ntk_dest – The destination logic network, whose names are to be restored