mirror of https://github.com/YosysHQ/abc.git
pdr -X to write CEXes immediately
This commit is contained in:
parent
896e5e7ded
commit
f63471bdf5
|
|
@ -29275,7 +29275,7 @@ int Abc_CommandPdr( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
int c;
|
||||
Pdr_ManSetDefaultParams( pPars );
|
||||
Extra_UtilGetoptReset();
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "MFCDQTHGSLIaxrmuyfqipdegjonctkvwzh" ) ) != EOF )
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "MFCDQTHGSLIXaxrmuyfqipdegjonctkvwzh" ) ) != EOF )
|
||||
{
|
||||
switch ( c )
|
||||
{
|
||||
|
|
@ -29396,6 +29396,15 @@ int Abc_CommandPdr( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
pPars->pInvFileName = argv[globalUtilOptind];
|
||||
globalUtilOptind++;
|
||||
break;
|
||||
case 'X':
|
||||
if ( globalUtilOptind >= argc )
|
||||
{
|
||||
Abc_Print( -1, "Command line switch \"-X\" should be followed by a directory name.\n" );
|
||||
goto usage;
|
||||
}
|
||||
pPars->pCexFilePrefix = argv[globalUtilOptind];
|
||||
globalUtilOptind++;
|
||||
break;
|
||||
case 'a':
|
||||
pPars->fSolveAll ^= 1;
|
||||
break;
|
||||
|
|
@ -29503,7 +29512,7 @@ int Abc_CommandPdr( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
return 0;
|
||||
|
||||
usage:
|
||||
Abc_Print( -2, "usage: pdr [-MFCDQTHGS <num>] [-LI <file>] [-axrmuyfqipdegjonctkvwzh]\n" );
|
||||
Abc_Print( -2, "usage: pdr [-MFCDQTHGS <num>] [-LI <file>] [-X <prefix>] [-axrmuyfqipdegjonctkvwzh]\n" );
|
||||
Abc_Print( -2, "\t model checking using property directed reachability (aka IC3)\n" );
|
||||
Abc_Print( -2, "\t pioneered by Aaron R. Bradley (http://theory.stanford.edu/~arbrad/)\n" );
|
||||
Abc_Print( -2, "\t with improvements by Niklas Een (http://een.se/niklas/)\n" );
|
||||
|
|
@ -29518,6 +29527,7 @@ usage:
|
|||
Abc_Print( -2, "\t-S num : * value to seed the SAT solver with [default = %d]\n", pPars->nRandomSeed );
|
||||
Abc_Print( -2, "\t-L file: the log file name [default = %s]\n", pLogFileName ? pLogFileName : "no logging" );
|
||||
Abc_Print( -2, "\t-I file: the invariant file name [default = %s]\n", pPars->pInvFileName ? pPars->pInvFileName : "default name" );
|
||||
Abc_Print( -2, "\t-X pref: when solving all outputs, store CEXes immediately as <pref>*.aiw [default = %s]\n", pPars->pCexFilePrefix ? pPars->pCexFilePrefix : "disabled");
|
||||
Abc_Print( -2, "\t-a : toggle solving all outputs even if one of them is SAT [default = %s]\n", pPars->fSolveAll? "yes": "no" );
|
||||
Abc_Print( -2, "\t-x : toggle storing CEXes when solving all outputs [default = %s]\n", pPars->fStoreCex? "yes": "no" );
|
||||
Abc_Print( -2, "\t-r : toggle using more effort in generalization [default = %s]\n", pPars->fTwoRounds? "yes": "no" );
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ struct Pdr_Par_t_
|
|||
abctime timeLastSolved; // the time when the last output was solved
|
||||
Vec_Int_t * vOutMap; // in the multi-output mode, contains status for each PO (0 = sat; 1 = unsat; negative = undecided)
|
||||
char * pInvFileName; // invariable file name
|
||||
char * pCexFilePrefix; // CEX output prefix
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -95,6 +96,7 @@ struct Pdr_Par_t_
|
|||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*=== pdrCore.c ==========================================================*/
|
||||
extern void Pdr_OutputCexToDir( Pdr_Par_t * pPars, Abc_Cex_t * pCex );
|
||||
extern void Pdr_ManSetDefaultParams( Pdr_Par_t * pPars );
|
||||
extern int Pdr_ManSolve( Aig_Man_t * p, Pdr_Par_t * pPars );
|
||||
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ void Pdr_ManSetDefaultParams( Pdr_Par_t * pPars )
|
|||
pPars->nDropOuts = 0; // the number of timed out outputs
|
||||
pPars->timeLastSolved = 0; // last one solved
|
||||
pPars->pInvFileName = NULL; // invariant file name
|
||||
pPars->pCexFilePrefix = NULL; // CEX output prefix
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
|
@ -1026,6 +1027,38 @@ int Pdr_ManBlockCube( Pdr_Man_t * p, Pdr_Set_t * pCube )
|
|||
return 1;
|
||||
}
|
||||
|
||||
void Pdr_OutputCexToDir( Pdr_Par_t * pPars, Abc_Cex_t * pCex )
|
||||
{
|
||||
int i, f, iBit;
|
||||
size_t iCexPathSize;
|
||||
char * pCexPath;
|
||||
FILE * pCexFile;
|
||||
|
||||
iCexPathSize = snprintf( NULL, 0, "%s%d.aiw", pPars->pCexFilePrefix, pCex->iPo ) + 1;
|
||||
pCexPath = malloc( iCexPathSize );
|
||||
snprintf( pCexPath, iCexPathSize, "%s%d.aiw", pPars->pCexFilePrefix, pCex->iPo );
|
||||
Abc_Print( 1, "Writing CEX for output %d to %s\n", pCex->iPo, pCexPath );
|
||||
pCexFile = fopen( pCexPath, "w" );
|
||||
free( pCexPath );
|
||||
|
||||
fprintf( pCexFile, "1\n");
|
||||
fprintf( pCexFile, "b%d\n", pCex->iPo);
|
||||
|
||||
iBit = 0;
|
||||
for ( i = 0; i < pCex->nRegs; i++, iBit++ )
|
||||
putc( '0' + Abc_InfoHasBit(pCex->pData, iBit), pCexFile );
|
||||
putc( '\n', pCexFile );
|
||||
|
||||
for ( f = 0; f <= pCex->iFrame; f++ )
|
||||
{
|
||||
for ( i = 0; i < pCex->nPis; i++, iBit++ )
|
||||
putc( '0' + Abc_InfoHasBit(pCex->pData, iBit), pCexFile );
|
||||
putc( '\n', pCexFile );
|
||||
}
|
||||
fprintf( pCexFile, ".\n");
|
||||
fclose( pCexFile );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
|
@ -1100,7 +1133,7 @@ int Pdr_ManSolveInt( Pdr_Man_t * p )
|
|||
p->pAig->pSeqModel = pCexNew;
|
||||
return 0; // SAT
|
||||
}
|
||||
pCexNew = (p->pPars->fUseBridge || p->pPars->fStoreCex) ? Abc_CexMakeTriv( Aig_ManRegNum(p->pAig), Saig_ManPiNum(p->pAig), Saig_ManPoNum(p->pAig), iFrame*Saig_ManPoNum(p->pAig)+p->iOutCur ) : (Abc_Cex_t *)(ABC_PTRINT_T)1;
|
||||
pCexNew = (p->pPars->fUseBridge || p->pPars->fStoreCex || p->pPars->pCexFilePrefix) ? Abc_CexMakeTriv( Aig_ManRegNum(p->pAig), Saig_ManPiNum(p->pAig), Saig_ManPoNum(p->pAig), iFrame*Saig_ManPoNum(p->pAig)+p->iOutCur ) : (Abc_Cex_t *)(ABC_PTRINT_T)1;
|
||||
p->pPars->nFailOuts++;
|
||||
if ( p->pPars->vOutMap ) Vec_IntWriteEntry( p->pPars->vOutMap, p->iOutCur, 0 );
|
||||
if ( !p->pPars->fNotVerbose )
|
||||
|
|
@ -1109,6 +1142,8 @@ int Pdr_ManSolveInt( Pdr_Man_t * p )
|
|||
assert( Vec_PtrEntry(p->vCexes, p->iOutCur) == NULL );
|
||||
if ( p->pPars->fUseBridge )
|
||||
Gia_ManToBridgeResult( stdout, 0, pCexNew, pCexNew->iPo );
|
||||
if ( p->pPars->pCexFilePrefix )
|
||||
Pdr_OutputCexToDir( p->pPars, pCexNew );
|
||||
Vec_PtrWriteEntry( p->vCexes, p->iOutCur, pCexNew );
|
||||
if ( p->pPars->pFuncOnFail && p->pPars->pFuncOnFail(p->iOutCur, p->pPars->fStoreCex ? (Abc_Cex_t *)Vec_PtrEntry(p->vCexes, p->iOutCur) : NULL) )
|
||||
{
|
||||
|
|
@ -1217,11 +1252,13 @@ int Pdr_ManSolveInt( Pdr_Man_t * p )
|
|||
return 0; // SAT
|
||||
}
|
||||
p->pPars->nFailOuts++;
|
||||
pCexNew = (p->pPars->fUseBridge || p->pPars->fStoreCex) ? Pdr_ManDeriveCex(p) : (Abc_Cex_t *)(ABC_PTRINT_T)1;
|
||||
pCexNew = (p->pPars->fUseBridge || p->pPars->fStoreCex || p->pPars->pCexFilePrefix) ? Pdr_ManDeriveCex(p) : (Abc_Cex_t *)(ABC_PTRINT_T)1;
|
||||
if ( p->pPars->vOutMap ) Vec_IntWriteEntry( p->pPars->vOutMap, p->iOutCur, 0 );
|
||||
assert( Vec_PtrEntry(p->vCexes, p->iOutCur) == NULL );
|
||||
if ( p->pPars->fUseBridge )
|
||||
Gia_ManToBridgeResult( stdout, 0, pCexNew, pCexNew->iPo );
|
||||
if ( p->pPars->pCexFilePrefix )
|
||||
Pdr_OutputCexToDir( p->pPars, pCexNew );
|
||||
Vec_PtrWriteEntry( p->vCexes, p->iOutCur, pCexNew );
|
||||
if ( p->pPars->pFuncOnFail && p->pPars->pFuncOnFail(p->iOutCur, p->pPars->fStoreCex ? (Abc_Cex_t *)Vec_PtrEntry(p->vCexes, p->iOutCur) : NULL) )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -484,7 +484,7 @@ int IPdr_ManSolveInt( Pdr_Man_t * p, int fCheckClauses, int fPushClauses )
|
|||
p->pAig->pSeqModel = pCexNew;
|
||||
return 0; // SAT
|
||||
}
|
||||
pCexNew = (p->pPars->fUseBridge || p->pPars->fStoreCex) ? Abc_CexMakeTriv( Aig_ManRegNum(p->pAig), Saig_ManPiNum(p->pAig), Saig_ManPoNum(p->pAig), iFrame*Saig_ManPoNum(p->pAig)+p->iOutCur ) : (Abc_Cex_t *)(ABC_PTRINT_T)1;
|
||||
pCexNew = (p->pPars->fUseBridge || p->pPars->fStoreCex || p->pPars->pCexFilePrefix) ? Abc_CexMakeTriv( Aig_ManRegNum(p->pAig), Saig_ManPiNum(p->pAig), Saig_ManPoNum(p->pAig), iFrame*Saig_ManPoNum(p->pAig)+p->iOutCur ) : (Abc_Cex_t *)(ABC_PTRINT_T)1;
|
||||
p->pPars->nFailOuts++;
|
||||
if ( p->pPars->vOutMap ) Vec_IntWriteEntry( p->pPars->vOutMap, p->iOutCur, 0 );
|
||||
if ( !p->pPars->fNotVerbose )
|
||||
|
|
@ -493,6 +493,8 @@ int IPdr_ManSolveInt( Pdr_Man_t * p, int fCheckClauses, int fPushClauses )
|
|||
assert( Vec_PtrEntry(p->vCexes, p->iOutCur) == NULL );
|
||||
if ( p->pPars->fUseBridge )
|
||||
Gia_ManToBridgeResult( stdout, 0, pCexNew, pCexNew->iPo );
|
||||
if ( p->pPars->pCexFilePrefix )
|
||||
Pdr_OutputCexToDir( p->pPars, pCexNew );
|
||||
Vec_PtrWriteEntry( p->vCexes, p->iOutCur, pCexNew );
|
||||
if ( p->pPars->pFuncOnFail && p->pPars->pFuncOnFail(p->iOutCur, p->pPars->fStoreCex ? (Abc_Cex_t *)Vec_PtrEntry(p->vCexes, p->iOutCur) : NULL) )
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue