23#include "aig/nwk/nwkMerge.h"
51 if ( !Abc_ObjIsNode(pLut) )
53 if ( Abc_NodeIsTravIdCurrent( pLut ) )
55 Abc_NodeSetTravIdCurrent( pLut );
56 if ( Abc_ObjLevel(pLut) < nLevMin )
77 if ( !Abc_ObjIsNode(pLut) )
79 if ( Abc_NodeIsTravIdCurrent( pLut ) )
81 Abc_NodeSetTravIdCurrent( pLut );
82 if ( Abc_ObjLevel(pLut) > nLevMax )
84 if ( Abc_ObjFanoutNum(pLut) > nFanMax )
105 Vec_PtrClear( vNext );
110 if ( !Abc_ObjIsNode(pNext) )
112 if ( Abc_NodeIsTravIdCurrent( pNext ) )
114 Abc_NodeSetTravIdCurrent( pNext );
115 Vec_PtrPush( vNext, pNext );
119 if ( !Abc_ObjIsNode(pNext) )
121 if ( Abc_NodeIsTravIdCurrent( pNext ) )
123 Abc_NodeSetTravIdCurrent( pNext );
124 if ( Abc_ObjFanoutNum(pNext) > nFanMax )
126 Vec_PtrPush( vNext, pNext );
147 Vec_PtrClear( vCands );
153 Vec_PtrClear( vStart );
154 Vec_PtrPush( vStart, pLut );
155 Abc_NtkIncrementTravId( pLut->
pNtk );
156 Abc_NodeSetTravIdCurrent( pLut );
165 Vec_PtrPush( vCands, pObj );
169 Abc_NtkIncrementTravId( pLut->
pNtk );
171 Abc_NodeSetTravIdCurrent( pLut );
174 Abc_NodeSetTravIdPrevious( pLut );
176 Abc_NodeSetTravIdPrevious( pLut );
188 if ( Abc_NodeIsTravIdCurrent(pObj) )
190 if ( Abc_ObjFaninNum(pLut) + Abc_ObjFaninNum(pObj) > pPars->
nMaxSuppSize )
192 if ( Abc_ObjLevel(pLut) - Abc_ObjLevel(pObj) > pPars->
nMaxLevelDiff ||
193 Abc_ObjLevel(pObj) - Abc_ObjLevel(pLut) > pPars->
nMaxLevelDiff )
195 Vec_PtrWriteEntry( vCands, k++, pObj );
197 Vec_PtrShrink( vCands, k );
215 int i, nCounter = Abc_ObjFaninNum(pLut);
217 nCounter += !pFanin->
fMarkC;
240 Vec_PtrClear( vCands );
241 Abc_NtkIncrementTravId( pLut->
pNtk );
242 Abc_NodeSetTravIdCurrent( pLut );
245 if ( !Abc_ObjIsNode(pFanin) )
247 if ( Abc_ObjFanoutNum(pFanin) > pPars->
nMaxFanout )
251 if ( !Abc_ObjIsNode(pObj) )
253 if ( Abc_NodeIsTravIdCurrent( pObj ) )
255 Abc_NodeSetTravIdCurrent( pObj );
257 if ( Abc_ObjLevel(pLut) - Abc_ObjLevel(pObj) > pPars->
nMaxLevelDiff ||
258 Abc_ObjLevel(pObj) - Abc_ObjLevel(pLut) > pPars->
nMaxLevelDiff )
263 Vec_PtrPush( vCands, pObj );
286 Vec_Ptr_t * vStart, * vNext, * vCands1, * vCands2;
288 int i, k, nVertsMax, nCands;
289 clock_t clk = clock();
293 nVertsMax += (int)(Abc_ObjFaninNum(pLut) <= pPars->
nMaxLutSize);
296 vStart = Vec_PtrAlloc( 1000 );
297 vNext = Vec_PtrAlloc( 1000 );
298 vCands1 = Vec_PtrAlloc( 1000 );
299 vCands2 = Vec_PtrAlloc( 1000 );
308 if ( Vec_PtrSize(vCands1) == 0 && Vec_PtrSize(vCands2) == 0 )
310 nCands += Vec_PtrSize(vCands1) + Vec_PtrSize(vCands2);
318 printf(
"Node %6d : Fanins = %d. Fanouts = %3d. Cand1 = %3d. Cand2 = %3d.\n",
319 Abc_ObjId(pLut), Abc_ObjFaninNum(pLut), Abc_ObjFaninNum(pLut),
320 Vec_PtrSize(vCands1), Vec_PtrSize(vCands2) );
322 Vec_PtrFree( vStart );
323 Vec_PtrFree( vNext );
324 Vec_PtrFree( vCands1 );
325 Vec_PtrFree( vCands2 );
328 printf(
"Mergable LUTs = %6d. Total cands = %6d. ",
p->nVertsMax, nCands );
329 ABC_PRT(
"Deriving graph", clock() - clk );
336 printf(
"GRAPH: Nodes = %6d. Edges = %6d. Pairs = %6d. ",
337 p->nVerts,
p->nEdges, Vec_IntSize(
p->vPairs)/2 );
338 ABC_PRT(
"Solving", clock() - clk );
341 vResult =
p->vPairs;
p->vPairs = NULL;
struct Abc_Obj_t_ Abc_Obj_t
#define Abc_ObjForEachFanin(pObj, pFanin, i)
#define Abc_ObjForEachFanout(pObj, pFanout, i)
struct Abc_Ntk_t_ Abc_Ntk_t
#define Abc_NtkForEachNode(pNtk, pNode, i)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
void Abc_NtkCollectCircle(Vec_Ptr_t *vStart, Vec_Ptr_t *vNext, int nFanMax)
Vec_Int_t * Abc_NtkLutMerge(Abc_Ntk_t *pNtk, Nwk_LMPars_t *pPars)
int Abc_NtkCountTotalFanins(Abc_Obj_t *pLut, Abc_Obj_t *pCand)
ABC_NAMESPACE_IMPL_START void Abc_NtkMarkFanins_rec(Abc_Obj_t *pLut, int nLevMin)
DECLARATIONS ///.
void Abc_NtkCollectOverlapCands(Abc_Obj_t *pLut, Vec_Ptr_t *vCands, Nwk_LMPars_t *pPars)
void Abc_NtkMarkFanouts_rec(Abc_Obj_t *pLut, int nLevMax, int nFanMax)
void Abc_NtkCollectNonOverlapCands(Abc_Obj_t *pLut, Vec_Ptr_t *vStart, Vec_Ptr_t *vNext, Vec_Ptr_t *vCands, Nwk_LMPars_t *pPars)
void Nwk_ManGraphSolve(Nwk_Grf_t *p)
ABC_NAMESPACE_IMPL_START Nwk_Grf_t * Nwk_ManGraphAlloc(int nVertsMax)
DECLARATIONS ///.
void Nwk_ManGraphHashEdge(Nwk_Grf_t *p, int iLut1, int iLut2)
void Nwk_ManGraphReportMemoryUsage(Nwk_Grf_t *p)
void Nwk_ManGraphFree(Nwk_Grf_t *p)
struct Nwk_Grf_t_ Nwk_Grf_t
struct Nwk_LMPars_t_ Nwk_LMPars_t
BASIC TYPES ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.