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

33 lines
794 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::resubstitution_params ps;
mockturtle::resubstitution_stats st;
ps.max_pis = 8u;
ps.max_inserts = 1u;
ps.progress = false;
mockturtle::depth_view depth_mig{ mig };
mockturtle::fanout_view fanout_mig{ depth_mig };
mockturtle::mig_resubstitution( fanout_mig, ps, &st );
mig = mockturtle::cleanup_dangling( mig );
// output
mockturtle::write_verilog(mig, "mig.v");
return 0;
}