73 static unsigned s_BigPrimes[7] = {12582917, 25165843, 50331653, 100663319, 201326611, 402653189, 805306457};
76 for ( w = 0; w <
nWords; w++ )
77 Key += pFunc[w] * s_BigPrimes[w % 7];
78 return (
int)(Key % nTableSize);
84 for ( iThat = pTable[Key]; iThat != -1; iThat = pNexts[iThat] )
85 if ( !
memcmp( pFuncs[iThat], pFuncs[iThis],
sizeof(
word) * nWords ) )
98 for ( i = 0; i < p->
nFuncs; i++ )
104 pNexts[i] = pTable[Key], pTable[Key] = i;
110 for ( i = k = 1; i < p->
nFuncs; i++ )
111 if ( p->
pFuncs[i] != NULL )
137 for ( i = k = 1; i < p->
nFuncs; i++ )
156 char pCanonPerm[16];
int i;
158 for ( i = 0; i < nVars; i++ )
159 pCanonPerm[i] = pCanonPermInit ? pCanonPermInit[i] :
'a' + i;
160 printf(
" %c = ( ",
Abc_InfoHasBit(&uCanonPhase, nVars) ?
'Z':
'z' );
161 for ( i = 0; i < nVars; i++ )
162 printf(
"%c%s", pCanonPerm[i] + (
'A'-
'a') *
Abc_InfoHasBit(&uCanonPhase, pCanonPerm[i]-
'a'), i == nVars-1 ?
"":
"," );
180 word pAuxWord[1024], pAuxWord1[1024];
182 unsigned uCanonPhase=0;
186 char * pAlgoName = NULL;
188 pAlgoName =
"uniqifying ";
189 else if ( NpnType == 1 )
190 pAlgoName =
"exact NPN ";
191 else if ( NpnType == 2 )
192 pAlgoName =
"counting 1s ";
193 else if ( NpnType == 3 )
194 pAlgoName =
"Jake's hybrid fast ";
195 else if ( NpnType == 4 )
196 pAlgoName =
"Jake's hybrid good ";
197 else if ( NpnType == 5 )
198 pAlgoName =
"new hybrid fast ";
199 else if ( NpnType == 6 )
200 pAlgoName =
"new phase flipping ";
204 printf(
"Applying %-20s to %8d func%s of %2d vars... ",
211 for ( i = 0; i < p->
nFuncs; i++ )
214 printf(
"%7d : ", i );
219 else if ( NpnType == 1 )
224 for ( i = 0; i < p->
nFuncs; i++ )
227 printf(
"%7d : ", i );
234 else if ( NpnType == 2 )
236 for ( i = 0; i < p->
nFuncs; i++ )
239 printf(
"%7d : ", i );
246 else if ( NpnType == 3 )
248 for ( i = 0; i < p->
nFuncs; i++ )
251 printf(
"%7d : ", i );
258 else if ( NpnType == 4 )
260 for ( i = 0; i < p->
nFuncs; i++ )
263 printf(
"%7d : ", i );
270 else if ( NpnType == 5 )
272 for ( i = 0; i < p->
nFuncs; i++ )
275 printf(
"%7d : ", i );
281 else if ( NpnType == 6 )
283 for ( i = 0; i < p->
nFuncs; i++ )
286 printf(
"%7d : ", i );
309 void Abc_TruthNpnTest(
char * pFileName,
int NpnType,
int nVarNum,
int fDumpRes,
int fBinary,
int fVerbose )
331 printf(
"The resulting functions are written into file \"%s\".\n", pFileNameOut );
351 int Abc_NpnTest(
char * pFileName,
int NpnType,
int nVarNum,
int fDumpRes,
int fBinary,
int fVerbose )
354 printf(
"Using truth tables from file \"%s\"...\n", pFileName );
355 if ( NpnType >= 0 && NpnType <= 6 )
356 Abc_TruthNpnTest( pFileName, NpnType, nVarNum, fDumpRes, fBinary, fVerbose );
358 printf(
"Unknown canonical form value (%d).\n", NpnType );
void Abc_TtStoreFree(Abc_TtStore_t *p, int nVarNum)
int Abc_TruthCompare(word **p1, word **p2)
static int Abc_PrimeCudd(unsigned int p)
int Abc_TruthNpnCountUniqueSort(Abc_TtStore_t *p)
static int Abc_InfoHasBit(unsigned *p, int i)
int Abc_NpnTest(char *pFileName, int NpnType, int nVarNum, int fDumpRes, int fBinary, int fVerbose)
void Abc_TruthNpnTest(char *pFileName, int NpnType, int nVarNum, int fDumpRes, int fBinary, int fVerbose)
static abctime Abc_Clock()
void resetPCanonPermArray(char *x, int nVars)
void Abc_TruthNpnPrint(char *pCanonPermInit, unsigned uCanonPhase, int nVars)
static void Abc_PrintTime(int level, const char *pStr, abctime time)
unsigned Abc_TtCanonicizePhase(word *pTruth, int nVars)
int Abc_TruthNpnCountUnique(Abc_TtStore_t *p)
Abc_TtStore_t * Abc_TtStoreLoad(char *pFileName, int nVarNum)
void Abc_TtStoreWrite(char *pFileName, Abc_TtStore_t *p, int fBinary)
unsigned __int64 word
DECLARATIONS ///.
#define ABC_NAMESPACE_IMPL_END
permInfo * setPermInfoPtr(int var)
unsigned Kit_TruthSemiCanonicize(unsigned *pInOut, unsigned *pAux, int nVars, char *pCanonPerm)
unsigned luckyCanonicizer_final_fast(word *pInOut, int nVars, char *pCanonPerm)
void freePermInfoPtr(permInfo *x)
#define ABC_NAMESPACE_IMPL_START
void Abc_TruthNpnPerform(Abc_TtStore_t *p, int NpnType, int fVerbose)
unsigned Abc_TtCanonicize(word *pTruth, int nVars, char *pCanonPerm)
FUNCTION DECLARATIONS ///.
void simpleMinimal(word *x, word *pAux, word *minimal, permInfo *pi, int nVars)
unsigned luckyCanonicizer_final_fast1(word *pInOut, int nVars, char *pCanonPerm)
static int Abc_TruthHashKey(word *pFunc, int nWords, int nTableSize)
FUNCTION DEFINITIONS ///.
#define ABC_FALLOC(type, num)
static int Abc_TruthHashLookup(word **pFuncs, int iThis, int nWords, int *pTable, int *pNexts, int Key)