From 8f3447800cc93f891cc84bb4bbc88e76bb5d6ef7 Mon Sep 17 00:00:00 2001 From: aletempiac Date: Tue, 2 Apr 2024 11:25:03 +0200 Subject: [PATCH] Support again decompositions into luts smaller than 6 --- src/map/if/acd/ac_decomposition.hpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/map/if/acd/ac_decomposition.hpp b/src/map/if/acd/ac_decomposition.hpp index a384cc2e1..a7321d0d5 100644 --- a/src/map/if/acd/ac_decomposition.hpp +++ b/src/map/if/acd/ac_decomposition.hpp @@ -1369,10 +1369,15 @@ private: std::swap( var_index1, var_index2 ); } - assert( num_vars > 6 ); const uint32_t num_blocks = 1 << ( num_vars - 6 ); - if ( var_index2 <= 5 ) + if ( num_vars <= 6 ) + { + const auto& pmask = kitty::detail::ppermutation_masks[var_index1][var_index2]; + const auto shift = ( 1 << var_index2 ) - ( 1 << var_index1 ); + tt._bits[0] = ( tt._bits[0] & pmask[0] ) | ( ( tt._bits[0] & pmask[1] ) << shift ) | ( ( tt._bits[0] & pmask[2] ) >> shift ); + } + else if ( var_index2 <= 5 ) { const auto& pmask = kitty::detail::ppermutation_masks[var_index1][var_index2]; const auto shift = ( 1 << var_index2 ) - ( 1 << var_index1 );