mirror of https://github.com/YosysHQ/abc.git
Adding ACD cascade 666, performance improvements
This commit is contained in:
parent
eba56b088f
commit
f72000f5ae
|
|
@ -19630,9 +19630,9 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
pPars->pLutStruct = argv[globalUtilOptind];
|
||||
pPars->fEnableStructN = 1;
|
||||
globalUtilOptind++;
|
||||
if ( strlen(pPars->pLutStruct) != 2 )
|
||||
if ( strlen(pPars->pLutStruct) != 2 && strlen(pPars->pLutStruct) != 3 )
|
||||
{
|
||||
Abc_Print( -1, "Command line switch \"-J\" should be followed by a 2-char string (e.g. \"66\").\n" );
|
||||
Abc_Print( -1, "Command line switch \"-J\" should be followed by a 2- or 3-char string (e.g. \"66\" or \"666\").\n" );
|
||||
goto usage;
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
#include "ac_wrapper.h"
|
||||
#include "ac_decomposition.hpp"
|
||||
#include "acd66.hpp"
|
||||
#include "acd666.hpp"
|
||||
|
||||
ABC_NAMESPACE_IMPL_START
|
||||
|
||||
|
|
@ -108,4 +109,25 @@ int acd66_decompose( word * pTruth, unsigned nVars, unsigned char *decomposition
|
|||
return 0;
|
||||
}
|
||||
|
||||
int acd666_evaluate( word * pTruth, unsigned nVars, int compute_decomposition )
|
||||
{
|
||||
using namespace acd;
|
||||
|
||||
acd666_impl acd( nVars, false );
|
||||
|
||||
if ( acd.run( pTruth ) == 0 )
|
||||
return 0;
|
||||
|
||||
if ( !compute_decomposition )
|
||||
return 1;
|
||||
|
||||
int val = acd.compute_decomposition();
|
||||
if ( val != 0 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
ABC_NAMESPACE_IMPL_END
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ int acd_decompose( word * pTruth, unsigned nVars, int lutSize, unsigned *pdelay,
|
|||
int acd66_evaluate( word * pTruth, unsigned nVars, int compute_decomposition );
|
||||
int acd66_decompose( word * pTruth, unsigned nVars, unsigned char *decomposition );
|
||||
|
||||
int acd666_evaluate( word * pTruth, unsigned nVars, int compute_decomposition );
|
||||
|
||||
ABC_NAMESPACE_HEADER_END
|
||||
|
||||
#endif
|
||||
|
|
@ -52,7 +52,7 @@ private:
|
|||
using LTT = kitty::static_truth_table<6>;
|
||||
|
||||
public:
|
||||
explicit acd66_impl( uint32_t num_vars, bool verify = false )
|
||||
explicit acd66_impl( uint32_t const num_vars, bool const verify = false )
|
||||
: num_vars( num_vars ), verify( verify )
|
||||
{
|
||||
std::iota( permutations.begin(), permutations.end(), 0 );
|
||||
|
|
@ -838,8 +838,8 @@ private:
|
|||
uint64_t dec_funcs[2];
|
||||
uint32_t bs_support[6];
|
||||
|
||||
uint32_t num_vars;
|
||||
bool verify;
|
||||
uint32_t const num_vars;
|
||||
bool const verify;
|
||||
std::array<uint32_t, max_num_vars> permutations;
|
||||
};
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -276,6 +276,31 @@ int If_CluCheck66( If_Man_t * p, word * pTruth0, int nVars, int fHashing )
|
|||
return G1.nVars;
|
||||
}
|
||||
|
||||
// returns if successful
|
||||
int If_CluCheck666( If_Man_t * p, word * pTruth0, int nVars, int fHashing )
|
||||
{
|
||||
If_Grp_t G1 = {0};
|
||||
unsigned * pHashed = NULL;
|
||||
|
||||
if ( p && fHashing )
|
||||
{
|
||||
pHashed = If_CluHashLookup2( p, pTruth0, 0 );
|
||||
if ( pHashed && *pHashed != CLU_UNUSED )
|
||||
If_CluUns2Grp2( *pHashed, &G1 );
|
||||
}
|
||||
|
||||
/* new entry */
|
||||
if ( G1.nVars == 0 )
|
||||
{
|
||||
G1.nVars = acd666_evaluate( pTruth0, nVars, 0 );
|
||||
}
|
||||
|
||||
if ( pHashed )
|
||||
*pHashed = If_CluGrp2Uns2( &G1 );
|
||||
|
||||
return G1.nVars;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Performs ACD into 66 cascade.]
|
||||
|
|
@ -302,7 +327,7 @@ int If_CutPerformCheck66( If_Man_t * p, unsigned * pTruth0, int nVars, int nLeav
|
|||
|
||||
// quit if parameters are wrong
|
||||
Length = strlen(pStr);
|
||||
if ( Length != 2 )
|
||||
if ( Length != 2 && Length != 3 )
|
||||
{
|
||||
printf( "Wrong LUT struct (%s)\n", pStr );
|
||||
return 0;
|
||||
|
|
@ -316,7 +341,7 @@ int If_CutPerformCheck66( If_Man_t * p, unsigned * pTruth0, int nVars, int nLeav
|
|||
}
|
||||
}
|
||||
|
||||
if ( nLeaves > 11 )
|
||||
if ( ( Length == 2 && nLeaves > 11 ) || ( Length == 3 && nLeaves > 16 ) )
|
||||
{
|
||||
printf( "The cut size (%d) is too large for the LUT structure %s.\n", nLeaves, pStr );
|
||||
return 0;
|
||||
|
|
@ -327,7 +352,10 @@ int If_CutPerformCheck66( If_Man_t * p, unsigned * pTruth0, int nVars, int nLeav
|
|||
return 1;
|
||||
|
||||
// derive the decomposition
|
||||
return If_CluCheck66(p, (word*)pTruth, nVars, 1);
|
||||
if ( Length == 2 )
|
||||
return If_CluCheck66(p, (word*)pTruth, nVars, 1);
|
||||
else
|
||||
return If_CluCheck666(p, (word*)pTruth, nVars, 1);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
Loading…
Reference in New Issue