67 #define Dch_ManForEachClass( p, ppClass, i ) \
68 for ( i = 0; i < Aig_ManObjNumMax(p->pAig); i++ ) \
69 if ( ((ppClass) = p->pId2Class[i]) == NULL ) {} else
71 #define Dch_ClassForEachNode( p, pRepr, pNode, i ) \
72 for ( i = 0; i < p->pClassSizes[pRepr->Id]; i++ ) \
73 if ( ((pNode) = p->pId2Class[pRepr->Id][i]) == NULL ) {} else
92 assert( p->pId2Class[pRepr->
Id] == NULL );
93 p->pId2Class[pRepr->
Id] = pClass;
94 assert( p->pClassSizes[pRepr->
Id] == 0 );
96 p->pClassSizes[pRepr->
Id] = nSize;
98 p->nLits += nSize - 1;
117 p->pId2Class[pRepr->
Id] = NULL;
118 nSize = p->pClassSizes[pRepr->
Id];
121 p->nLits -= nSize - 1;
122 p->pClassSizes[pRepr->
Id] = 0;
147 assert( pAig->pReprs == NULL );
164 unsigned (*pFuncNodeHash)(
void *,
Aig_Obj_t *),
165 int (*pFuncNodeIsConst)(
void *,
Aig_Obj_t *),
168 p->pManData = pManData;
169 p->pFuncNodeHash = pFuncNodeHash;
170 p->pFuncNodeIsConst = pFuncNodeIsConst;
171 p->pFuncNodesAreEqual = pFuncNodesAreEqual;
224 assert( p->pId2Class[pRepr->
Id] != NULL );
225 assert( p->pClassSizes[pRepr->
Id] > 1 );
226 *pnSize = p->pClassSizes[pRepr->
Id];
227 return p->pId2Class[pRepr->
Id];
244 int i, k, nLits, nClasses, nCands1;
245 nClasses = nLits = 0;
266 assert( p->nLits == nLits );
267 assert( p->nCands1 == nCands1 );
268 assert( p->nClasses == nClasses );
308 Abc_Print( 1,
"Equivalence classes: Const1 = %5d. Class = %5d. Lit = %5d.\n",
309 p->nCands1, p->nClasses, p->nLits );
319 Abc_Print( 1,
"%3d (%3d) : ", i, p->pClassSizes[i] );
338 Aig_Obj_t ** ppTable, ** ppNexts, ** ppClassNew;
340 int i, k, nTableSize, nNodes, iEntry, nEntries, nEntries2;
361 if ( nMaxLevs && (
int)pObj->
Level >= nMaxLevs )
365 if ( p->pFuncNodeIsConst( p->pManData, pObj ) )
372 iEntry = p->pFuncNodeHash( p->pManData, pObj ) % nTableSize;
374 if ( ppTable[iEntry] == NULL )
375 ppTable[iEntry] = pObj;
379 pRepr = ppTable[iEntry];
384 p->pClassSizes[pRepr->
Id]++;
390 p->pClassSizes[pRepr->
Id]++;
397 p->pMemClassesFree = p->pMemClasses + nEntries;
405 nNodes = p->pClassSizes[pObj->
Id];
411 ppClassNew = p->pMemClasses + nEntries2;
412 ppClassNew[0] = pObj;
413 for ( pTemp =
Dch_ObjNext(ppNexts, pObj), k = 1; pTemp;
416 ppClassNew[nNodes-k] = pTemp;
419 p->pClassSizes[pObj->
Id] = 0;
424 assert( nEntries == nEntries2 );
453 if ( p->pFuncNodesAreEqual(p->pManData, pReprOld, pObj) )
474 pClassNew = pClassOld + i;
551 for ( i = pObj->
Id; i < Limit; i++ )
572 Aig_Obj_t * pObj, * pReprNew, ** ppClassNew;
579 if ( !p->pFuncNodeIsConst( p->pManData, pObj ) )
590 ppClassNew = p->pMemClassesFree;
594 ppClassNew[i] = pObj;
#define Dch_ManForEachClass(p, ppClass, i)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
static int Abc_PrimeCudd(unsigned int p)
static Aig_Obj_t * Aig_ObjRepr(Aig_Man_t *p, Aig_Obj_t *pObj)
int Dch_ClassesLitNum(Dch_Cla_t *p)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
static void Dch_ObjSetConst1Cand(Aig_Man_t *pAig, Aig_Obj_t *pObj)
static Aig_Obj_t ** Dch_ObjRemoveClass(Dch_Cla_t *p, Aig_Obj_t *pRepr)
static void Dch_ObjAddClass(Dch_Cla_t *p, Aig_Obj_t *pRepr, Aig_Obj_t **pClass, int nSize)
FUNCTION DEFINITIONS ///.
static Aig_Obj_t * Dch_ObjNext(Aig_Obj_t **ppNexts, Aig_Obj_t *pObj)
DECLARATIONS ///.
static int Dch_ObjIsConst1Cand(Aig_Man_t *pAig, Aig_Obj_t *pObj)
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
void Dch_ClassesStop(Dch_Cla_t *p)
int Dch_ClassesRefine(Dch_Cla_t *p)
#define ABC_ALLOC(type, num)
static Aig_Obj_t * Aig_ManObj(Aig_Man_t *p, int i)
unsigned(* pFuncNodeHash)(void *, Aig_Obj_t *)
static int Vec_PtrSize(Vec_Ptr_t *p)
int Aig_SupportSize(Aig_Man_t *p, Aig_Obj_t *pObj)
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
static int Abc_MinInt(int a, int b)
int Dch_ClassesRefineConst1Group(Dch_Cla_t *p, Vec_Ptr_t *vRoots, int fRecursive)
static void Aig_ObjSetRepr(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pRepr)
void Aig_ManReprStart(Aig_Man_t *p, int nIdMax)
DECLARATIONS ///.
int Dch_ClassesRefineOneClass(Dch_Cla_t *p, Aig_Obj_t *pReprOld, int fRecursive)
#define Dch_ClassForEachNode(p, pRepr, pNode, i)
void Dch_ClassesCollectConst1Group(Dch_Cla_t *p, Aig_Obj_t *pObj, int nNodes, Vec_Ptr_t *vRoots)
int(* pFuncNodesAreEqual)(void *, Aig_Obj_t *, Aig_Obj_t *)
#define ABC_NAMESPACE_IMPL_END
void Dch_ClassesSetData(Dch_Cla_t *p, void *pManData, unsigned(*pFuncNodeHash)(void *, Aig_Obj_t *), int(*pFuncNodeIsConst)(void *, Aig_Obj_t *), int(*pFuncNodesAreEqual)(void *, Aig_Obj_t *, Aig_Obj_t *))
static void Abc_Print(int level, const char *format,...)
void Dch_ClassesPrint(Dch_Cla_t *p, int fVeryVerbose)
static int Aig_ManObjNumMax(Aig_Man_t *p)
void Dch_ClassesPrepare(Dch_Cla_t *p, int fLatchCorr, int nMaxLevs)
#define ABC_NAMESPACE_IMPL_START
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
void Dch_ClassesPrintOne(Dch_Cla_t *p, Aig_Obj_t *pRepr)
#define Aig_ManForEachObj(p, pObj, i)
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
void Dch_ClassesCheck(Dch_Cla_t *p)
Dch_Cla_t * Dch_ClassesStart(Aig_Man_t *pAig)
#define ABC_CALLOC(type, num)
static void Dch_ObjSetNext(Aig_Obj_t **ppNexts, Aig_Obj_t *pObj, Aig_Obj_t *pNext)
int(* pFuncNodeIsConst)(void *, Aig_Obj_t *)
Aig_Obj_t ** Dch_ClassesReadClass(Dch_Cla_t *p, Aig_Obj_t *pRepr, int *pnSize)
static void Vec_PtrClear(Vec_Ptr_t *p)
void Dch_ClassesCollectOneClass(Dch_Cla_t *p, Aig_Obj_t *pRepr, Vec_Ptr_t *vRoots)
Aig_Obj_t ** pMemClassesFree
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
static void Vec_PtrFree(Vec_Ptr_t *p)
typedefABC_NAMESPACE_HEADER_START struct Dch_Cla_t_ Dch_Cla_t
INCLUDES ///.