42 return( *(
word*)a < *(
word*)b ) ? -1: 0;
48 int i, count=1, WordsN = p->
nFuncs;
86 int i, count=1, WordsPtrN = p->
nFuncs;
88 qsort(a,WordsPtrN,
sizeof(
word*),(
int(*)(
const void *,
const void *))
compareWords3);
90 for(i=1;i<WordsPtrN;i++)
146 for(i=0;i<nFuncs;i++)
280 printf(
"average NCycles = %.3f\n",cCtr->
totalCycles/(
double)nFuncs);
305 memcpy(pMinimal, pInOut, blockSize);
306 memcpy(PDuplicat, pInOut, blockSize);
312 memcpy(pMinimal, pInOut, blockSize);
317 memcpy(pInOut, pMinimal, blockSize);
322 memcpy(pInOut, pMinimal, blockSize);
323 if(
memcmp(pInOut,PDuplicat,blockSize) == 0)
336 memcpy(pMinimal, pInOut, blockSize);
337 memcpy(PDuplicat, pInOut, blockSize);
339 for(i=1;i<nVars-1;i++)
343 memcpy(pMinimal, pInOut, blockSize);
348 memcpy(pInOut, pMinimal, blockSize);
353 memcpy(pInOut, pMinimal, blockSize);
354 if(
memcmp(pInOut,PDuplicat,blockSize) == 0)
368 *p_uCanonPhase ^= (1 << nVars);
381 unsigned minTemp = *p_uCanonPhase;
383 memcpy(pMinimal, pInOut, blockSize);
384 memcpy(PDuplicat, pInOut, blockSize);
386 *p_uCanonPhase ^= (unsigned)1;
391 memcpy(pMinimal, pInOut, blockSize);
392 minTemp = *p_uCanonPhase;
396 memcpy(pInOut, pMinimal, blockSize);
397 *p_uCanonPhase = minTemp;
400 *p_uCanonPhase ^= (1 << i);
404 memcpy(pInOut, pMinimal, blockSize);
405 *p_uCanonPhase = minTemp;
407 if(
memcmp(pInOut,PDuplicat,blockSize) == 0)
416 char Temp = pCanonPerm[iVar];
417 pCanonPerm[iVar] = pCanonPerm[iVar+1];
418 pCanonPerm[iVar+1] = Temp;
421 if ( ((*p_uCanonPhase & (1 << iVar)) > 0) != ((*p_uCanonPhase & (1 << (iVar+1))) > 0) )
423 *p_uCanonPhase ^= (1 << iVar);
424 *p_uCanonPhase ^= (1 << (iVar+1));
475 int minimalSwap(
word* pInOut,
word* pMinimal,
word* PDuplicat,
int nVars,
char * pCanonPerm,
char * tempArray,
unsigned* p_uCanonPhase)
479 int blockSizeChar = nVars *
sizeof(char);
480 unsigned TempuCanonPhase = *p_uCanonPhase;
481 memcpy(pMinimal, pInOut, blockSizeWord);
482 memcpy(PDuplicat, pInOut, blockSizeWord);
483 memcpy(tempArray, pCanonPerm, blockSizeChar);
486 for(i=1;i<nVars-1;i++)
490 memcpy(pMinimal, pInOut, blockSizeWord);
491 memcpy(tempArray, pCanonPerm, blockSizeChar);
492 TempuCanonPhase = *p_uCanonPhase;
497 memcpy(pInOut, pMinimal, blockSizeWord);
498 memcpy(pCanonPerm, tempArray, blockSizeChar);
499 *p_uCanonPhase = TempuCanonPhase;
506 memcpy(pInOut, pMinimal, blockSizeWord);
507 memcpy(pCanonPerm, tempArray, blockSizeChar);
508 *p_uCanonPhase = TempuCanonPhase;
510 if(
memcmp(pInOut,PDuplicat,blockSizeWord) == 0)
572 counter +=
minimalFlip(pInOut, pAux, pAux1, nVars, p_uCanonPhase);
573 counter +=
minimalSwap(pInOut, pAux, pAux1, nVars, pCanonPerm, tempArray, p_uCanonPhase);
601 word pAux[1024], pAux1[1024];
606 luckyCanonicizer(pInOut, pAux, pAux1, nVars, pCanonPerm, tempArray, &CanonPhase);
618 pInOut[0] = (unsigned)Temp;
628 #ifndef _RUNNING_ABC_
649 char * pFileInput =
"nonDSDfunc16var10K.txt";
650 char * pFileInput1 =
"partDSDfunc16var10K.txt";
651 char * pFileInput2 =
"fullDSDfunc16var10K.txt";
657 word * pAux, * pAux1;
660 charArray = (
char**)
malloc(
sizeof(
char*)*3);
662 charArray[0] = pFileInput;
663 charArray[1] = pFileInput1;
664 charArray[2] = pFileInput2;
676 printf(
"In %s Fs at start = %d\n",charArray[j],p->
nFuncs);
686 printf(
"F left in A final = %d\n",p->
nFuncs);
void swapInfoAdjacentVars(int iVar, char *pCanonPerm, unsigned *p_uCanonPhase)
unsigned luckyCanonicizer1_simple(word *pInOut, word *pAux, word *pAux1, int nVars, char *pCanonPerm, unsigned CanonPhase)
int minimalFlip1(word *pInOut, word *pMinimal, word *PDuplicat, int nVars)
void luckyCanonicizer(word *pInOut, word *pAux, word *pAux1, int nVars, char *pCanonPerm, char *tempArray, unsigned *p_uCanonPhase)
int minimalSwap1(word *pInOut, word *pMinimal, word *PDuplicat, int nVars)
int compareWords2(const void **x, const void **y)
void Kit_TruthSwapAdjacentVars_64bit(word *pInOut, int nVars, int iVar)
void sortAndUnique1(word *a, Abc_TtStore_t *p)
int minimalInitialFlip1(word *pInOut, int nVars)
void luckyCanonicizer_final(word *pInOut, word *pAux, word *pAux1, int nVars)
int compareWords1(const void *a, const void *b)
int minimalFlip(word *pInOut, word *pMinimal, word *PDuplicat, int nVars, unsigned *p_uCanonPhase)
void freeCycleCtr(cycleCtr *x)
int Kit_TruthWordNum_64bit(int nVars)
word ** makeArray(Abc_TtStore_t *p)
void freeArray(word **a, Abc_TtStore_t *p)
Abc_TtStore_t * setTtStore(char *pFileInput)
void Kit_TruthSemiCanonicize_Yasha_simple(word *pInOut, int nVars, int *pStore)
int minimalSwap(word *pInOut, word *pMinimal, word *PDuplicat, int nVars, char *pCanonPerm, char *tempArray, unsigned *p_uCanonPhase)
unsigned __int64 word
DECLARATIONS ///.
static void TimePrint(char *Message)
#define ABC_NAMESPACE_IMPL_END
word * makeArrayB(word **a, int nFuncs)
void Kit_TruthNot_64bit(word *pIn, int nVars)
#define ABC_NAMESPACE_IMPL_START
void Abc_TruthStoreFree(Abc_TtStore_t *p)
int compareWords3(const void **x, const void **y)
void printCCtrInfo(cycleCtr *cCtr, int nFuncs)
void sortAndUnique(word **a, Abc_TtStore_t *p)
cycleCtr * setCycleCtrPtr()
int minimalInitialFlip(word *pInOut, int nVars, unsigned *p_uCanonPhase)
unsigned Kit_TruthSemiCanonicize_new(unsigned *pInOut, unsigned *pAux, int nVars, char *pCanonPerm)
ABC_NAMESPACE_IMPL_START int memCompare(word *x, word *y, int nVars)
int compareWords(const void **a, const void **b)
int main(int argc, char *argv[])
GLOBAL VARIABLES ///.
void Kit_TruthChangePhase_64bit(word *pInOut, int nVars, int iVar)
unsigned Kit_TruthSemiCanonicize_new_internal(word *pInOut, int nVars, char *pCanonPerm)
unsigned Kit_TruthSemiCanonicize_Yasha(word *pInOut, int nVars, char *pCanonPerm)