diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2012-09-16 22:05:15 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2012-09-16 22:05:15 -0700 |
commit | 6d05fde2dc046d16c0d04b06d1755b9c25e6ee1d (patch) | |
tree | 6c3e8ea87c81b5c578726b232b2caea45b582609 | |
parent | bbf4b8bc1e35f33b9150963059396ae25bc13a54 (diff) | |
download | abc-6d05fde2dc046d16c0d04b06d1755b9c25e6ee1d.tar.gz abc-6d05fde2dc046d16c0d04b06d1755b9c25e6ee1d.tar.bz2 abc-6d05fde2dc046d16c0d04b06d1755b9c25e6ee1d.zip |
Added delay multipliers to 'map'.
-rw-r--r-- | src/base/abci/abc.c | 32 | ||||
-rw-r--r-- | src/base/abci/abcMap.c | 21 | ||||
-rw-r--r-- | src/map/mio/mio.h | 3 | ||||
-rw-r--r-- | src/map/mio/mioUtils.c | 29 |
4 files changed, 63 insertions, 22 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 254359c2..951a0e71 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -13006,26 +13006,28 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv ) char Buffer[100]; double DelayTarget; double AreaMulti; + double DelayMulti; int fAreaOnly; int fRecovery; int fSweep; int fSwitching; int fVerbose; int c; - extern Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti, int fRecovery, int fSwitching, int fVerbose ); + extern Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti, double DelayMulti, int fRecovery, int fSwitching, int fVerbose ); extern int Abc_NtkFraigSweep( Abc_Ntk_t * pNtk, int fUseInv, int fExdc, int fVerbose, int fVeryVerbose ); pNtk = Abc_FrameReadNtk(pAbc); // set defaults DelayTarget =-1; AreaMulti = 0; + DelayMulti = 0; fAreaOnly = 0; fRecovery = 1; fSweep = 1; fSwitching = 0; fVerbose = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "DMarspvh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "DABarspvh" ) ) != EOF ) { switch ( c ) { @@ -13040,16 +13042,27 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( DelayTarget <= 0.0 ) goto usage; break; - case 'M': + case 'A': if ( globalUtilOptind >= argc ) { - Abc_Print( -1, "Command line switch \"-M\" should be followed by a floating point number.\n" ); + Abc_Print( -1, "Command line switch \"-A\" should be followed by a floating point number.\n" ); goto usage; } AreaMulti = (float)atof(argv[globalUtilOptind]); globalUtilOptind++; - if ( AreaMulti < 0.0 ) +// if ( AreaMulti < 0.0 ) +// goto usage; + break; + case 'B': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-B\" should be followed by a floating point number.\n" ); goto usage; + } + DelayMulti = (float)atof(argv[globalUtilOptind]); + globalUtilOptind++; +// if ( DelayMulti < 0.0 ) +// goto usage; break; case 'a': fAreaOnly ^= 1; @@ -13099,7 +13112,7 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv ) } Abc_Print( 0, "The network was strashed and balanced before mapping.\n" ); // get the new network - pNtkRes = Abc_NtkMap( pNtk, DelayTarget, AreaMulti, fRecovery, fSwitching, fVerbose ); + pNtkRes = Abc_NtkMap( pNtk, DelayTarget, AreaMulti, DelayMulti, fRecovery, fSwitching, fVerbose ); if ( pNtkRes == NULL ) { Abc_NtkDelete( pNtk ); @@ -13111,7 +13124,7 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv ) else { // get the new network - pNtkRes = Abc_NtkMap( pNtk, DelayTarget, AreaMulti, fRecovery, fSwitching, fVerbose ); + pNtkRes = Abc_NtkMap( pNtk, DelayTarget, AreaMulti, DelayMulti, fRecovery, fSwitching, fVerbose ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Mapping has failed.\n" ); @@ -13138,10 +13151,11 @@ usage: sprintf( Buffer, "not used" ); else sprintf( Buffer, "%.3f", DelayTarget ); - Abc_Print( -2, "usage: map [-DM float] [-arspvh]\n" ); + Abc_Print( -2, "usage: map [-DAB float] [-arspvh]\n" ); Abc_Print( -2, "\t performs standard cell mapping of the current network\n" ); Abc_Print( -2, "\t-D float : sets the global required times [default = %s]\n", Buffer ); - Abc_Print( -2, "\t-M float : \"area multiplier\" to discourage large gates [default = %.2f]\n", AreaMulti ); + Abc_Print( -2, "\t-A float : \"area multiplier\" to bias gate selection [default = %.2f]\n", AreaMulti ); + Abc_Print( -2, "\t-B float : \"delay multiplier\" to bias gate selection [default = %.2f]\n", DelayMulti ); Abc_Print( -2, "\t-a : toggles area-only mapping [default = %s]\n", fAreaOnly? "yes": "no" ); Abc_Print( -2, "\t-r : toggles area recovery [default = %s]\n", fRecovery? "yes": "no" ); Abc_Print( -2, "\t-s : toggles sweep after mapping [default = %s]\n", fSweep? "yes": "no" ); diff --git a/src/base/abci/abcMap.c b/src/base/abci/abcMap.c index 1abe872d..56348ee7 100644 --- a/src/base/abci/abcMap.c +++ b/src/base/abci/abcMap.c @@ -57,7 +57,7 @@ static Abc_Obj_t * Abc_NodeFromMapSuperChoice_rec( Abc_Ntk_t * pNtkNew, Map_Sup SeeAlso [] ***********************************************************************/ -Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti, int fRecovery, int fSwitching, int fVerbose ) +Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti, double DelayMulti, int fRecovery, int fSwitching, int fVerbose ) { int fShowSwitching = 1; Abc_Ntk_t * pNtkNew; @@ -76,22 +76,27 @@ Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti, return 0; } + // penalize large gates by increasing their area + Mio_LibraryMultiArea( pLib, AreaMulti ); + Mio_LibraryMultiDelay( pLib, DelayMulti ); + // derive the supergate library if ( Abc_FrameReadLibSuper() == NULL && pLib ) { // printf( "A simple supergate library is derived from gate library \"%s\".\n", // Mio_LibraryReadName((Mio_Library_t *)Abc_FrameReadLibGen()) ); - - // penalize large gates by increasing their area - Mio_LibraryShiftArea( pLib, AreaMulti ); // compute supergate library to be used for mapping Map_SuperLibDeriveFromGenlib( pLib ); - // return the library to normal - Mio_LibraryShiftArea( Abc_FrameReadLibGen(), -AreaMulti ); - if ( AreaMulti != 0.0 ) - printf( "The cell areas are multiplied by the factor: <num_fanins> ^ (%.2f).\n", AreaMulti ); } + // return the library to normal + Mio_LibraryMultiArea( Abc_FrameReadLibGen(), -AreaMulti ); + Mio_LibraryMultiDelay( Abc_FrameReadLibGen(), -DelayMulti ); + if ( AreaMulti != 0.0 ) + printf( "The cell areas are multiplied by the factor: <num_fanins> ^ (%.2f).\n", AreaMulti ); + if ( DelayMulti != 0.0 ) + printf( "The cell delay are multiplied by the factor: <num_fanins> ^ (%.2f).\n", DelayMulti ); + // print a warning about choice nodes if ( Abc_NtkGetChoiceNum( pNtk ) ) printf( "Performing mapping with choices.\n" ); diff --git a/src/map/mio/mio.h b/src/map/mio/mio.h index a7b3f669..7bccc3a1 100644 --- a/src/map/mio/mio.h +++ b/src/map/mio/mio.h @@ -150,7 +150,8 @@ extern void Mio_DeriveGateDelays( Mio_Gate_t * pGate, float * ptDelaysRes, float * ptPinDelayMax ); extern Mio_Gate_t * Mio_GateCreatePseudo( int nInputs ); extern void Mio_LibraryShiftDelay( Mio_Library_t * pLib, double Shift ); -extern void Mio_LibraryShiftArea( Mio_Library_t * pLib, double Shift ); +extern void Mio_LibraryMultiArea( Mio_Library_t * pLib, double Multi ); +extern void Mio_LibraryMultiDelay( Mio_Library_t * pLib, double Multi ); ABC_NAMESPACE_HEADER_END diff --git a/src/map/mio/mioUtils.c b/src/map/mio/mioUtils.c index c2022186..0583276a 100644 --- a/src/map/mio/mioUtils.c +++ b/src/map/mio/mioUtils.c @@ -610,7 +610,7 @@ void Mio_LibraryShiftDelay( Mio_Library_t * pLib, double Shift ) /**Function************************************************************* - Synopsis [Multiply areas of all gates by values proportional to fanin count.] + Synopsis [Multiply areas/delays by values proportional to fanin count.] Description [] @@ -619,14 +619,35 @@ void Mio_LibraryShiftDelay( Mio_Library_t * pLib, double Shift ) SeeAlso [] ***********************************************************************/ -void Mio_LibraryShiftArea( Mio_Library_t * pLib, double Shift ) +void Mio_LibraryMultiArea( Mio_Library_t * pLib, double Multi ) { Mio_Gate_t * pGate; Mio_LibraryForEachGate( pLib, pGate ) { + if ( pGate->nInputs < 2 ) + continue; // printf( "Before %8.3f ", pGate->dArea ); - pGate->dArea *= pow( pGate->nInputs, Shift ); -// printf( "After %8.3f Inputs = %d. Factor = %8.3f\n", pGate->dArea, pGate->nInputs, pow( pGate->nInputs, Shift ) ); + pGate->dArea *= pow( pGate->nInputs, Multi ); +// printf( "After %8.3f Inputs = %d. Factor = %8.3f\n", pGate->dArea, pGate->nInputs, pow( pGate->nInputs, Multi ) ); + } +} +void Mio_LibraryMultiDelay( Mio_Library_t * pLib, double Multi ) +{ + Mio_Gate_t * pGate; + Mio_Pin_t * pPin; + Mio_LibraryForEachGate( pLib, pGate ) + { + if ( pGate->nInputs < 2 ) + continue; +// printf( "Before %8.3f ", pGate->dDelayMax ); + pGate->dDelayMax *= pow( pGate->nInputs, Multi ); +// printf( "After %8.3f Inputs = %d. Factor = %8.3f\n", pGate->dDelayMax, pGate->nInputs, pow( pGate->nInputs, Multi ) ); + Mio_GateForEachPin( pGate, pPin ) + { + pPin->dDelayBlockRise *= pow( pGate->nInputs, Multi ); + pPin->dDelayBlockFall *= pow( pGate->nInputs, Multi ); + pPin->dDelayBlockMax *= pow( pGate->nInputs, Multi ); + } } } |