mirror of
https://github.com/YosysHQ/abc.git
synced 2026-09-07 19:17:35 +02:00
Added features 'map -M <float>' to control the use of large gates.
This commit is contained in:
+19
-5
@@ -13256,25 +13256,27 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||
Abc_Ntk_t * pNtk, * pNtkRes;
|
||||
char Buffer[100];
|
||||
double DelayTarget;
|
||||
double AreaMulti;
|
||||
int fAreaOnly;
|
||||
int fRecovery;
|
||||
int fSweep;
|
||||
int fSwitching;
|
||||
int fVerbose;
|
||||
int c;
|
||||
extern Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, int fRecovery, int fSwitching, int fVerbose );
|
||||
extern Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti, 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;
|
||||
fAreaOnly = 0;
|
||||
fRecovery = 1;
|
||||
fSweep = 1;
|
||||
fSwitching = 0;
|
||||
fVerbose = 0;
|
||||
Extra_UtilGetoptReset();
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "Darspvh" ) ) != EOF )
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "DMarspvh" ) ) != EOF )
|
||||
{
|
||||
switch ( c )
|
||||
{
|
||||
@@ -13289,6 +13291,17 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||
if ( DelayTarget <= 0.0 )
|
||||
goto usage;
|
||||
break;
|
||||
case 'M':
|
||||
if ( globalUtilOptind >= argc )
|
||||
{
|
||||
Abc_Print( -1, "Command line switch \"-M\" should be followed by a floating point number.\n" );
|
||||
goto usage;
|
||||
}
|
||||
AreaMulti = (float)atof(argv[globalUtilOptind]);
|
||||
globalUtilOptind++;
|
||||
if ( AreaMulti < 0.0 )
|
||||
goto usage;
|
||||
break;
|
||||
case 'a':
|
||||
fAreaOnly ^= 1;
|
||||
break;
|
||||
@@ -13337,7 +13350,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, fRecovery, fSwitching, fVerbose );
|
||||
pNtkRes = Abc_NtkMap( pNtk, DelayTarget, AreaMulti, fRecovery, fSwitching, fVerbose );
|
||||
if ( pNtkRes == NULL )
|
||||
{
|
||||
Abc_NtkDelete( pNtk );
|
||||
@@ -13349,7 +13362,7 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||
else
|
||||
{
|
||||
// get the new network
|
||||
pNtkRes = Abc_NtkMap( pNtk, DelayTarget, fRecovery, fSwitching, fVerbose );
|
||||
pNtkRes = Abc_NtkMap( pNtk, DelayTarget, AreaMulti, fRecovery, fSwitching, fVerbose );
|
||||
if ( pNtkRes == NULL )
|
||||
{
|
||||
Abc_Print( -1, "Mapping has failed.\n" );
|
||||
@@ -13369,9 +13382,10 @@ usage:
|
||||
sprintf( Buffer, "not used" );
|
||||
else
|
||||
sprintf( Buffer, "%.3f", DelayTarget );
|
||||
Abc_Print( -2, "usage: map [-D float] [-arspvh]\n" );
|
||||
Abc_Print( -2, "usage: map [-DM 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 : 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" );
|
||||
|
||||
+13
-4
@@ -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, int fRecovery, int fSwitching, int fVerbose )
|
||||
Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti, int fRecovery, int fSwitching, int fVerbose )
|
||||
{
|
||||
int fShowSwitching = 1;
|
||||
Abc_Ntk_t * pNtkNew;
|
||||
@@ -65,22 +65,31 @@ Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, int fRecovery, int
|
||||
Vec_Int_t * vSwitching = NULL;
|
||||
float * pSwitching = NULL;
|
||||
clock_t clk, clkTotal = clock();
|
||||
Mio_Library_t * pLib = Abc_FrameReadLibGen();
|
||||
|
||||
assert( Abc_NtkIsStrash(pNtk) );
|
||||
|
||||
// check that the library is available
|
||||
if ( Abc_FrameReadLibGen() == NULL )
|
||||
if ( pLib == NULL )
|
||||
{
|
||||
printf( "The current library is not available.\n" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
// derive the supergate library
|
||||
if ( Abc_FrameReadLibSuper() == NULL && Abc_FrameReadLibGen() )
|
||||
if ( Abc_FrameReadLibSuper() == NULL && pLib )
|
||||
{
|
||||
// printf( "A simple supergate library is derived from gate library \"%s\".\n",
|
||||
// Mio_LibraryReadName((Mio_Library_t *)Abc_FrameReadLibGen()) );
|
||||
Map_SuperLibDeriveFromGenlib( (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 );
|
||||
}
|
||||
|
||||
// print a warning about choice nodes
|
||||
|
||||
Reference in New Issue
Block a user