33 #define RMAN_MAXVARS 12
34 #define RMAX_MAXWORD (RMAN_MAXVARS <= 5 ? 1 : (1 << (RMAN_MAXVARS - 5)))
101 static Bdc_Par_t Pars = {0}, * pPars = &Pars;
113 pPars->nVarsMax = p->
nVars;
134 for ( i = 0; i <
nWords; i++ )
135 uHash ^= pTruth[i] * pPrimes[i & 0xf];
136 return (
int)(uHash % nBins);
153 1291, 1699, 1999, 2357, 2953, 3313, 3907, 4177,
154 4831, 5147, 5647, 6343, 6899, 7103, 7873, 8147 };
157 for ( pEntry = *ppSpot; pEntry; ppSpot = &pEntry->
pNext, pEntry = pEntry->
pNext )
190 for ( i = 0; i < nBinsOld; i++ )
191 for ( pEntry = pBinsOld[i], pNext = pEntry? pEntry->
pNext : NULL;
192 pEntry; pEntry = pNext, pNext = pEntry? pEntry->
pNext : NULL )
196 assert( *ppPlace == NULL );
199 pEntry->
pNext = NULL;
225 (*ppSpot)->nVisits++;
233 pEntry->
nVars = nVars;
235 pEntry->
pNext = NULL;
255 printf(
"Total funcs = %10d\n", p->
nTotal );
256 printf(
"Full DSD funcs = %10d\n", p->
nTtDsd );
257 printf(
"Part DSD funcs = %10d\n", p->
nTtDsdPart );
258 printf(
"Non- DSD funcs = %10d\n", p->
nTtDsdNot );
259 printf(
"Uniq-var funcs = %10d\n", p->
nUniqueVars );
260 printf(
"Unique funcs = %10d\n", p->
nEntries );
261 printf(
"Distribution of functions:\n" );
262 for ( i = 5; i <= p->
nVars; i++ )
263 printf(
"%2d = %8d\n", i, p->
nVarFuncs[i] );
287 if ( s_pRMan == NULL )
313 for ( i = 0; i < nVars; i++ )
314 printf(
"%2d/%2d ", pStore2[2*i], pStore2[2*i+1] );
331 int i, j, best_i, tmp;
332 for ( i = 0; i < nVars-1; i++ )
335 for ( j = i+1; j < nVars; j++ )
336 if ( pArray[j] > pArray[best_i] )
338 tmp = pArray[i]; pArray[i] = pArray[best_i]; pArray[best_i] = tmp;
356 for ( v = 0; v < nVars; v++ )
358 printf(
"%2d : ", v );
359 for ( k = 0; k < 2; k++ )
361 printf(
"%5d ", pSigs[2*v+k].nOnes );
363 for ( i = 0; i < nVars; i++ )
364 printf(
"%4d ", pSigs[2*v+k].nCofOnes[i] );
385 for ( v = 0; v < nVars; v++ )
413 return memcmp( p0, p1,
sizeof(
int) );
430 for ( i = 0; i < nVars - 1; i++ )
450 for ( i = 0; i < nVars; i++ )
458 for ( i = 1; i < nVars; i++ )
462 printf(
"%c",
'0' + i );
464 printf(
"%c",
'A' + i-10 );
483 unsigned * pTemp, uCanonPhase = 0;
487 for ( i = 0; i < nVars; i++ )
492 uCanonPhase |= (1 << i);
493 TempSig = pSigs[2*i+0];
494 pSigs[2*i+0] = pSigs[2*i+1];
495 pSigs[2*i+1] = TempSig;
502 for ( i = 0; i < nVars-1; i++ )
510 Temp = pCanonPerm[i];
511 pCanonPerm[i] = pCanonPerm[i+1];
512 pCanonPerm[i+1] = Temp;
514 TempSig = pSigs[2*i];
515 pSigs[2*i] = pSigs[2*(i+1)];
516 pSigs[2*(i+1)] = TempSig;
518 TempSig = pSigs[2*i+1];
519 pSigs[2*i+1] = pSigs[2*(i+1)+1];
520 pSigs[2*(i+1)+1] = TempSig;
523 pTemp = pIn; pIn = pOut; pOut = pTemp;
528 if ( fReturnIn ^ !(Counter & 1) )
560 int i, nNodes, RetValue;
567 printf(
"Decomposition failed.\n" );
572 for ( i = 0; i < nVars; i++ )
575 for ( i = nVars + 1; i < nNodes; i++ )
609 printf(
"The number of variables in too large.\n" );
613 if ( s_pRMan == NULL )
619 if ( pObj == NULL || pObj->
nFans == 3 )
627 if ( nVars < nVarsInit )
642 for ( i = 0; i < nVars; i++ )
643 s_pRMan->
pPerm[i] = i;
678 for ( i = 0; i < nVars; i++ )
683 for ( i = 0; i < nVars; i++ )
684 if ( uPhaseC & (1 << i) )
689 printf(
"Verification failed.\n" );
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Bdc_Fun_t * Bdc_ManRoot(Bdc_Man_t *p)
static int Abc_PrimeCudd(unsigned int p)
static int Kit_TruthWordNum(int nVars)
struct Aig_Tru_t_ Aig_Tru_t
void Aig_RManComputeVSigs(unsigned *pTruth, int nVars, Aig_VSig_t *pSigs, unsigned *pAux)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
char pPermR[RMAN_MAXVARS]
void Kit_TruthSwapAdjacentVars(unsigned *pOut, unsigned *pIn, int nVars, int Start)
DECLARATIONS ///.
void Aig_ManStop(Aig_Man_t *p)
void Kit_TruthPermute(unsigned *pOut, unsigned *pIn, int nVars, char *pPerm, int fReturnIn)
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
char * Aig_MmFlexEntryFetch(Aig_MmFlex_t *p, int nBytes)
Bdc_Man_t * Bdc_ManAlloc(Bdc_Par_t *pPars)
MACRO DEFINITIONS ///.
void Kit_TruthChangePhase(unsigned *pTruth, int nVars, int iVar)
void Kit_TruthCountOnesInCofsSlow(unsigned *pTruth, int nVars, int *pStore, unsigned *pAux)
#define ABC_ALLOC(type, num)
static int Kit_TruthIsEqual(unsigned *pIn0, unsigned *pIn1, int nVars)
void Aig_RManPrintUniqueVars(Aig_VSig_t *pMints, int nVars)
static int Abc_TruthWordNum(int nVars)
static int Aig_RManTableHash(unsigned *pTruth, int nVars, int nBins, int *pPrimes)
int Bdc_ManDecompose(Bdc_Man_t *p, unsigned *puFunc, unsigned *puCare, int nVars, Vec_Ptr_t *vDivs, int nNodesMax)
static abctime Abc_Clock()
Kit_DsdObj_t * Kit_DsdNonDsdPrimeMax(Kit_DsdNtk_t *pNtk)
void Aig_RManPrintVarProfile(unsigned *pTruth, int nVars, unsigned *pTruthAux)
void Kit_TruthCountOnesInCofs0(unsigned *pTruth, int nVars, int *pStore)
Kit_DsdNtk_t * Kit_DsdDecompose(unsigned *pTruth, int nVars)
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
void Aig_RManSortNums(int *pArray, int nVars)
static Aig_RMan_t * s_pRMan
Bdc_Fun_t * Bdc_ManFunc(Bdc_Man_t *p, int i)
DECLARATIONS ///.
Aig_RMan_t * Aig_RManStart()
FUNCTION DEFINITIONS ///.
Aig_Tru_t ** Aig_RManTableLookup(Aig_RMan_t *p, unsigned *pTruth, int nVars)
void Kit_TruthCofactor0New(unsigned *pOut, unsigned *pIn, int nVars, int iVar)
unsigned Aig_RManSemiCanonicize(unsigned *pOut, unsigned *pIn, int nVars, char *pCanonPerm, Aig_VSig_t *pSigs, int fReturnIn)
void Bdc_FuncSetCopy(Bdc_Fun_t *p, void *pCopy)
static int s_Primes[MAX_PRIMES]
void Aig_RManRecord(unsigned *pTruth, int nVarsInit)
unsigned pTruthTemp[RMAX_MAXWORD]
int Aig_RManVarsAreUnique(Aig_VSig_t *pMints, int nVars)
typedefABC_NAMESPACE_HEADER_START struct Bdc_Fun_t_ Bdc_Fun_t
INCLUDES ///.
Aig_Obj_t * Aig_IthVar(Aig_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
static unsigned * Kit_DsdObjTruth(Kit_DsdObj_t *pObj)
int nVarFuncs[RMAN_MAXVARS+1]
void Aig_RManTableResize(Aig_RMan_t *p)
#define RMAN_MAXVARS
DECLARATIONS ///.
unsigned pTruthInit[RMAX_MAXWORD]
#define ABC_NAMESPACE_IMPL_END
static int Kit_TruthCountOnes(unsigned *pIn, int nVars)
int Aig_RManTableFindOrAdd(Aig_RMan_t *p, unsigned *pTruth, int nVars)
void Kit_TruthCofactor1New(unsigned *pOut, unsigned *pIn, int nVars, int iVar)
unsigned pTruthC[RMAX_MAXWORD]
void Aig_RManStop(Aig_RMan_t *p)
void Aig_RManSaveOne(Aig_RMan_t *p, unsigned *pTruth, int nVars)
Aig_VSig_t pMints[2 *RMAN_MAXVARS]
static void Kit_TruthNot(unsigned *pOut, unsigned *pIn, int nVars)
void Ioa_WriteAiger(Aig_Man_t *pMan, char *pFileName, int fWriteSymbols, int fCompact)
int nCofOnes[RMAN_MAXVARS]
unsigned pTruth[RMAX_MAXWORD]
Bdc_Fun_t * Bdc_FuncFanin0(Bdc_Fun_t *p)
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
#define ABC_NAMESPACE_IMPL_START
static int Bdc_IsComplement(Bdc_Fun_t *p)
void Aig_RManPrintSigs(Aig_VSig_t *pSigs, int nVars)
Aig_MmFlex_t * Aig_MmFlexStart()
void Aig_MmFlexStop(Aig_MmFlex_t *p, int fVerbose)
static void Kit_TruthCopy(unsigned *pOut, unsigned *pIn, int nVars)
#define ABC_CALLOC(type, num)
static int Aig_RManCompareSigs(Aig_VSig_t *p0, Aig_VSig_t *p1, int nVars)
static Aig_Obj_t * Bdc_FunCopyHop(Bdc_Fun_t *pObj)
void Kit_DsdNtkFree(Kit_DsdNtk_t *pNtk)
int Bdc_ManNodeNum(Bdc_Man_t *p)
void Bdc_ManFree(Bdc_Man_t *p)
Bdc_Fun_t * Bdc_FuncFanin1(Bdc_Fun_t *p)
void * Bdc_FuncCopy(Bdc_Fun_t *p)
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
static Bdc_Fun_t * Bdc_Regular(Bdc_Fun_t *p)