From e162a26197b194e6b9adfcf455edb4312285c644 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Sat, 31 Jul 2021 22:46:47 -0700 Subject: Allow retiming to skip some logic. --- src/base/wln/wlnRetime.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) (limited to 'src/base/wln/wlnRetime.c') diff --git a/src/base/wln/wlnRetime.c b/src/base/wln/wlnRetime.c index 734ac194..5ccc1dd0 100644 --- a/src/base/wln/wlnRetime.c +++ b/src/base/wln/wlnRetime.c @@ -333,6 +333,55 @@ void Wln_RetFindSources( Wln_Ret_t * p ) // Vec_IntPrint( &p->vSources ); } +/**Function************************************************************* + + Synopsis [Mark paths from PIs to POs.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Wln_RetMarkPaths_rec( Wln_Ntk_t * p, int iObj, int fVerbose ) +{ + int k, iFanin, fPrev = 1; + if ( Wln_ObjIsTravIdPrevious(p, iObj) ) + return 1; + if ( Wln_ObjIsTravIdCurrent(p, iObj) ) + return 0; + if ( Wln_ObjIsCio(p, iObj) || Wln_ObjIsFf(p, iObj) ) + return 0; + Wln_ObjForEachFanin( p, iObj, iFanin, k ) + fPrev &= Wln_RetMarkPaths_rec( p, iFanin, fVerbose ); + if ( fPrev ) + { + Wln_ObjSetTravIdPrevious( p, iObj ); + if ( Vec_IntEntry(&p->vInstIds, iObj) > 0 ) + { + if ( fVerbose ) + printf( "Updating delay %5d -> %5d : ", Vec_IntEntry(&p->vInstIds, iObj), 1 ); + if ( fVerbose ) + Wln_ObjPrint( p, iObj ); + Vec_IntWriteEntry( &p->vInstIds, iObj, 1 ); + } + return 1; + } + Wln_ObjSetTravIdCurrent( p, iObj ); + return 0; +} +void Wln_RetMarkPaths( Wln_Ntk_t * p, int fVerbose ) +{ + int i, iObj; + Wln_NtkIncrementTravId( p ); + Wln_NtkIncrementTravId( p ); + Wln_NtkForEachPi( p, iObj, i ) + Wln_ObjSetTravIdPrevious( p, iObj ); + Wln_NtkForEachPo( p, iObj, i ) + Wln_RetMarkPaths_rec( p, Wln_ObjFanin0(p, iObj), fVerbose ); +} + /**Function************************************************************* Synopsis [Retimability check.] @@ -571,7 +620,7 @@ void Wln_NtkRetimeCreateDelayInfo( Wln_Ntk_t * pNtk ) printf( "Assuming default delays: 10 units for most nodes and 1 unit for bit-slice, concat, and buffers driving COs.\n" ); } } -Vec_Int_t * Wln_NtkRetime( Wln_Ntk_t * pNtk, int fSkipSimple, int fVerbose ) +Vec_Int_t * Wln_NtkRetime_int( Wln_Ntk_t * pNtk, int fSkipSimple, int fVerbose ) { Wln_Ret_t * p = Wln_RetAlloc( pNtk ); Vec_Int_t * vSources = &p->vSources; @@ -666,6 +715,12 @@ Vec_Int_t * Wln_NtkRetime( Wln_Ntk_t * pNtk, int fSkipSimple, int fVerbose ) } return vMoves; } +Vec_Int_t * Wln_NtkRetime( Wln_Ntk_t * pNtk, int fIgnoreIO, int fSkipSimple, int fVerbose ) +{ + if ( fIgnoreIO ) + Wln_RetMarkPaths( pNtk, fVerbose ); + return Wln_NtkRetime_int( pNtk, fSkipSimple, fVerbose ); +} //////////////////////////////////////////////////////////////////////// /// END OF FILE /// -- cgit v1.2.3