Commit 74ff01bf by Alan Mishchenko

Version abc80515

parent 37b6c727
......@@ -56,6 +56,7 @@ alias r3f retime -M 3 -f
alias r3b retime -M 3 -b
alias ren renode
alias rh read_hie
alias ri read_init
alias rl read_blif
alias rb read_bench
alias ret retime
......
......@@ -51,6 +51,7 @@ extern "C" {
typedef struct Fra_Par_t_ Fra_Par_t;
typedef struct Fra_Ssw_t_ Fra_Ssw_t;
typedef struct Fra_Sec_t_ Fra_Sec_t;
typedef struct Fra_Man_t_ Fra_Man_t;
typedef struct Fra_Cla_t_ Fra_Cla_t;
typedef struct Fra_Sml_t_ Fra_Sml_t;
......@@ -87,7 +88,7 @@ struct Fra_Par_t_
int fDontShowBar; // does not show progressbar during fraiging
};
// seq SAT sweeping parametesr
// seq SAT sweeping parameters
struct Fra_Ssw_t_
{
int nPartSize; // size of the partition
......@@ -107,6 +108,27 @@ struct Fra_Ssw_t_
float TimeLimit; // the runtime budget for this call
};
// SEC parametesr
struct Fra_Sec_t_
{
int fTryComb; // try CEC call as a preprocessing step
int fTryBmc; // try BMC call as a preprocessing step
int nFramesMax; // the max number of frames used for induction
int fPhaseAbstract; // enables phase abstraction
int fRetimeFirst; // enables most-forward retiming at the beginning
int fRetimeRegs; // enables min-register retiming at the beginning
int fFraiging; // enables fraiging at the beginning
int fInterpolation; // enables interpolation
int fReachability; // enables BDD based reachability
int fStopOnFirstFail; // enables stopping after first output of a miter has failed to prove
int fVerbose; // enables verbose reporting of statistics
int fVeryVerbose; // enables very verbose reporting
int TimeLimit; // enables the timeout
// internal parameters
int fRecursive; // set to 1 when SEC is called recursively
int fReportSolution; // enables report solution in a special form
};
// FRAIG equivalence classes
struct Fra_Cla_t_
{
......@@ -329,7 +351,8 @@ extern int Fra_NodesAreImp( Fra_Man_t * p, Aig_Obj_t * pOld, Aig
extern int Fra_NodesAreClause( Fra_Man_t * p, Aig_Obj_t * pOld, Aig_Obj_t * pNew, int fComplL, int fComplR );
extern int Fra_NodeIsConst( Fra_Man_t * p, Aig_Obj_t * pNew );
/*=== fraSec.c ========================================================*/
extern int Fra_FraigSec( Aig_Man_t * p, int nFrames, int fPhaseAbstract, int fRetimeFirst, int fRetimeRegs, int fFraiging, int fVerbose, int fVeryVerbose, int TimeLimit );
extern void Fra_SecSetDefaultParams( Fra_Sec_t * p );
extern int Fra_FraigSec( Aig_Man_t * p, Fra_Sec_t * pParSec );
/*=== fraSim.c ========================================================*/
extern int Fra_SmlNodeHash( Aig_Obj_t * pObj, int nTableSize );
extern int Fra_SmlNodeIsConst( Aig_Obj_t * pObj );
......
......@@ -69,20 +69,10 @@ int Ioa_FileSize( char * pFileName )
***********************************************************************/
char * Ioa_FileNameGeneric( char * FileName )
{
char * pDot;
char * pUnd;
char * pRes;
// find the generic name of the file
char * pDot, * pRes;
pRes = Aig_UtilStrsav( FileName );
// find the pointer to the "." symbol in the file name
// pUnd = strstr( FileName, "_" );
pUnd = NULL;
pDot = strstr( FileName, "." );
if ( pUnd )
pRes[pUnd - FileName] = 0;
else if ( pDot )
pRes[pDot - FileName] = 0;
if ( (pDot = strrchr( pRes, '.' )) )
*pDot = 0;
return pRes;
}
......@@ -107,8 +97,7 @@ char * Ioa_FileNameGenericAppend( char * pBase, char * pSuffix )
return Buffer;
}
strcpy( Buffer, pBase );
pDot = strstr( Buffer, "." );
if ( pDot )
if ( (pDot = strrchr( Buffer, '.' )) )
*pDot = 0;
strcat( Buffer, pSuffix );
// find the last occurrance of slash
......
......@@ -174,19 +174,10 @@ int Nwk_ManCompareAndSaveBest( Nwk_Man_t * pNtk, void * pNtl )
***********************************************************************/
char * Nwk_FileNameGeneric( char * FileName )
{
char * pDot;
char * pUnd;
char * pRes;
// find the generic name of the file
char * pDot, * pRes;
pRes = Aig_UtilStrsav( FileName );
// find the pointer to the "." symbol in the file name
// pUnd = strstr( FileName, "_" );
pUnd = NULL;
pDot = strstr( FileName, "." );
if ( pUnd )
pRes[pUnd - FileName] = 0;
else if ( pDot )
pRes[pDot - FileName] = 0;
if ( (pDot = strrchr( pRes, '.' )) )
*pDot = 0;
return pRes;
}
......
......@@ -182,7 +182,6 @@ int Saig_ManBmcSimple( Aig_Man_t * pAig, int nFrames, int nSizeMax, int nConfLim
Aig_Man_t * pFrames, * pAigTemp;
Aig_Obj_t * pObj;
int status, clk, Lit, i, RetValue = 1;
*piFrame = -1;
// derive the timeframes
clk = clock();
if ( nSizeMax > 0 )
......@@ -192,6 +191,7 @@ int Saig_ManBmcSimple( Aig_Man_t * pAig, int nFrames, int nSizeMax, int nConfLim
}
else
pFrames = Saig_ManFramesBmc( pAig, nFrames );
*piFrame = nFrames;
if ( fVerbose )
{
printf( "AIG: PI/PO/Reg = %d/%d/%d. Node = %6d. Lev = %5d.\n",
......
......@@ -178,6 +178,7 @@ Aig_Man_t * Saig_ManTransformed( Aig_Man_t * p )
Saig_ManForEachLiLo( p, pObjLi, pObjLo, i )
{
pObj = Aig_Mux( pNew, pCtrl, pObjLo->pData, Aig_ObjChild0Copy(pObjLi) );
// pObj = Aig_Mux( pNew, pCtrl, Aig_ManConst0(pNew), Aig_ObjChild0Copy(pObjLi) );
Aig_ObjCreatePo( pNew, pObj );
}
Aig_ManCleanup( pNew );
......@@ -566,10 +567,10 @@ p->timeCnf += clock() - clk;
// iterate the interpolation procedure
for ( i = 0; ; i++ )
{
if ( p->nFrames + i >= 100 )
if ( p->nFrames + i >= 75 )
{
if ( fVerbose )
printf( "Reached limit (%d) on the number of timeframes.\n", 100 );
printf( "Reached limit (%d) on the number of timeframes.\n", 75 );
p->timeTotal = clock() - clkTotal;
Saig_ManagerFree( p );
return -1;
......
Comparing files abcDfs.c and C:\_PROJECTS\AARON\FRETIME\SRC\BASE\ABC\ABCDFS.C
***** abcDfs.c
return pNode->Level;
assert( Abc_ObjIsNode( pNode ) );
// if this node is already visited, return
***** C:\_PROJECTS\AARON\FRETIME\SRC\BASE\ABC\ABCDFS.C
return pNode->Level;
assert( Abc_ObjIsNode( pNode ) || pNode->Type == ABC_OBJ_CONST1);
// if this node is already visited, return
*****
***** abcDfs.c
return pNode->Level;
assert( Abc_ObjIsNode( pNode ) );
// if this node is already visited, return
***** C:\_PROJECTS\AARON\FRETIME\SRC\BASE\ABC\ABCDFS.C
return pNode->Level;
assert( Abc_ObjIsNode( pNode ) || pNode->Type == ABC_OBJ_CONST1);
// if this node is already visited, return
*****
......@@ -135,6 +135,7 @@ static inline int Abc_StringGetNumber( char ** ppStr )
***********************************************************************/
int Abc_NodeStrashBlifMv( Abc_Ntk_t * pNtkNew, Abc_Obj_t * pObj )
{
int fAddFreeVars = 1;
char * pSop;
Abc_Obj_t ** pValues, ** pValuesF, ** pValuesF2;
Abc_Obj_t * pTemp, * pTemp2, * pFanin, * pFanin2, * pNet;
......@@ -168,7 +169,17 @@ int Abc_NodeStrashBlifMv( Abc_Ntk_t * pNtkNew, Abc_Obj_t * pObj )
else
Index = Abc_StringGetNumber( &pSop );
assert( Index < nValues );
pValues[Index] = Abc_AigConst1(pNtkNew);
////////////////////////////////////////////
// adding free variables for binary ND-constants
if ( fAddFreeVars && nValues == 2 && *pSop == '-' )
{
pValues[1] = Abc_NtkCreatePi(pNtkNew);
pValues[0] = Abc_ObjNot( pValues[1] );
Abc_ObjAssignName( pValues[1], "free_var_", Abc_ObjName(pValues[1]) );
}
else
pValues[Index] = Abc_AigConst1(pNtkNew);
////////////////////////////////////////////
// save the values in the fanout net
pNet->pCopy = (Abc_Obj_t *)pValues;
return 1;
......@@ -414,7 +425,10 @@ Abc_Ntk_t * Abc_NtkStrashBlifMv( Abc_Ntk_t * pNtk )
for ( v = 0; v < nValues; v++ )
{
pValues[v] = Abc_NtkCreatePi( pNtkNew );
Abc_NtkConvertAssignName( pValues[v], pNet, v );
if ( nValuesMax == 2 )
Abc_ObjAssignName( pValues[v], Abc_ObjName(pNet), NULL );
else
Abc_NtkConvertAssignName( pValues[v], pNet, v );
}
// save the values in the fanout net
pNet->pCopy = (Abc_Obj_t *)pValues;
......@@ -432,7 +446,10 @@ Abc_Ntk_t * Abc_NtkStrashBlifMv( Abc_Ntk_t * pNtk )
for ( v = 0; v < nValues; v++ )
{
pValues[v] = Abc_NtkCreateBo( pNtkNew );
Abc_NtkConvertAssignName( pValues[v], pNet, v );
if ( nValuesMax == 2 )
Abc_ObjAssignName( pValues[v], Abc_ObjName(pNet), NULL );
else
Abc_NtkConvertAssignName( pValues[v], pNet, v );
nCount1++;
}
// save the values in the fanout net
......@@ -455,7 +472,10 @@ Abc_Ntk_t * Abc_NtkStrashBlifMv( Abc_Ntk_t * pNtk )
for ( k = 0; k < nBits; k++ )
{
pBits[k] = Abc_NtkCreatePi( pNtkNew );
Abc_NtkConvertAssignName( pBits[k], pNet, k );
if ( nValuesMax == 2 )
Abc_ObjAssignName( pBits[k], Abc_ObjName(pNet), NULL );
else
Abc_NtkConvertAssignName( pBits[k], pNet, k );
}
// encode the values
for ( v = 0; v < nValues; v++ )
......@@ -484,7 +504,10 @@ Abc_Ntk_t * Abc_NtkStrashBlifMv( Abc_Ntk_t * pNtk )
for ( k = 0; k < nBits; k++ )
{
pBits[k] = Abc_NtkCreateBo( pNtkNew );
Abc_NtkConvertAssignName( pBits[k], pNet, k );
if ( nValuesMax == 2 )
Abc_ObjAssignName( pBits[k], Abc_ObjName(pNet), NULL );
else
Abc_NtkConvertAssignName( pBits[k], pNet, k );
nCount1++;
}
// encode the values
......@@ -522,16 +545,19 @@ Abc_Ntk_t * Abc_NtkStrashBlifMv( Abc_Ntk_t * pNtk )
continue;
pNet = Abc_ObjFanin0(pObj);
// skip marked nets
if ( Abc_NodeIsTravIdCurrent(pNet) )
continue;
Abc_NodeSetTravIdCurrent( pNet );
// if ( Abc_NodeIsTravIdCurrent(pNet) )
// continue;
// Abc_NodeSetTravIdCurrent( pNet );
nValues = Abc_ObjMvVarNum(pNet);
pValues = (Abc_Obj_t **)pNet->pCopy;
for ( v = 0; v < nValues; v++ )
{
pTemp = Abc_NtkCreatePo( pNtkNew );
Abc_ObjAddFanin( pTemp, pValues[v] );
Abc_NtkConvertAssignName( pTemp, pNet, v );
if ( nValuesMax == 2 )
Abc_ObjAssignName( pTemp, Abc_ObjName(pNet), NULL );
else
Abc_NtkConvertAssignName( pTemp, pNet, v );
}
}
Abc_NtkForEachCo( pNtk, pObj, i )
......@@ -540,21 +566,24 @@ Abc_Ntk_t * Abc_NtkStrashBlifMv( Abc_Ntk_t * pNtk )
continue;
pNet = Abc_ObjFanin0(pObj);
// skip marked nets
if ( Abc_NodeIsTravIdCurrent(pNet) )
continue;
Abc_NodeSetTravIdCurrent( pNet );
// if ( Abc_NodeIsTravIdCurrent(pNet) )
// continue;
// Abc_NodeSetTravIdCurrent( pNet );
nValues = Abc_ObjMvVarNum(pNet);
pValues = (Abc_Obj_t **)pNet->pCopy;
for ( v = 0; v < nValues; v++ )
{
pTemp = Abc_NtkCreateBi( pNtkNew );
Abc_ObjAddFanin( pTemp, pValues[v] );
Abc_NtkConvertAssignName( pTemp, pNet, v );
if ( nValuesMax == 2 )
Abc_ObjAssignName( pTemp, Abc_ObjName(pNet), NULL );
else
Abc_NtkConvertAssignName( pTemp, pNet, v );
nCount2++;
}
}
}
else
else // if ( fPositional == 0 )
{
Abc_NtkForEachCo( pNtk, pObj, i )
{
......@@ -562,9 +591,9 @@ Abc_Ntk_t * Abc_NtkStrashBlifMv( Abc_Ntk_t * pNtk )
continue;
pNet = Abc_ObjFanin0(pObj);
// skip marked nets
if ( Abc_NodeIsTravIdCurrent(pNet) )
continue;
Abc_NodeSetTravIdCurrent( pNet );
// if ( Abc_NodeIsTravIdCurrent(pNet) )
// continue;
// Abc_NodeSetTravIdCurrent( pNet );
nValues = Abc_ObjMvVarNum(pNet);
pValues = (Abc_Obj_t **)pNet->pCopy;
nBits = Extra_Base2Log( nValues );
......@@ -576,7 +605,10 @@ Abc_Ntk_t * Abc_NtkStrashBlifMv( Abc_Ntk_t * pNtk )
pBit = Abc_AigOr( pNtkNew->pManFunc, pBit, pValues[v] );
pTemp = Abc_NtkCreatePo( pNtkNew );
Abc_ObjAddFanin( pTemp, pBit );
Abc_NtkConvertAssignName( pTemp, pNet, k );
if ( nValuesMax == 2 )
Abc_ObjAssignName( pTemp, Abc_ObjName(pNet), NULL );
else
Abc_NtkConvertAssignName( pTemp, pNet, k );
}
}
Abc_NtkForEachCo( pNtk, pObj, i )
......@@ -585,9 +617,9 @@ Abc_Ntk_t * Abc_NtkStrashBlifMv( Abc_Ntk_t * pNtk )
continue;
pNet = Abc_ObjFanin0(pObj);
// skip marked nets
if ( Abc_NodeIsTravIdCurrent(pNet) )
continue;
Abc_NodeSetTravIdCurrent( pNet );
// if ( Abc_NodeIsTravIdCurrent(pNet) )
// continue;
// Abc_NodeSetTravIdCurrent( pNet );
nValues = Abc_ObjMvVarNum(pNet);
pValues = (Abc_Obj_t **)pNet->pCopy;
nBits = Extra_Base2Log( nValues );
......@@ -599,7 +631,10 @@ Abc_Ntk_t * Abc_NtkStrashBlifMv( Abc_Ntk_t * pNtk )
pBit = Abc_AigOr( pNtkNew->pManFunc, pBit, pValues[v] );
pTemp = Abc_NtkCreateBi( pNtkNew );
Abc_ObjAddFanin( pTemp, pBit );
Abc_NtkConvertAssignName( pTemp, pNet, k );
if ( nValuesMax == 2 )
Abc_ObjAssignName( pTemp, Abc_ObjName(pNet), NULL );
else
Abc_NtkConvertAssignName( pTemp, pNet, k );
nCount2++;
}
}
......@@ -607,8 +642,32 @@ Abc_Ntk_t * Abc_NtkStrashBlifMv( Abc_Ntk_t * pNtk )
if ( Abc_NtkLatchNum(pNtk) )
{
Vec_Ptr_t * vTemp;
Abc_Obj_t * pLatch, * pObjLi, * pObjLo;
int i;
// move free vars to the front among the PIs
vTemp = Vec_PtrAlloc( Vec_PtrSize(pNtkNew->vPis) );
Abc_NtkForEachPi( pNtkNew, pObj, i )
if ( strncmp( Abc_ObjName(pObj), "free_var_", 9 ) == 0 )
Vec_PtrPush( vTemp, pObj );
Abc_NtkForEachPi( pNtkNew, pObj, i )
if ( strncmp( Abc_ObjName(pObj), "free_var_", 9 ) != 0 )
Vec_PtrPush( vTemp, pObj );
assert( Vec_PtrSize(vTemp) == Vec_PtrSize(pNtkNew->vPis) );
Vec_PtrFree( pNtkNew->vPis );
pNtkNew->vPis = vTemp;
// move free vars to the front among the CIs
vTemp = Vec_PtrAlloc( Vec_PtrSize(pNtkNew->vCis) );
Abc_NtkForEachCi( pNtkNew, pObj, i )
if ( strncmp( Abc_ObjName(pObj), "free_var_", 9 ) == 0 )
Vec_PtrPush( vTemp, pObj );
Abc_NtkForEachCi( pNtkNew, pObj, i )
if ( strncmp( Abc_ObjName(pObj), "free_var_", 9 ) != 0 )
Vec_PtrPush( vTemp, pObj );
assert( Vec_PtrSize(vTemp) == Vec_PtrSize(pNtkNew->vCis) );
Vec_PtrFree( pNtkNew->vCis );
pNtkNew->vCis = vTemp;
// create registers
assert( nCount1 == nCount2 );
for ( i = 0; i < nCount1; i++ )
{
......
......@@ -92,6 +92,10 @@ void Abc_ObjAddFanin( Abc_Obj_t * pObj, Abc_Obj_t * pFanin )
{
int x = 0;
}
if ( pObj->Id == 1960 )
{
int x = 0;
}
// printf( "Adding fanin of %s ", Abc_ObjName(pObj) );
// printf( "to be %s\n", Abc_ObjName(pFanin) );
}
......
......@@ -1229,7 +1229,7 @@ int Abc_NtkDarBmc( Abc_Ntk_t * pNtk, int nFrames, int nSizeMax, int nBTLimit, in
RetValue = Saig_ManBmcSimple( pMan, nFrames, nSizeMax, nBTLimit, fRewrite, fVerbose, &iFrame );
pNtk->pSeqModel = pMan->pSeqModel; pMan->pSeqModel = NULL;
if ( RetValue == 1 )
printf( "No output was asserted in %d frames. ", nFrames );
printf( "No output was asserted in %d frames. ", iFrame );
else if ( RetValue == -1 )
printf( "No output was asserted in %d frames. Reached conflict limit (%d). ", iFrame, nBTLimit );
else // if ( RetValue == 0 )
......@@ -1309,15 +1309,17 @@ PRT( "Time", clock() - clk );
SeeAlso []
***********************************************************************/
int Abc_NtkDarProve( Abc_Ntk_t * pNtk, int fTryComb, int fTryBmc, int nFrames, int fPhaseAbstract, int fRetimeFirst, int fRetimeRegs, int fFraiging, int fVerbose, int fVeryVerbose, int TimeLimit )
int Abc_NtkDarProve( Abc_Ntk_t * pNtk, Fra_Sec_t * pSecPar )
{
Aig_Man_t * pMan;
int RetValue;
if ( fTryComb )
int RetValue, clkTotal = clock();
if ( pSecPar->fTryComb || Abc_NtkLatchNum(pNtk) == 0 )
{
Prove_Params_t Params, * pParams = &Params;
Abc_Ntk_t * pNtkComb;
int RetValue, clk = clock();
if ( Abc_NtkLatchNum(pNtk) == 0 )
printf( "The network has no latches. Running CEC.\n" );
// create combinational network
pNtkComb = Abc_NtkDup( pNtk );
Abc_NtkMakeComb( pNtkComb, 1 );
......@@ -1332,14 +1334,27 @@ int Abc_NtkDarProve( Abc_Ntk_t * pNtk, int fTryComb, int fTryBmc, int nFrames, i
{
printf( "Networks are equivalent after CEC. " );
PRT( "Time", clock() - clk );
if ( pSecPar->fReportSolution )
{
printf( "SOLUTION: PASS " );
PRT( "Time", clock() - clkTotal );
}
return RetValue;
}
}
if ( fTryBmc )
if ( pSecPar->fTryBmc )
{
RetValue = Abc_NtkDarBmc( pNtk, 20, 100000, 1000, 0, 1, 0 );
RetValue = Abc_NtkDarBmc( pNtk, 20, 100000, 2000, 0, 1, 0 );
if ( RetValue == 0 )
{
printf( "Networks are not equivalent.\n" );
if ( pSecPar->fReportSolution )
{
printf( "SOLUTION: FAIL " );
PRT( "Time", clock() - clkTotal );
}
return RetValue;
}
}
// derive the AIG manager
pMan = Abc_NtkToDar( pNtk, 0, 1 );
......@@ -1350,7 +1365,7 @@ int Abc_NtkDarProve( Abc_Ntk_t * pNtk, int fTryComb, int fTryBmc, int nFrames, i
}
assert( pMan->nRegs > 0 );
// perform verification
RetValue = Fra_FraigSec( pMan, nFrames, fPhaseAbstract, fRetimeFirst, fRetimeRegs, fFraiging, fVerbose, fVeryVerbose, TimeLimit );
RetValue = Fra_FraigSec( pMan, pSecPar );
pNtk->pSeqModel = pMan->pSeqModel; pMan->pSeqModel = NULL;
if ( pNtk->pSeqModel )
{
......@@ -1372,7 +1387,7 @@ int Abc_NtkDarProve( Abc_Ntk_t * pNtk, int fTryComb, int fTryBmc, int nFrames, i
SeeAlso []
***********************************************************************/
int Abc_NtkDarSec( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nFrames, int fPhaseAbstract, int fRetimeFirst, int fRetimeRegs, int fFraiging, int fVerbose, int fVeryVerbose )
int Abc_NtkDarSec( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, Fra_Sec_t * pSecPar )
{
// Fraig_Params_t Params;
Aig_Man_t * pMan;
......@@ -1392,8 +1407,8 @@ int Abc_NtkDarSec( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nFrames, int fPhase
extern void Abc_NtkVerifyReportErrorSeq( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int * pModel, int nFrames );
printf( "Networks are NOT EQUIVALENT after structural hashing.\n" );
// report the error
pMiter->pModel = Abc_NtkVerifyGetCleanModel( pMiter, nFrames );
Abc_NtkVerifyReportErrorSeq( pNtk1, pNtk2, pMiter->pModel, nFrames );
pMiter->pModel = Abc_NtkVerifyGetCleanModel( pMiter, pSecPar->nFramesMax );
Abc_NtkVerifyReportErrorSeq( pNtk1, pNtk2, pMiter->pModel, pSecPar->nFramesMax );
FREE( pMiter->pModel );
Abc_NtkDelete( pMiter );
return 0;
......@@ -1444,7 +1459,7 @@ int Abc_NtkDarSec( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nFrames, int fPhase
assert( pMan->nRegs > 0 );
// perform verification
RetValue = Fra_FraigSec( pMan, nFrames, fPhaseAbstract, fRetimeFirst, fRetimeRegs, fFraiging, fVerbose, fVeryVerbose, 0 );
RetValue = Fra_FraigSec( pMan, pSecPar );
Aig_ManStop( pMan );
return RetValue;
}
......
......@@ -683,7 +683,7 @@ int IoCommandReadInit( Abc_Frame_t * pAbc, int argc, char ** argv )
goto usage;
}
}
if ( argc != globalUtilOptind + 1 )
if ( argc != globalUtilOptind && argc != globalUtilOptind + 1 )
goto usage;
if ( pNtk == NULL )
......@@ -692,7 +692,16 @@ int IoCommandReadInit( Abc_Frame_t * pAbc, int argc, char ** argv )
return 1;
}
// get the input file name
pFileName = argv[globalUtilOptind];
if ( argc == globalUtilOptind + 1 )
pFileName = argv[globalUtilOptind];
else if ( pNtk->pSpec )
pFileName = Extra_FileNameGenericAppend( pNtk->pSpec, ".init" );
else
{
printf( "File name should be given on the command line.\n" );
return 1;
}
// read the file using the corresponding file reader
pNtk = Abc_NtkDup( pNtk );
Io_ReadBenchInit( pNtk, pFileName );
......
......@@ -160,20 +160,10 @@ char * Extra_FileNameAppend( char * pBase, char * pSuffix )
***********************************************************************/
char * Extra_FileNameGeneric( char * FileName )
{
char * pDot;
char * pUnd;
char * pRes;
// find the generic name of the file
char * pDot, * pRes;
pRes = Extra_UtilStrsav( FileName );
// find the pointer to the "." symbol in the file name
// pUnd = strstr( FileName, "_" );
pUnd = NULL;
pDot = strstr( FileName, "." );
if ( pUnd )
pRes[pUnd - FileName] = 0;
else if ( pDot )
pRes[pDot - FileName] = 0;
if ( (pDot = strrchr( pRes, '.' )) )
*pDot = 0;
return pRes;
}
......@@ -193,8 +183,7 @@ char * Extra_FileNameGenericAppend( char * pBase, char * pSuffix )
static char Buffer[1000];
char * pDot;
strcpy( Buffer, pBase );
pDot = strstr( Buffer, "." );
if ( pDot )
if ( (pDot = strrchr( Buffer, '.' )) )
*pDot = 0;
strcat( Buffer, pSuffix );
return Buffer;
......
......@@ -789,7 +789,7 @@ clause* sat_solver_propagate(sat_solver* s)
return confl;
}
static inline int clause_cmp (const void* x, const void* y) {
static int clause_cmp (const void* x, const void* y) {
return clause_size((clause*)x) > 2 && (clause_size((clause*)y) == 2 || clause_activity((clause*)x) < clause_activity((clause*)y)) ? -1 : 1; }
void sat_solver_reducedb(sat_solver* s)
......
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