Skip to content

Commit

Permalink
Fix required time decrease with multi-output cells in emap
Browse files Browse the repository at this point in the history
  • Loading branch information
aletempiac committed Feb 15, 2024
1 parent 5168ba2 commit 8b3791c
Showing 1 changed file with 24 additions and 23 deletions.
47 changes: 24 additions & 23 deletions include/mockturtle/algorithms/emap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1801,10 +1801,17 @@ class emap_impl
/* try a multi-output match */
if ( ps.map_multioutput && node_tuple_match[index] < UINT32_MAX - 1 )
{
match_multioutput_exact<SwitchActivity>( *it, true );
bool mapped = match_multioutput_exact<SwitchActivity>( *it, true );

/* propagate required time for the selected gates */
match_multioutput_propagate_required( *it );
if ( mapped )
{
match_multioutput_propagate_required( *it );
}
else
{
match_propagate_required( index );
}
}
else
{
Expand Down Expand Up @@ -3021,6 +3028,19 @@ class emap_impl
return false;
}

/* if one of the outputs is not referenced, do not use multi-output gate */
if ( last_round )
{
for ( uint32_t j = 0; j < max_multioutput_output_size; ++j )
{
uint32_t node_index = tuple_data[j].node_index;
if ( node_match[node_index].map_refs[2] == 0 )
{
return false;
}
}
}

/* if "same match" and used in the cover dereference the leaves (reverse topo order) */
for ( int j = max_multioutput_output_size - 1; j >= 0; --j )
{
Expand All @@ -3041,28 +3061,9 @@ class emap_impl
}
}

/* if one of the outputs is not referenced, do not use multi-output gate */
bool skip = false;
if ( last_round )
{
for ( uint32_t j = 0; j < max_multioutput_output_size; ++j )
{
uint32_t node_index = tuple_data[j].node_index;
if ( node_match[node_index].map_refs[2] == 0 )
{
skip = true;
break;
}
}
}

bool mapped_multioutput = false;

/* perform mapping */
if ( !skip )
{
mapped_multioutput = match_multioutput_exact_core<SwitchActivity>( tuple_data, best_exact_area );
}
bool mapped_multioutput = false;
mapped_multioutput = match_multioutput_exact_core<SwitchActivity>( tuple_data, best_exact_area );

/* if "same match" and used in the cover reference the leaves (topo order) */
for ( auto j = 0; j < max_multioutput_output_size; ++j )
Expand Down

0 comments on commit 8b3791c

Please sign in to comment.