Commit 6d05fde2 by Alan Mishchenko

Added delay multipliers to 'map'.

parent bbf4b8bc
...@@ -13006,26 +13006,28 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -13006,26 +13006,28 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
char Buffer[100]; char Buffer[100];
double DelayTarget; double DelayTarget;
double AreaMulti; double AreaMulti;
double DelayMulti;
int fAreaOnly; int fAreaOnly;
int fRecovery; int fRecovery;
int fSweep; int fSweep;
int fSwitching; int fSwitching;
int fVerbose; int fVerbose;
int c; 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 ); extern int Abc_NtkFraigSweep( Abc_Ntk_t * pNtk, int fUseInv, int fExdc, int fVerbose, int fVeryVerbose );
pNtk = Abc_FrameReadNtk(pAbc); pNtk = Abc_FrameReadNtk(pAbc);
// set defaults // set defaults
DelayTarget =-1; DelayTarget =-1;
AreaMulti = 0; AreaMulti = 0;
DelayMulti = 0;
fAreaOnly = 0; fAreaOnly = 0;
fRecovery = 1; fRecovery = 1;
fSweep = 1; fSweep = 1;
fSwitching = 0; fSwitching = 0;
fVerbose = 0; fVerbose = 0;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "DMarspvh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "DABarspvh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -13040,16 +13042,27 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -13040,16 +13042,27 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( DelayTarget <= 0.0 ) if ( DelayTarget <= 0.0 )
goto usage; goto usage;
break; break;
case 'M': case 'A':
if ( globalUtilOptind >= argc ) 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; goto usage;
} }
AreaMulti = (float)atof(argv[globalUtilOptind]); AreaMulti = (float)atof(argv[globalUtilOptind]);
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; goto usage;
}
DelayMulti = (float)atof(argv[globalUtilOptind]);
globalUtilOptind++;
// if ( DelayMulti < 0.0 )
// goto usage;
break; break;
case 'a': case 'a':
fAreaOnly ^= 1; fAreaOnly ^= 1;
...@@ -13099,7 +13112,7 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -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" ); Abc_Print( 0, "The network was strashed and balanced before mapping.\n" );
// get the new network // 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 ) if ( pNtkRes == NULL )
{ {
Abc_NtkDelete( pNtk ); Abc_NtkDelete( pNtk );
...@@ -13111,7 +13124,7 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -13111,7 +13124,7 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
else else
{ {
// get the new network // 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 ) if ( pNtkRes == NULL )
{ {
Abc_Print( -1, "Mapping has failed.\n" ); Abc_Print( -1, "Mapping has failed.\n" );
...@@ -13138,10 +13151,11 @@ usage: ...@@ -13138,10 +13151,11 @@ usage:
sprintf( Buffer, "not used" ); sprintf( Buffer, "not used" );
else else
sprintf( Buffer, "%.3f", DelayTarget ); 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 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-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-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-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" ); Abc_Print( -2, "\t-s : toggles sweep after mapping [default = %s]\n", fSweep? "yes": "no" );
......
...@@ -57,7 +57,7 @@ static Abc_Obj_t * Abc_NodeFromMapSuperChoice_rec( Abc_Ntk_t * pNtkNew, Map_Sup ...@@ -57,7 +57,7 @@ static Abc_Obj_t * Abc_NodeFromMapSuperChoice_rec( Abc_Ntk_t * pNtkNew, Map_Sup
SeeAlso [] 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; int fShowSwitching = 1;
Abc_Ntk_t * pNtkNew; Abc_Ntk_t * pNtkNew;
...@@ -76,21 +76,26 @@ Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti, ...@@ -76,21 +76,26 @@ Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti,
return 0; return 0;
} }
// penalize large gates by increasing their area
Mio_LibraryMultiArea( pLib, AreaMulti );
Mio_LibraryMultiDelay( pLib, DelayMulti );
// derive the supergate library // derive the supergate library
if ( Abc_FrameReadLibSuper() == NULL && pLib ) if ( Abc_FrameReadLibSuper() == NULL && pLib )
{ {
// printf( "A simple supergate library is derived from gate library \"%s\".\n", // printf( "A simple supergate library is derived from gate library \"%s\".\n",
// Mio_LibraryReadName((Mio_Library_t *)Abc_FrameReadLibGen()) ); // 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 // compute supergate library to be used for mapping
Map_SuperLibDeriveFromGenlib( pLib ); Map_SuperLibDeriveFromGenlib( pLib );
}
// return the library to normal // return the library to normal
Mio_LibraryShiftArea( Abc_FrameReadLibGen(), -AreaMulti ); Mio_LibraryMultiArea( Abc_FrameReadLibGen(), -AreaMulti );
Mio_LibraryMultiDelay( Abc_FrameReadLibGen(), -DelayMulti );
if ( AreaMulti != 0.0 ) if ( AreaMulti != 0.0 )
printf( "The cell areas are multiplied by the factor: <num_fanins> ^ (%.2f).\n", AreaMulti ); 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 // print a warning about choice nodes
if ( Abc_NtkGetChoiceNum( pNtk ) ) if ( Abc_NtkGetChoiceNum( pNtk ) )
......
...@@ -150,7 +150,8 @@ extern void Mio_DeriveGateDelays( Mio_Gate_t * pGate, ...@@ -150,7 +150,8 @@ extern void Mio_DeriveGateDelays( Mio_Gate_t * pGate,
float * ptDelaysRes, float * ptPinDelayMax ); float * ptDelaysRes, float * ptPinDelayMax );
extern Mio_Gate_t * Mio_GateCreatePseudo( int nInputs ); extern Mio_Gate_t * Mio_GateCreatePseudo( int nInputs );
extern void Mio_LibraryShiftDelay( Mio_Library_t * pLib, double Shift ); 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 ABC_NAMESPACE_HEADER_END
......
...@@ -610,7 +610,7 @@ void Mio_LibraryShiftDelay( Mio_Library_t * pLib, double Shift ) ...@@ -610,7 +610,7 @@ void Mio_LibraryShiftDelay( Mio_Library_t * pLib, double Shift )
/**Function************************************************************* /**Function*************************************************************
Synopsis [Multiply areas of all gates by values proportional to fanin count.] Synopsis [Multiply areas/delays by values proportional to fanin count.]
Description [] Description []
...@@ -619,14 +619,35 @@ void Mio_LibraryShiftDelay( Mio_Library_t * pLib, double Shift ) ...@@ -619,14 +619,35 @@ void Mio_LibraryShiftDelay( Mio_Library_t * pLib, double Shift )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
void Mio_LibraryShiftArea( Mio_Library_t * pLib, double Shift ) void Mio_LibraryMultiArea( Mio_Library_t * pLib, double Multi )
{ {
Mio_Gate_t * pGate; Mio_Gate_t * pGate;
Mio_LibraryForEachGate( pLib, pGate ) Mio_LibraryForEachGate( pLib, pGate )
{ {
if ( pGate->nInputs < 2 )
continue;
// printf( "Before %8.3f ", pGate->dArea ); // printf( "Before %8.3f ", pGate->dArea );
pGate->dArea *= 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, Shift ) ); // 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 );
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment