Commit 978b5db0 by Alan Mishchenko

Fix a bug in comb loop detection.

parent 94a2cffe
......@@ -1327,19 +1327,22 @@ usage:
******************************************************************************/
int Abc_CommandRetime( Abc_Frame_t * pAbc, int argc, char ** argv )
{
extern void Wln_NtkRetimeTest( char * pFileName, int fSkipSimple, int fVerbose );
extern void Wln_NtkRetimeTest( char * pFileName, int fSkipSimple, int fDump, int fVerbose );
FILE * pFile;
char * pFileName = NULL;
int fSkipSimple = 0;
int c, fVerbose = 0;
int c, fDump = 0, fVerbose = 0;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "svh" ) ) != EOF )
while ( ( c = Extra_UtilGetopt( argc, argv, "sdvh" ) ) != EOF )
{
switch ( c )
{
case 's':
fSkipSimple ^= 1;
break;
case 'd':
fDump ^= 1;
break;
case 'v':
fVerbose ^= 1;
break;
......@@ -1352,7 +1355,7 @@ int Abc_CommandRetime( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( pAbc->pNdr )
{
Vec_Int_t * vMoves;
Wln_Ntk_t * pNtk = Wln_NtkFromNdr( pAbc->pNdr );
Wln_Ntk_t * pNtk = Wln_NtkFromNdr( pAbc->pNdr, fDump );
Wln_NtkRetimeCreateDelayInfo( pNtk );
if ( pNtk == NULL )
{
......@@ -1382,12 +1385,13 @@ int Abc_CommandRetime( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0;
}
fclose( pFile );
Wln_NtkRetimeTest( pFileName, fSkipSimple, fVerbose );
Wln_NtkRetimeTest( pFileName, fSkipSimple, fDump, fVerbose );
return 0;
usage:
Abc_Print( -2, "usage: %%retime [-svh]\n" );
Abc_Print( -2, "usage: %%retime [-sdvh]\n" );
Abc_Print( -2, "\t performs retiming for the NDR design\n" );
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" );
Abc_Print( -2, "\t-h : print the command usage\n");
return 1;
......
......@@ -218,7 +218,7 @@ static inline int Wln_ObjRiToRo( Wln_Ntk_t * p, int i )
/*=== wlcNdr.c ========================================================*/
extern Wln_Ntk_t * Wln_ReadNdr( char * pFileName );
extern void Wln_WriteNdr( Wln_Ntk_t * pNtk, char * pFileName );
extern Wln_Ntk_t * Wln_NtkFromNdr( void * pData );
extern Wln_Ntk_t * Wln_NtkFromNdr( void * pData, int fDump );
extern void * Wln_NtkToNdr( Wln_Ntk_t * pNtk );
/*=== wlcNtk.c ========================================================*/
extern Wln_Ntk_t * Wln_NtkAlloc( char * pName, int nObjsMax );
......
......@@ -179,7 +179,7 @@ void Wln_NtkCheckIntegrity( void * pData )
}
Vec_IntFree( vMap );
}
Wln_Ntk_t * Wln_NtkFromNdr( void * pData )
Wln_Ntk_t * Wln_NtkFromNdr( void * pData, int fDump )
{
Ndr_Data_t * p = (Ndr_Data_t *)pData;
Vec_Int_t * vName2Obj, * vFanins = Vec_IntAlloc( 100 );
......@@ -298,7 +298,7 @@ Wln_Ntk_t * Wln_NtkFromNdr( void * pData )
Wln_Ntk_t * Wln_ReadNdr( char * pFileName )
{
void * pData = Ndr_Read( pFileName );
Wln_Ntk_t * pNtk = pData ? Wln_NtkFromNdr( pData ) : NULL;
Wln_Ntk_t * pNtk = pData ? Wln_NtkFromNdr( pData, 0 ) : NULL;
if ( pNtk ) return NULL;
//char * ppNames[10] = { NULL, "a", "b", "c", "d", "e", "f", "g", "h", "i" };
//Ndr_WriteVerilog( NULL, pData, ppNames );
......@@ -314,17 +314,17 @@ void Wln_ReadNdrTest()
Wln_NtkStaticFanoutTest( pNtk );
Wln_NtkFree( pNtk );
}
void Wln_NtkRetimeTest( char * pFileName, int fSkipSimple, int fVerbose )
void Wln_NtkRetimeTest( char * pFileName, int fSkipSimple, int fDump, int fVerbose )
{
Vec_Int_t * vMoves;
void * pData = Ndr_Read( pFileName );
Wln_Ntk_t * pNtk = pData ? Wln_NtkFromNdr( pData ) : NULL;
Wln_Ntk_t * pNtk = pData ? Wln_NtkFromNdr( pData, fDump ) : NULL;
Ndr_Delete( pData );
if ( pNtk == NULL )
{
printf( "Retiming network is not available.\n" );
return;
}
Ndr_Delete( pData );
Wln_NtkRetimeCreateDelayInfo( pNtk );
vMoves = Wln_NtkRetime( pNtk, fSkipSimple, fVerbose );
//Vec_IntPrint( vMoves );
......
......@@ -207,7 +207,7 @@ int Wln_NtkIsAcyclic( Wln_Ntk_t * p )
continue;
// stop as soon as the first loop is detected
fprintf( stdout, "Primary output %16s (ID %6d)\n", Wln_ObjName(p, iObj), iObj );
break;
goto finish;
}
Wln_NtkForEachFf( p, iObj, i )
{
......@@ -216,7 +216,7 @@ int Wln_NtkIsAcyclic( Wln_Ntk_t * p )
continue;
// stop as soon as the first loop is detected
fprintf( stdout, "Flip-flop %16s (ID %6d)\n", Wln_ObjName(p, iObj), iObj );
break;
goto finish;
}
Wln_NtkForEachObj( p, iObj )
nUnvisited += !Wln_ObjIsTravIdPrevious(p, iObj) && !Wln_ObjIsCi(p, iObj);
......@@ -227,14 +227,14 @@ int Wln_NtkIsAcyclic( Wln_Ntk_t * p )
printf( "The network has %d objects and %d (%6.2f %%) of them are not connected to the outputs.\n",
Wln_NtkObjNum(p), nUnvisited, 100.0*nUnvisited/Wln_NtkObjNum(p) );
Wln_NtkForEachObj( p, iObj )
if ( !Wln_ObjRefs(p, iObj) && !Wln_ObjIsCi(p, iObj) && !Wln_ObjIsFf(p, iObj) )
if ( !Wln_ObjRefs(p, iObj) && !Wln_ObjIsCi(p, iObj) && !Wln_ObjIsCo(p, iObj) && !Wln_ObjIsFf(p, iObj) )
nSinks++;
if ( nSinks )
{
int nPrinted = 0;
printf( "These unconnected objects feed into %d sink objects without fanout:\n", nSinks );
Wln_NtkForEachObj( p, iObj )
if ( !Wln_ObjRefs(p, iObj) && !Wln_ObjIsCi(p, iObj) && !Wln_ObjIsFf(p, iObj) )
if ( !Wln_ObjRefs(p, iObj) && !Wln_ObjIsCi(p, iObj) && !Wln_ObjIsCo(p, iObj) && !Wln_ObjIsFf(p, iObj) )
{
fprintf( stdout, "Node %16s (ID %6d) of type %5s (type ID %2d)\n",
Wln_ObjName(p, iObj), iObj, Abc_OperName(Wln_ObjType(p, iObj)), Wln_ObjType(p, iObj) );
......@@ -252,9 +252,10 @@ int Wln_NtkIsAcyclic( Wln_Ntk_t * p )
continue;
// stop as soon as the first loop is detected
fprintf( stdout, "Unconnected object %s\n", Wln_ObjName(p, iObj) );
break;
goto finish;
}
}
finish:
return fAcyclic;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment