summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2021-07-31 22:46:47 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2021-07-31 22:46:47 -0700
commite162a26197b194e6b9adfcf455edb4312285c644 (patch)
treeb3e3465d4fe40991d34ce7d8e5cdfa36b26eb11f /src
parent692dd763190d2e2682c0eeabdcd81f16aaaabe94 (diff)
downloadabc-e162a26197b194e6b9adfcf455edb4312285c644.tar.gz
abc-e162a26197b194e6b9adfcf455edb4312285c644.tar.bz2
abc-e162a26197b194e6b9adfcf455edb4312285c644.zip
Allow retiming to skip some logic.
Diffstat (limited to 'src')
-rw-r--r--src/base/wlc/wlcCom.c15
-rw-r--r--src/base/wln/wln.h2
-rw-r--r--src/base/wln/wlnNdr.c4
-rw-r--r--src/base/wln/wlnRetime.c57
4 files changed, 69 insertions, 9 deletions
diff --git a/src/base/wlc/wlcCom.c b/src/base/wlc/wlcCom.c
index e6294f41..666a8776 100644
--- a/src/base/wlc/wlcCom.c
+++ b/src/base/wlc/wlcCom.c
@@ -1331,16 +1331,20 @@ usage:
******************************************************************************/
int Abc_CommandRetime( Abc_Frame_t * pAbc, int argc, char ** argv )
{
- extern void Wln_NtkRetimeTest( char * pFileName, int fSkipSimple, int fDump, int fVerbose );
+ extern void Wln_NtkRetimeTest( char * pFileName, int fIgnoreIO, int fSkipSimple, int fDump, int fVerbose );
FILE * pFile;
char * pFileName = NULL;
+ int fIgnoreIO = 0;
int fSkipSimple = 0;
int c, fDump = 0, fVerbose = 0;
Extra_UtilGetoptReset();
- while ( ( c = Extra_UtilGetopt( argc, argv, "sdvh" ) ) != EOF )
+ while ( ( c = Extra_UtilGetopt( argc, argv, "isdvh" ) ) != EOF )
{
switch ( c )
{
+ case 'i':
+ fIgnoreIO ^= 1;
+ break;
case 's':
fSkipSimple ^= 1;
break;
@@ -1366,7 +1370,7 @@ int Abc_CommandRetime( Abc_Frame_t * pAbc, int argc, char ** argv )
printf( "Transforming NDR into internal represnetation has failed.\n" );
return 0;
}
- vMoves = Wln_NtkRetime( pNtk, fSkipSimple, fVerbose );
+ vMoves = Wln_NtkRetime( pNtk, fIgnoreIO, fSkipSimple, fVerbose );
Wln_NtkFree( pNtk );
ABC_FREE( pAbc->pNdrArray );
if ( vMoves ) pAbc->pNdrArray = Vec_IntReleaseNewArray( vMoves );
@@ -1389,11 +1393,12 @@ int Abc_CommandRetime( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0;
}
fclose( pFile );
- Wln_NtkRetimeTest( pFileName, fSkipSimple, fDump, fVerbose );
+ Wln_NtkRetimeTest( pFileName, fIgnoreIO, fSkipSimple, fDump, fVerbose );
return 0;
usage:
- Abc_Print( -2, "usage: %%retime [-sdvh]\n" );
+ Abc_Print( -2, "usage: %%retime [-isdvh]\n" );
Abc_Print( -2, "\t performs retiming for the NDR design\n" );
+ Abc_Print( -2, "\t-i : toggle ignoring delays of IO paths [default = %s]\n", fIgnoreIO? "yes": "no" );
Abc_Print( -2, "\t-s : toggle printing simple nodes [default = %s]\n", !fSkipSimple? "yes": "no" );
Abc_Print( -2, "\t-d : toggle dumping the network in Verilog [default = %s]\n", fDump? "yes": "no" );
Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
diff --git a/src/base/wln/wln.h b/src/base/wln/wln.h
index 510d74c1..93a1a92a 100644
--- a/src/base/wln/wln.h
+++ b/src/base/wln/wln.h
@@ -246,7 +246,7 @@ extern int Wln_ObjClone( Wln_Ntk_t * pNew, Wln_Ntk_t * p, int iObj );
extern int Wln_ObjCreateCo( Wln_Ntk_t * p, int iFanin );
extern void Wln_ObjPrint( Wln_Ntk_t * p, int iObj );
/*=== wlcRetime.c ========================================================*/
-extern Vec_Int_t * Wln_NtkRetime( Wln_Ntk_t * p, int fSkipSimple, int fVerbose );
+extern Vec_Int_t * Wln_NtkRetime( Wln_Ntk_t * p, int fIgnoreIO, int fSkipSimple, int fVerbose );
extern void Wln_NtkRetimeCreateDelayInfo( Wln_Ntk_t * pNtk );
/*=== wlcWriteVer.c ========================================================*/
extern void Wln_WriteVer( Wln_Ntk_t * p, char * pFileName );
diff --git a/src/base/wln/wlnNdr.c b/src/base/wln/wlnNdr.c
index eb685463..d16840c6 100644
--- a/src/base/wln/wlnNdr.c
+++ b/src/base/wln/wlnNdr.c
@@ -314,7 +314,7 @@ void Wln_ReadNdrTest()
Wln_NtkStaticFanoutTest( pNtk );
Wln_NtkFree( pNtk );
}
-void Wln_NtkRetimeTest( char * pFileName, int fSkipSimple, int fDump, int fVerbose )
+void Wln_NtkRetimeTest( char * pFileName, int fIgnoreIO, int fSkipSimple, int fDump, int fVerbose )
{
Vec_Int_t * vMoves;
void * pData = Ndr_Read( pFileName );
@@ -326,7 +326,7 @@ void Wln_NtkRetimeTest( char * pFileName, int fSkipSimple, int fDump, int fVerbo
return;
}
Wln_NtkRetimeCreateDelayInfo( pNtk );
- vMoves = Wln_NtkRetime( pNtk, fSkipSimple, fVerbose );
+ vMoves = Wln_NtkRetime( pNtk, fIgnoreIO, fSkipSimple, fVerbose );
//Vec_IntPrint( vMoves );
Vec_IntFree( vMoves );
Wln_NtkFree( pNtk );
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
@@ -335,6 +335,55 @@ void Wln_RetFindSources( Wln_Ret_t * p )
/**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.]
Description []
@@ -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 ///