diff options
-rw-r--r-- | src/aig/gia/giaMfs.c | 4 | ||||
-rw-r--r-- | src/base/abc/abc.h | 3 | ||||
-rw-r--r-- | src/base/abc/abcUtil.c | 20 | ||||
-rw-r--r-- | src/base/abci/abc.c | 33 | ||||
-rw-r--r-- | src/base/abci/abcMini.c | 2 | ||||
-rw-r--r-- | src/base/abci/abcPrint.c | 8 |
6 files changed, 51 insertions, 19 deletions
diff --git a/src/aig/gia/giaMfs.c b/src/aig/gia/giaMfs.c index e5dfb788..c39e102d 100644 --- a/src/aig/gia/giaMfs.c +++ b/src/aig/gia/giaMfs.c @@ -67,7 +67,7 @@ Sfm_Ntk_t * Gia_ManExtractMfs( Gia_Man_t * p ) int i, j, k, curCi, curCo, nBoxIns, nBoxOuts; int Id, iFan, nMfsVars, nBbIns = 0, nBbOuts = 0, Counter = 0; assert( !p->pAigExtra || Gia_ManPiNum(p->pAigExtra) <= 6 ); - Tim_ManBlackBoxIoNum( pManTime, &nBbIns, &nBbOuts ); + if ( pManTime ) Tim_ManBlackBoxIoNum( pManTime, &nBbIns, &nBbOuts ); // skip PIs due to box outputs Counter += nBbOuts; // prepare storage @@ -252,7 +252,7 @@ Gia_Man_t * Gia_ManInsertMfs( Gia_Man_t * p, Sfm_Ntk_t * pNtk ) Vec_Int_t * vArray, * vLeaves; Vec_Int_t * vMapping, * vMapping2; int nBbIns = 0, nBbOuts = 0; - Tim_ManBlackBoxIoNum( pManTime, &nBbIns, &nBbOuts ); + if ( pManTime ) Tim_ManBlackBoxIoNum( pManTime, &nBbIns, &nBbOuts ); nMfsNodes = 1 + Gia_ManCiNum(p) + Gia_ManLutNum(p) + Gia_ManCoNum(p) + nBbIns + nBbOuts; vMfs2Gia = Vec_IntStartFull( nMfsNodes ); vGroupMap = Vec_IntStartFull( nMfsNodes ); diff --git a/src/base/abc/abc.h b/src/base/abc/abc.h index 971f29bb..78afb412 100644 --- a/src/base/abc/abc.h +++ b/src/base/abc/abc.h @@ -820,7 +820,7 @@ extern ABC_DLL void Abc_NtkDontCareFree( Odc_Man_t * p ); extern ABC_DLL int Abc_NtkDontCareCompute( Odc_Man_t * p, Abc_Obj_t * pNode, Vec_Ptr_t * vLeaves, unsigned * puTruth ); /*=== abcPrint.c ==========================================================*/ extern ABC_DLL float Abc_NtkMfsTotalSwitching( Abc_Ntk_t * pNtk ); -extern ABC_DLL void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFactored, int fSaveBest, int fDumpResult, int fUseLutLib, int fPrintMuxes, int fPower, int fGlitch, int fSkipBuf, int fPrintMem ); +extern ABC_DLL void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFactored, int fSaveBest, int fDumpResult, int fUseLutLib, int fPrintMuxes, int fPower, int fGlitch, int fSkipBuf, int fSkipSmall, int fPrintMem ); extern ABC_DLL void Abc_NtkPrintIo( FILE * pFile, Abc_Ntk_t * pNtk, int fPrintFlops ); extern ABC_DLL void Abc_NtkPrintLatch( FILE * pFile, Abc_Ntk_t * pNtk ); extern ABC_DLL void Abc_NtkPrintFanio( FILE * pFile, Abc_Ntk_t * pNtk, int fUseFanio, int fUsePio, int fUseSupp, int fUseCone ); @@ -986,6 +986,7 @@ extern ABC_DLL double Abc_NtkGetMappedArea( Abc_Ntk_t * pNtk ); extern ABC_DLL int Abc_NtkGetExorNum( Abc_Ntk_t * pNtk ); extern ABC_DLL int Abc_NtkGetMuxNum( Abc_Ntk_t * pNtk ); extern ABC_DLL int Abc_NtkGetBufNum( Abc_Ntk_t * pNtk ); +extern ABC_DLL int Abc_NtkGetLargeNodeNum( Abc_Ntk_t * pNtk ); extern ABC_DLL int Abc_NtkGetChoiceNum( Abc_Ntk_t * pNtk ); extern ABC_DLL int Abc_NtkGetFaninMax( Abc_Ntk_t * pNtk ); extern ABC_DLL int Abc_NtkGetFanoutMax( Abc_Ntk_t * pNtk ); diff --git a/src/base/abc/abcUtil.c b/src/base/abc/abcUtil.c index 59993614..f01ef07a 100644 --- a/src/base/abc/abcUtil.c +++ b/src/base/abc/abcUtil.c @@ -429,6 +429,26 @@ int Abc_NtkGetBufNum( Abc_Ntk_t * pNtk ) /**Function************************************************************* + Synopsis [Counts the number of exors.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_NtkGetLargeNodeNum( Abc_Ntk_t * pNtk ) +{ + Abc_Obj_t * pNode; + int i, Counter = 0; + Abc_NtkForEachNode( pNtk, pNode, i ) + Counter += (Abc_ObjFaninNum(pNode) > 1); + return Counter; +} + +/**Function************************************************************* + Synopsis [Returns 1 if it is an AIG with choice nodes.] Description [] diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index c5a1ee3f..e883c8fc 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -1223,6 +1223,7 @@ int Abc_CommandPrintStats( Abc_Frame_t * pAbc, int argc, char ** argv ) int fPower; int fGlitch; int fSkipBuf; + int fSkipSmall; int fPrintMem; int c; @@ -1238,9 +1239,10 @@ int Abc_CommandPrintStats( Abc_Frame_t * pAbc, int argc, char ** argv ) fPower = 0; fGlitch = 0; fSkipBuf = 0; + fSkipSmall = 0; fPrintMem = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "fbdltmpgsuh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "fbdltmpgscuh" ) ) != EOF ) { switch ( c ) { @@ -1271,6 +1273,9 @@ int Abc_CommandPrintStats( Abc_Frame_t * pAbc, int argc, char ** argv ) case 's': fSkipBuf ^= 1; break; + case 'c': + fSkipSmall ^= 1; + break; case 'u': fPrintMem ^= 1; break; @@ -1291,7 +1296,7 @@ int Abc_CommandPrintStats( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_Print( -1, "Cannot print LUT delay for a non-logic network.\n" ); return 1; } - Abc_NtkPrintStats( pNtk, fFactor, fSaveBest, fDumpResult, fUseLutLib, fPrintMuxes, fPower, fGlitch, fSkipBuf, fPrintMem ); + Abc_NtkPrintStats( pNtk, fFactor, fSaveBest, fDumpResult, fUseLutLib, fPrintMuxes, fPower, fGlitch, fSkipBuf, fSkipSmall, fPrintMem ); if ( fPrintTime ) { pAbc->TimeTotal += pAbc->TimeCommand; @@ -1301,7 +1306,7 @@ int Abc_CommandPrintStats( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - Abc_Print( -2, "usage: print_stats [-fbdltmpgsuh]\n" ); + Abc_Print( -2, "usage: print_stats [-fbdltmpgscuh]\n" ); Abc_Print( -2, "\t prints the network statistics\n" ); Abc_Print( -2, "\t-f : toggles printing the literal count in the factored forms [default = %s]\n", fFactor? "yes": "no" ); Abc_Print( -2, "\t-b : toggles saving the best logic network in \"best.blif\" [default = %s]\n", fSaveBest? "yes": "no" ); @@ -1312,6 +1317,7 @@ usage: Abc_Print( -2, "\t-p : toggles printing power dissipation due to switching [default = %s]\n", fPower? "yes": "no" ); Abc_Print( -2, "\t-g : toggles printing percentage of increased power due to glitching [default = %s]\n", fGlitch? "yes": "no" ); Abc_Print( -2, "\t-s : toggles not counting single-output nodes as nodes [default = %s]\n", fSkipBuf? "yes": "no" ); + Abc_Print( -2, "\t-c : toggles not counting constants and single-output nodes as nodes [default = %s]\n", fSkipSmall? "yes": "no" ); Abc_Print( -2, "\t-u : toggles printing memory usage [default = %s]\n", fPrintMem? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; @@ -1393,7 +1399,7 @@ int Abc_CommandPrintExdc( Abc_Frame_t * pAbc, int argc, char ** argv ) } else Abc_Print( 1, "EXDC network statistics: \n" ); - Abc_NtkPrintStats( pNtk->pExdc, 0, 0, 0, 0, 0, 0, 0, 0, 0 ); + Abc_NtkPrintStats( pNtk->pExdc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ); return 0; usage: @@ -27110,7 +27116,7 @@ usage: SeeAlso [] ***********************************************************************/ -static inline int Gia_ManCompareWithBest( Gia_Man_t * pBest, Gia_Man_t * p, int * pnBestLuts, int * pnBestEdges, int * pnBestLevels ) +static inline int Gia_ManCompareWithBest( Gia_Man_t * pBest, Gia_Man_t * p, int * pnBestLuts, int * pnBestEdges, int * pnBestLevels, int fArea ) { int nCurLuts, nCurEdges, nCurLevels; Gia_ManLutParams( p, &nCurLuts, &nCurEdges, &nCurLevels ); @@ -27119,8 +27125,9 @@ static inline int Gia_ManCompareWithBest( Gia_Man_t * pBest, Gia_Man_t * p, int Gia_ManPoNum(pBest) != Gia_ManPoNum(p) || Gia_ManRegNum(pBest) != Gia_ManRegNum(p) || strcmp(Gia_ManName(pBest), Gia_ManName(p)) || - (*pnBestLevels > nCurLevels) || - (*pnBestLevels == nCurLevels && 2*(*pnBestLuts) + *pnBestEdges > 2*nCurLuts + nCurEdges) ) + (!fArea && (*pnBestLevels > nCurLevels || (*pnBestLevels == nCurLevels && 2*(*pnBestLuts) + *pnBestEdges > 2*nCurLuts + nCurEdges))) || + ( fArea && (*pnBestLuts > nCurLuts || (*pnBestLuts == nCurLuts && *pnBestLevels > nCurLevels))) + ) { *pnBestLuts = nCurLuts; *pnBestEdges = nCurEdges; @@ -27143,12 +27150,15 @@ static inline int Gia_ManCompareWithBest( Gia_Man_t * pBest, Gia_Man_t * p, int ***********************************************************************/ int Abc_CommandAbc9Save( Abc_Frame_t * pAbc, int argc, char ** argv ) { - int c; + int c, fArea = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "ah" ) ) != EOF ) { switch ( c ) { + case 'a': + fArea ^= 1; + break; case 'h': goto usage; default: @@ -27165,7 +27175,7 @@ int Abc_CommandAbc9Save( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_Print( -1, "GIA has no mapping.\n" ); return 1; } - if ( !Gia_ManCompareWithBest( pAbc->pGiaBest, pAbc->pGia, &pAbc->nBestLuts, &pAbc->nBestEdges, &pAbc->nBestLevels ) ) + if ( !Gia_ManCompareWithBest( pAbc->pGiaBest, pAbc->pGia, &pAbc->nBestLuts, &pAbc->nBestEdges, &pAbc->nBestLevels, fArea ) ) return 0; // save the design as best Gia_ManStopP( &pAbc->pGiaBest ); @@ -27173,8 +27183,9 @@ int Abc_CommandAbc9Save( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - Abc_Print( -2, "usage: &save [-h]\n" ); + Abc_Print( -2, "usage: &save [-ah]\n" ); Abc_Print( -2, "\t compares and possibly saves AIG with mapping\n" ); + Abc_Print( -2, "\t-a : toggle using area as the primary metric [default = %s]\n", fArea? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } diff --git a/src/base/abci/abcMini.c b/src/base/abci/abcMini.c index bd893b5b..876f4c8c 100644 --- a/src/base/abci/abcMini.c +++ b/src/base/abci/abcMini.c @@ -205,7 +205,7 @@ void Abc_NtkMiniAigTest( Abc_Ntk_t * pNtk ) p = Abc_NtkToMiniAig( pNtk ); pNtkNew = Abc_NtkFromMiniAig( p ); Mini_AigStop( p ); - Abc_NtkPrintStats( pNtkNew, 0, 0, 0, 0, 0, 0, 0, 0, 0 ); + Abc_NtkPrintStats( pNtkNew, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ); Abc_NtkDelete( pNtkNew ); // test dumping diff --git a/src/base/abci/abcPrint.c b/src/base/abci/abcPrint.c index 40ce38b4..2129782f 100644 --- a/src/base/abci/abcPrint.c +++ b/src/base/abci/abcPrint.c @@ -235,7 +235,7 @@ float Abc_NtkGetArea( Abc_Ntk_t * pNtk ) SeeAlso [] ***********************************************************************/ -void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFactored, int fSaveBest, int fDumpResult, int fUseLutLib, int fPrintMuxes, int fPower, int fGlitch, int fSkipBuf, int fPrintMem ) +void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFactored, int fSaveBest, int fDumpResult, int fUseLutLib, int fPrintMuxes, int fPower, int fGlitch, int fSkipBuf, int fSkipSmall, int fPrintMem ) { int nSingles = fSkipBuf ? Abc_NtkGetBufNum(pNtk) : 0; if ( fPrintMuxes && Abc_NtkIsStrash(pNtk) ) @@ -283,7 +283,7 @@ void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFactored, int fSaveBest, int fDum if ( Abc_NtkIsNetlist(pNtk) ) { Abc_Print( 1," net =%5d", Abc_NtkNetNum(pNtk) ); - Abc_Print( 1," nd =%5d", Abc_NtkNodeNum(pNtk) - nSingles ); + Abc_Print( 1," nd =%5d", fSkipSmall ? Abc_NtkGetLargeNodeNum(pNtk) : Abc_NtkNodeNum(pNtk) - nSingles ); Abc_Print( 1," wbox =%3d", Abc_NtkWhiteboxNum(pNtk) ); Abc_Print( 1," bbox =%3d", Abc_NtkBlackboxNum(pNtk) ); } @@ -295,7 +295,7 @@ void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFactored, int fSaveBest, int fDum } else { - Abc_Print( 1," nd =%6d", Abc_NtkNodeNum(pNtk) - nSingles ); + Abc_Print( 1," nd =%6d", fSkipSmall ? Abc_NtkGetLargeNodeNum(pNtk) : Abc_NtkNodeNum(pNtk) - nSingles ); Abc_Print( 1," edge =%7d", Abc_NtkGetTotalFanins(pNtk) - nSingles ); } @@ -455,7 +455,7 @@ void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFactored, int fSaveBest, int fDum fflush( stdout ); if ( pNtk->pExdc ) - Abc_NtkPrintStats( pNtk->pExdc, fFactored, fSaveBest, fDumpResult, fUseLutLib, fPrintMuxes, fPower, fGlitch, fSkipBuf, fPrintMem ); + Abc_NtkPrintStats( pNtk->pExdc, fFactored, fSaveBest, fDumpResult, fUseLutLib, fPrintMuxes, fPower, fGlitch, fSkipBuf, fSkipSmall, fPrintMem ); } /**Function************************************************************* |