diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2015-07-10 21:20:50 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2015-07-10 21:20:50 -0700 |
commit | 05ca4afb770ffffca62e913f4e2fd4fd56085281 (patch) | |
tree | c20d27e51400b45242314963903d0feca575f42b /src | |
parent | 3aece535b93f7407a27e33bacb4599c38c3c16b8 (diff) | |
download | abc-05ca4afb770ffffca62e913f4e2fd4fd56085281.tar.gz abc-05ca4afb770ffffca62e913f4e2fd4fd56085281.tar.bz2 abc-05ca4afb770ffffca62e913f4e2fd4fd56085281.zip |
New TFI/TFO profiling code.
Diffstat (limited to 'src')
-rw-r--r-- | src/aig/gia/giaMuxes.c | 58 | ||||
-rw-r--r-- | src/base/abci/abc.c | 14 |
2 files changed, 50 insertions, 22 deletions
diff --git a/src/aig/gia/giaMuxes.c b/src/aig/gia/giaMuxes.c index 9aa58c8a..50084c8b 100644 --- a/src/aig/gia/giaMuxes.c +++ b/src/aig/gia/giaMuxes.c @@ -630,6 +630,7 @@ void Gia_ManMuxProfiling( Gia_Man_t * p ) ITEM(oXOR) \ ITEM(oMUXc) \ ITEM(oMUXd) \ + ITEM(oAND) \ ITEM(oANDn) \ ITEM(oANDp) \ ITEM(GIA_END) @@ -684,15 +685,16 @@ int Gia_ManEncodeFanin( Gia_Man_t * p, int iLit ) if ( Gia_ObjIsMux(p, pObj) ) return iMUX; assert( Gia_ObjIsAnd(pObj) ); - if ( Abc_LitIsCompl(iLit) ) - return iANDn; - else - return iANDp; + return iAND; +// if ( Abc_LitIsCompl(iLit) ) +// return iANDn; +// else +// return iANDp; } // find fanout code int Gia_ManEncodeFanout( Gia_Man_t * p, Gia_Obj_t * pObj, int i ) { - int iLit; +// int iLit; if ( Gia_ObjIsPo(p, pObj) ) return oPO; if ( Gia_ObjIsCo(pObj) ) @@ -702,11 +704,12 @@ int Gia_ManEncodeFanout( Gia_Man_t * p, Gia_Obj_t * pObj, int i ) if ( Gia_ObjIsMux(p, pObj) ) return i == 2 ? oMUXc : oMUXd; assert( Gia_ObjIsAnd(pObj) ); - iLit = i ? Gia_ObjFaninLit1p(p, pObj) : Gia_ObjFaninLit0p(p, pObj); - if ( Abc_LitIsCompl(iLit) ) - return oANDn; - else - return oANDp; + return oAND; +// iLit = i ? Gia_ObjFaninLit1p(p, pObj) : Gia_ObjFaninLit0p(p, pObj); +// if ( Abc_LitIsCompl(iLit) ) +// return oANDn; +// else +// return oANDp; } void Gia_ManProfileCollect( Gia_Man_t * p, int i, Vec_Int_t * vCode, Vec_Int_t * vCodeOffsets, Vec_Int_t * vArray ) @@ -723,7 +726,7 @@ void Gia_ManProfilePrintOne( Gia_Man_t * p, int i, Vec_Int_t * vArray ) int k, nFanins, nFanouts; if ( Gia_ObjIsRi(p, pObj) ) return; - nFanins = Gia_ObjFaninNum(p, pObj); + nFanins = Gia_ObjIsRo(p, pObj) ? 1 : Gia_ObjFaninNum(p, pObj); nFanouts = Gia_ObjFanoutNum(p, pObj); printf( "%6d : ", i ); @@ -734,8 +737,21 @@ void Gia_ManProfilePrintOne( Gia_Man_t * p, int i, Vec_Int_t * vArray ) printf( " ->" ); printf( " %5s", GIA_TYPE_STRINGS[Vec_IntEntry(vArray, 0)] ); printf( " ->" ); - for ( k = 0; k < nFanouts; k++ ) - printf( " %5s", GIA_TYPE_STRINGS[Vec_IntEntry(vArray, k + 1 + nFanins)] ); + if ( nFanouts > 0 ) + { + int Count = 1, Prev = Vec_IntEntry(vArray, 1 + nFanins); + for ( k = 1; k < nFanouts; k++ ) + { + if ( Prev != Vec_IntEntry(vArray, k + 1 + nFanins) ) + { + printf( " %d x %s", Count, GIA_TYPE_STRINGS[Prev] ); + Prev = Vec_IntEntry(vArray, k + 1 + nFanins); + Count = 0; + } + Count++; + } + printf( " %d x %s", Count, GIA_TYPE_STRINGS[Prev] ); + } printf( "\n" ); } @@ -785,9 +801,18 @@ void Gia_ManProfileStructuresInt( Gia_Man_t * p, int nLimit, int fVerbose ) Vec_IntPush( vCode, Gia_ManEncodeObj(p, i) ); if ( nFanins == 3 ) { - Vec_IntPush( vCode, Gia_ManEncodeFanin(p, Gia_ObjFaninLit0p(p, pObj)) ); - Vec_IntPush( vCode, Gia_ManEncodeFanin(p, Gia_ObjFaninLit1p(p, pObj)) ); - Vec_IntPush( vCode, Gia_ManEncodeFanin(p, Gia_ObjFaninLit2p(p, pObj)) ); + int iLit = Gia_ObjFaninLit2p(p, pObj); + Vec_IntPush( vCode, Gia_ManEncodeFanin(p, Abc_LitRegular(iLit)) ); + if ( Abc_LitIsCompl(iLit) ) + { + Vec_IntPush( vCode, Gia_ManEncodeFanin(p, Gia_ObjFaninLit0p(p, pObj)) ); + Vec_IntPush( vCode, Gia_ManEncodeFanin(p, Gia_ObjFaninLit1p(p, pObj)) ); + } + else + { + Vec_IntPush( vCode, Gia_ManEncodeFanin(p, Gia_ObjFaninLit1p(p, pObj)) ); + Vec_IntPush( vCode, Gia_ManEncodeFanin(p, Gia_ObjFaninLit0p(p, pObj)) ); + } } else if ( nFanins == 2 ) { @@ -856,7 +881,6 @@ void Gia_ManProfileStructuresInt( Gia_Man_t * p, int nLimit, int fVerbose ) // print the object Gia_ManProfileCollect( p, Vec_IntEntry(vFirst, pPerm[i]), vCode, vCodeOffsets, vArray ); Gia_ManProfilePrintOne( p, Vec_IntEntry(vFirst, pPerm[i]), vArray ); - //printf( "\n" ); } // cleanup diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 06f5fe5d..ca693f11 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -26727,9 +26727,9 @@ int Abc_CommandAbc9MuxProfile( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern void Gia_ManMuxProfiling( Gia_Man_t * p ); extern void Gia_ManProfileStructures( Gia_Man_t * p, int nLimit, int fVerbose ); - int c, nLimit = 0, fVerbose = 0; + int c, fMuxes = 0, nLimit = 0, fVerbose = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "Nvh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "Nmvh" ) ) != EOF ) { switch ( c ) { @@ -26744,6 +26744,9 @@ int Abc_CommandAbc9MuxProfile( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( nLimit < 0 ) goto usage; break; + case 'm': + fMuxes ^= 1; + break; case 'v': fVerbose ^= 1; break; @@ -26758,16 +26761,17 @@ int Abc_CommandAbc9MuxProfile( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_Print( -1, "Abc_CommandAbc9MuxProfile(): There is no AIG.\n" ); return 1; } - if ( nLimit == 0 ) + if ( fMuxes ) Gia_ManMuxProfiling( pAbc->pGia ); else Gia_ManProfileStructures( pAbc->pGia, nLimit, fVerbose ); return 0; usage: - Abc_Print( -2, "usage: &profile [-N num] [-vh]\n" ); - Abc_Print( -2, "\t profile MUXes appearing in the design\n" ); + Abc_Print( -2, "usage: &profile [-N num] [-mvh]\n" ); + Abc_Print( -2, "\t profile gate structures appearing in the AIG\n" ); Abc_Print( -2, "\t-N num : limit on class size to show [default = %d]\n", nLimit ); + Abc_Print( -2, "\t-m : toggle profiling MUX structures [default = %s]\n", fMuxes? "yes": "no" ); Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; |