Commit 64bdbe1a by Alan Mishchenko

Adding switch '-c' to generate only stuck-at faults in 'faultclasses -g'.

parent b483c97f
...@@ -7241,18 +7241,21 @@ usage: ...@@ -7241,18 +7241,21 @@ usage:
int Abc_CommandFaultClasses( Abc_Frame_t * pAbc, int argc, char ** argv ) int Abc_CommandFaultClasses( Abc_Frame_t * pAbc, int argc, char ** argv )
{ {
extern void Abc_NtkDetectClassesTest( Abc_Ntk_t * pNtk, int fSeq, int fVerbose, int fVeryVerbose ); extern void Abc_NtkDetectClassesTest( Abc_Ntk_t * pNtk, int fSeq, int fVerbose, int fVeryVerbose );
extern void Abc_NtkGenFaultList( Abc_Ntk_t * pNtk, char * pFileName ); extern void Abc_NtkGenFaultList( Abc_Ntk_t * pNtk, char * pFileName, int fStuckAt );
Abc_Ntk_t * pNtk; Abc_Ntk_t * pNtk;
int c, fGen = 0, fSeq = 0, fVerbose = 0, fVeryVerbose = 0; int c, fGen = 0, fStuckAt = 0, fSeq = 0, fVerbose = 0, fVeryVerbose = 0;
pNtk = Abc_FrameReadNtk(pAbc); pNtk = Abc_FrameReadNtk(pAbc);
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "gsvwh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "gcsvwh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
case 'g': case 'g':
fGen ^= 1; fGen ^= 1;
break; break;
case 'c':
fStuckAt ^= 1;
break;
case 's': case 's':
fSeq ^= 1; fSeq ^= 1;
break; break;
...@@ -7281,18 +7284,19 @@ int Abc_CommandFaultClasses( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -7281,18 +7284,19 @@ int Abc_CommandFaultClasses( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( fGen ) if ( fGen )
{ {
char * pFileName = Extra_FileNameGenericAppend(Abc_NtkSpec(pNtk), "_faults.txt"); char * pFileName = Extra_FileNameGenericAppend(Abc_NtkSpec(pNtk), "_faults.txt");
Abc_NtkGenFaultList( pNtk, pFileName ); Abc_NtkGenFaultList( pNtk, pFileName, fStuckAt );
} }
else else
Abc_NtkDetectClassesTest( pNtk, fSeq, fVerbose, fVeryVerbose ); Abc_NtkDetectClassesTest( pNtk, fSeq, fVerbose, fVeryVerbose );
return 0; return 0;
usage: usage:
Abc_Print( -2, "usage: faultclasses [-gsvwh]\n" ); Abc_Print( -2, "usage: faultclasses [-gcsvwh]\n" );
Abc_Print( -2, "\t computes equivalence classes of faults in the given mapped netlist;\n" ); Abc_Print( -2, "\t computes equivalence classes of faults in the given mapped netlist;\n" );
Abc_Print( -2, "\t the fault list with faults in the format: <fault_id> <node_name> <fault_name>\n" ); Abc_Print( -2, "\t the fault list with faults in the format: <fault_id> <node_name> <fault_name>\n" );
Abc_Print( -2, "\t should be read by command \"read_fins\" before calling this command\n" ); Abc_Print( -2, "\t should be read by command \"read_fins\" before calling this command\n" );
Abc_Print( -2, "\t-g : toggle generating a fault list for the current mapped network [default = %s]\n", fGen? "yes": "no" ); Abc_Print( -2, "\t-g : toggle generating a fault list for the current mapped network [default = %s]\n", fGen? "yes": "no" );
Abc_Print( -2, "\t-c : toggle using only stuck-at faults in the generated fault list [default = %s]\n", fStuckAt? "yes": "no" );
Abc_Print( -2, "\t-s : toggle detecting sequential equivalence classes [default = %s]\n", fSeq? "yes": "no" ); Abc_Print( -2, "\t-s : toggle detecting sequential equivalence classes [default = %s]\n", fSeq? "yes": "no" );
Abc_Print( -2, "\t-v : toggle verbose printout during computation [default = %s]\n", fVerbose? "yes": "no" ); Abc_Print( -2, "\t-v : toggle verbose printout during computation [default = %s]\n", fVerbose? "yes": "no" );
Abc_Print( -2, "\t-w : toggle printing of resulting fault equivalence classes [default = %s]\n", fVeryVerbose? "yes": "no" ); Abc_Print( -2, "\t-w : toggle printing of resulting fault equivalence classes [default = %s]\n", fVeryVerbose? "yes": "no" );
...@@ -63,7 +63,7 @@ typedef enum { ...@@ -63,7 +63,7 @@ typedef enum {
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
void Abc_NtkGenFaultList( Abc_Ntk_t * pNtk, char * pFileName ) void Abc_NtkGenFaultList( Abc_Ntk_t * pNtk, char * pFileName, int fStuckAt )
{ {
Mio_Library_t * pLib = (Mio_Library_t *)pNtk->pManFunc; Mio_Library_t * pLib = (Mio_Library_t *)pNtk->pManFunc;
Mio_Gate_t * pGate; Mio_Gate_t * pGate;
...@@ -84,14 +84,16 @@ void Abc_NtkGenFaultList( Abc_Ntk_t * pNtk, char * pFileName ) ...@@ -84,14 +84,16 @@ void Abc_NtkGenFaultList( Abc_Ntk_t * pNtk, char * pFileName )
fprintf( pFile, "%d %s %s\n", Count, Abc_ObjName(pObj), "SA0" ), Count++; fprintf( pFile, "%d %s %s\n", Count, Abc_ObjName(pObj), "SA0" ), Count++;
fprintf( pFile, "%d %s %s\n", Count, Abc_ObjName(pObj), "SA1" ), Count++; fprintf( pFile, "%d %s %s\n", Count, Abc_ObjName(pObj), "SA1" ), Count++;
fprintf( pFile, "%d %s %s\n", Count, Abc_ObjName(pObj), "NEG" ), Count++; fprintf( pFile, "%d %s %s\n", Count, Abc_ObjName(pObj), "NEG" ), Count++;
if ( fStuckAt )
continue;
// add other faults, which correspond to changing the given gate // add other faults, which correspond to changing the given gate
// by another gate with the same support-size from the same library // by another gate with the same support-size from the same library
Mio_LibraryForEachGate( pLib, pGate ) Mio_LibraryForEachGate( pLib, pGate )
if ( pGate != pGateObj && Mio_GateReadPinNum(pGate) == nInputs ) if ( pGate != pGateObj && Mio_GateReadPinNum(pGate) == nInputs )
fprintf( pFile, "%d %s %s\n", Count, Abc_ObjName(pObj), Mio_GateReadName(pGate) ), Count++; fprintf( pFile, "%d %s %s\n", Count, Abc_ObjName(pObj), Mio_GateReadName(pGate) ), Count++;
} }
printf( "Generated fault list \"%s\" for network \"%s\" with %d nodes and %d faults.\n", printf( "Generated fault list \"%s\" for network \"%s\" with %d nodes and %d %sfaults.\n",
pFileName, Abc_NtkName(pNtk), Abc_NtkNodeNum(pNtk), Count-1 ); pFileName, Abc_NtkName(pNtk), Abc_NtkNodeNum(pNtk), Count-1, fStuckAt ? "stuck-at ":"" );
fclose( pFile ); fclose( pFile );
} }
......
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