ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
mfsWin.c
Go to the documentation of this file.
1
20
21#include "mfsInt.h"
22
24
25
29
33
45static inline int Abc_MfsComputeRootsCheck( Abc_Obj_t * pNode, int nLevelMax, int nFanoutLimit )
46{
47 Abc_Obj_t * pFanout;
48 int i;
49 // the node is the root if one of the following is true:
50 // (1) the node has more than fanouts than the limit
51 if ( Abc_ObjFanoutNum(pNode) > nFanoutLimit )
52 return 1;
53 // (2) the node has CO fanouts
54 // (3) the node has fanouts above the cutoff level
55 Abc_ObjForEachFanout( pNode, pFanout, i )
56 if ( Abc_ObjIsCo(pFanout) || (int)pFanout->Level > nLevelMax )
57 return 1;
58 return 0;
59}
60
72void Abc_MfsComputeRoots_rec( Abc_Obj_t * pNode, int nLevelMax, int nFanoutLimit, Vec_Ptr_t * vRoots )
73{
74 Abc_Obj_t * pFanout;
75 int i;
76 assert( Abc_ObjIsNode(pNode) );
77 if ( Abc_NodeIsTravIdCurrent(pNode) )
78 return;
79 Abc_NodeSetTravIdCurrent( pNode );
80 // check if the node should be the root
81 if ( Abc_MfsComputeRootsCheck( pNode, nLevelMax, nFanoutLimit ) )
82 Vec_PtrPush( vRoots, pNode );
83 else // if not, explore its fanouts
84 Abc_ObjForEachFanout( pNode, pFanout, i )
85 Abc_MfsComputeRoots_rec( pFanout, nLevelMax, nFanoutLimit, vRoots );
86}
87
99Vec_Ptr_t * Abc_MfsComputeRoots( Abc_Obj_t * pNode, int nWinTfoMax, int nFanoutLimit )
100{
101 Vec_Ptr_t * vRoots;
102 vRoots = Vec_PtrAlloc( 10 );
103 Abc_NtkIncrementTravId( pNode->pNtk );
104 Abc_MfsComputeRoots_rec( pNode, pNode->Level + nWinTfoMax, nFanoutLimit, vRoots );
105 assert( Vec_PtrSize(vRoots) > 0 );
106// if ( Vec_PtrSize(vRoots) == 1 && Vec_PtrEntry(vRoots, 0) == pNode )
107// return 0;
108 return vRoots;
109}
110
114
115
117
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition abc.h:529
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
Vec_Ptr_t * Abc_MfsComputeRoots(Abc_Obj_t *pNode, int nWinTfoMax, int nFanoutLimit)
Definition mfsWin.c:99
void Abc_MfsComputeRoots_rec(Abc_Obj_t *pNode, int nLevelMax, int nFanoutLimit, Vec_Ptr_t *vRoots)
Definition mfsWin.c:72
Abc_Ntk_t * pNtk
Definition abc.h:130
unsigned Level
Definition abc.h:142
#define assert(ex)
Definition util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42