diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2016-05-16 16:50:01 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2016-05-16 16:50:01 -0700 |
commit | 7c089a3ac6b049f4ae4c8fe84347387e564e9d4f (patch) | |
tree | 0442fcfae10ae223d572beb587771a0232ca7fdd /src/map/mio | |
parent | 20a2b0a0f28bc09a69326cad16248bb450605fa5 (diff) | |
download | abc-7c089a3ac6b049f4ae4c8fe84347387e564e9d4f.tar.gz abc-7c089a3ac6b049f4ae4c8fe84347387e564e9d4f.tar.bz2 abc-7c089a3ac6b049f4ae4c8fe84347387e564e9d4f.zip |
Factoring out library preprocessing code in &nf and putting it elsewhere.
Diffstat (limited to 'src/map/mio')
-rw-r--r-- | src/map/mio/mio.h | 4 | ||||
-rw-r--r-- | src/map/mio/mioInt.h | 8 | ||||
-rw-r--r-- | src/map/mio/mioUtils.c | 47 |
3 files changed, 59 insertions, 0 deletions
diff --git a/src/map/mio/mio.h b/src/map/mio/mio.h index 7a9911c3..f45cce89 100644 --- a/src/map/mio/mio.h +++ b/src/map/mio/mio.h @@ -215,6 +215,10 @@ extern int Mio_LibraryHasProfile( Mio_Library_t * pLib ); extern void Mio_LibraryCleanProfile2( Mio_Library_t * pLib ); extern void Mio_LibraryShortNames( Mio_Library_t * pLib ); +extern void Mio_LibraryMatchesStop( Mio_Library_t * pLib ); +extern void Mio_LibraryMatchesStart( Mio_Library_t * pLib, int fPinFilter, int fPinPerm, int fPinQuick ); +extern void Mio_LibraryMatchesFetch( Mio_Library_t * pLib, Vec_Mem_t ** pvTtMem, Vec_Wec_t ** pvTt2Match, Mio_Cell2_t ** ppCells, int * pnCells, int fPinFilter, int fPinPerm, int fPinQuick ); + /*=== sclUtil.c =========================================================*/ extern Mio_Library_t * Abc_SclDeriveGenlibSimple( void * pScl ); extern Mio_Library_t * Abc_SclDeriveGenlib( void * pScl, void * pMio, float Slew, float Gain, int nGatesMin, int fVerbose ); diff --git a/src/map/mio/mioInt.h b/src/map/mio/mioInt.h index 541a7a7f..23f48b2f 100644 --- a/src/map/mio/mioInt.h +++ b/src/map/mio/mioInt.h @@ -76,6 +76,14 @@ struct Mio_LibraryStruct_t_ st__table * tName2Gate; // the mapping of gate names into their pointer Mem_Flex_t * pMmFlex; // the memory manaqer for SOPs Vec_Str_t * vCube; // temporary cube + // matching + int fPinFilter; // pin filtering + int fPinPerm; // pin permutation + int fPinQuick; // pin permutation + Vec_Mem_t * vTtMem; // truth tables + Vec_Wec_t * vTt2Match; // matches for truth tables + Mio_Cell2_t * pCells; // library gates + int nCells; // library gate count }; struct Mio_GateStruct_t_ diff --git a/src/map/mio/mioUtils.c b/src/map/mio/mioUtils.c index 152230dc..5b1185eb 100644 --- a/src/map/mio/mioUtils.c +++ b/src/map/mio/mioUtils.c @@ -53,6 +53,7 @@ void Mio_LibraryDelete( Mio_Library_t * pLib ) Mio_Gate_t * pGate, * pGate2; if ( pLib == NULL ) return; + Mio_LibraryMatchesStop( pLib ); // free the bindings of nodes to gates from this library for all networks Abc_FrameUnmapAllNetworks( Abc_FrameGetGlobalFrame() ); // free the library @@ -1590,6 +1591,52 @@ void Mio_LibraryShortNames( Mio_Library_t * pLib ) pLib->pName = Abc_UtilStrsav( Buffer ); } +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Mio_LibraryMatchesStop( Mio_Library_t * pLib ) +{ + if ( !pLib->vTtMem ) + return; + Vec_WecFree( pLib->vTt2Match ); + Vec_MemHashFree( pLib->vTtMem ); + Vec_MemFree( pLib->vTtMem ); + ABC_FREE( pLib->pCells ); +} +void Mio_LibraryMatchesStart( Mio_Library_t * pLib, int fPinFilter, int fPinPerm, int fPinQuick ) +{ + extern Mio_Cell2_t * Nf_StoDeriveMatches( Vec_Mem_t * vTtMem, Vec_Wec_t * vTt2Match, int * pnCells, int fPinFilter, int fPinPerm, int fPinQuick ); + if ( pLib->vTtMem && pLib->fPinFilter == fPinFilter && pLib->fPinPerm == fPinPerm && pLib->fPinQuick == fPinQuick ) + return; + if ( pLib->vTtMem ) + Mio_LibraryMatchesStop( pLib ); + pLib->fPinFilter = fPinFilter; // pin filtering + pLib->fPinPerm = fPinPerm; // pin permutation + pLib->fPinQuick = fPinQuick; // pin permutation + pLib->vTtMem = Vec_MemAllocForTT( 6, 0 ); + pLib->vTt2Match = Vec_WecAlloc( 1000 ); + Vec_WecPushLevel( pLib->vTt2Match ); + Vec_WecPushLevel( pLib->vTt2Match ); + assert( Vec_WecSize(pLib->vTt2Match) == Vec_MemEntryNum(pLib->vTtMem) ); + pLib->pCells = Nf_StoDeriveMatches( pLib->vTtMem, pLib->vTt2Match, &pLib->nCells, fPinFilter, fPinPerm, fPinQuick ); +} +void Mio_LibraryMatchesFetch( Mio_Library_t * pLib, Vec_Mem_t ** pvTtMem, Vec_Wec_t ** pvTt2Match, Mio_Cell2_t ** ppCells, int * pnCells, int fPinFilter, int fPinPerm, int fPinQuick ) +{ + Mio_LibraryMatchesStart( pLib, fPinFilter, fPinPerm, fPinQuick ); + *pvTtMem = pLib->vTtMem; // truth tables + *pvTt2Match = pLib->vTt2Match; // matches for truth tables + *ppCells = pLib->pCells; // library gates + *pnCells = pLib->nCells; // library gate count +} + //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// |