#include "base/abc/abc.h"
#include "resInt.h"
Go to the source code of this file.
|
| ABC_NAMESPACE_IMPL_START Res_Win_t * | Res_WinAlloc () |
| | DECLARATIONS ///.
|
| |
| void | Res_WinFree (Res_Win_t *p) |
| |
| int | Res_WinCollectLeavesAndNodes (Res_Win_t *p) |
| |
| void | Res_WinComputeRoots_rec (Abc_Obj_t *pNode, int nLevelMax, int nFanoutLimit, Vec_Ptr_t *vRoots) |
| |
| int | Res_WinComputeRoots (Res_Win_t *p) |
| |
| int | Res_WinMarkPaths_rec (Abc_Obj_t *pNode, Abc_Obj_t *pPivot, int nLevelMin) |
| |
| void | Res_WinMarkPaths (Res_Win_t *p) |
| |
| void | Res_WinFinalizeRoots_rec (Abc_Obj_t *pObj, Vec_Ptr_t *vRoots) |
| |
| int | Res_WinFinalizeRoots (Res_Win_t *p) |
| |
| void | Res_WinAddMissing_rec (Res_Win_t *p, Abc_Obj_t *pObj, int nLevTravMin) |
| |
| void | Res_WinAddMissing (Res_Win_t *p) |
| |
| int | Res_WinIsTrivial (Res_Win_t *p) |
| |
| int | Res_WinCompute (Abc_Obj_t *pNode, int nWinTfiMax, int nWinTfoMax, Res_Win_t *p) |
| |
◆ Res_WinAddMissing()
Function*************************************************************
Synopsis [Adds to the window nodes and leaves in the TFI of the roots.]
Description []
SideEffects []
SeeAlso []
Definition at line 404 of file resWin.c.
405{
407 int i;
408
409 Abc_NtkIncrementTravId(
p->pNode->pNtk );
411 Abc_NodeSetTravIdCurrent( pObj );
412
414 Abc_NodeSetTravIdCurrent( pObj );
415
416 Vec_PtrClear(
p->vBranches );
419}
struct Abc_Obj_t_ Abc_Obj_t
void Res_WinAddMissing_rec(Res_Win_t *p, Abc_Obj_t *pObj, int nLevTravMin)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
◆ Res_WinAddMissing_rec()
Function*************************************************************
Synopsis [Recursively adds missing nodes and leaves.]
Description []
SideEffects []
SeeAlso []
Definition at line 369 of file resWin.c.
370{
372 int i;
373
374 if ( Abc_NodeIsTravIdCurrent(pObj) )
375 return;
376
377 if ( !Abc_NodeIsTravIdPrevious(pObj) )
378 {
379 assert( Vec_PtrFind(
p->vLeaves, pObj) == -1 );
380 Abc_NodeSetTravIdCurrent( pObj );
381 Vec_PtrPush(
p->vBranches, pObj );
382 return;
383 }
384 assert( Abc_ObjIsNode(pObj) );
385 Abc_NodeSetTravIdCurrent( pObj );
386
389
390 Vec_PtrPush(
p->vNodes, pObj );
391}
#define Abc_ObjForEachFanin(pObj, pFanin, i)
◆ Res_WinAlloc()
DECLARATIONS ///.
CFile****************************************************************
FileName [resWin.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Resynthesis package.]
Synopsis [Windowing algorithm.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - January 15, 2007.]
Revision [
- Id
- resWin.c,v 1.00 2007/01/15 00:00:00 alanmi Exp
] FUNCTION DEFINITIONS /// Function*************************************************************
Synopsis [Allocates the window.]
Description []
SideEffects []
SeeAlso []
Definition at line 46 of file resWin.c.
47{
49
52
55
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 );
63}
#define ABC_ALLOC(type, num)
typedefABC_NAMESPACE_HEADER_START struct Res_Win_t_ Res_Win_t
INCLUDES ///.
◆ Res_WinCollectLeavesAndNodes()
| int Res_WinCollectLeavesAndNodes |
( |
Res_Win_t * | p | ) |
|
Function*************************************************************
Synopsis [Collect the limited TFI cone of the node.]
Description []
SideEffects []
SeeAlso []
Definition at line 100 of file resWin.c.
101{
104 int i, k, m;
105
107 assert( Vec_VecSize(
p->vMatrix) >
p->nWinTfiMax );
108
109
110 Vec_VecClear(
p->vMatrix );
111 Vec_VecPush(
p->vMatrix, 0,
p->pNode );
112 Abc_NtkIncrementTravId(
p->pNode->pNtk );
113 Abc_NodeSetTravIdCurrent(
p->pNode );
114
115
116 Vec_PtrClear(
p->vLeaves );
118 {
120 {
122 {
123 if ( Abc_NodeIsTravIdCurrent( pTemp ) )
124 continue;
125 Abc_NodeSetTravIdCurrent( pTemp );
126 if ( Abc_ObjIsCi(pTemp) || (
int)(
p->pNode->Level - pTemp->
Level) >
p->nWinTfiMax )
127 Vec_PtrPush(
p->vLeaves, pTemp );
128 else
129 Vec_VecPush(
p->vMatrix,
p->pNode->Level - pTemp->
Level, pTemp );
130 }
131 }
132 }
133 if ( Vec_PtrSize(
p->vLeaves) == 0 )
134 return 0;
135
136
137 Vec_PtrClear(
p->vNodes );
139 {
141 Vec_PtrPush(
p->vNodes, pObj );
142 Vec_PtrClear( vFront );
143 }
144
145
148 p->nLevLeafMin = Abc_MinInt(
p->nLevLeafMin, (
int)pObj->
Level );
149
150
151 p->nLevTravMin = Abc_MaxInt( ((
int)
p->pNode->Level) -
p->nWinTfiMax -
p->nLevTfiMinus,
p->nLevLeafMin );
153 return 1;
154}
#define ABC_INFINITY
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
#define Vec_VecForEachLevelStartStop(vGlob, vVec, i, LevelStart, LevelStop)
#define Vec_VecForEachLevelReverseStartStop(vGlob, vVec, i, LevelStart, LevelStop)
◆ Res_WinCompute()
Function*************************************************************
Synopsis [Computes the window.]
Description []
SideEffects []
SeeAlso []
Definition at line 451 of file resWin.c.
452{
453 assert( Abc_ObjIsNode(pNode) );
454 assert( nWinTfiMax > 0 && nWinTfiMax < 10 );
455 assert( nWinTfoMax >= 0 && nWinTfoMax < 10 );
456
457
459 p->nWinTfiMax = nWinTfiMax;
460 p->nWinTfoMax = nWinTfoMax;
461
462 Vec_PtrClear(
p->vBranches );
463 Vec_PtrClear(
p->vDivs );
464 Vec_PtrClear(
p->vRoots );
465 Vec_PtrPush(
p->vRoots, pNode );
466
467
469 return 0;
470
471
473 {
474
476
479 }
480
481 return 1;
482}
int Res_WinComputeRoots(Res_Win_t *p)
void Res_WinAddMissing(Res_Win_t *p)
void Res_WinMarkPaths(Res_Win_t *p)
int Res_WinCollectLeavesAndNodes(Res_Win_t *p)
int Res_WinFinalizeRoots(Res_Win_t *p)
◆ Res_WinComputeRoots()
Function*************************************************************
Synopsis [Recursively collects the root candidates.]
Description [Returns 1 if the only root is this node.]
SideEffects []
SeeAlso []
Definition at line 223 of file resWin.c.
224{
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 )
230 return 0;
231 return 1;
232}
void Res_WinComputeRoots_rec(Abc_Obj_t *pNode, int nLevelMax, int nFanoutLimit, Vec_Ptr_t *vRoots)
◆ Res_WinComputeRoots_rec()
| void Res_WinComputeRoots_rec |
( |
Abc_Obj_t * | pNode, |
|
|
int | nLevelMax, |
|
|
int | nFanoutLimit, |
|
|
Vec_Ptr_t * | vRoots ) |
Function*************************************************************
Synopsis [Recursively collects the root candidates.]
Description []
SideEffects []
SeeAlso []
Definition at line 196 of file resWin.c.
197{
199 int i;
200 assert( Abc_ObjIsNode(pNode) );
201 if ( Abc_NodeIsTravIdCurrent(pNode) )
202 return;
203 Abc_NodeSetTravIdCurrent( pNode );
204
205 if ( Res_WinComputeRootsCheck( pNode, nLevelMax, nFanoutLimit ) )
206 Vec_PtrPush( vRoots, pNode );
207 else
210}
#define Abc_ObjForEachFanout(pObj, pFanout, i)
◆ Res_WinFinalizeRoots()
Function*************************************************************
Synopsis [Finalizes the roots of the window.]
Description [Roots of the window are the nodes that have at least one fanout that it not in the TFO of the leaves.]
SideEffects []
SeeAlso []
Definition at line 343 of file resWin.c.
344{
345 assert( !Abc_NodeIsTravIdCurrent(
p->pNode) );
346
347 Abc_NodeSetTravIdCurrent(
p->pNode );
348
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 )
353 return 0;
354 return 1;
355}
void Res_WinFinalizeRoots_rec(Abc_Obj_t *pObj, Vec_Ptr_t *vRoots)
◆ Res_WinFinalizeRoots_rec()
Function*************************************************************
Synopsis [Recursively collects the roots.]
Description []
SideEffects []
SeeAlso []
Definition at line 313 of file resWin.c.
314{
316 int i;
317 assert( Abc_ObjIsNode(pObj) );
318 assert( Abc_NodeIsTravIdCurrent(pObj) );
319
321 if ( !Abc_NodeIsTravIdCurrent(pFanout) )
322 break;
323
324 if ( i < Abc_ObjFanoutNum(pObj) )
325 Vec_PtrPushUnique( vRoots, pObj );
326 else
329}
◆ Res_WinFree()
Function*************************************************************
Synopsis [Frees the window.]
Description []
SideEffects []
SeeAlso []
Definition at line 76 of file resWin.c.
77{
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 );
85}
◆ Res_WinIsTrivial()
Function*************************************************************
Synopsis [Returns 1 if the window is trivial (without TFO).]
Description []
SideEffects []
SeeAlso []
Definition at line 435 of file resWin.c.
436{
437 return Vec_PtrSize(
p->vRoots) == 1 && Vec_PtrEntry(
p->vRoots, 0) ==
p->pNode;
438}
◆ Res_WinMarkPaths()
Function*************************************************************
Synopsis [Marks the paths from the roots to the leaves.]
Description []
SideEffects []
SeeAlso []
Definition at line 283 of file resWin.c.
284{
286 int i;
287
288 Abc_NtkIncrementTravId(
p->pNode->pNtk );
289 Abc_NtkIncrementTravId(
p->pNode->pNtk );
291 Abc_NodeSetTravIdCurrent( pObj );
292
293
294
297}
int Res_WinMarkPaths_rec(Abc_Obj_t *pNode, Abc_Obj_t *pPivot, int nLevelMin)
◆ Res_WinMarkPaths_rec()
Function*************************************************************
Synopsis [Marks the paths from the roots to the leaves.]
Description [Returns 1 if the the node can reach a leaf.]
SideEffects []
SeeAlso []
Definition at line 247 of file resWin.c.
248{
250 int i, RetValue;
251
252 if ( Abc_NodeIsTravIdCurrent(pNode) )
253 return 1;
254 if ( Abc_NodeIsTravIdPrevious(pNode) )
255 return 0;
256
257 Abc_NodeSetTravIdPrevious( pNode );
258
259 if ( pNode == pPivot || (
int)pNode->
Level <= nLevelMin )
260 return 0;
261 assert( Abc_ObjIsNode(pNode) );
262
263 RetValue = 0;
266
267 if ( RetValue )
268 Abc_NodeSetTravIdCurrent( pNode );
269 return RetValue;
270}