mirror of
https://github.com/YosysHQ/abc.git
synced 2026-09-07 03:05:36 +02:00
Tuning standard-cell mapping flow.
This commit is contained in:
+44
-9
@@ -14391,13 +14391,16 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||
double DelayTarget;
|
||||
double AreaMulti;
|
||||
double DelayMulti;
|
||||
float Slew = 200;
|
||||
float Gain = 100;
|
||||
int nGatesMin = 4;
|
||||
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, double DelayMulti, int fRecovery, int fSwitching, int fVerbose );
|
||||
extern Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti, double DelayMulti, float Slew, float Gain, int nGatesMin, 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);
|
||||
@@ -14411,7 +14414,7 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||
fSwitching = 0;
|
||||
fVerbose = 0;
|
||||
Extra_UtilGetoptReset();
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "DABarspvh" ) ) != EOF )
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "DABSGMarspvh" ) ) != EOF )
|
||||
{
|
||||
switch ( c )
|
||||
{
|
||||
@@ -14434,8 +14437,6 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||
}
|
||||
AreaMulti = (float)atof(argv[globalUtilOptind]);
|
||||
globalUtilOptind++;
|
||||
// if ( AreaMulti < 0.0 )
|
||||
// goto usage;
|
||||
break;
|
||||
case 'B':
|
||||
if ( globalUtilOptind >= argc )
|
||||
@@ -14445,8 +14446,39 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||
}
|
||||
DelayMulti = (float)atof(argv[globalUtilOptind]);
|
||||
globalUtilOptind++;
|
||||
// if ( DelayMulti < 0.0 )
|
||||
// goto usage;
|
||||
break;
|
||||
case 'S':
|
||||
if ( globalUtilOptind >= argc )
|
||||
{
|
||||
Abc_Print( -1, "Command line switch \"-S\" should be followed by a floating point number.\n" );
|
||||
goto usage;
|
||||
}
|
||||
Slew = (float)atof(argv[globalUtilOptind]);
|
||||
globalUtilOptind++;
|
||||
if ( Slew <= 0.0 )
|
||||
goto usage;
|
||||
break;
|
||||
case 'G':
|
||||
if ( globalUtilOptind >= argc )
|
||||
{
|
||||
Abc_Print( -1, "Command line switch \"-G\" should be followed by a floating point number.\n" );
|
||||
goto usage;
|
||||
}
|
||||
Gain = (float)atof(argv[globalUtilOptind]);
|
||||
globalUtilOptind++;
|
||||
if ( Gain <= 0.0 )
|
||||
goto usage;
|
||||
break;
|
||||
case 'M':
|
||||
if ( globalUtilOptind >= argc )
|
||||
{
|
||||
Abc_Print( -1, "Command line switch \"-M\" should be followed by a positive integer.\n" );
|
||||
goto usage;
|
||||
}
|
||||
nGatesMin = atoi(argv[globalUtilOptind]);
|
||||
globalUtilOptind++;
|
||||
if ( nGatesMin < 0 )
|
||||
goto usage;
|
||||
break;
|
||||
case 'a':
|
||||
fAreaOnly ^= 1;
|
||||
@@ -14496,7 +14528,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, DelayMulti, fRecovery, fSwitching, fVerbose );
|
||||
pNtkRes = Abc_NtkMap( pNtk, DelayTarget, AreaMulti, DelayMulti, Slew, Gain, nGatesMin, fRecovery, fSwitching, fVerbose );
|
||||
if ( pNtkRes == NULL )
|
||||
{
|
||||
Abc_NtkDelete( pNtk );
|
||||
@@ -14508,7 +14540,7 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||
else
|
||||
{
|
||||
// get the new network
|
||||
pNtkRes = Abc_NtkMap( pNtk, DelayTarget, AreaMulti, DelayMulti, fRecovery, fSwitching, fVerbose );
|
||||
pNtkRes = Abc_NtkMap( pNtk, DelayTarget, AreaMulti, DelayMulti, Slew, Gain, nGatesMin, fRecovery, fSwitching, fVerbose );
|
||||
if ( pNtkRes == NULL )
|
||||
{
|
||||
Abc_Print( -1, "Mapping has failed.\n" );
|
||||
@@ -14535,11 +14567,14 @@ usage:
|
||||
sprintf(Buffer, "not used" );
|
||||
else
|
||||
sprintf(Buffer, "%.3f", DelayTarget );
|
||||
Abc_Print( -2, "usage: map [-DAB float] [-arspvh]\n" );
|
||||
Abc_Print( -2, "usage: map [-DABSG float] [-M num] [-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-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-S float : the slew parameter used to generate the library [default = %.2f]\n", Slew );
|
||||
Abc_Print( -2, "\t-G float : the gain parameter used to generate the library [default = %.2f]\n", Gain );
|
||||
Abc_Print( -2, "\t-M num : skip gate classes whose size is less than this [default = %d]\n", nGatesMin );
|
||||
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, double DelayMulti, int fRecovery, int fSwitching, int fVerbose )
|
||||
Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti, double DelayMulti, float Slew, float Gain, int nGatesMin, int fRecovery, int fSwitching, int fVerbose )
|
||||
{
|
||||
static int fUseMulti = 0;
|
||||
int fShowSwitching = 1;
|
||||
@@ -66,17 +66,18 @@ Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti,
|
||||
Vec_Int_t * vSwitching = NULL;
|
||||
float * pSwitching = NULL;
|
||||
abctime clk, clkTotal = Abc_Clock();
|
||||
Mio_Library_t * pLib = (Mio_Library_t *)Abc_FrameReadLibGen();
|
||||
|
||||
Mio_Library_t * pLib;
|
||||
assert( Abc_NtkIsStrash(pNtk) );
|
||||
|
||||
// check that the library is available
|
||||
// derive library from SCL
|
||||
if ( Abc_FrameReadLibScl() )
|
||||
Mio_SclDeriveGenlib( Abc_FrameReadLibScl(), Slew, Gain, nGatesMin );
|
||||
// quit if there is no library
|
||||
pLib = Abc_FrameReadLibGen();
|
||||
if ( pLib == NULL )
|
||||
{
|
||||
printf( "The current library is not available.\n" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( AreaMulti != 0.0 )
|
||||
fUseMulti = 1, printf( "The cell areas are multiplied by the factor: <num_fanins> ^ (%.2f).\n", AreaMulti );
|
||||
if ( DelayMulti != 0.0 )
|
||||
@@ -91,8 +92,6 @@ Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti,
|
||||
// derive the supergate library
|
||||
if ( fUseMulti || Abc_FrameReadLibSuper() == NULL )
|
||||
{
|
||||
// printf( "A simple supergate library is derived from gate library \"%s\".\n",
|
||||
// Mio_LibraryReadName((Mio_Library_t *)Abc_FrameReadLibGen()) );
|
||||
if ( fVerbose )
|
||||
printf( "Converting \"%s\" into supergate library \"%s\".\n",
|
||||
Mio_LibraryReadName(pLib), Extra_FileNameGenericAppend(Mio_LibraryReadName(pLib), ".super") );
|
||||
|
||||
@@ -103,6 +103,7 @@ extern ABC_DLL void * Abc_FrameReadLibGen();
|
||||
extern ABC_DLL void * Abc_FrameReadLibGen2();
|
||||
extern ABC_DLL void * Abc_FrameReadLibSuper();
|
||||
extern ABC_DLL void * Abc_FrameReadLibVer();
|
||||
extern ABC_DLL void * Abc_FrameReadLibScl();
|
||||
extern ABC_DLL void * Abc_FrameReadManDd();
|
||||
extern ABC_DLL void * Abc_FrameReadManDec();
|
||||
extern ABC_DLL char * Abc_FrameReadFlag( char * pFlag );
|
||||
|
||||
@@ -56,6 +56,7 @@ void * Abc_FrameReadLibGen() { return s_GlobalFr
|
||||
void * Abc_FrameReadLibGen2() { return s_GlobalFrame->pLibGen2; }
|
||||
void * Abc_FrameReadLibSuper() { return s_GlobalFrame->pLibSuper; }
|
||||
void * Abc_FrameReadLibVer() { return s_GlobalFrame->pLibVer; }
|
||||
void * Abc_FrameReadLibScl() { return s_GlobalFrame->pLibScl; }
|
||||
void * Abc_FrameReadManDd() { if ( s_GlobalFrame->dd == NULL ) s_GlobalFrame->dd = Cudd_Init( 0, 0, CUDD_UNIQUE_SLOTS, CUDD_CACHE_SLOTS, 0 ); return s_GlobalFrame->dd; }
|
||||
void * Abc_FrameReadManDec() { if ( s_GlobalFrame->pManDec == NULL ) s_GlobalFrame->pManDec = Dec_ManStart(); return s_GlobalFrame->pManDec; }
|
||||
char * Abc_FrameReadFlag( char * pFlag ) { return Cmd_FlagReadByName( s_GlobalFrame, pFlag ); }
|
||||
|
||||
Reference in New Issue
Block a user