diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2006-11-11 08:01:00 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2006-11-11 08:01:00 -0800 |
commit | da5e0785dfb98335bd49a13bf9e86e736fb931be (patch) | |
tree | 3e88084f64093c8394fddf2d96b522a4df183981 /src/opt/ret/retCore.c | |
parent | faf1265bb82f934cc14b6106ccce89e37203efbd (diff) | |
download | abc-da5e0785dfb98335bd49a13bf9e86e736fb931be.tar.gz abc-da5e0785dfb98335bd49a13bf9e86e736fb931be.tar.bz2 abc-da5e0785dfb98335bd49a13bf9e86e736fb931be.zip |
Version abc61111
Diffstat (limited to 'src/opt/ret/retCore.c')
-rw-r--r-- | src/opt/ret/retCore.c | 56 |
1 files changed, 48 insertions, 8 deletions
diff --git a/src/opt/ret/retCore.c b/src/opt/ret/retCore.c index 541f5962..8ef4e79b 100644 --- a/src/opt/ret/retCore.c +++ b/src/opt/ret/retCore.c @@ -24,6 +24,8 @@ /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// +int timeRetime = 0; + //////////////////////////////////////////////////////////////////////// /// FUNCTION DEFINITIONS /// //////////////////////////////////////////////////////////////////////// @@ -39,36 +41,74 @@ SeeAlso [] ***********************************************************************/ -int Abc_NtkRetime( Abc_Ntk_t * pNtk, int Mode, int fVerbose ) +int Abc_NtkRetime( Abc_Ntk_t * pNtk, int Mode, int fForwardOnly, int fBackwardOnly, int fVerbose ) { - int RetValue; + int nLatches = Abc_NtkLatchNum(pNtk); + int nLevels = Abc_NtkGetLevelNum(pNtk); + int RetValue = 0, clkTotal = clock(); assert( Mode > 0 && Mode < 6 ); + assert( !fForwardOnly || !fBackwardOnly ); // perform forward retiming switch ( Mode ) { case 1: // forward - RetValue = Abc_NtkRetimeForward( pNtk, fVerbose ); + RetValue = Abc_NtkRetimeIncremental( pNtk, 1, 0, fVerbose ); break; case 2: // backward - RetValue = Abc_NtkRetimeBackward( pNtk, fVerbose ); + RetValue = Abc_NtkRetimeIncremental( pNtk, 0, 0, fVerbose ); break; case 3: // min-area - RetValue = Abc_NtkRetimeMinArea( pNtk, fVerbose ); + RetValue = Abc_NtkRetimeMinArea( pNtk, fForwardOnly, fBackwardOnly, fVerbose ); break; case 4: // min-delay - RetValue = Abc_NtkRetimeMinDelay( pNtk, fVerbose ); + if ( !fBackwardOnly ) + RetValue += Abc_NtkRetimeIncremental( pNtk, 1, 1, fVerbose ); + if ( !fForwardOnly ) + RetValue += Abc_NtkRetimeIncremental( pNtk, 0, 1, fVerbose ); break; case 5: // min-area + min-delay - RetValue = Abc_NtkRetimeMinArea( pNtk, fVerbose ); - RetValue += Abc_NtkRetimeMinDelay( pNtk, fVerbose ); + RetValue = Abc_NtkRetimeMinArea( pNtk, fForwardOnly, fBackwardOnly, fVerbose ); + if ( !fBackwardOnly ) + RetValue += Abc_NtkRetimeIncremental( pNtk, 1, 1, fVerbose ); + if ( !fForwardOnly ) + RetValue += Abc_NtkRetimeIncremental( pNtk, 0, 1, fVerbose ); break; default: printf( "Unknown retiming option.\n" ); break; } + if ( fVerbose ) + { + printf( "Reduction in area = %3d. Reduction in delay = %3d. ", + nLatches - Abc_NtkLatchNum(pNtk), nLevels - Abc_NtkGetLevelNum(pNtk) ); + PRT( "Total runtime", clock() - clkTotal ); + } + timeRetime = clock() - clkTotal; return RetValue; } +/**Function************************************************************* + + Synopsis [Used for automated debugging.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_NtkRetimeDebug( Abc_Ntk_t * pNtk ) +{ + extern int Abc_NtkSecFraig( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nSeconds, int nFrames, int fVerbose ); + Abc_Ntk_t * pNtkRet; + assert( Abc_NtkIsLogic(pNtk) ); + Abc_NtkLogicToSop( pNtk, 0 ); + pNtkRet = Abc_NtkDup( pNtk ); + Abc_NtkRetime( pNtkRet, 3, 0, 1, 0 ); + return !Abc_NtkSecFraig( pNtk, pNtkRet, 10000, 3, 0 ); +} + //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// |