diff options
-rw-r--r-- | src/base/abci/abcMap.c | 5 | ||||
-rw-r--r-- | src/base/abci/abcPrint.c | 8 | ||||
-rw-r--r-- | src/map/mio/mio.h | 7 | ||||
-rw-r--r-- | src/map/mio/mioApi.c | 4 | ||||
-rw-r--r-- | src/map/mio/mioInt.h | 1 | ||||
-rw-r--r-- | src/map/mio/mioUtils.c | 39 |
6 files changed, 62 insertions, 2 deletions
diff --git a/src/base/abci/abcMap.c b/src/base/abci/abcMap.c index ce5bc5e8..ac7bd0f4 100644 --- a/src/base/abci/abcMap.c +++ b/src/base/abci/abcMap.c @@ -74,7 +74,10 @@ Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti, { pLib = Abc_SclDeriveGenlib( Abc_FrameReadLibScl(), Slew, Gain, nGatesMin, fVerbose ); if ( Abc_FrameReadLibGen() ) + { Mio_LibraryTransferDelays( (Mio_Library_t *)Abc_FrameReadLibGen(), pLib ); + Mio_LibraryTransferProfile( pLib, (Mio_Library_t *)Abc_FrameReadLibGen() ); + } // remove supergate library Map_SuperLibFree( (Map_SuperLib_t *)Abc_FrameReadLibSuper() ); Abc_FrameSetLibSuper( NULL ); @@ -103,6 +106,8 @@ Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti, printf( "Converting \"%s\" into supergate library \"%s\".\n", Mio_LibraryReadName(pLib), Extra_FileNameGenericAppend(Mio_LibraryReadName(pLib), ".super") ); // compute supergate library to be used for mapping + if ( Mio_LibraryHasProfile(pLib) ) + printf( "Abc_NtkMap(): Genlib library has profile.\n" ); Map_SuperLibDeriveFromGenlib( pLib, fVerbose ); } diff --git a/src/base/abci/abcPrint.c b/src/base/abci/abcPrint.c index b6ddeffc..a577b807 100644 --- a/src/base/abci/abcPrint.c +++ b/src/base/abci/abcPrint.c @@ -1339,7 +1339,10 @@ void Abc_NtkPrintGates( Abc_Ntk_t * pNtk, int fUseLibrary ) nGates = Mio_LibraryReadGateNum( (Mio_Library_t *)pNtk->pManFunc ); ppGates = Mio_LibraryReadGateArray( (Mio_Library_t *)pNtk->pManFunc ); for ( i = 0; i < nGates; i++ ) + { Mio_GateSetValue( ppGates[i], 0 ); + Mio_GateSetProfile2( ppGates[i], 0 ); + } // count the gates by name CounterTotal = 0; @@ -1347,6 +1350,7 @@ void Abc_NtkPrintGates( Abc_Ntk_t * pNtk, int fUseLibrary ) { if ( i == 0 ) continue; Mio_GateSetValue( (Mio_Gate_t *)pObj->pData, 1 + Mio_GateReadValue((Mio_Gate_t *)pObj->pData) ); + Mio_GateIncProfile2( (Mio_Gate_t *)pObj->pData ); CounterTotal++; // assuming that twin gates follow each other if ( Abc_NtkFetchTwinNode(pObj) ) @@ -1371,10 +1375,12 @@ void Abc_NtkPrintGates( Abc_Ntk_t * pNtk, int fUseLibrary ) if ( Counter == 0 ) continue; Area = Counter * Mio_GateReadArea( ppGates[i] ); - printf( "%-*s Fanin = %2d Instance = %8d Area = %10.2f %6.2f %% %s\n", + printf( "%-*s Fanin = %2d Instance = %8d Area = %10.2f %6.2f %% %8d %8d %s\n", nGateNameLen, Mio_GateReadName( ppGates[i] ), Mio_GateReadPinNum( ppGates[i] ), Counter, Area, 100.0 * Area / AreaTotal, + Mio_GateReadProfile(ppGates[i]), + Mio_GateReadProfile2(ppGates[i]), Mio_GateReadForm(ppGates[i]) ); } printf( "%-*s Instance = %8d Area = %10.2f %6.2f %%\n", diff --git a/src/map/mio/mio.h b/src/map/mio/mio.h index de9fb199..35b5641c 100644 --- a/src/map/mio/mio.h +++ b/src/map/mio/mio.h @@ -153,11 +153,15 @@ extern word Mio_GateReadTruth ( Mio_Gate_t * pGate ); extern int Mio_GateReadValue ( Mio_Gate_t * pGate ); extern int Mio_GateReadCell ( Mio_Gate_t * pGate ); extern int Mio_GateReadProfile ( Mio_Gate_t * pGate ); +extern int Mio_GateReadProfile2 ( Mio_Gate_t * pGate ); extern char * Mio_GateReadPinName ( Mio_Gate_t * pGate, int iPin ); extern float Mio_GateReadPinDelay ( Mio_Gate_t * pGate, int iPin ); extern void Mio_GateSetValue ( Mio_Gate_t * pGate, int Value ); extern void Mio_GateSetCell ( Mio_Gate_t * pGate, int Cell ); extern void Mio_GateSetProfile ( Mio_Gate_t * pGate, int Prof ); +extern void Mio_GateSetProfile2 ( Mio_Gate_t * pGate, int Prof ); +extern void Mio_GateIncProfile2 ( Mio_Gate_t * pGate ); +extern void Mio_GateDecProfile2 ( Mio_Gate_t * pGate ); extern int Mio_GateIsInv ( Mio_Gate_t * pGate ); extern char * Mio_PinReadName ( Mio_Pin_t * pPin ); extern Mio_PinPhase_t Mio_PinReadPhase ( Mio_Pin_t * pPin ); @@ -204,6 +208,9 @@ extern void Mio_LibraryTransferDelays( Mio_Library_t * pLibD, Mio_L extern void Mio_LibraryTransferCellIds(); extern void Mio_LibraryReadProfile( FILE * pFile, Mio_Library_t * pLib ); extern void Mio_LibraryWriteProfile( FILE * pFile, Mio_Library_t * pLib ); +extern void Mio_LibraryTransferProfile( Mio_Library_t * pLibDst, Mio_Library_t * pLibSrc ); +extern int Mio_LibraryHasProfile( Mio_Library_t * pLib ); +extern void Mio_LibraryCleanProfile2( Mio_Library_t * pLib ); /*=== sclUtil.c =========================================================*/ extern Mio_Library_t * Abc_SclDeriveGenlibSimple( void * pScl ); diff --git a/src/map/mio/mioApi.c b/src/map/mio/mioApi.c index 8fc11666..3d24f4d6 100644 --- a/src/map/mio/mioApi.c +++ b/src/map/mio/mioApi.c @@ -180,9 +180,13 @@ word * Mio_GateReadTruthP ( Mio_Gate_t * pGate ) { return int Mio_GateReadValue ( Mio_Gate_t * pGate ) { return pGate->Value; } int Mio_GateReadCell ( Mio_Gate_t * pGate ) { return pGate->Cell; } int Mio_GateReadProfile ( Mio_Gate_t * pGate ) { return pGate->Profile; } +int Mio_GateReadProfile2( Mio_Gate_t * pGate ) { return pGate->Profile2; } void Mio_GateSetValue ( Mio_Gate_t * pGate, int Value ) { pGate->Value = Value; } void Mio_GateSetCell ( Mio_Gate_t * pGate, int Cell ) { pGate->Cell = Cell; } void Mio_GateSetProfile ( Mio_Gate_t * pGate, int Prof ) { pGate->Profile = Prof; } +void Mio_GateSetProfile2 ( Mio_Gate_t * pGate, int Prof ) { pGate->Profile2 = Prof; } +void Mio_GateIncProfile2 ( Mio_Gate_t * pGate ) { pGate->Profile2++; } +void Mio_GateDecProfile2 ( Mio_Gate_t * pGate ) { pGate->Profile2--; } int Mio_GateIsInv ( Mio_Gate_t * pGate ) { return pGate->uTruth == ABC_CONST(0x5555555555555555); } /**Function************************************************************* diff --git a/src/map/mio/mioInt.h b/src/map/mio/mioInt.h index 394187c5..541a7a7f 100644 --- a/src/map/mio/mioInt.h +++ b/src/map/mio/mioInt.h @@ -96,6 +96,7 @@ struct Mio_GateStruct_t_ int Cell; // cell id int nInputs; // the number of inputs int Profile; // the number of occurrences + int Profile2; // the number of occurrences double dDelayMax; // the maximum delay char * pSop; // sum-of-products Vec_Int_t * vExpr; // boolean expression diff --git a/src/map/mio/mioUtils.c b/src/map/mio/mioUtils.c index 5c8e1569..14b8b45d 100644 --- a/src/map/mio/mioUtils.c +++ b/src/map/mio/mioUtils.c @@ -413,16 +413,22 @@ Mio_Gate_t ** Mio_CollectRoots( Mio_Library_t * pLib, int nInputs, float tDelay, { Mio_Gate_t * pGate; Mio_Gate_t ** ppGates; - int i, nGates, iGate; + int i, nGates, iGate, fProfile; nGates = Mio_LibraryReadGateNum( pLib ); ppGates = ABC_ALLOC( Mio_Gate_t *, nGates ); iGate = 0; + // check if profile is entered + fProfile = Mio_LibraryHasProfile( pLib ); + if ( fProfile ) + printf( "Mio_CollectRoots(): Using gate profile to select gates for mapping.\n" ); // for each functionality, select gate with the smallest area // if equal areas, select gate with lexicographically smaller name Mio_LibraryForEachGate( pLib, pGate ) { if ( pGate->nInputs > nInputs ) continue; + if ( fProfile && Mio_GateReadProfile(pGate) == 0 && pGate->nInputs > 1 ) + continue; if ( tDelay > 0.0 && pGate->dDelayMax > (double)tDelay ) continue; if ( pGate->uTruth == 0 || pGate->uTruth == ~(word)0 ) @@ -1388,6 +1394,37 @@ void Mio_LibraryWriteProfile( FILE * pFile, Mio_Library_t * pLib ) fprintf( pFile, "%-24s %6d\n", Mio_GateReadName(pGate), Mio_GateReadProfile(pGate) ); } +int Mio_LibraryHasProfile( Mio_Library_t * pLib ) +{ + Mio_Gate_t * pGate; + Mio_LibraryForEachGate( pLib, pGate ) + if ( Mio_GateReadProfile(pGate) > 0 ) + return 1; + return 0; +} + +void Mio_LibraryTransferProfile( Mio_Library_t * pLibDst, Mio_Library_t * pLibSrc ) +{ + Mio_Gate_t * pGateSrc, * pGateDst; + Mio_LibraryForEachGate( pLibSrc, pGateSrc ) + if ( Mio_GateReadProfile(pGateSrc) > 0 ) + { + pGateDst = Mio_LibraryReadGateByName( pLibDst, Mio_GateReadName(pGateSrc), NULL ); + if ( pGateDst == NULL ) + { + printf( "Cannot find gate \"%s\" in library \"%s\".\n", Mio_GateReadName(pGateSrc), Mio_LibraryReadName(pLibDst) ); + continue; + } + Mio_GateSetProfile( pGateDst, Mio_GateReadProfile(pGateSrc) ); + } +} + +void Mio_LibraryCleanProfile2( Mio_Library_t * pLib ) +{ + Mio_Gate_t * pGate; + Mio_LibraryForEachGate( pLib, pGate ) + Mio_GateSetProfile2( pGate, 0 ); +} //////////////////////////////////////////////////////////////////////// /// END OF FILE /// |