TableForMTAndAG/MTCodes/rewriting.cpp
Lukas Plevac b7f83bfed2 Init
2024-11-16 21:06:27 +01:00

31 lines
810 B
C++

#include <lorina/aiger.hpp>
#include <mockturtle/mockturtle.hpp>
int main() {
mockturtle::mig_network mig;
auto const result = lorina::read_aiger("aig.aig", mockturtle::aiger_reader(mig) );
if ( result != lorina::return_code::success ) {
std::cout << "Read AIG failed\n";
return -1;
}
//apply rewriring
//mockturtle::mig_algebraic_depth_rewriting(mig);
mockturtle::mig_algebraic_depth_rewriting_params rp;
//rp.strategy = mockturtle::mig_algebraic_depth_rewriting_params::aggressive;
//rp.overhead = 1.5;
mockturtle::depth_view depth_mig{ mig };
mockturtle::fanout_view fanout_mig{ depth_mig };
mockturtle::mig_algebraic_depth_rewriting(fanout_mig, rp);
mig = mockturtle::cleanup_dangling( mig );
// output
mockturtle::write_verilog(mig, "mig.v");
return 0;
}