From 9e20b3016ddb16993687cffc050c3cee127f677d Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Fri, 24 Apr 2015 14:51:34 -0700 Subject: Adding switch 'map -f' to not use large gates for high-fanout nodes (disabled by default). --- src/base/abci/abc.c | 16 +++++++++++----- src/base/abci/abcMap.c | 3 ++- src/map/mapper/mapper.h | 1 + src/map/mapper/mapperCreate.c | 1 + src/map/mapper/mapperInt.h | 3 ++- src/map/mapper/mapperMatch.c | 2 +- 6 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 7249e676..e9df4ec2 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -14369,9 +14369,10 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv ) int fRecovery; int fSweep; int fSwitching; + int fSkipFanout; 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 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 fVerbose ); extern int Abc_NtkFraigSweep( Abc_Ntk_t * pNtk, int fUseInv, int fExdc, int fVerbose, int fVeryVerbose ); pNtk = Abc_FrameReadNtk(pAbc); @@ -14383,9 +14384,10 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv ) fRecovery = 1; fSweep = 0; fSwitching = 0; + fSkipFanout = 0; fVerbose = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "DABFSGMarspvh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "DABFSGMarspfvh" ) ) != EOF ) { switch ( c ) { @@ -14474,6 +14476,9 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'p': fSwitching ^= 1; break; + case 'f': + fSkipFanout ^= 1; + break; case 'v': fVerbose ^= 1; break; @@ -14510,7 +14515,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, fVerbose ); + pNtkRes = Abc_NtkMap( pNtk, DelayTarget, AreaMulti, DelayMulti, LogFan, Slew, Gain, nGatesMin, fRecovery, fSwitching, fSkipFanout, fVerbose ); if ( pNtkRes == NULL ) { Abc_NtkDelete( pNtk ); @@ -14522,7 +14527,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, fVerbose ); + pNtkRes = Abc_NtkMap( pNtk, DelayTarget, AreaMulti, DelayMulti, LogFan, Slew, Gain, nGatesMin, fRecovery, fSwitching, fSkipFanout, fVerbose ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Mapping has failed.\n" ); @@ -14549,7 +14554,7 @@ usage: sprintf(Buffer, "not used" ); else sprintf(Buffer, "%.3f", DelayTarget ); - Abc_Print( -2, "usage: map [-DABFSG float] [-M num] [-arspvh]\n" ); + Abc_Print( -2, "usage: map [-DABFSG float] [-M num] [-arspfvh]\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 ); @@ -14562,6 +14567,7 @@ usage: 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-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-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; diff --git a/src/base/abci/abcMap.c b/src/base/abci/abcMap.c index c3e103a4..c40029f7 100644 --- a/src/base/abci/abcMap.c +++ b/src/base/abci/abcMap.c @@ -56,7 +56,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 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 fVerbose ) { static int fUseMulti = 0; int fShowSwitching = 1; @@ -132,6 +132,7 @@ Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti, return NULL; clk = Abc_Clock(); Map_ManSetSwitching( pMan, fSwitching ); + Map_ManSetSkipFanout( pMan, fSkipFanout ); if ( LogFan != 0 ) Map_ManCreateNodeDelays( pMan, LogFan ); if ( !Map_Mapping( pMan ) ) diff --git a/src/map/mapper/mapper.h b/src/map/mapper/mapper.h index 2a52ee08..169223d8 100644 --- a/src/map/mapper/mapper.h +++ b/src/map/mapper/mapper.h @@ -108,6 +108,7 @@ extern void Map_ManSetChoiceNodeNum( Map_Man_t * p, int nChoiceNodes extern void Map_ManSetChoiceNum( Map_Man_t * p, int nChoices ); extern void Map_ManSetVerbose( Map_Man_t * p, int fVerbose ); extern void Map_ManSetSwitching( Map_Man_t * p, int fSwitching ); +extern void Map_ManSetSkipFanout( Map_Man_t * p, int fSkipFanout ); extern Map_Man_t * Map_NodeReadMan( Map_Node_t * p ); extern char * Map_NodeReadData( Map_Node_t * p, int fPhase ); diff --git a/src/map/mapper/mapperCreate.c b/src/map/mapper/mapperCreate.c index 6914724c..e7ad4819 100644 --- a/src/map/mapper/mapperCreate.c +++ b/src/map/mapper/mapperCreate.c @@ -73,6 +73,7 @@ void Map_ManSetChoiceNodeNum( Map_Man_t * p, int nChoiceNodes ) { p-> void Map_ManSetChoiceNum( Map_Man_t * p, int nChoices ) { p->nChoices = nChoices; } void Map_ManSetVerbose( Map_Man_t * p, int fVerbose ) { p->fVerbose = fVerbose; } void Map_ManSetSwitching( Map_Man_t * p, int fSwitching ) { p->fSwitching = fSwitching; } +void Map_ManSetSkipFanout( Map_Man_t * p, int fSkipFanout ) { p->fSkipFanout = fSkipFanout; } /**Function************************************************************* diff --git a/src/map/mapper/mapperInt.h b/src/map/mapper/mapperInt.h index cd6ac81c..fdfece30 100644 --- a/src/map/mapper/mapperInt.h +++ b/src/map/mapper/mapperInt.h @@ -120,7 +120,8 @@ struct Map_ManStruct_t_ int fObeyFanoutLimits;// Should mapper try to obey fanout limits or not float DelayTarget; // the required times set by the user int nTravIds; // the traversal counter - int fSwitching; // Should mapper try to obey fanout limits or not + int fSwitching; // use switching activity + int fSkipFanout; // skip large gates when mapping high-fanout nodes // the supergate library Map_SuperLib_t * pSuperLib; // the current supergate library diff --git a/src/map/mapper/mapperMatch.c b/src/map/mapper/mapperMatch.c index 97b3737a..6e1287b2 100644 --- a/src/map/mapper/mapperMatch.c +++ b/src/map/mapper/mapperMatch.c @@ -288,7 +288,7 @@ int Map_MatchNodePhase( Map_Man_t * p, Map_Node_t * pNode, int fPhase ) for ( pCut = pNode->pCuts->pNext; pCut; pCut = pCut->pNext ) { // limit gate sizes based on fanout count - if ( (pNode->nRefs > 3 && pCut->nLeaves > 2) || (pNode->nRefs > 1 && pCut->nLeaves > 3) ) + if ( p->fSkipFanout && (pNode->nRefs > 3 && pCut->nLeaves > 2) || (pNode->nRefs > 1 && pCut->nLeaves > 3) ) continue; pMatch = pCut->M + fPhase; if ( pMatch->pSupers == NULL ) -- cgit v1.2.3