mirror of https://github.com/YosysHQ/abc.git
Allow retiming to skip some logic.
This commit is contained in:
parent
692dd76319
commit
e162a26197
|
|
@ -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" );
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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 ///
|
||||
|
|
|
|||
Loading…
Reference in New Issue