Skip to content
Prev Previous commit
Next Next commit
if a cyclic substitution is detected, avoid substitution (for all out…
…puts).
  • Loading branch information
hriener committed Apr 23, 2021
commit 520c2dd679115675d50a0be104809fd5257f72a9
9 changes: 7 additions & 2 deletions include/mockturtle/algorithms/window_rewriting.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,15 @@ class window_rewriting_impl
if ( ps.filter_cyclic_substitutions && is_contained_in_tfi( ntk, ntk.get_node( _new ), ntk.get_node( _old ) ) )
{
std::cout << "undo resubstitution " << ntk.get_node( _old ) << std::endl;
if ( ntk.fanout_size( ntk.get_node( _new ) ) == 0u )
substitutions.emplace_back( std::make_pair( ntk.get_node( _old ), ntk.is_complemented( _old ) ? !_new : _new ) );
for ( auto it = std::rbegin( substitutions ); it != std::rend( substitutions ); ++it )
{
ntk.take_out_node( ntk.get_node( _new ) );
if ( ntk.fanout_size( ntk.get_node( it->second ) ) == 0u )
{
ntk.take_out_node( ntk.get_node( it->second ) );
}
}
substitutions.clear();
return false;
}

Expand Down