Skip to content

Commit 8b3791c

Browse files
committed
Fix required time decrease with multi-output cells in emap
1 parent 5168ba2 commit 8b3791c

File tree

1 file changed

+24
-23
lines changed

1 file changed

+24
-23
lines changed

include/mockturtle/algorithms/emap.hpp

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,10 +1801,17 @@ class emap_impl
18011801
/* try a multi-output match */
18021802
if ( ps.map_multioutput && node_tuple_match[index] < UINT32_MAX - 1 )
18031803
{
1804-
match_multioutput_exact<SwitchActivity>( *it, true );
1804+
bool mapped = match_multioutput_exact<SwitchActivity>( *it, true );
18051805

18061806
/* propagate required time for the selected gates */
1807-
match_multioutput_propagate_required( *it );
1807+
if ( mapped )
1808+
{
1809+
match_multioutput_propagate_required( *it );
1810+
}
1811+
else
1812+
{
1813+
match_propagate_required( index );
1814+
}
18081815
}
18091816
else
18101817
{
@@ -3021,6 +3028,19 @@ class emap_impl
30213028
return false;
30223029
}
30233030

3031+
/* if one of the outputs is not referenced, do not use multi-output gate */
3032+
if ( last_round )
3033+
{
3034+
for ( uint32_t j = 0; j < max_multioutput_output_size; ++j )
3035+
{
3036+
uint32_t node_index = tuple_data[j].node_index;
3037+
if ( node_match[node_index].map_refs[2] == 0 )
3038+
{
3039+
return false;
3040+
}
3041+
}
3042+
}
3043+
30243044
/* if "same match" and used in the cover dereference the leaves (reverse topo order) */
30253045
for ( int j = max_multioutput_output_size - 1; j >= 0; --j )
30263046
{
@@ -3041,28 +3061,9 @@ class emap_impl
30413061
}
30423062
}
30433063

3044-
/* if one of the outputs is not referenced, do not use multi-output gate */
3045-
bool skip = false;
3046-
if ( last_round )
3047-
{
3048-
for ( uint32_t j = 0; j < max_multioutput_output_size; ++j )
3049-
{
3050-
uint32_t node_index = tuple_data[j].node_index;
3051-
if ( node_match[node_index].map_refs[2] == 0 )
3052-
{
3053-
skip = true;
3054-
break;
3055-
}
3056-
}
3057-
}
3058-
3059-
bool mapped_multioutput = false;
3060-
30613064
/* perform mapping */
3062-
if ( !skip )
3063-
{
3064-
mapped_multioutput = match_multioutput_exact_core<SwitchActivity>( tuple_data, best_exact_area );
3065-
}
3065+
bool mapped_multioutput = false;
3066+
mapped_multioutput = match_multioutput_exact_core<SwitchActivity>( tuple_data, best_exact_area );
30663067

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

0 commit comments

Comments
 (0)