Adding switch -o to 'map' and '&put' to control gate duplication.

This commit is contained in:
Alan Mishchenko 2019-10-26 14:07:52 +03:00
parent d3fddd4443
commit 35c2b42164
3 changed files with 34 additions and 24 deletions

View File

@ -17075,9 +17075,10 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
int fSwitching;
int fSkipFanout;
int fUseProfile;
int fUseBuffs;
int fVerbose;
int c;
extern Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti, double DelayMulti, float LogFan, float Slew, float Gain, int nGatesMin, int fRecovery, int fSwitching, int fSkipFanout, int fUseProfile, int fVerbose );
extern Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti, double DelayMulti, float LogFan, float Slew, float Gain, int nGatesMin, int fRecovery, int fSwitching, int fSkipFanout, int fUseProfile, int fUseBuffs, int fVerbose );
extern int Abc_NtkFraigSweep( Abc_Ntk_t * pNtk, int fUseInv, int fExdc, int fVerbose, int fVeryVerbose );
pNtk = Abc_FrameReadNtk(pAbc);
@ -17091,9 +17092,10 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
fSwitching = 0;
fSkipFanout = 0;
fUseProfile = 0;
fUseBuffs = 0;
fVerbose = 0;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "DABFSGMarspfuvh" ) ) != EOF )
while ( ( c = Extra_UtilGetopt( argc, argv, "DABFSGMarspfuovh" ) ) != EOF )
{
switch ( c )
{
@ -17188,6 +17190,9 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'u':
fUseProfile ^= 1;
break;
case 'o':
fUseBuffs ^= 1;
break;
case 'v':
fVerbose ^= 1;
break;
@ -17224,7 +17229,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, LogFan, Slew, Gain, nGatesMin, fRecovery, fSwitching, fSkipFanout, fUseProfile, fVerbose );
pNtkRes = Abc_NtkMap( pNtk, DelayTarget, AreaMulti, DelayMulti, LogFan, Slew, Gain, nGatesMin, fRecovery, fSwitching, fSkipFanout, fUseProfile, fUseBuffs, fVerbose );
if ( pNtkRes == NULL )
{
Abc_NtkDelete( pNtk );
@ -17236,7 +17241,7 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
else
{
// get the new network
pNtkRes = Abc_NtkMap( pNtk, DelayTarget, AreaMulti, DelayMulti, LogFan, Slew, Gain, nGatesMin, fRecovery, fSwitching, fSkipFanout, fUseProfile, fVerbose );
pNtkRes = Abc_NtkMap( pNtk, DelayTarget, AreaMulti, DelayMulti, LogFan, Slew, Gain, nGatesMin, fRecovery, fSwitching, fSkipFanout, fUseProfile, fUseBuffs, fVerbose );
if ( pNtkRes == NULL )
{
Abc_Print( -1, "Mapping has failed.\n" );
@ -17263,7 +17268,7 @@ usage:
sprintf(Buffer, "not used" );
else
sprintf(Buffer, "%.3f", DelayTarget );
Abc_Print( -2, "usage: map [-DABFSG float] [-M num] [-arspfuvh]\n" );
Abc_Print( -2, "usage: map [-DABFSG float] [-M num] [-arspfuovh]\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 );
@ -17278,6 +17283,7 @@ usage:
Abc_Print( -2, "\t-p : optimizes power by minimizing switching [default = %s]\n", fSwitching? "yes": "no" );
Abc_Print( -2, "\t-f : do not use large gates to map high-fanout nodes [default = %s]\n", fSkipFanout? "yes": "no" );
Abc_Print( -2, "\t-u : use standard-cell profile [default = %s]\n", fUseProfile? "yes": "no" );
Abc_Print( -2, "\t-o : toggles using buffers to decouple combinational outputs [default = %s]\n", fUseBuffs? "yes": "no" );
Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n");
return 1;
@ -29791,17 +29797,18 @@ int Abc_CommandAbc9Put( Abc_Frame_t * pAbc, int argc, char ** argv )
{
extern Abc_Ntk_t * Abc_NtkFromDarChoices( Abc_Ntk_t * pNtkOld, Aig_Man_t * pMan );
extern void Abc_NtkRedirectCiCo( Abc_Ntk_t * pNtk );
extern Abc_Ntk_t * Abc_NtkFromCellMappedGia( Gia_Man_t * p );
extern Abc_Ntk_t * Abc_NtkFromMappedGia( Gia_Man_t * p, int fFindEnables );
extern Abc_Ntk_t * Abc_NtkFromCellMappedGia( Gia_Man_t * p, int fUseBuffs );
extern Abc_Ntk_t * Abc_NtkFromMappedGia( Gia_Man_t * p, int fFindEnables, int fUseBuffs );
Aig_Man_t * pMan;
Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
int fStatusClear = 1;
int fFindEnables = 0;
int fUseBuffs = 0;
int c, fVerbose = 0;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "sevh" ) ) != EOF )
while ( ( c = Extra_UtilGetopt( argc, argv, "seovh" ) ) != EOF )
{
switch ( c )
{
@ -29811,6 +29818,9 @@ int Abc_CommandAbc9Put( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'e':
fFindEnables ^= 1;
break;
case 'o':
fUseBuffs ^= 1;
break;
case 'v':
fVerbose ^= 1;
break;
@ -29826,11 +29836,11 @@ int Abc_CommandAbc9Put( Abc_Frame_t * pAbc, int argc, char ** argv )
return 1;
}
if ( fFindEnables )
pNtk = Abc_NtkFromMappedGia( pAbc->pGia, 1 );
pNtk = Abc_NtkFromMappedGia( pAbc->pGia, 1, fUseBuffs );
else if ( Gia_ManHasCellMapping(pAbc->pGia) )
pNtk = Abc_NtkFromCellMappedGia( pAbc->pGia );
pNtk = Abc_NtkFromCellMappedGia( pAbc->pGia, fUseBuffs );
else if ( Gia_ManHasMapping(pAbc->pGia) || pAbc->pGia->pMuxes )
pNtk = Abc_NtkFromMappedGia( pAbc->pGia, 0 );
pNtk = Abc_NtkFromMappedGia( pAbc->pGia, 0, fUseBuffs );
else if ( Gia_ManHasDangling(pAbc->pGia) == 0 )
{
pMan = Gia_ManToAig( pAbc->pGia, 0 );
@ -29912,10 +29922,11 @@ int Abc_CommandAbc9Put( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0;
usage:
Abc_Print( -2, "usage: &put [-sevh]\n" );
Abc_Print( -2, "usage: &put [-seovh]\n" );
Abc_Print( -2, "\t transfer the current network into the old ABC\n" );
Abc_Print( -2, "\t-s : toggle clearning verification status [default = %s]\n", fStatusClear? "yes": "no" );
Abc_Print( -2, "\t-e : toggle extracting MUXes for flop enables [default = %s]\n", fFindEnables? "yes": "no" );
Abc_Print( -2, "\t-o : toggles using buffers to decouple combinational outputs [default = %s]\n", fUseBuffs? "yes": "no" );
Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n");
return 1;

View File

@ -734,7 +734,7 @@ Abc_Obj_t * Abc_NtkFromMappedGia_rec( Abc_Ntk_t * pNtkNew, Gia_Man_t * p, int iO
pObjNew = Abc_NtkCreateNodeInv(pNtkNew, pObjNew);
return pObjNew;
}
Abc_Ntk_t * Abc_NtkFromMappedGia( Gia_Man_t * p, int fFindEnables )
Abc_Ntk_t * Abc_NtkFromMappedGia( Gia_Man_t * p, int fFindEnables, int fUseBuffs )
{
int fVerbose = 0;
int fDuplicate = 0;
@ -877,7 +877,7 @@ Abc_Ntk_t * Abc_NtkFromMappedGia( Gia_Man_t * p, int fFindEnables )
Abc_NtkAddDummyBoxNames( pNtkNew );
// decouple the PO driver nodes to reduce the number of levels
nDupGates = Abc_NtkLogicMakeSimpleCos( pNtkNew, fDuplicate );
nDupGates = Abc_NtkLogicMakeSimpleCos( pNtkNew, !fUseBuffs );
if ( fVerbose && nDupGates && !Abc_FrameReadFlag("silentmode") )
{
if ( !fDuplicate )
@ -932,10 +932,9 @@ static inline Abc_Obj_t * Abc_NtkFromCellRead( Abc_Ntk_t * p, Vec_Int_t * vCopyL
Abc_NtkFromCellWrite( vCopyLits, i, c, Abc_ObjId(pObjNew) );
return pObjNew;
}
Abc_Ntk_t * Abc_NtkFromCellMappedGia( Gia_Man_t * p )
Abc_Ntk_t * Abc_NtkFromCellMappedGia( Gia_Man_t * p, int fUseBuffs )
{
int fFixDrivers = 1;
int fDuplicate = 1;
int fVerbose = 0;
Abc_Ntk_t * pNtkNew;
Vec_Int_t * vCopyLits;
@ -1051,10 +1050,10 @@ Abc_Ntk_t * Abc_NtkFromCellMappedGia( Gia_Man_t * p )
// decouple the PO driver nodes to reduce the number of levels
if ( fFixDrivers )
{
int nDupGates = Abc_NtkLogicMakeSimpleCos( pNtkNew, fDuplicate );
int nDupGates = Abc_NtkLogicMakeSimpleCos( pNtkNew, !fUseBuffs );
if ( fVerbose && nDupGates && !Abc_FrameReadFlag("silentmode") )
{
if ( !fDuplicate )
if ( fUseBuffs )
printf( "Added %d buffers/inverters to decouple the CO drivers.\n", nDupGates );
else
printf( "Duplicated %d gates to decouple the CO drivers.\n", nDupGates );

View File

@ -33,7 +33,7 @@ ABC_NAMESPACE_IMPL_START
////////////////////////////////////////////////////////////////////////
static Map_Man_t * Abc_NtkToMap( Abc_Ntk_t * pNtk, double DelayTarget, int fRecovery, float * pSwitching, int fVerbose );
static Abc_Ntk_t * Abc_NtkFromMap( Map_Man_t * pMan, Abc_Ntk_t * pNtk );
static Abc_Ntk_t * Abc_NtkFromMap( Map_Man_t * pMan, Abc_Ntk_t * pNtk, int fUseBuffs );
static Abc_Obj_t * Abc_NodeFromMap_rec( Abc_Ntk_t * pNtkNew, Map_Node_t * pNodeMap, int fPhase );
static Abc_Obj_t * Abc_NodeFromMapPhase_rec( Abc_Ntk_t * pNtkNew, Map_Node_t * pNodeMap, int fPhase );
@ -58,7 +58,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, float LogFan, float Slew, float Gain, int nGatesMin, int fRecovery, int fSwitching, int fSkipFanout, int fUseProfile, int fVerbose )
Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti, double DelayMulti, float LogFan, float Slew, float Gain, int nGatesMin, int fRecovery, int fSwitching, int fSkipFanout, int fUseProfile, int fUseBuffs, int fVerbose )
{
static int fUseMulti = 0;
int fShowSwitching = 1;
@ -154,8 +154,8 @@ clk = Abc_Clock();
}
// Map_ManPrintStatsToFile( pNtk->pSpec, Map_ManReadAreaFinal(pMan), Map_ManReadRequiredGlo(pMan), Abc_Clock()-clk );
// reconstruct the network after mapping
pNtkNew = Abc_NtkFromMap( pMan, pNtk );
// reconstruct the network after mapping (use buffers when user requested or in the area mode)
pNtkNew = Abc_NtkFromMap( pMan, pNtk, fUseBuffs || (DelayTarget == (double)ABC_INFINITY) );
if ( Mio_LibraryHasProfile(pLib) )
Mio_LibraryTransferProfile2( (Mio_Library_t *)Abc_FrameReadLibGen(), pLib );
Map_ManFree( pMan );
@ -468,7 +468,7 @@ Abc_Obj_t * Abc_NodeFromMap_rec( Abc_Ntk_t * pNtkNew, Map_Node_t * pNodeMap, int
Map_NodeSetData( pNodeMap, fPhase, (char *)pNodeInv );
return pNodeInv;
}
Abc_Ntk_t * Abc_NtkFromMap( Map_Man_t * pMan, Abc_Ntk_t * pNtk )
Abc_Ntk_t * Abc_NtkFromMap( Map_Man_t * pMan, Abc_Ntk_t * pNtk, int fUseBuffs )
{
Abc_Ntk_t * pNtkNew;
Map_Node_t * pNodeMap;
@ -511,7 +511,7 @@ Abc_Ntk_t * Abc_NtkFromMap( Map_Man_t * pMan, Abc_Ntk_t * pNtk )
Abc_ObjAddFanin( pNode->pCopy, pNodeNew );
}
// decouple the PO driver nodes to reduce the number of levels
nDupGates = Abc_NtkLogicMakeSimpleCos( pNtkNew, 1 );
nDupGates = Abc_NtkLogicMakeSimpleCos( pNtkNew, !fUseBuffs );
// if ( nDupGates && Map_ManReadVerbose(pMan) )
// printf( "Duplicated %d gates to decouple the CO drivers.\n", nDupGates );
return pNtkNew;