Write into file formats
Write into AIGER files
Header: mockturtle/io/write_aiger.hpp
-
template<typename Ntk>
inline void mockturtle::write_aiger(Ntk const &aig, std::string const &filename) Writes an AIG network in binary AIGER format into a file.
This function should be only called on “clean” aig_networks, e.g., immediately after
cleanup_dangling.Sequential networks (e.g.,
sequential<aig_network>) are supported: their registers are emitted as AIGER latches. See thestd::ostreamoverload for the requirements this places on the order in which the network was built.Required network functions:
num_cisnum_cosforeach_gateforeach_faninforeach_poget_nodeis_complementednode_to_index
Optional network functions (enable sequential support):
num_registersforeach_riregister_at
- Parameters:
aig – AIG network
filename – Filename
-
template<typename Ntk>
inline void mockturtle::write_aiger(Ntk const &aig, std::ostream &os) Writes an AIG network in binary AIGER format into a file.
This function should be only called on “clean” aig_networks, e.g., immediately after
cleanup_dangling.Sequential networks (e.g.,
sequential<aig_network>) are supported: their registers are emitted as AIGER latches. For a network type that does not implementforeach_ri/num_registers, a latch count of 0 is written and the network is asserted to be combinational.The binary AIGER format encodes the primary inputs and the register outputs implicitly, by requiring that variables
1..Iare the primary inputs and variablesI+1..I+Lare the register outputs. Networks must therefore be built by creating all primary inputs first, then all register outputs, before any gate. This matches the order in whichaiger_readerconstructs a network and is checked by an assertion.Required network functions:
num_cisnum_cosforeach_gateforeach_faninforeach_poget_nodeis_complementednode_to_index
Optional network functions (enable sequential support):
num_registersforeach_riregister_at
- Parameters:
aig – AIG network
os – Output stream
Write into BENCH files
Header: mockturtle/io/write_bench.hpp
-
template<class Ntk>
void mockturtle::write_bench(Ntk const &ntk, std::string const &filename) Writes network in BENCH format into a file.
Required network functions:
is_constantis_piis_complementedget_nodenum_posnode_to_indexnode_function
- Parameters:
ntk – Network
filename – Filename
-
template<class Ntk>
void mockturtle::write_bench(Ntk const &ntk, std::ostream &os) Writes network in BENCH format into output stream.
An overloaded variant exists that writes the network into a file.
Required network functions:
is_constantis_piis_complementedget_nodenum_posnode_to_indexnode_function
- Parameters:
ntk – Network
os – Output stream
Write into BLIF files
Header: mockturtle/io/write_blif.hpp
-
template<class Ntk>
void mockturtle::write_blif(Ntk const &ntk, std::string const &filename, write_blif_params const &ps = {}) Writes network in BLIF format into a file.
Required network functions:
fanin_sizeforeach_faninforeach_piforeach_poget_nodeis_constantis_pinode_functionnode_to_indexnum_pisnum_pos
- Parameters:
ntk – Network
filename – Filename
-
template<class Ntk>
void mockturtle::write_blif(Ntk const &ntk, std::ostream &os, write_blif_params const &ps = {}) Writes network in BLIF format into output stream.
An overloaded variant exists that writes the network into a file.
Required network functions:
fanin_sizeforeach_faninforeach_piforeach_poget_nodeis_constantis_pinode_functionnode_to_indexnum_pisnum_pos
- Parameters:
ntk – Network
os – Output stream
Write into structural Verilog files
Header: mockturtle/io/write_verilog.hpp
-
template<class Ntk>
void mockturtle::write_verilog(Ntk const &ntk, std::string const &filename, write_verilog_params const &ps = {}) Writes network in structural Verilog format into a file.
Required network functions:
num_pisnum_posforeach_piforeach_nodeforeach_faninget_nodeget_constantis_constantis_piis_andis_oris_xoris_xor3is_majnode_to_index
- Parameters:
ntk – Network
filename – Filename
-
template<class Ntk>
void mockturtle::write_verilog(Ntk const &ntk, std::ostream &os, write_verilog_params const &ps = {}) Writes network in structural Verilog format into output stream.
An overloaded variant exists that writes the network into a file.
Required network functions:
num_pisnum_posforeach_piforeach_nodeforeach_faninget_nodeget_constantis_constantis_piis_andis_oris_xoris_xor3is_majis_itenode_to_index
- Parameters:
ntk – Network
os – Output stream
-
template<class Ntk>
void mockturtle::write_verilog_with_binding(Ntk const &ntk, std::string const &filename, write_verilog_params const &ps = {}) Writes mapped network in structural Verilog format into a file.
Required network functions:
num_pisnum_posforeach_piforeach_nodeforeach_faninget_nodeget_constantis_constantis_pinode_to_indexhas_bindingget_binding_index
- Parameters:
ntk – Network (binding_view)
filename – Filename
-
template<class Ntk>
void mockturtle::write_verilog_with_binding(Ntk const &ntk, std::ostream &os, write_verilog_params const &ps = {}) Writes mapped network in structural Verilog format into output stream.
Required network functions:
num_pisnum_posforeach_piforeach_nodeforeach_faninget_nodeget_constantis_constantis_pinode_to_indexhas_bindingget_binding_index
- Parameters:
ntk – Mapped network
os – Output stream
ps – Verilog parameters
-
template<class Ntk>
void mockturtle::write_verilog_with_cell(Ntk const &ntk, std::string const &filename, write_verilog_params const &ps = {}) Writes mapped network in structural Verilog format into a file.
Required network functions:
num_pisnum_posforeach_piforeach_nodeforeach_faninget_nodeget_constantis_constantis_pinode_to_indexhas_cellget_cell_index
- Parameters:
ntk – Network (cell_view)
filename – Filename
-
template<class Ntk>
void mockturtle::write_verilog_with_cell(Ntk const &ntk, std::ostream &os, write_verilog_params const &ps = {}) Writes mapped network in structural Verilog format into output stream.
Required network functions:
num_pisnum_posforeach_piforeach_nodeforeach_faninget_nodeget_constantis_constantis_pinode_to_indexhas_cellget_cell_index
- Parameters:
ntk – Mapped network
os – Output stream
ps – Verilog parameters
Write into DIMACS files (CNF)
Header: mockturtle/io/write_cnf.hpp
Write into DOT files (Graphviz)
Header: mockturtle/io/write_dot.hpp
-
template<class Ntk, class Drawer = default_dot_drawer<Ntk>>
void mockturtle::write_dot(Ntk const &ntk, std::string const &filename, Drawer const &drawer = {}) Writes network in DOT format into a file.
Required network functions:
is_constant
is_ci
foreach_node
foreach_fanin
foreach_po
- Parameters:
ntk – Network
filename – Filename
-
template<class Ntk, class Drawer = default_dot_drawer<Ntk>>
void mockturtle::write_dot(Ntk const &ntk, std::ostream &os, Drawer const &drawer = {}) Writes network in DOT format into output stream.
An overloaded variant exists that writes the network into a file.
Required network functions:
is_constant
is_ci
foreach_node
foreach_fanin
foreach_po
- Parameters:
ntk – Network
os – Output stream
Write simulation patterns into file
Header: mockturtle/io/write_patterns.hpp
-
template<class Simulator>
void mockturtle::write_patterns(Simulator const &sim, std::string const &filename) Writes simulation patterns.
The output contains
num_pis()lines, each line contains a stream of simulation values of a primary input, represented in hexadecimal.- Parameters:
sim – The
partial_simulatororbit_packed_simulatorobject containing simulation patternsfilename – Filename
-
template<class Simulator>
void mockturtle::write_patterns(Simulator const &sim, std::ostream &out = std::cout) Writes simulation patterns.
The output contains
num_pis()lines, each line contains a stream of simulation values of a primary input, represented in hexadecimal.- Parameters:
sim – The
partial_simulatororbit_packed_simulatorobject containing simulation patternsout – Output stream
Write library into GENLIB file
Header: mockturtle/io/write_genlib.hpp
-
void mockturtle::write_genlib(std::vector<gate> const &gates, std::string const &filename)
Write library of gates into a GENLIB file.
- Parameters:
gates – List of gates
filename – Filename
-
void mockturtle::write_genlib(std::vector<gate> const &gates, std::ostream &os)
Writes library of gates to GENLIB format.
An overloaded variant exists that writes the network into a file.
- Parameters:
gates – List of gates
os – Output stream