From 13fd0d55c7b7e54cf0a7fc70ade6ffeae7397d5b Mon Sep 17 00:00:00 2001 From: aletempiac Date: Wed, 21 Feb 2024 09:47:16 +0100 Subject: [PATCH] Removing unnecessary structs --- src/map/if/acd/ac_wrapper.cpp | 7 ++---- src/map/if/acd/acd66.hpp | 42 ++++++++++++----------------------- 2 files changed, 16 insertions(+), 33 deletions(-) diff --git a/src/map/if/acd/ac_wrapper.cpp b/src/map/if/acd/ac_wrapper.cpp index 441cb7008..f2e2f1015 100644 --- a/src/map/if/acd/ac_wrapper.cpp +++ b/src/map/if/acd/ac_wrapper.cpp @@ -74,9 +74,7 @@ int acd66_evaluate( word * pTruth, unsigned nVars, int compute_decomposition ) { using namespace acd; - acd66_params ps; - ps.verify = false; - acd66_impl acd( nVars, ps ); + acd66_impl acd( nVars, false ); if ( acd.run( pTruth ) == 0 ) return 0; @@ -97,8 +95,7 @@ int acd66_decompose( word * pTruth, unsigned nVars, unsigned char *decomposition { using namespace acd; - acd66_params ps; - acd66_impl acd( nVars, ps ); + acd66_impl acd( nVars, false ); acd.run( pTruth ); int val = acd.compute_decomposition(); diff --git a/src/map/if/acd/acd66.hpp b/src/map/if/acd/acd66.hpp index 976c1e353..7c8c7a821 100644 --- a/src/map/if/acd/acd66.hpp +++ b/src/map/if/acd/acd66.hpp @@ -44,25 +44,6 @@ ABC_NAMESPACE_CXX_HEADER_START namespace acd { -/*! \brief Parameters for acd66 */ -struct acd66_params -{ - /*! \brief Maximum size of the free set (1 < num < 6). */ - uint32_t max_free_set_vars{ 5 }; - - /*! \brief Number of configurations to test for decomposition. */ - uint32_t max_evaluations{ 3 }; - - /*! \brief Run verification before returning. */ - bool verify{ false }; -}; - -/*! \brief Statistics for acd66 */ -struct acd66_stats -{ - uint32_t num_edges{ 0 }; -}; - class acd66_impl { private: @@ -71,8 +52,8 @@ private: using LTT = kitty::static_truth_table<6>; public: - explicit acd66_impl( uint32_t num_vars, acd66_params const& ps, acd66_stats* pst = nullptr ) - : num_vars( num_vars ), ps( ps ), pst( pst ) + explicit acd66_impl( uint32_t num_vars, bool verify = false ) + : num_vars( num_vars ), verify( verify ) { std::iota( permutations.begin(), permutations.end(), 0 ); } @@ -102,17 +83,23 @@ public: compute_decomposition_impl(); - if ( ps.verify && !verify_impl() ) + if ( verify && !verify_impl() ) { return 1; } - if ( pst ) + return 0; + } + + uint32_t get_num_edges() + { + if ( bs_support_size == UINT32_MAX ) { - pst->num_edges = bs_support_size + best_free_set + 1 + ( best_multiplicity > 2 ? 1 : 0 ); + return num_vars + 1 + ( best_multiplicity > 2 ? 1 : 0 ); } - return 0; + /* real value after support minimization */ + return bs_support_size + best_free_set + 1 + ( best_multiplicity > 2 ? 1 : 0 ); } /* contains a 1 for BS variables */ @@ -146,7 +133,7 @@ private: best_free_set = UINT32_MAX; /* find AC decompositions with minimal multiplicity */ - for ( uint32_t i = num_vars - 6; i <= 5 && i <= ps.max_free_set_vars; ++i ) + for ( uint32_t i = num_vars - 6; i <= 5; ++i ) { if ( find_decomposition_bs( i ) ) return true; @@ -940,8 +927,7 @@ private: uint32_t bs_support[6]; uint32_t num_vars; - acd66_params const& ps; - acd66_stats* pst; + bool verify; std::array permutations; };