99 for ( i = 0; i < nNodes; i++ )
101 for ( i = 0; i < nNodes; i++ )
240 for ( i = 0; i < nNodes; i++ )
250 for ( i = 0; i < nNodes; i++ )
267 Abc_Obj_t * pFanout, * pFanoutBest = NULL;
268 double CostBest = 0.0;
277 for ( k = 0; k < nObjs; k++ )
278 if ( pFanout == ppObjs[k] )
282 ppObjs[nObjs] = pFanout;
288 pFanoutBest = pFanout;
308 Vec_Ptr_t * vRoots1, * vNodes, * vLeaves, * vFanouts;
345 Vec_Ptr_t * vRoots2, * vNodes, * vLeaves, * vFanouts;
359 if ( ppObjs[1] == NULL )
394 pFile = fopen( pFileName,
"wb" );
395 fprintf( pFile,
".model %s_part\n", pNodes[0]->pNtk->pName );
396 fprintf( pFile,
".inputs" );
399 fprintf( pFile,
"\n" );
400 fprintf( pFile,
".outputs" );
401 for ( i = 0; i < nNodes; i++ )
403 fprintf( pFile,
"\n" );
406 fprintf( pFile,
".names" );
410 fprintf( pFile,
"\n%s", (
char *)pObj->
pData );
412 fprintf( pFile,
".end\n" );
435 pFile = fopen( pFileName,
"wb" );
436 fprintf( pFile,
".model %s_part\n", pNtk->
pName );
437 fprintf( pFile,
".inputs" );
440 fprintf( pFile,
"\n" );
441 fprintf( pFile,
".outputs" );
444 fprintf( pFile,
"\n" );
447 fprintf( pFile,
".names" );
451 fprintf( pFile,
"\n%s", (
char *)pObj->
pData );
453 fprintf( pFile,
".end\n" );
470 char pFileName[1000];
471 Vec_Ptr_t * vRoots, * vRoots1, * vRoots2, * vNodes, * vLeaves;
473 int i, nNodes = 0, nNodes2 = 0;
481 printf(
"%6d : ", i );
498 if ( pNodes[1] == NULL || pNodes[2] == NULL )
520 printf(
"Total nodes = %d. Root nodes = %d. Mffc nodes = %d. Mffc nodes2 = %d.\n",
544 Vec_Ptr_t * vRoots, * vFanins, * vFanouts, * vNodes, * vLeaves;
546 Vec_Int_t * vCounts, * vNumbers, * vSizes, * vMarks;
548 int i, k, Entry, nSizes;
611 printf(
"Included = %6d. Total = %6d. (%6.2f %%)\n",
642 else if ( Entry <= 100 )
644 else if ( Entry < 1000 )
649 for ( i = 1; i <= 10; i++ )
651 printf(
" n = %4d %6d\n", i,
Vec_IntEntry(vNumbers,i) );
652 for ( i = 11; i <= 20; i++ )
654 printf(
"%4d < n <= %4d %6d\n", 10*(i-10), 10*(i-9),
Vec_IntEntry(vNumbers,i) );
655 for ( i = 21; i < 30; i++ )
657 printf(
"%4d < n <= %4d %6d\n", 100*(i-20), 100*(i-19),
Vec_IntEntry(vNumbers,i) );
660 printf(
"Total MFFCs = %d. ",
Vec_PtrSize(vRoots) );
787 Vec_Ptr_t * vNodes, * vLeaves, * vRoots, * vVolume;
788 Vec_Ptr_t * vLeaves2, * vRoots2, * vVolume2;
790 double Cost, CostBest = 0.0;
800 for ( i = 1; i <= 16; i++ )
806 printf(
"%2d : Node =%6d (%2d%3d) Cost =%6.2f ", i,
Abc_ObjId(pNodeBest),
820 if ( pNodeBest == NULL || CostBest < Cost )
837 if ( pNodeBest == NULL || CostBest < Cost )
844 if ( pNodeBest == NULL )
894 Vec_Ptr_t * vRoots, * vFanins, * vFanouts, * vVolumes, * vNodes, * vLeaves;
938 *pvFanouts = vFanouts;
939 *pvVolumes = vVolumes;
988 return 0.6 * nCommon - 1.2 *
Vec_IntSize(vSupp2) + 0.8 * Volume;
1030 Vec_Int_t * vIns2, * vOuts, * vOuts2, * vTemp;
1031 Abc_Obj_t * pPivot2, * pObj, * pObjBest = NULL;
1055 if ( pObjBest == NULL || CostBest < Cost )
1133 Vec_Ptr_t * vPivots, * vFanins, * vFanouts, * vVolumes;
1137 assert( nOutMax >= 1 && nOutMax <= 32 );
1170 for ( k = 1; k < nOutMax; k++ )
1175 pObj2 =
Abc_NktMffcFindBest( pNtk, vMarks, vLeaves, vFanins, vFanouts, vVolumes, nInMax );
1178 if ( pObj2 == NULL )
1206 char pFileName[1000];
1209 double Cost, CostAll = 0.0;
1210 int i, k, Entry, nNodes = 0;
1226 printf(
"%6d : Root =%3d. Leaf =%3d. Node =%4d. ",
1228 printf(
"Cost =%6.2f ", Cost );
1230 printf(
"%d ", Entry );
1241 printf(
"Total = %6d. Nodes = %6d. ",
Abc_NtkNodeNum(pNtk), nNodes );
1242 printf(
"Cost = %6.2f ", CostAll );
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
static Vec_Ptr_t * Vec_PtrStart(int nSize)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
void Abc_MffcCollectNodes(Abc_Obj_t **pNodes, int nNodes, Vec_Ptr_t *vNodes)
Abc_Obj_t * Abc_NktMffcGrowOne(Abc_Ntk_t *pNtk, Abc_Obj_t **ppObjs, int nObjs, Vec_Ptr_t *vNodes, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vFanouts)
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
void Abc_NktMffcPrint(char *pFileName, Abc_Obj_t **pNodes, int nNodes, Vec_Ptr_t *vNodes, Vec_Ptr_t *vLeaves)
static void Vec_PtrSort(Vec_Ptr_t *p, int(*Vec_PtrSortCompare)()) ___unused
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
#define Abc_NtkForEachCo(pNtk, pCo, i)
static abctime Abc_Clock()
static int Vec_PtrSize(Vec_Ptr_t *p)
static void * Vec_PtrPop(Vec_Ptr_t *p)
static void Vec_IntSort(Vec_Int_t *p, int fReverse)
static int Vec_IntTwoCountCommon(Vec_Int_t *vArr1, Vec_Int_t *vArr2)
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
static int Vec_PtrFind(Vec_Ptr_t *p, void *Entry)
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
void Abc_NktMffcPrintInt(char *pFileName, Abc_Ntk_t *pNtk, Vec_Int_t *vRoots, Vec_Int_t *vNodes, Vec_Int_t *vLeaves)
void Abc_NktMffcCollectFanout_rec(Abc_Obj_t *pObj, Vec_Ptr_t *vFanouts)
static void Abc_PrintTime(int level, const char *pStr, abctime time)
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
ABC_DLL void Abc_NtkCleanMarkA(Abc_Ntk_t *pNtk)
static Vec_Int_t * Vec_IntStart(int nSize)
Vec_Int_t * Abc_NktMffcSaveOne(Vec_Ptr_t *vThis, Vec_Ptr_t *vVolumes)
void Abc_NktMffcTest(Abc_Ntk_t *pNtk)
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
void Abc_NktMffcTestIdeaOne(Abc_Ntk_t *pNtk, Abc_Obj_t *pObj)
ABC_DLL int Abc_NtkToSop(Abc_Ntk_t *pNtk, int fDirect)
static void Vec_IntAddToEntry(Vec_Int_t *p, int i, int Addition)
#define Abc_NtkForEachObjVec(vIds, pNtk, pObj, i)
Vec_Ptr_t * Abc_NktMffcGrowRootsAgain(Abc_Ntk_t *pNtk, Vec_Ptr_t *vRoots, Vec_Ptr_t *vRoots1)
Vec_Ptr_t * Abc_NktMffcMarkRoots(Abc_Ntk_t *pNtk, int fSkipPis)
static int Vec_IntEntry(Vec_Int_t *p, int i)
#define ABC_NAMESPACE_IMPL_END
void Abc_NktMffcCollectFanout(Abc_Obj_t **pNodes, int nNodes, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vFanouts)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
static Vec_Int_t * Vec_IntTwoMerge(Vec_Int_t *vArr1, Vec_Int_t *vArr2)
void Abc_NktMffcTestSuper(Abc_Ntk_t *pNtk)
void Abc_MffcCollectLeaves(Vec_Ptr_t *vNodes, Vec_Ptr_t *vLeaves)
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
void Abc_NktMffcTestIdea(Abc_Ntk_t *pNtk)
#define Abc_NtkForEachNode(pNtk, pNode, i)
#define ABC_NAMESPACE_IMPL_START
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
ABC_NAMESPACE_IMPL_START void Abc_MffcDeref_rec(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
DECLARATIONS ///.
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
Vec_Ptr_t * Abc_NktMffcDerive(Abc_Ntk_t *pNtk, Vec_Ptr_t **pvFanins, Vec_Ptr_t **pvFanouts, Vec_Ptr_t **pvVolumes)
static int Vec_IntSize(Vec_Int_t *p)
#define Abc_ObjForEachFanout(pObj, pFanout, i)
static char * Abc_NtkName(Abc_Ntk_t *pNtk)
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Vec_Ptr_t * Abc_NktMffcServer(Abc_Ntk_t *pNtk, int nInMax, int nOutMax)
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
double Abc_NktMffcCostTwo(Vec_Int_t *vSupp1, Vec_Int_t *vSupp2, int Volume, int Limit)
#define ABC_INFINITY
MACRO DEFINITIONS ///.
static void Vec_PtrClear(Vec_Ptr_t *p)
Vec_Int_t * Abc_NktMffcSupport(Vec_Ptr_t *vThis, Vec_Ptr_t *vFanins)
static void Vec_IntFree(Vec_Int_t *p)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
static void Vec_IntClear(Vec_Int_t *p)
void Abc_MffcRef_rec(Abc_Obj_t *pNode)
void Abc_NktMffcFree(Vec_Ptr_t *vRoots, Vec_Ptr_t *vFanins, Vec_Ptr_t *vFanouts, Vec_Ptr_t *vVolumes)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
static void ** Vec_PtrArray(Vec_Ptr_t *p)
int Abc_NodeCompareVolumeDecrease(Abc_Obj_t **pp1, Abc_Obj_t **pp2)
void Abc_NktMffcServerTest(Abc_Ntk_t *pNtk)
Abc_Obj_t * Abc_NktMffcFindBest(Abc_Ntk_t *pNtk, Vec_Int_t *vMarks, Vec_Int_t *vIns, Vec_Ptr_t *vFanins, Vec_Ptr_t *vFanouts, Vec_Ptr_t *vVolumes, int Limit)
void Abc_NktMffCollectLeafRoot(Abc_Ntk_t *pNtk, Vec_Ptr_t *vNodes, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vRoots)
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Vec_Ptr_t * Abc_NktMffcGrowRoots(Abc_Ntk_t *pNtk, Vec_Ptr_t *vRoots)
static void Vec_PtrFree(Vec_Ptr_t *p)
void Abc_NktMffCollectLeafRootInt(Abc_Ntk_t *pNtk, Vec_Int_t *vNodes, Vec_Int_t *vLeaves, Vec_Int_t *vRoots)