56 p->vRoots = Vec_PtrAlloc( 256 );
57 p->vLeaves = Vec_PtrAlloc( 256 );
58 p->vBranches = Vec_PtrAlloc( 256 );
59 p->vNodes = Vec_PtrAlloc( 256 );
60 p->vDivs = Vec_PtrAlloc( 256 );
61 p->vMatrix = Vec_VecStart( 128 );
78 Vec_PtrFree(
p->vRoots );
79 Vec_PtrFree(
p->vLeaves );
80 Vec_PtrFree(
p->vBranches );
81 Vec_PtrFree(
p->vNodes );
82 Vec_PtrFree(
p->vDivs );
83 Vec_VecFree(
p->vMatrix );
107 assert( Vec_VecSize(
p->vMatrix) >
p->nWinTfiMax );
110 Vec_VecClear(
p->vMatrix );
111 Vec_VecPush(
p->vMatrix, 0,
p->pNode );
112 Abc_NtkIncrementTravId(
p->pNode->pNtk );
113 Abc_NodeSetTravIdCurrent(
p->pNode );
116 Vec_PtrClear(
p->vLeaves );
123 if ( Abc_NodeIsTravIdCurrent( pTemp ) )
125 Abc_NodeSetTravIdCurrent( pTemp );
126 if ( Abc_ObjIsCi(pTemp) || (
int)(
p->pNode->Level - pTemp->
Level) >
p->nWinTfiMax )
127 Vec_PtrPush(
p->vLeaves, pTemp );
129 Vec_VecPush(
p->vMatrix,
p->pNode->Level - pTemp->
Level, pTemp );
133 if ( Vec_PtrSize(
p->vLeaves) == 0 )
137 Vec_PtrClear(
p->vNodes );
141 Vec_PtrPush(
p->vNodes, pObj );
142 Vec_PtrClear( vFront );
148 p->nLevLeafMin = Abc_MinInt(
p->nLevLeafMin, (
int)pObj->
Level );
151 p->nLevTravMin = Abc_MaxInt( ((
int)
p->pNode->Level) -
p->nWinTfiMax -
p->nLevTfiMinus,
p->nLevLeafMin );
169static inline int Res_WinComputeRootsCheck(
Abc_Obj_t * pNode,
int nLevelMax,
int nFanoutLimit )
175 if ( Abc_ObjFanoutNum(pNode) > nFanoutLimit )
180 if ( Abc_ObjIsCo(pFanout) || (
int)pFanout->
Level > nLevelMax )
200 assert( Abc_ObjIsNode(pNode) );
201 if ( Abc_NodeIsTravIdCurrent(pNode) )
203 Abc_NodeSetTravIdCurrent( pNode );
205 if ( Res_WinComputeRootsCheck( pNode, nLevelMax, nFanoutLimit ) )
206 Vec_PtrPush( vRoots, pNode );
225 Vec_PtrClear(
p->vRoots );
226 Abc_NtkIncrementTravId(
p->pNode->pNtk );
228 assert( Vec_PtrSize(
p->vRoots) > 0 );
229 if ( Vec_PtrSize(
p->vRoots) == 1 && Vec_PtrEntry(
p->vRoots, 0) ==
p->pNode )
252 if ( Abc_NodeIsTravIdCurrent(pNode) )
254 if ( Abc_NodeIsTravIdPrevious(pNode) )
257 Abc_NodeSetTravIdPrevious( pNode );
259 if ( pNode == pPivot || (
int)pNode->
Level <= nLevelMin )
261 assert( Abc_ObjIsNode(pNode) );
268 Abc_NodeSetTravIdCurrent( pNode );
288 Abc_NtkIncrementTravId(
p->pNode->pNtk );
289 Abc_NtkIncrementTravId(
p->pNode->pNtk );
291 Abc_NodeSetTravIdCurrent( pObj );
317 assert( Abc_ObjIsNode(pObj) );
318 assert( Abc_NodeIsTravIdCurrent(pObj) );
321 if ( !Abc_NodeIsTravIdCurrent(pFanout) )
324 if ( i < Abc_ObjFanoutNum(pObj) )
325 Vec_PtrPushUnique( vRoots, pObj );
345 assert( !Abc_NodeIsTravIdCurrent(
p->pNode) );
347 Abc_NodeSetTravIdCurrent(
p->pNode );
349 Vec_PtrClear(
p->vRoots );
351 assert( Vec_PtrSize(
p->vRoots) > 0 );
352 if ( Vec_PtrSize(
p->vRoots) == 1 && Vec_PtrEntry(
p->vRoots, 0) ==
p->pNode )
374 if ( Abc_NodeIsTravIdCurrent(pObj) )
377 if ( !Abc_NodeIsTravIdPrevious(pObj) )
379 assert( Vec_PtrFind(
p->vLeaves, pObj) == -1 );
380 Abc_NodeSetTravIdCurrent( pObj );
381 Vec_PtrPush(
p->vBranches, pObj );
384 assert( Abc_ObjIsNode(pObj) );
385 Abc_NodeSetTravIdCurrent( pObj );
390 Vec_PtrPush(
p->vNodes, pObj );
409 Abc_NtkIncrementTravId(
p->pNode->pNtk );
411 Abc_NodeSetTravIdCurrent( pObj );
414 Abc_NodeSetTravIdCurrent( pObj );
416 Vec_PtrClear(
p->vBranches );
437 return Vec_PtrSize(
p->vRoots) == 1 && Vec_PtrEntry(
p->vRoots, 0) ==
p->pNode;
453 assert( Abc_ObjIsNode(pNode) );
454 assert( nWinTfiMax > 0 && nWinTfiMax < 10 );
455 assert( nWinTfoMax >= 0 && nWinTfoMax < 10 );
459 p->nWinTfiMax = nWinTfiMax;
460 p->nWinTfoMax = nWinTfoMax;
462 Vec_PtrClear(
p->vBranches );
463 Vec_PtrClear(
p->vDivs );
464 Vec_PtrClear(
p->vRoots );
465 Vec_PtrPush(
p->vRoots, pNode );
struct Abc_Obj_t_ Abc_Obj_t
#define Abc_ObjForEachFanin(pObj, pFanin, i)
#define Abc_ObjForEachFanout(pObj, pFanout, i)
#define ABC_ALLOC(type, num)
#define ABC_INFINITY
MACRO DEFINITIONS ///.
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_HEADER_START struct Res_Win_t_ Res_Win_t
INCLUDES ///.
void Res_WinAddMissing_rec(Res_Win_t *p, Abc_Obj_t *pObj, int nLevTravMin)
int Res_WinComputeRoots(Res_Win_t *p)
void Res_WinFinalizeRoots_rec(Abc_Obj_t *pObj, Vec_Ptr_t *vRoots)
int Res_WinIsTrivial(Res_Win_t *p)
void Res_WinAddMissing(Res_Win_t *p)
int Res_WinCompute(Abc_Obj_t *pNode, int nWinTfiMax, int nWinTfoMax, Res_Win_t *p)
void Res_WinFree(Res_Win_t *p)
ABC_NAMESPACE_IMPL_START Res_Win_t * Res_WinAlloc()
DECLARATIONS ///.
void Res_WinMarkPaths(Res_Win_t *p)
int Res_WinCollectLeavesAndNodes(Res_Win_t *p)
int Res_WinMarkPaths_rec(Abc_Obj_t *pNode, Abc_Obj_t *pPivot, int nLevelMin)
void Res_WinComputeRoots_rec(Abc_Obj_t *pNode, int nLevelMax, int nFanoutLimit, Vec_Ptr_t *vRoots)
int Res_WinFinalizeRoots(Res_Win_t *p)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
#define Vec_VecForEachLevelStartStop(vGlob, vVec, i, LevelStart, LevelStop)
#define Vec_VecForEachLevelReverseStartStop(vGlob, vVec, i, LevelStart, LevelStop)