Various usability changes.

This commit is contained in:
Alan Mishchenko 2018-11-18 21:01:30 -08:00
parent 3315992920
commit 12908d3c25
10 changed files with 179 additions and 18 deletions

View File

@ -15114,6 +15114,7 @@ int Abc_CommandIProve( Abc_Frame_t * pAbc, int argc, char ** argv )
Prove_Params_t Params, * pParams = &Params;
Abc_Ntk_t * pNtk, * pNtkTemp;
int c, RetValue, iOut = -1;
char * pLogFileName = NULL;
abctime clk;
extern int Abc_NtkIvyProve( Abc_Ntk_t ** ppNtk, void * pPars );
@ -15124,7 +15125,7 @@ int Abc_CommandIProve( Abc_Frame_t * pAbc, int argc, char ** argv )
pParams->fUseRewriting = 1;
pParams->fVerbose = 0;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "NCFGLIrfbvh" ) ) != EOF )
while ( ( c = Extra_UtilGetopt( argc, argv, "NCFGMILrfbvh" ) ) != EOF )
{
switch ( c )
{
@ -15172,10 +15173,10 @@ int Abc_CommandIProve( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( pParams->nFraigingLimitMulti < 0 )
goto usage;
break;
case 'L':
case 'M':
if ( globalUtilOptind >= argc )
{
Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" );
Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" );
goto usage;
}
pParams->nMiteringLimitLast = atoi(argv[globalUtilOptind]);
@ -15194,6 +15195,15 @@ int Abc_CommandIProve( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( pParams->nTotalInspectLimit < 0 )
goto usage;
break;
case 'L':
if ( globalUtilOptind >= argc )
{
Abc_Print( -1, "Command line switch \"-L\" should be followed by a file name.\n" );
goto usage;
}
pLogFileName = argv[globalUtilOptind];
globalUtilOptind++;
break;
case 'r':
pParams->fUseRewriting ^= 1;
break;
@ -15267,17 +15277,20 @@ int Abc_CommandIProve( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Cex_t * pCex = Abc_CexDeriveFromCombModel( pNtkTemp->pModel, Abc_NtkPiNum(pNtkTemp), 0, iOut );
Abc_FrameReplaceCex( pAbc, &pCex );
}
if ( pLogFileName )
Abc_NtkWriteLogFile( pLogFileName, pAbc->pCex, pAbc->Status, pAbc->nFrames, "iprove" );
return 0;
usage:
Abc_Print( -2, "usage: iprove [-NCFGLI num] [-rfbvh]\n" );
Abc_Print( -2, "usage: iprove [-NCFGMI num] [-L file] [-rfbvh]\n" );
Abc_Print( -2, "\t performs CEC using a new method\n" );
Abc_Print( -2, "\t-N num : max number of iterations [default = %d]\n", pParams->nItersMax );
Abc_Print( -2, "\t-C num : max starting number of conflicts in mitering [default = %d]\n", pParams->nMiteringLimitStart );
Abc_Print( -2, "\t-F num : max starting number of conflicts in fraiging [default = %d]\n", pParams->nFraigingLimitStart );
Abc_Print( -2, "\t-G num : multiplicative coefficient for fraiging [default = %d]\n", (int)pParams->nFraigingLimitMulti );
Abc_Print( -2, "\t-L num : max last-gasp number of conflicts in mitering [default = %d]\n", pParams->nMiteringLimitLast );
Abc_Print( -2, "\t-M num : max last-gasp number of conflicts in mitering [default = %d]\n", pParams->nMiteringLimitLast );
Abc_Print( -2, "\t-I num : max number of clause inspections in all SAT calls [default = %d]\n", (int)pParams->nTotalInspectLimit );
Abc_Print( -2, "\t-L file: the log file name [default = %s]\n", pLogFileName ? pLogFileName : "no logging" );
Abc_Print( -2, "\t-r : toggle the use of rewriting [default = %s]\n", pParams->fUseRewriting? "yes": "no" );
Abc_Print( -2, "\t-f : toggle the use of FRAIGing [default = %s]\n", pParams->fUseFraiging? "yes": "no" );
Abc_Print( -2, "\t-b : toggle the use of BDDs [default = %s]\n", pParams->fUseBdds? "yes": "no" );
@ -27781,10 +27794,11 @@ int Abc_CommandPdr( Abc_Frame_t * pAbc, int argc, char ** argv )
extern int Abc_NtkDarPdr( Abc_Ntk_t * pNtk, Pdr_Par_t * pPars );
Pdr_Par_t Pars, * pPars = &Pars;
Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc), * pNtkUsed, * pNtkFlop = NULL;
char * pLogFileName = NULL;
int c;
Pdr_ManSetDefaultParams( pPars );
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "MFCDQTHGSaxrmuyfqipdegjonctkvwzh" ) ) != EOF )
while ( ( c = Extra_UtilGetopt( argc, argv, "MFCDQTHGSLaxrmuyfqipdegjonctkvwzh" ) ) != EOF )
{
switch ( c )
{
@ -27887,6 +27901,15 @@ int Abc_CommandPdr( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( pPars->nRandomSeed < 0 )
goto usage;
break;
case 'L':
if ( globalUtilOptind >= argc )
{
Abc_Print( -1, "Command line switch \"-L\" should be followed by a file name.\n" );
goto usage;
}
pLogFileName = argv[globalUtilOptind];
globalUtilOptind++;
break;
case 'a':
pPars->fSolveAll ^= 1;
break;
@ -27984,10 +28007,12 @@ int Abc_CommandPdr( Abc_Frame_t * pAbc, int argc, char ** argv )
else
Abc_FrameReplaceCex( pAbc, &pNtkUsed->pSeqModel );
if ( pNtkFlop ) Abc_NtkDelete( pNtkFlop );
if ( pLogFileName )
Abc_NtkWriteLogFile( pLogFileName, pAbc->pCex, pAbc->Status, pAbc->nFrames, "pdr" );
return 0;
usage:
Abc_Print( -2, "usage: pdr [-MFCDQTHGS <num>] [-axrmuyfqipdegjonctkvwzh]\n" );
Abc_Print( -2, "usage: pdr [-MFCDQTHGS <num>] [-L <file>] [-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" );
@ -28000,6 +28025,7 @@ usage:
Abc_Print( -2, "\t-H num : runtime limit per output, in miliseconds (with \"-a\") [default = %d]\n", pPars->nTimeOutOne );
Abc_Print( -2, "\t-G num : runtime gap since the last CEX (0 = no limit) [default = %d]\n", pPars->nTimeOutGap );
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-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" );

View File

@ -13,7 +13,7 @@ Abc_Ntk_t * Abc_NtkDarFold2( Abc_Ntk_t * pNtk, int fCompl, int fVerbose , int);
Abc_Ntk_t * Abc_NtkDarUnfold2( Abc_Ntk_t * pNtk, int nFrames, int nConfs, int nProps, int fStruct, int fOldAlgo, int fVerbose )
{
Abc_Ntk_t * pNtkAig;
Aig_Man_t * pMan, * pTemp;
Aig_Man_t * pMan, * pTemp = NULL;
int typeII_cnt = 0;
assert( Abc_NtkIsStrash(pNtk) );
pMan = Abc_NtkToDar( pNtk, 0, 1 );

View File

@ -227,7 +227,16 @@ int Abc_NtkReadLogFile( char * pFileName, Abc_Cex_t ** ppCex, int * pnFrames )
ABC_FREE( pCex );
}
else
Vec_IntFree( vNums );
{
// corner case of seq circuit with no PIs
int iFrameCex = (nFrames2 == -1) ? nFrames : nFrames2;
pCex = Abc_CexAlloc( 0, 0, iFrameCex + 1 );
pCex->iFrame = iFrameCex;
pCex->iPo = iPo;
if ( ppCex )
*ppCex = pCex;
Vec_IntFree( vNums );
}
if ( pnFrames )
*pnFrames = nFrames;
return Status;

View File

@ -1106,7 +1106,7 @@ int Abc_RecToGia3( Gia_Man_t * pMan, If_Man_t * pIfMan, If_Cut_t * pCut, Vec_Int
{
Lms_Man_t * p = s_pMan3;
char pCanonPerm[LMS_VAR_MAX];
unsigned uCanonPhase;
unsigned uCanonPhase = 0;
int iFan0, iFan1, iGiaObj;
Gia_Man_t * pGia = p->pGia;
Gia_Obj_t * pGiaPo, * pGiaTemp = NULL;

View File

@ -2421,6 +2421,8 @@ int IoCommandWriteCex( Abc_Frame_t * pAbc, int argc, char **argv )
{
extern Aig_Man_t * Abc_NtkToDar( Abc_Ntk_t * pNtk, int fExors, int fRegisters );
Aig_Man_t * pAig = Abc_NtkToDar( pNtk, 0, 1 );
fprintf( pFile, "# FALSIFYING OUTPUTS:");
fprintf( pFile, " %s", Abc_ObjName(Abc_NtkCo(pNtk, pCex->iPo)) );
if ( fUseOldMin )
{
pCare = Saig_ManCbaFindCexCareBits( pAig, pCex, 0, fVerbose );
@ -2432,15 +2434,24 @@ int IoCommandWriteCex( Abc_Frame_t * pAbc, int argc, char **argv )
else
pCare = Bmc_CexCareMinimize( pAig, Saig_ManPiNum(pAig), pCex, 4, fCheckCex, fVerbose );
Aig_ManStop( pAig );
if(pCare == NULL)
printf( "Counter-example minimization has failed.\n" );
}
else
{
fprintf( pFile, "# FALSIFYING OUTPUTS:");
fprintf( pFile, " %s", Abc_ObjName(Abc_NtkCo(pNtk, pCex->iPo)) );
}
fprintf( pFile, "\n");
fprintf( pFile, "# COUNTEREXAMPLE LENGTH: %u\n", pCex->iFrame+1);
// output flop values (unaffected by the minimization)
Abc_NtkForEachLatch( pNtk, pObj, i )
fprintf( pFile, "%s@0=%c ", Abc_ObjName(Abc_ObjFanout0(pObj)), '0'+!Abc_LatchIsInit0(pObj) );
fprintf( pFile, "%s@0=%c\n", Abc_ObjName(Abc_ObjFanout0(pObj)), '0'+!Abc_LatchIsInit0(pObj) );
// output PI values (while skipping the minimized ones)
for ( f = 0; f <= pCex->iFrame; f++ )
Abc_NtkForEachPi( pNtk, pObj, i )
if ( !pCare || Abc_InfoHasBit(pCare->pData, pCare->nRegs+pCare->nPis*f + i) )
fprintf( pFile, "%s@%d=%c ", Abc_ObjName(pObj), f, '0'+Abc_InfoHasBit(pCex->pData, pCex->nRegs+pCex->nPis*f + i) );
fprintf( pFile, "%s@%d=%c\n", Abc_ObjName(pObj), f, '0'+Abc_InfoHasBit(pCex->pData, pCex->nRegs+pCex->nPis*f + i) );
Abc_CexFreeP( &pCare );
}
else
@ -2455,7 +2466,7 @@ int IoCommandWriteCex( Abc_Frame_t * pAbc, int argc, char **argv )
fprintf( pFile, "%c", '0'+Abc_InfoHasBit(pCex->pData, i) );
}
}
fprintf( pFile, "\n" );
fprintf( pFile, "# DONE\n" );
fclose( pFile );
}
else

View File

@ -31,6 +31,58 @@ ABC_NAMESPACE_IMPL_START
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Wlc_NtkPrintInputInfo( Wlc_Ntk_t * pNtk )
{
Wlc_Obj_t * pObj;
int i, k, nRange, nBeg, nEnd, nBits = 0;
FILE * output;
output = fopen("abc_blast_input.info","w");
Wlc_NtkForEachCi( pNtk, pObj, i )
{
nRange = Wlc_ObjRange(pObj);
nBeg = pObj->Beg;
nEnd = pObj->End;
for ( k = 0; k < nRange; k++ )
{
int index = nEnd > nBeg ? nBeg + k : nEnd + k;
char c = pObj->Type != WLC_OBJ_FO ? 'i' : pNtk->pInits[nBits + k];
fprintf(output,"%s[%d] : %c \n", Wlc_ObjName(pNtk, Wlc_ObjId(pNtk, pObj)), index , c );
}
if (pObj->Type == WLC_OBJ_FO)
nBits += nRange;
}
Wlc_NtkForEachPo( pNtk, pObj, i )
{
nRange = Wlc_ObjRange(pObj);
nBeg = pObj->Beg;
nEnd = pObj->End;
for ( k = 0; k < nRange; k++ )
{
int index = nEnd > nBeg ? nBeg + k : nEnd + k;
fprintf(output,"%s[%d] : o \n", Wlc_ObjName(pNtk, Wlc_ObjId(pNtk, pObj)), index);
}
}
fclose(output);
return;
}
/**Function*************************************************************
Synopsis []

View File

@ -173,7 +173,7 @@ void Wlc_BlastShiftRight( Gia_Man_t * pNew, int * pNum, int nNum, int * pShift,
int nShiftMax = Abc_Base2Log(nNum);
int * pShiftNew = ABC_ALLOC( int, nShift );
memcpy( pShiftNew, pShift, sizeof(int)*nShift );
if ( nShiftMax < nShift )
if ( nShiftMax < nShift && nShift > 30 )
{
int i, iRes = pShiftNew[nShiftMax];
for ( i = nShiftMax + 1; i < nShift; i++ )

View File

@ -970,13 +970,14 @@ usage:
******************************************************************************/
int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv )
{
extern void Wlc_NtkPrintInputInfo( Wlc_Ntk_t * pNtk );
Wlc_Ntk_t * pNtk = Wlc_AbcGetNtk(pAbc);
Gia_Man_t * pNew = NULL; int c, fMiter = 0, fDumpNames = 0;
Gia_Man_t * pNew = NULL; int c, fMiter = 0, fDumpNames = 0, fPrintInputInfo = 0;
Wlc_BstPar_t Par, * pPar = &Par;
Wlc_BstParDefault( pPar );
pPar->nOutputRange = 2;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "ORAMcombadstnvh" ) ) != EOF )
while ( ( c = Extra_UtilGetopt( argc, argv, "ORAMcombadstnivh" ) ) != EOF )
{
switch ( c )
{
@ -1052,6 +1053,9 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'n':
fDumpNames ^= 1;
break;
case 'i':
fPrintInputInfo ^= 1;
break;
case 'v':
pPar->fVerbose ^= 1;
break;
@ -1066,6 +1070,8 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( 1, "Abc_CommandBlast(): There is no current design.\n" );
return 0;
}
if ( fPrintInputInfo )
Wlc_NtkPrintInputInfo(pNtk);
if ( pPar->fMulti )
{
pPar->vBoxIds = Wlc_NtkCollectMultipliers( pNtk );
@ -1118,7 +1124,7 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_FrameUpdateGia( pAbc, pNew );
return 0;
usage:
Abc_Print( -2, "usage: %%blast [-ORAM num] [-combadstnvh]\n" );
Abc_Print( -2, "usage: %%blast [-ORAM num] [-combadstnivh]\n" );
Abc_Print( -2, "\t performs bit-blasting of the word-level design\n" );
Abc_Print( -2, "\t-O num : zero-based index of the first word-level PO to bit-blast [default = %d]\n", pPar->iOutput );
Abc_Print( -2, "\t-R num : the total number of word-level POs to bit-blast [default = %d]\n", pPar->nOutputRange );
@ -1133,6 +1139,7 @@ usage:
Abc_Print( -2, "\t-s : toggle creating decoded MUXes [default = %s]\n", pPar->fDecMuxes? "yes": "no" );
Abc_Print( -2, "\t-t : toggle creating regular multi-output miter [default = %s]\n", fMiter? "yes": "no" );
Abc_Print( -2, "\t-n : toggle dumping signal names into a text file [default = %s]\n", fDumpNames? "yes": "no" );
Abc_Print( -2, "\t-i : toggle to print input names after blasting [default = %s]\n", fPrintInputInfo ? "yes": "no" );
Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", pPar->fVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n");
return 1;

View File

@ -1203,7 +1203,13 @@ startword:
break;
}
// check range of the control
if ( nValues != Vec_IntSize(p->vFanins) - 1 )
if ( nValues < Vec_IntSize(p->vFanins) - 1 ) // may occur if default is not there
{
//return Wlc_PrsWriteErrorMessage( p, pStart, "The number of values in the case statement is wrong.", pName );
printf( "Warning: The number of values in the case statement is wrong.\n" );
Vec_IntShrink(p->vFanins,nValues+1);
}
else if ( nValues > Vec_IntSize(p->vFanins) - 1 )
return Wlc_PrsWriteErrorMessage( p, pStart, "The number of values in the case statement is wrong.", pName );
if ( Wlc_ObjRange(pObj) == 1 )
{
@ -1526,6 +1532,55 @@ startword:
Wlc_ObjAddFanins( p->pNtk, pObj, p->vFanins );
p->pNtk->fMemPorts = 1;
}
else if ( Wlc_PrsStrCmp( pStart, "CPL_RROT" ) || Wlc_PrsStrCmp( pStart, "CPL_LROT" ) )
{
// CPL_RROT #(128, 6) I_47479(.o ( E_46713 ) , .d ( E_46718 ) , .s ( E_46712 ) );
int right_rotation = Wlc_PrsStrCmp( pStart, "CPL_RROT" );
int NameId = -1, NameIdOut = -1, NameIdInD = -1, NameIdInS = -1, fFound, fRotInD, fRotInS, fRotOut;
pStart += strlen("CPL_RROT");
// NOTE: no need to parse the parameter values
//if ( pStart[0] == '#' )
// read names
while ( 1 )
{
pStart = Wlc_PrsFindSymbol( pStart, '.' );
if ( pStart == NULL )
break;
pStart = Wlc_PrsSkipSpaces( pStart+1 );
if ( pStart[0] != 'o' && pStart[0] != 'd' && pStart[0] != 's')
continue;
fRotInD = (pStart[0] == 'd');
fRotInS = (pStart[0] == 's');
fRotOut = (pStart[0] == 'o');
pStart = Wlc_PrsFindSymbol( pStart, '(' );
if ( pStart == NULL )
return Wlc_PrsWriteErrorMessage( p, pStart, "Cannot read opening parenthesis in the rotation description." );
pStart = Wlc_PrsFindName( pStart+1, &pName );
if ( pStart == NULL )
return Wlc_PrsWriteErrorMessage( p, pStart, "Cannot read name inside rotation description." );
if ( fRotInD )
NameIdInD = Abc_NamStrFindOrAdd( p->pNtk->pManName, pName, &fFound );
else if ( fRotInS )
NameIdInS = Abc_NamStrFindOrAdd( p->pNtk->pManName, pName, &fFound );
else if ( fRotOut )
NameIdOut = Abc_NamStrFindOrAdd( p->pNtk->pManName, pName, &fFound );
else
NameId = Abc_NamStrFindOrAdd( p->pNtk->pManName, pName, &fFound );
if ( !fFound )
return Wlc_PrsWriteErrorMessage( p, pStart, "Name %s is not declared.", pName );
}
if ( NameIdOut == -1 || NameIdInD == -1 || NameIdInS == -1 )
return Wlc_PrsWriteErrorMessage( p, pStart, "Some fields of CPL_ROT are missing." );
// create rot output
pObj = Wlc_NtkObj( p->pNtk, NameIdOut );
Wlc_ObjUpdateType( p->pNtk, pObj, right_rotation ? WLC_OBJ_ROTATE_R : WLC_OBJ_ROTATE_L );
Vec_IntClear( p->vFanins );
Vec_IntPush( p->vFanins, NameIdInD );
Vec_IntPush( p->vFanins, NameIdInS );
Wlc_ObjAddFanins( p->pNtk, pObj, p->vFanins );
}
else if ( pStart[0] == '(' && pStart[1] == '*' ) // skip comments
{
while ( *pStart++ != ')' );

View File

@ -1427,6 +1427,7 @@ int Pdr_ManSolve( Aig_Man_t * pAig, Pdr_Par_t * pPars )
char * pFileName = Extra_FileNameGenericAppend(p->pAig->pName, "_inv.pla");
Abc_FrameSetInv( Pdr_ManDeriveInfinityClauses( p, RetValue!=1 ) );
Pdr_ManDumpClauses( p, pFileName, RetValue==1 );
printf( "Dumpted invariable in file \"%s\".\n", pFileName );
}
else if ( RetValue == 1 )
Abc_FrameSetInv( Pdr_ManDeriveInfinityClauses( p, RetValue!=1 ) );