98 int Abc_NtkRR(
Abc_Ntk_t * pNtk,
int nFaninLevels,
int nFanoutLevels,
int fUseFanouts,
int fVerbose )
103 int i, k, m, nNodes, RetValue;
108 p->nFaninLevels = nFaninLevels;
109 p->nFanoutLevels = nFanoutLevels;
194 p->pFanout = pFanout;
231 printf(
"Abc_NtkRR: The network check has failed.\n" );
300 double Ratio = 100.0*(p->nNodesOld -
Abc_NtkNodeNum(p->pNtk))/p->nNodesOld;
301 printf(
"Redundancy removal statistics:\n" );
302 printf(
"Edges tried = %6d.\n", p->nEdgesTried );
303 printf(
"Edges removed = %6d. (%5.2f %%)\n", p->nEdgesRemoved, 100.0*p->nEdgesRemoved/p->nEdgesTried );
304 printf(
"Node gain = %6d. (%5.2f %%)\n", p->nNodesOld -
Abc_NtkNodeNum(p->pNtk), Ratio );
305 printf(
"Level gain = %6d.\n", p->nLevelsOld -
Abc_AigLevel(p->pNtk) );
306 ABC_PRT(
"Windowing ", p->timeWindow );
307 ABC_PRT(
"Miter ", p->timeMiter );
308 ABC_PRT(
" Construct ", p->timeMiter - p->timeProve );
309 ABC_PRT(
" Prove ", p->timeProve );
310 ABC_PRT(
"Update ", p->timeUpdate );
311 ABC_PRT(
"TOTAL ", p->timeTotal );
362 p->pMiter =
Abc_NtkMiter( p->pWnd, pWndCopy, 1, 0, 0, 0 );
388 assert( pFanout == NULL );
399 if ( pFanout == NULL )
431 Abc_Obj_t * pObj, * pEdgeFanin, * pEdgeFanout;
432 int i, LevelMin, LevelMax, RetValue;
435 pEdgeFanout = p->pFanout? p->pFanout : p->pNode;
436 pEdgeFanin = p->pFanout? p->pNode : p->pFanin;
438 LevelMin =
Abc_MaxInt( 0, ((
int)p->pFanin->Level) - p->nFaninLevels );
439 LevelMax = (int)pEdgeFanout->
Level + p->nFanoutLevels;
455 while (
Abc_NtkRRTfo_int(p->vFaninLeaves, p->vFanoutRoots, LevelMax, pEdgeFanin, pEdgeFanout) );
477 p->pWnd =
Abc_NtkWindow( p->pNtk, p->vLeaves, p->vCone, p->vRoots );
495 int i, k, LevelMax, nSize;
496 assert( LevelLimit >= 0 );
500 if ( LevelMax < (
int)pObj->
Level )
501 LevelMax = pObj->
Level;
503 if ( LevelMax <= LevelLimit )
509 if ( LevelMax != (
int)pObj->
Level )
523 if ( LevelMax == (
int)pObj->
Level )
547 int i, k, LevelMin, nSize, fObjIsRoot;
551 if ( LevelMin > (
int)pObj->
Level )
552 LevelMin = pObj->
Level;
554 if ( LevelMin > LevelLimit )
560 if ( LevelMin != (
int)pObj->
Level )
572 if ( pObj == pEdgeFanin && pNext == pEdgeFanout )
587 if ( LevelMin == (
int)pObj->
Level )
697 printf(
"Warning: Structural hashing during windowing reduced %d nodes (this is a bug).\n",
711 printf(
"Abc_NtkWindow: The network check has failed.\n" );
732 unsigned uData, uData0, uData1;
739 if ( i == 0 )
continue;
745 pObj->
pData = (
void *)(ABC_PTRUINT_T)uData;
794 unsigned uData, uData0, uData1;
795 int PrevCi, Phase, i, k;
812 if ( i == 0 )
continue;
824 pObj->
pData = (
void *)(ABC_PTRUINT_T)~uData0;
826 pObj->
pData = (
void *)(ABC_PTRUINT_T)uData0;
830 for ( PrevCi = 0; PrevCi <
Abc_NtkCiNum(pNtk); PrevCi = i )
928 Abc_Obj_t * pObj, * pFanin0, * pFanin1, * pDisproved;
930 unsigned * pUnsigned, * pUnsignedF;
931 int i, k, Phase, fCompl;
941 pUnsigned[k] = (
unsigned)(ABC_PTRUINT_T)pObj->
pCopy;
950 pUnsigned[k] = ~pUnsignedF[k];
953 pUnsigned[k] = pUnsignedF[k];
957 if ( pUnsigned[k] == (
unsigned)(ABC_PTRUINT_T)pObj->
pData )
static void Abc_NtkRRSimulateStart(Abc_Ntk_t *pNtk)
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
static void Sim_SimulateCollected(Vec_Str_t *vTargets, Vec_Ptr_t *vNodes, Vec_Ptr_t *vField)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
static int Abc_NtkRRTfo_int(Vec_Ptr_t *vLeaves, Vec_Ptr_t *vRoots, int LevelLimit, Abc_Obj_t *pEdgeFanin, Abc_Obj_t *pEdgeFanout)
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
static int Abc_ObjFaninC1(Abc_Obj_t *pObj)
static int Vec_PtrPushUnique(Vec_Ptr_t *p, void *Entry)
static Abc_RRMan_t * Abc_RRManStart()
static int Abc_NtkRRTfi_int(Vec_Ptr_t *vLeaves, int LevelLimit)
int Abc_NtkRR(Abc_Ntk_t *pNtk, int nFaninLevels, int nFanoutLevels, int fUseFanouts, int fVerbose)
FUNCTION DEFINITIONS ///.
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
#define SIM_RANDOM_UNSIGNED
static Abc_Obj_t * Abc_ObjChild1Copy(Abc_Obj_t *pObj)
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
ABC_DLL Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
#define ABC_ALLOC(type, num)
#define Abc_NtkForEachCo(pNtk, pCo, i)
static int Abc_NtkRRWindow(Abc_RRMan_t *p)
static Abc_Obj_t * Abc_NtkCi(Abc_Ntk_t *pNtk, int i)
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
void Prove_ParamsSetDefault(Prove_Params_t *pParams)
FUNCTION DEFINITIONS ///.
ABC_DLL int Abc_NtkMiterProve(Abc_Ntk_t **ppNtk, void *pParams)
FUNCTION DEFINITIONS ///.
static abctime Abc_Clock()
static int Abc_NodeIsTravIdPrevious(Abc_Obj_t *p)
static int Abc_MaxInt(int a, int b)
static int Vec_PtrSize(Vec_Ptr_t *p)
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
static void Abc_RRManClean(Abc_RRMan_t *p)
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
ABC_DLL void Abc_NtkReassignIds(Abc_Ntk_t *pNtk)
static Abc_Obj_t * Abc_ObjChild0(Abc_Obj_t *pObj)
static Abc_Ntk_t * Abc_NtkWindow(Abc_Ntk_t *pNtk, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vCone, Vec_Ptr_t *vRoots)
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Vec_Str_t * Abc_NtkRRSimulate(Abc_Ntk_t *pNtk)
static void Vec_StrWriteEntry(Vec_Str_t *p, int i, char Entry)
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
ABC_DLL void Abc_NtkAddDummyPoNames(Abc_Ntk_t *pNtk)
Vec_Ptr_t * Sim_UtilInfoAlloc(int nSize, int nWords, int fClean)
FUNCTION DEFINITIONS ///.
static Abc_Obj_t * Abc_ObjChild0Copy(Abc_Obj_t *pObj)
static char Vec_StrEntry(Vec_Str_t *p, int i)
static void Abc_NtkRRSimulateStop(Abc_Ntk_t *pNtk)
ABC_DLL Abc_Ntk_t * Abc_NtkMiter(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int fComb, int nPartSize, int fImplic, int fMulti)
FUNCTION DEFINITIONS ///.
ABC_DLL int Abc_AigLevel(Abc_Ntk_t *pNtk)
#define ABC_NAMESPACE_IMPL_END
static Vec_Str_t * Vec_StrStart(int nSize)
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
#define Abc_NtkForEachNode(pNtk, pNode, i)
static int Abc_NodeIsPersistant(Abc_Obj_t *pNode)
#define ABC_NAMESPACE_IMPL_START
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
static int Abc_NtkRRProve(Abc_RRMan_t *p)
typedefABC_NAMESPACE_IMPL_START struct Abc_RRMan_t_ Abc_RRMan_t
DECLARATIONS ///.
static void Sim_CollectNodes_rec(Abc_Obj_t *pRoot, Vec_Ptr_t *vField)
#define Vec_PtrForEachEntryStop(Type, vVec, pEntry, i, Stop)
#define Abc_ObjForEachFanout(pObj, pFanout, i)
#define Abc_NtkForEachCi(pNtk, pCi, i)
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
static void Abc_RRManPrintStats(Abc_RRMan_t *p)
#define Abc_ObjForEachFanin(pObj, pFanin, i)
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
static void Abc_RRManStop(Abc_RRMan_t *p)
static int Abc_NtkRRTfo_rec(Abc_Obj_t *pNode, Vec_Ptr_t *vRoots, int LevelLimit)
#define ABC_INFINITY
MACRO DEFINITIONS ///.
ABC_DLL int Abc_NtkIsDfsOrdered(Abc_Ntk_t *pNtk)
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
static void Vec_PtrClear(Vec_Ptr_t *p)
static Abc_Obj_t * Abc_ObjNot(Abc_Obj_t *p)
static void Sim_TraverseNodes_rec(Abc_Obj_t *pRoot, Vec_Str_t *vTargets, Vec_Ptr_t *vNodes)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
static int Abc_ObjIsComplement(Abc_Obj_t *p)
static void Abc_NtkRRTfi_rec(Abc_Obj_t *pNode, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vCone, int LevelLimit)
static void Vec_PtrShrink(Vec_Ptr_t *p, int nSizeNew)
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
ABC_DLL void Abc_NtkAddDummyPiNames(Abc_Ntk_t *pNtk)
static Abc_Obj_t * Abc_NtkCreatePo(Abc_Ntk_t *pNtk)
static Abc_Obj_t * Abc_ObjChild1(Abc_Obj_t *pObj)
static int Abc_NtkRRUpdate(Abc_Ntk_t *pNtk, Abc_Obj_t *pNode, Abc_Obj_t *pFanin, Abc_Obj_t *pFanout)
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
static void Vec_PtrFree(Vec_Ptr_t *p)
ABC_DLL void Abc_AigReplace(Abc_Aig_t *pMan, Abc_Obj_t *pOld, Abc_Obj_t *pNew, int fUpdateLevel)