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 )
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" );
......
......@@ -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,21 +76,26 @@ 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 );
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 ) )
......
......@@ -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
......
......@@ -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 );
}
}
}
......
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