94 dd->shiftUnique = 8*
sizeof(
unsigned) - (nBits + 1);
96 dd->shiftCache[i] = 8*
sizeof(
unsigned) - dd->bitsCache[i];
98 dd->nNodesAlloc = (1 << (nBits + 1));
99 dd->nNodesLimit = (1 << nBits);
104 dd->nMemUsed +=
sizeof(
CloudNode) * dd->nNodesAlloc;
110 dd->tUnique[0].s = dd->nSignCur;
112 dd->tUnique[0].e = NULL;
113 dd->tUnique[0].t = NULL;
114 dd->one = dd->tUnique;
119 dd->pNodeStart = dd->tUnique + 1;
120 dd->pNodeEnd = dd->tUnique + dd->nNodesAlloc;
124 dd->nMemUsed +=
sizeof(
CloudNode *) * dd->nVars;
125 for ( i = 0; i < dd->nVars; i++ )
150 for ( i = 0; i < 4; i++ )
169 assert( dd->one->s == dd->nSignCur );
172 for ( i = 0; i < dd->nVars; i++ )
174 dd->nNodesCur = 1 + dd->nVars;
198 assert( logratio < dd->bitsNode );
202 dd->bitsCache[oper] = dd->bitsNode - logratio;
203 dd->shiftCache[oper] = 8*
sizeof(unsigned) - dd->bitsCache[oper];
221 int nCacheEntries = (1 << dd->bitsCache[oper]);
290 assert( ((
int)v) >= 0 && ((
int)v) < dd->nVars );
298 entryUnique = dd->tUnique +
cloudHashCudd3(v, t, e, dd->shiftUnique);
299 while ( entryUnique->
s == dd->nSignCur )
302 if ( entryUnique->
v == v && entryUnique->
t == t && entryUnique->
e == e )
308 if ( ++entryUnique - dd->tUnique == dd->nNodesAlloc )
309 entryUnique = dd->tUnique + 1;
316 if ( ++dd->nNodesCur == dd->nNodesLimit )
318 printf(
"Cloud needs restart!\n" );
324 entryUnique->
s = dd->nSignCur;
347 CloudNode * fv, * fnv, * gv, * gnv, * t, * e;
634 for ( i = dd->nVars - 1; i >= 0; i-- )
635 if ( support[i] == 1 )
660 int * support, i, count;
673 for ( i = 0; i < dd->nVars; i++ )
675 if ( support[i] == 1 )
705 return tval + eval + 1;
750 dd->ppNodes[(*pCounter)++] = n;
755 dd->ppNodes[(*pCounter)++] = n;
756 return tval + eval + 1;
775 if ( dd->ppNodes == NULL )
800 for ( i = 0; i < nn; i++ )
802 for ( i = 0; i < nn; i++ )
841 if ( res != dd->zero )
851 assert( res != dd->zero );
871 if ( Func == dd->zero )
872 printf(
"Constant 0." );
873 else if ( Func == dd->one )
874 printf(
"Constant 1." );
880 if ( Cube == NULL || Cube == dd->zero )
882 if ( fFirst ) fFirst = 0;
883 else printf(
" + " );
923 if ( bCube0 != dd->zero )
925 assert( bCube1 == dd->zero );
926 printf(
"[%d]'",
cloudV(bCube) );
931 assert( bCube1 != dd->zero );
932 printf(
"[%d]",
cloudV(bCube) );
952 if ( dd == NULL )
return;
953 printf(
"The number of unique table nodes allocated = %12d.\n", dd->nNodesAlloc );
954 printf(
"The number of unique table nodes present = %12d.\n", dd->nNodesCur );
955 printf(
"The number of unique table hits = %12d.\n", dd->nUniqueHits );
956 printf(
"The number of unique table misses = %12d.\n", dd->nUniqueMisses );
957 printf(
"The number of unique table steps = %12d.\n", dd->nUniqueSteps );
958 printf(
"The number of cache hits = %12d.\n", dd->nCacheHits );
959 printf(
"The number of cache misses = %12d.\n", dd->nCacheMisses );
960 printf(
"The current signature = %12d.\n", dd->nSignCur );
961 printf(
"The total memory in use = %12d.\n", dd->nMemUsed );
979 for ( i = 0; i < dd->nNodesAlloc; i++ )
#define cloudHashCudd2(f, g, s)
void Cloud_Quit(CloudManager *dd)
typedefABC_NAMESPACE_HEADER_START struct cloudManager CloudManager
void Cloud_PrintInfo(CloudManager *dd)
CloudManager * Cloud_Init(int nVars, int nBits)
FUNCTION DEFINITIONS ///.
#define Cloud_NotCond(p, c)
static int cloudDagSize(CloudManager *dd, CloudNode *n)
#define Cloud_IsComplement(p)
CloudNode * cloudBddAnd(CloudManager *dd, CloudNode *f, CloudNode *g)
CloudNode * Cloud_GetOneCube(CloudManager *dd, CloudNode *bFunc)
static ABC_NAMESPACE_IMPL_START int CacheOperNum
int Cloud_SupportSize(CloudManager *dd, CloudNode *n)
#define CLOUD_CONST_INDEX
#define ABC_ALLOC(type, num)
void Cloud_CacheAllocate(CloudManager *dd, CloudOper oper, int logratio)
static void cloudClearMark(CloudManager *dd, CloudNode *n)
static abctime Abc_Clock()
void Cloud_Restart(CloudManager *dd)
CloudNode * Cloud_bddAnd(CloudManager *dd, CloudNode *f, CloudNode *g)
struct cloudCacheEntry2 CloudCacheEntry2
for(p=first;p->value< newval;p=p->next)
static int Cloud_DagCollect_rec(CloudManager *dd, CloudNode *n, int *pCounter)
CloudNode * Cloud_bddOr(CloudManager *dd, CloudNode *f, CloudNode *g)
void Cloud_bddPrintCube(CloudManager *dd, CloudNode *bCube)
static int CacheLogRatioDefault[4]
CloudNode * Cloud_bddXor(CloudManager *dd, CloudNode *f, CloudNode *g)
struct cloudCacheEntry3 CloudCacheEntry3
#define cloudIsConstant(p)
#define cloudNodeUnmark(p)
struct cloudNode CloudNode
#define ABC_NAMESPACE_IMPL_END
int Cloud_SharingSize(CloudManager *dd, CloudNode **pn, int nn)
CloudNode * Cloud_MakeNode(CloudManager *dd, CloudVar v, CloudNode *t, CloudNode *e)
void Cloud_PrintHashTable(CloudManager *dd)
static void cloudCacheAllocate(CloudManager *dd, CloudOper oper)
static void cloudSupport(CloudManager *dd, CloudNode *n, int *support)
#define ABC_NAMESPACE_IMPL_START
#define cloudHashCudd3(f, g, h, s)
#define Cloud_IsConstant(p)
CloudNode * Cloud_Support(CloudManager *dd, CloudNode *n)
void Cloud_bddPrint(CloudManager *dd, CloudNode *Func)
#define cloudCacheLookup2(p, sign, f, g)
#define ABC_CALLOC(type, num)
int Cloud_DagSize(CloudManager *dd, CloudNode *n)
#define cloudNodeIsMarked(p)
struct cloudCacheEntry1 CloudCacheEntry1
#define cloudCacheInsert2(p, sign, f, g, r)
static CloudNode * cloudMakeNode(CloudManager *dd, CloudVar v, CloudNode *t, CloudNode *e)
FUNCTION DECLARATIONS ///.
int Cloud_DagCollect(CloudManager *dd, CloudNode *n)
static CloudNode * cloudBddAnd_gate(CloudManager *dd, CloudNode *f, CloudNode *g)