Commit 582cf0b9 by Alan Mishchenko

Version abc80511

parent 0f03f349
...@@ -3254,6 +3254,14 @@ SOURCE=.\src\aig\saig\saig.h ...@@ -3254,6 +3254,14 @@ SOURCE=.\src\aig\saig\saig.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\src\aig\saig\saigBmc.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\saig\saigCone.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\saig\saigInter.c SOURCE=.\src\aig\saig\saigInter.c
# End Source File # End Source File
# Begin Source File # Begin Source File
......
...@@ -35,6 +35,7 @@ alias fr fretime ...@@ -35,6 +35,7 @@ alias fr fretime
alias ft fraig_trust alias ft fraig_trust
alias ic indcut alias ic indcut
alias lp lutpack alias lp lutpack
alias pcon print_cone
alias pd print_dsd alias pd print_dsd
alias pex print_exdc -d alias pex print_exdc -d
alias pf print_factor alias pf print_factor
......
...@@ -70,7 +70,7 @@ int Dar_BalanceCone_rec( Aig_Obj_t * pRoot, Aig_Obj_t * pObj, Vec_Ptr_t * vSuper ...@@ -70,7 +70,7 @@ int Dar_BalanceCone_rec( Aig_Obj_t * pRoot, Aig_Obj_t * pObj, Vec_Ptr_t * vSuper
return 0; return 0;
} }
// if the new node is complemented or a PI, another gate begins // if the new node is complemented or a PI, another gate begins
if ( pObj != pRoot && (Aig_IsComplement(pObj) || Aig_ObjType(pObj) != Aig_ObjType(pRoot) || Aig_ObjRefs(pObj) > 1) ) if ( pObj != pRoot && (Aig_IsComplement(pObj) || Aig_ObjType(pObj) != Aig_ObjType(pRoot) || Aig_ObjRefs(pObj) > 1 || Vec_PtrSize(vSuper) > 10000) )
{ {
Vec_PtrPush( vSuper, pObj ); Vec_PtrPush( vSuper, pObj );
Aig_Regular(pObj)->fMarkB = 1; Aig_Regular(pObj)->fMarkB = 1;
......
...@@ -770,7 +770,7 @@ void Dar_LibObjPrint_rec( Dar_LibObj_t * pObj ) ...@@ -770,7 +770,7 @@ void Dar_LibObjPrint_rec( Dar_LibObj_t * pObj )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
void Dar_LibEvalAssignNums( Dar_Man_t * p, int Class ) void Dar_LibEvalAssignNums( Dar_Man_t * p, int Class, Aig_Obj_t * pRoot )
{ {
Dar_LibObj_t * pObj; Dar_LibObj_t * pObj;
Dar_LibDat_t * pData, * pData0, * pData1; Dar_LibDat_t * pData, * pData0, * pData1;
...@@ -797,13 +797,15 @@ void Dar_LibEvalAssignNums( Dar_Man_t * p, int Class ) ...@@ -797,13 +797,15 @@ void Dar_LibEvalAssignNums( Dar_Man_t * p, int Class )
continue; continue;
pFanin0 = Aig_NotCond( pData0->pFunc, pObj->fCompl0 ); pFanin0 = Aig_NotCond( pData0->pFunc, pObj->fCompl0 );
pFanin1 = Aig_NotCond( pData1->pFunc, pObj->fCompl1 ); pFanin1 = Aig_NotCond( pData1->pFunc, pObj->fCompl1 );
if ( Aig_Regular(pFanin0) == pRoot || Aig_Regular(pFanin1) == pRoot )
continue;
pData->pFunc = Aig_TableLookupTwo( p->pAig, pFanin0, pFanin1 ); pData->pFunc = Aig_TableLookupTwo( p->pAig, pFanin0, pFanin1 );
if ( pData->pFunc ) if ( pData->pFunc )
{ {
// update the level to be more accurate // update the level to be more accurate
pData->Level = Aig_Regular(pData->pFunc)->Level; pData->Level = Aig_Regular(pData->pFunc)->Level;
// mark the node if it is part of MFFC // mark the node if it is part of MFFC
pData->fMffc = Aig_ObjIsTravIdCurrent(p->pAig, pData->pFunc); pData->fMffc = Aig_ObjIsTravIdCurrent(p->pAig, Aig_Regular(pData->pFunc));
} }
} }
} }
...@@ -871,7 +873,7 @@ void Dar_LibEval( Dar_Man_t * p, Aig_Obj_t * pRoot, Dar_Cut_t * pCut, int Requir ...@@ -871,7 +873,7 @@ void Dar_LibEval( Dar_Man_t * p, Aig_Obj_t * pRoot, Dar_Cut_t * pCut, int Requir
nNodesSaved = Dar_LibCutMarkMffc( p->pAig, pRoot, pCut->nLeaves ); nNodesSaved = Dar_LibCutMarkMffc( p->pAig, pRoot, pCut->nLeaves );
// evaluate the cut // evaluate the cut
Class = s_DarLib->pMap[pCut->uTruth]; Class = s_DarLib->pMap[pCut->uTruth];
Dar_LibEvalAssignNums( p, Class ); Dar_LibEvalAssignNums( p, Class, pRoot );
// profile outputs by their savings // profile outputs by their savings
p->nTotalSubgs += s_DarLib->nSubgr0[Class]; p->nTotalSubgs += s_DarLib->nSubgr0[Class];
p->ClassSubgs[Class] += s_DarLib->nSubgr0[Class]; p->ClassSubgs[Class] += s_DarLib->nSubgr0[Class];
......
...@@ -90,7 +90,8 @@ Aig_Man_t * Dar_ManRwsat( Aig_Man_t * pAig, int fBalance, int fVerbose ) ...@@ -90,7 +90,8 @@ Aig_Man_t * Dar_ManRwsat( Aig_Man_t * pAig, int fBalance, int fVerbose )
Aig_ManStop( pTemp ); Aig_ManStop( pTemp );
if ( fVerbose ) Aig_ManPrintStats( pAig ); if ( fVerbose ) Aig_ManPrintStats( pAig );
} }
//Aig_ManDumpBlif( pAig, "inter.blif", NULL, NULL );
// rewrite // rewrite
Dar_ManRewrite( pAig, pParsRwr ); Dar_ManRewrite( pAig, pParsRwr );
pAig = Aig_ManDupDfs( pTemp = pAig ); pAig = Aig_ManDupDfs( pTemp = pAig );
......
...@@ -382,17 +382,36 @@ void Fra_BmcPerformSimple( Aig_Man_t * pAig, int nFrames, int nBTLimit, int fRew ...@@ -382,17 +382,36 @@ void Fra_BmcPerformSimple( Aig_Man_t * pAig, int nFrames, int nBTLimit, int fRew
Fra_Man_t * pTemp; Fra_Man_t * pTemp;
Fra_Bmc_t * pBmc; Fra_Bmc_t * pBmc;
Aig_Man_t * pAigTemp; Aig_Man_t * pAigTemp;
int iOutput; int clk, iOutput;
// derive and fraig the frames // derive and fraig the frames
clk = clock();
pBmc = Fra_BmcStart( pAig, 0, nFrames ); pBmc = Fra_BmcStart( pAig, 0, nFrames );
pTemp = Fra_LcrAigPrepare( pAig ); pTemp = Fra_LcrAigPrepare( pAig );
pTemp->pBmc = pBmc; pTemp->pBmc = pBmc;
pBmc->pAigFrames = Fra_BmcFrames( pBmc, 1 ); pBmc->pAigFrames = Fra_BmcFrames( pBmc, 1 );
if ( fVerbose )
{
printf( "AIG: PI/PO/Reg = %d/%d/%d. Node = %6d. Lev = %5d.\n",
Aig_ManPiNum(pAig)-Aig_ManRegNum(pAig), Aig_ManPoNum(pAig)-Aig_ManRegNum(pAig), Aig_ManRegNum(pAig),
Aig_ManNodeNum(pAig), Aig_ManLevelNum(pAig) );
printf( "Time-frames (%d): PI/PO = %d/%d. Node = %6d. Lev = %5d. ",
nFrames, Aig_ManPiNum(pBmc->pAigFrames), Aig_ManPoNum(pBmc->pAigFrames),
Aig_ManNodeNum(pBmc->pAigFrames), Aig_ManLevelNum(pBmc->pAigFrames) );
PRT( "Time", clock() - clk );
}
if ( fRewrite ) if ( fRewrite )
{ {
clk = clock();
pBmc->pAigFrames = Dar_ManRwsat( pAigTemp = pBmc->pAigFrames, 1, 0 ); pBmc->pAigFrames = Dar_ManRwsat( pAigTemp = pBmc->pAigFrames, 1, 0 );
Aig_ManStop( pAigTemp ); Aig_ManStop( pAigTemp );
if ( fVerbose )
{
printf( "Time-frames after rewriting: Node = %6d. Lev = %5d. ",
Aig_ManNodeNum(pBmc->pAigFrames), Aig_ManLevelNum(pBmc->pAigFrames) );
PRT( "Time", clock() - clk );
}
} }
clk = clock();
iOutput = Fra_FraigMiterAssertedOutput( pBmc->pAigFrames ); iOutput = Fra_FraigMiterAssertedOutput( pBmc->pAigFrames );
if ( iOutput >= 0 ) if ( iOutput >= 0 )
pAig->pSeqModel = Fra_SmlTrivCounterExample( pAig, iOutput ); pAig->pSeqModel = Fra_SmlTrivCounterExample( pAig, iOutput );
...@@ -409,8 +428,12 @@ void Fra_BmcPerformSimple( Aig_Man_t * pAig, int nFrames, int nBTLimit, int fRew ...@@ -409,8 +428,12 @@ void Fra_BmcPerformSimple( Aig_Man_t * pAig, int nFrames, int nBTLimit, int fRew
pAig->pSeqModel = Fra_SmlTrivCounterExample( pAig, iOutput ); pAig->pSeqModel = Fra_SmlTrivCounterExample( pAig, iOutput );
} }
if ( fVerbose ) if ( fVerbose )
printf( "nFrames = %3d. Aig = %6d. Init frames = %6d. Fraiged init frames = %6d.\n", {
nFrames, Aig_ManNodeNum(pAig), Aig_ManNodeNum(pBmc->pAigFrames), pBmc->pAigFraig? Aig_ManNodeNum(pBmc->pAigFraig) : -1 ); printf( "Fraiged init frames: Node = %6d. Lev = %5d. ",
pBmc->pAigFraig? Aig_ManNodeNum(pBmc->pAigFraig) : -1,
pBmc->pAigFraig? Aig_ManLevelNum(pBmc->pAigFraig) : -1 );
PRT( "Time", clock() - clk );
}
Fra_BmcStop( pBmc ); Fra_BmcStop( pBmc );
free( pTemp ); free( pTemp );
} }
......
...@@ -148,7 +148,7 @@ int Hop_NodeBalanceCone_rec( Hop_Obj_t * pRoot, Hop_Obj_t * pObj, Vec_Ptr_t * vS ...@@ -148,7 +148,7 @@ int Hop_NodeBalanceCone_rec( Hop_Obj_t * pRoot, Hop_Obj_t * pObj, Vec_Ptr_t * vS
return 0; return 0;
} }
// if the new node is complemented or a PI, another gate begins // if the new node is complemented or a PI, another gate begins
if ( pObj != pRoot && (Hop_IsComplement(pObj) || Hop_ObjType(pObj) != Hop_ObjType(pRoot) || Hop_ObjRefs(pObj) > 1) ) if ( pObj != pRoot && (Hop_IsComplement(pObj) || Hop_ObjType(pObj) != Hop_ObjType(pRoot) || Hop_ObjRefs(pObj) > 1 || Vec_PtrSize(vSuper) > 10000) )
{ {
Vec_PtrPush( vSuper, pObj ); Vec_PtrPush( vSuper, pObj );
Hop_Regular(pObj)->fMarkB = 1; Hop_Regular(pObj)->fMarkB = 1;
......
...@@ -215,7 +215,7 @@ int Ivy_NodeBalanceCone_rec( Ivy_Obj_t * pRoot, Ivy_Obj_t * pObj, Vec_Ptr_t * vS ...@@ -215,7 +215,7 @@ int Ivy_NodeBalanceCone_rec( Ivy_Obj_t * pRoot, Ivy_Obj_t * pObj, Vec_Ptr_t * vS
return 0; return 0;
} }
// if the new node is complemented or a PI, another gate begins // if the new node is complemented or a PI, another gate begins
if ( pObj != pRoot && (Ivy_IsComplement(pObj) || Ivy_ObjType(pObj) != Ivy_ObjType(pRoot) || Ivy_ObjRefs(pObj) > 1) ) if ( pObj != pRoot && (Ivy_IsComplement(pObj) || Ivy_ObjType(pObj) != Ivy_ObjType(pRoot) || Ivy_ObjRefs(pObj) > 1 || Vec_PtrSize(vSuper) > 10000) )
{ {
Vec_PtrPush( vSuper, pObj ); Vec_PtrPush( vSuper, pObj );
Ivy_Regular(pObj)->fMarkB = 1; Ivy_Regular(pObj)->fMarkB = 1;
......
SRC += src/aig/saig/saig_.c \ SRC += src/aig/saig/saigBmc.c \
src/aig/saig/saigCone.c \
src/aig/saig/saigInter.c \ src/aig/saig/saigInter.c \
src/aig/saig/saigPhase.c \ src/aig/saig/saigPhase.c \
src/aig/saig/saigRetFwd.c \ src/aig/saig/saigRetFwd.c \
......
...@@ -75,8 +75,12 @@ static inline int Saig_ObjIsLi( Aig_Man_t * p, Aig_Obj_t * pObj ) { ...@@ -75,8 +75,12 @@ static inline int Saig_ObjIsLi( Aig_Man_t * p, Aig_Obj_t * pObj ) {
/// FUNCTION DECLARATIONS /// /// FUNCTION DECLARATIONS ///
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
/*=== saigBmc.c ==========================================================*/
extern int Saig_ManBmcSimple( Aig_Man_t * pAig, int nFrames, int nBTLimit, int fRewrite, int fVerbose, int * piFrame );
/*=== saigCone.c ==========================================================*/
extern void Saig_ManPrintCones( Aig_Man_t * p );
/*=== saigInter.c ==========================================================*/ /*=== saigInter.c ==========================================================*/
extern int Saig_Interpolate( Aig_Man_t * pAig, int nConfLimit, int fVerbose, int * pDepth ); extern int Saig_Interpolate( Aig_Man_t * pAig, int nConfLimit, int fRewrite, int fTransLoop, int fVerbose, int * pDepth );
/*=== saigPhase.c ==========================================================*/ /*=== saigPhase.c ==========================================================*/
extern Aig_Man_t * Saig_ManPhaseAbstract( Aig_Man_t * p, Vec_Int_t * vInits, int nFrames, int fIgnore, int fPrint, int fVerbose ); extern Aig_Man_t * Saig_ManPhaseAbstract( Aig_Man_t * p, Vec_Int_t * vInits, int nFrames, int fIgnore, int fPrint, int fVerbose );
/*=== saigRetFwd.c ==========================================================*/ /*=== saigRetFwd.c ==========================================================*/
......
/**CFile****************************************************************
FileName [saigBmc.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Sequential AIG package.]
Synopsis [Simple BMC package.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [$Id: saigBmc.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
***********************************************************************/
#include "saig.h"
#include "cnf.h"
#include "satStore.h"
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis [Create timeframes of the manager for BMC.]
Description [The resulting manager is combinational. The primary inputs
corresponding to register outputs are ordered first. POs correspond to \
the property outputs in each time-frame.]
SideEffects []
SeeAlso []
***********************************************************************/
Aig_Man_t * Saig_ManFramesBmc( Aig_Man_t * pAig, int nFrames )
{
Aig_Man_t * pFrames;
Aig_Obj_t * pObj, * pObjLi, * pObjLo;
int i, f;
assert( Saig_ManRegNum(pAig) > 0 );
pFrames = Aig_ManStart( Aig_ManNodeNum(pAig) * nFrames );
// map the constant node
Aig_ManConst1(pAig)->pData = Aig_ManConst1( pFrames );
// create variables for register outputs
Saig_ManForEachLo( pAig, pObj, i )
pObj->pData = Aig_ManConst0( pFrames );
// add timeframes
for ( f = 0; f < nFrames; f++ )
{
// create PI nodes for this frame
Saig_ManForEachPi( pAig, pObj, i )
pObj->pData = Aig_ObjCreatePi( pFrames );
// add internal nodes of this frame
Aig_ManForEachNode( pAig, pObj, i )
pObj->pData = Aig_And( pFrames, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
// create POs for this frame
Saig_ManForEachPo( pAig, pObj, i )
Aig_ObjCreatePo( pFrames, Aig_ObjChild0Copy(pObj) );
if ( f == nFrames - 1 )
break;
// save register inputs
Saig_ManForEachLi( pAig, pObj, i )
pObj->pData = Aig_ObjChild0Copy(pObj);
// transfer to register outputs
Saig_ManForEachLiLo( pAig, pObjLi, pObjLo, i )
pObjLo->pData = pObjLi->pData;
}
Aig_ManCleanup( pFrames );
return pFrames;
}
/**Function*************************************************************
Synopsis [Performs BMC for the given AIG.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int Saig_ManBmcSimple( Aig_Man_t * pAig, int nFrames, int nConfLimit, int fRewrite, int fVerbose, int * piFrame )
{
sat_solver * pSat;
Cnf_Dat_t * pCnf;
Aig_Man_t * pFrames, * pAigTemp;
Aig_Obj_t * pObj;
int status, clk, Lit, i, RetValue = 1;
*piFrame = -1;
// derive the timeframes
clk = clock();
pFrames = Saig_ManFramesBmc( pAig, nFrames );
if ( fVerbose )
{
printf( "AIG: PI/PO/Reg = %d/%d/%d. Node = %6d. Lev = %5d.\n",
Saig_ManPiNum(pAig), Saig_ManPoNum(pAig), Saig_ManRegNum(pAig),
Aig_ManNodeNum(pAig), Aig_ManLevelNum(pAig) );
printf( "Time-frames (%d): PI/PO = %d/%d. Node = %6d. Lev = %5d. ",
nFrames, Aig_ManPiNum(pFrames), Aig_ManPoNum(pFrames),
Aig_ManNodeNum(pFrames), Aig_ManLevelNum(pFrames) );
PRT( "Time", clock() - clk );
}
// rewrite the timeframes
if ( fRewrite )
{
clk = clock();
// pFrames = Dar_ManBalance( pAigTemp = pFrames, 0 );
pFrames = Dar_ManRwsat( pAigTemp = pFrames, 1, 0 );
Aig_ManStop( pAigTemp );
if ( fVerbose )
{
printf( "Time-frames after rewriting: Node = %6d. Lev = %5d. ",
Aig_ManNodeNum(pFrames), Aig_ManLevelNum(pFrames) );
PRT( "Time", clock() - clk );
}
}
// create the SAT solver
clk = clock();
pCnf = Cnf_Derive( pFrames, Aig_ManPoNum(pFrames) );
pSat = sat_solver_new();
sat_solver_setnvars( pSat, pCnf->nVars );
for ( i = 0; i < pCnf->nClauses; i++ )
{
if ( !sat_solver_addclause( pSat, pCnf->pClauses[i], pCnf->pClauses[i+1] ) )
assert( 0 );
}
if ( fVerbose )
{
printf( "CNF: Variables = %6d. Clauses = %7d. Literals = %8d. ", pCnf->nVars, pCnf->nClauses, pCnf->nLiterals );
PRT( "Time", clock() - clk );
}
status = sat_solver_simplify(pSat);
if ( status == 0 )
{
if ( fVerbose )
printf( "The BMC problem is trivially UNSAT\n" );
}
else
{
Aig_ManForEachPo( pFrames, pObj, i )
{
Lit = toLitCond( pCnf->pVarNums[pObj->Id], 0 );
if ( fVerbose )
printf( "Solving output %2d of frame %3d ... \r",
i % Saig_ManPoNum(pAig), i / Saig_ManPoNum(pAig) );
clk = clock();
status = sat_solver_solve( pSat, &Lit, &Lit + 1, (sint64)nConfLimit, (sint64)0, (sint64)0, (sint64)0 );
if ( fVerbose )
{
printf( "Solved output %2d of frame %3d. ",
i % Saig_ManPoNum(pAig), i / Saig_ManPoNum(pAig) );
printf( "Conf =%8.0f. Imp =%11.0f. ", (double)pSat->stats.conflicts, (double)pSat->stats.propagations );
PRT( "Time", clock() - clk );
}
if ( status == l_False )
{
}
else if ( status == l_True )
{
extern void * Fra_SmlCopyCounterExample( Aig_Man_t * pAig, Aig_Man_t * pFrames, int * pModel );
Vec_Int_t * vCiIds = Cnf_DataCollectPiSatNums( pCnf, pFrames );
int * pModel = Sat_SolverGetModel( pSat, vCiIds->pArray, vCiIds->nSize );
pModel[Aig_ManPiNum(pFrames)] = pObj->Id;
pAig->pSeqModel = Fra_SmlCopyCounterExample( pAig, pFrames, pModel );
free( pModel );
Vec_IntFree( vCiIds );
RetValue = 0;
break;
}
else
{
*piFrame = i;
RetValue = -1;
break;
}
}
}
sat_solver_delete( pSat );
Cnf_DataFree( pCnf );
Aig_ManStop( pFrames );
return RetValue;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
/**CFile****************************************************************
FileName [saigCone.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Sequential AIG package.]
Synopsis [Cone of influence computation.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [$Id: saigCone.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
***********************************************************************/
#include "saig.h"
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis [Counts the support size of the node.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Saig_ManSupport_rec( Aig_Man_t * p, Aig_Obj_t * pObj, Vec_Ptr_t * vSupp )
{
if ( Aig_ObjIsTravIdCurrent(p, pObj) )
return;
Aig_ObjSetTravIdCurrent(p, pObj);
if ( Aig_ObjIsConst1(pObj) )
return;
if ( Aig_ObjIsPi(pObj) )
{
if ( Saig_ObjIsLo(p,pObj) )
{
pObj = Saig_ManLi( p, Aig_ObjPioNum(pObj)-Saig_ManPiNum(p) );
Vec_PtrPush( vSupp, pObj );
}
return;
}
assert( Aig_ObjIsNode(pObj) );
Saig_ManSupport_rec( p, Aig_ObjFanin0(pObj), vSupp );
Saig_ManSupport_rec( p, Aig_ObjFanin1(pObj), vSupp );
}
/**Function*************************************************************
Synopsis [Counts the support size of the node.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Vec_Ptr_t * Saig_ManSupport( Aig_Man_t * p, Vec_Ptr_t * vNodes )
{
Vec_Ptr_t * vSupp;
Aig_Obj_t * pObj;
int i;
vSupp = Vec_PtrAlloc( 100 );
Aig_ManIncrementTravId( p );
Vec_PtrForEachEntry( vNodes, pObj, i )
{
assert( Aig_ObjIsPo(pObj) );
Saig_ManSupport_rec( p, Aig_ObjFanin0(pObj), vSupp );
}
return vSupp;
}
/**Function*************************************************************
Synopsis [Prints information about cones of influence of the POs.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Saig_ManPrintConeOne( Aig_Man_t * p, Aig_Obj_t * pObj )
{
Vec_Ptr_t * vPrev, * vCur, * vTotal;
int s, i, nCurNew, nCurPrev, nCurOld;
assert( Saig_ObjIsPo(p, pObj) );
// start the array
vPrev = Vec_PtrAlloc( 100 );
Vec_PtrPush( vPrev, pObj );
// get the current support
vCur = Saig_ManSupport( p, vPrev );
Vec_PtrClear( vPrev );
printf( " PO %3d ", Aig_ObjPioNum(pObj) );
// continue computing supports as long as there are now nodes
vTotal = Vec_PtrAlloc( 100 );
for ( s = 0; ; s++ )
{
// classify current into those new, prev, and older
nCurNew = nCurPrev = nCurOld = 0;
Vec_PtrForEachEntry( vCur, pObj, i )
{
if ( Vec_PtrFind(vTotal, pObj) == -1 )
{
Vec_PtrPush( vTotal, pObj );
nCurNew++;
}
else if ( Vec_PtrFind(vPrev, pObj) >= 0 )
nCurPrev++;
else
nCurOld++;
}
assert( nCurNew + nCurPrev + nCurOld == Vec_PtrSize(vCur) );
// print the result
printf( "%d:%d %d=%d+%d+%d ", s, Vec_PtrSize(vTotal), Vec_PtrSize(vCur), nCurNew, nCurPrev, nCurOld );
if ( nCurNew == 0 )
break;
// compute one more step
Vec_PtrFree( vPrev );
vCur = Saig_ManSupport( p, vPrev = vCur );
}
printf( "\n" );
Vec_PtrFree( vPrev );
Vec_PtrFree( vCur );
Vec_PtrFree( vTotal );
}
/**Function*************************************************************
Synopsis [Prints information about cones of influence of the POs.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Saig_ManPrintCones( Aig_Man_t * p )
{
Aig_Obj_t * pObj;
int i;
printf( "The format of this print-out: For each PO, x:a b=c+d+e, where \n" );
printf( "- x is the time-frame counting back from the PO\n" );
printf( "- a is the total number of registers in the COI of the PO so far\n" );
printf( "- b is the number of registers in the COI of the PO in this time-frame\n" );
printf( "- c is the number of registers in b that are new (appear for the first time)\n" );
printf( "- d is the number of registers in b in common with the previous time-frame\n" );
printf( "- e is the number of registers in b in common with other time-frames\n" );
Aig_ManSetPioNumbers( p );
Saig_ManForEachPo( p, pObj, i )
Saig_ManPrintConeOne( p, pObj );
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
...@@ -23,15 +23,14 @@ ...@@ -23,15 +23,14 @@
#include "cnf.h" #include "cnf.h"
#include "satStore.h" #include "satStore.h"
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
/* /*
The interpolation algorithm implemented here was introduced in the paper: The interpolation algorithm implemented here was introduced in the paper:
K. L. McMillan. Interpolation and SAT-based model checking. CAV’03, pp. 1-13. K. L. McMillan. Interpolation and SAT-based model checking. CAV’03, pp. 1-13.
*/ */
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
// simulation manager // simulation manager
typedef struct Saig_IntMan_t_ Saig_IntMan_t; typedef struct Saig_IntMan_t_ Saig_IntMan_t;
...@@ -203,8 +202,8 @@ Aig_Man_t * Saig_ManFramesInter( Aig_Man_t * pAig, int nFrames ) ...@@ -203,8 +202,8 @@ Aig_Man_t * Saig_ManFramesInter( Aig_Man_t * pAig, int nFrames )
Aig_Man_t * pFrames; Aig_Man_t * pFrames;
Aig_Obj_t * pObj, * pObjLi, * pObjLo; Aig_Obj_t * pObj, * pObjLi, * pObjLo;
int i, f; int i, f;
assert( Saig_ManRegNum(pAig) > 0 );
assert( Saig_ManPoNum(pAig) == 1 ); assert( Saig_ManPoNum(pAig) == 1 );
// start the fraig package
pFrames = Aig_ManStart( Aig_ManNodeNum(pAig) * nFrames ); pFrames = Aig_ManStart( Aig_ManNodeNum(pAig) * nFrames );
// map the constant node // map the constant node
Aig_ManConst1(pAig)->pData = Aig_ManConst1( pFrames ); Aig_ManConst1(pAig)->pData = Aig_ManConst1( pFrames );
...@@ -265,7 +264,7 @@ sat_solver * Saig_DeriveSatSolver( ...@@ -265,7 +264,7 @@ sat_solver * Saig_DeriveSatSolver(
assert( Aig_ManPoNum(pInter) == 1 ); assert( Aig_ManPoNum(pInter) == 1 );
assert( Aig_ManPoNum(pFrames) == 1 ); assert( Aig_ManPoNum(pFrames) == 1 );
assert( Aig_ManPiNum(pInter) == Aig_ManRegNum(pAig) ); assert( Aig_ManPiNum(pInter) == Aig_ManRegNum(pAig) );
assert( (Aig_ManPiNum(pFrames) - Aig_ManRegNum(pAig)) % Saig_ManPiNum(pAig) == 0 ); // assert( (Aig_ManPiNum(pFrames) - Aig_ManRegNum(pAig)) % Saig_ManPiNum(pAig) == 0 );
// prepare CNFs // prepare CNFs
Cnf_DataLift( pCnfAig, pCnfFrames->nVars ); Cnf_DataLift( pCnfAig, pCnfFrames->nVars );
...@@ -354,7 +353,7 @@ int Saig_PerformOneStep( Saig_IntMan_t * p ) ...@@ -354,7 +353,7 @@ int Saig_PerformOneStep( Saig_IntMan_t * p )
// derive the SAT solver // derive the SAT solver
pSat = Saig_DeriveSatSolver( p->pInter, p->pCnfInter, p->pAigTrans, p->pCnfAig, p->pFrames, p->pCnfFrames, p->vVarsAB ); pSat = Saig_DeriveSatSolver( p->pInter, p->pCnfInter, p->pAigTrans, p->pCnfAig, p->pFrames, p->pCnfFrames, p->vVarsAB );
Sat_SolverWriteDimacs( pSat, "test.cnf", NULL, NULL, 1 ); //Sat_SolverWriteDimacs( pSat, "test.cnf", NULL, NULL, 1 );
// solve the problem // solve the problem
clk = clock(); clk = clock();
status = sat_solver_solve( pSat, NULL, NULL, (sint64)p->nConfLimit, (sint64)0, (sint64)0, (sint64)0 ); status = sat_solver_solve( pSat, NULL, NULL, (sint64)p->nConfLimit, (sint64)0, (sint64)0, (sint64)0 );
...@@ -403,14 +402,15 @@ int Saig_ManCheckContainment( Aig_Man_t * pNew, Aig_Man_t * pOld ) ...@@ -403,14 +402,15 @@ int Saig_ManCheckContainment( Aig_Man_t * pNew, Aig_Man_t * pOld )
Aig_Man_t * pMiter, * pAigTemp; Aig_Man_t * pMiter, * pAigTemp;
int RetValue; int RetValue;
pMiter = Aig_ManCreateMiter( pNew, pOld, 1 ); pMiter = Aig_ManCreateMiter( pNew, pOld, 1 );
pMiter = Dar_ManRwsat( pAigTemp = pMiter, 1, 0 ); // pMiter = Dar_ManRwsat( pAigTemp = pMiter, 1, 0 );
Aig_ManStop( pAigTemp ); // Aig_ManStop( pAigTemp );
RetValue = Fra_FraigMiterStatus( pMiter ); RetValue = Fra_FraigMiterStatus( pMiter );
if ( RetValue == -1 ) if ( RetValue == -1 )
{ {
pAigTemp = Fra_FraigEquivence( pMiter, 1000000, 1 ); pAigTemp = Fra_FraigEquivence( pMiter, 1000000, 1 );
RetValue = Fra_FraigMiterStatus( pAigTemp ); RetValue = Fra_FraigMiterStatus( pAigTemp );
Aig_ManStop( pAigTemp ); Aig_ManStop( pAigTemp );
// RetValue = Fra_FraigSat( pMiter, 1000000, 0, 0 );
} }
assert( RetValue != -1 ); assert( RetValue != -1 );
Aig_ManStop( pMiter ); Aig_ManStop( pMiter );
...@@ -495,9 +495,8 @@ void Saig_ManagerFree( Saig_IntMan_t * p ) ...@@ -495,9 +495,8 @@ void Saig_ManagerFree( Saig_IntMan_t * p )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
int Saig_Interpolate( Aig_Man_t * pAig, int nConfLimit, int fVerbose, int * pDepth ) int Saig_Interpolate( Aig_Man_t * pAig, int nConfLimit, int fRewrite, int fTransLoop, int fVerbose, int * pDepth )
{ {
int fUseTransRel = 0;
Saig_IntMan_t * p; Saig_IntMan_t * p;
Aig_Man_t * pAigTemp; Aig_Man_t * pAigTemp;
int s, i, RetValue, Status, clk, clk2, clkTotal = clock(); int s, i, RetValue, Status, clk, clk2, clkTotal = clock();
...@@ -516,18 +515,20 @@ int Saig_Interpolate( Aig_Man_t * pAig, int nConfLimit, int fVerbose, int * pDep ...@@ -516,18 +515,20 @@ int Saig_Interpolate( Aig_Man_t * pAig, int nConfLimit, int fVerbose, int * pDep
p->fVerbose = fVerbose; p->fVerbose = fVerbose;
// can perform SAT sweeping and/or rewriting of this AIG... // can perform SAT sweeping and/or rewriting of this AIG...
p->pAig = pAig; p->pAig = pAig;
if ( fUseTransRel ) if ( fTransLoop )
p->pAigTrans = Saig_ManTransformed( pAig ); p->pAigTrans = Saig_ManTransformed( pAig );
else else
p->pAigTrans = Saig_ManDuplicated( pAig ); p->pAigTrans = Saig_ManDuplicated( pAig );
// p->pAigTrans = Dar_ManRwsat( pAigTemp = p->pAigTrans, 1, 0 );
// Aig_ManStop( pAigTemp );
// derive CNF for the transformed AIG // derive CNF for the transformed AIG
clk = clock(); clk = clock();
p->pCnfAig = Cnf_Derive( p->pAigTrans, Aig_ManRegNum(p->pAigTrans) ); p->pCnfAig = Cnf_Derive( p->pAigTrans, Aig_ManRegNum(p->pAigTrans) );
p->timeCnf += clock() - clk; p->timeCnf += clock() - clk;
if ( fVerbose ) if ( fVerbose )
{ {
printf( "AIG: PI/PO/Reg = %d/%d/%d. And = %d. Lev = %d. CNF: Var/Cla = %d/%d.\n", printf( "AIG: PI/PO/Reg = %d/%d/%d. And = %d. Lev = %d. CNF: Var/Cla = %d/%d.\n",
Aig_ManPiNum(pAig), Aig_ManPoNum(pAig), Aig_ManRegNum(pAig), Saig_ManPiNum(pAig), Saig_ManPoNum(pAig), Saig_ManRegNum(pAig),
Aig_ManAndNum(pAig), Aig_ManLevelNum(pAig), Aig_ManAndNum(pAig), Aig_ManLevelNum(pAig),
p->pCnfAig->nVars, p->pCnfAig->nClauses ); p->pCnfAig->nVars, p->pCnfAig->nClauses );
} }
...@@ -545,10 +546,13 @@ p->timeCnf += clock() - clk; ...@@ -545,10 +546,13 @@ p->timeCnf += clock() - clk;
// timeframes // timeframes
p->pFrames = Saig_ManFramesInter( pAig, p->nFrames ); p->pFrames = Saig_ManFramesInter( pAig, p->nFrames );
clk = clock(); clk = clock();
// p->pFrames = Dar_ManRwsat( pAigTemp = p->pFrames, 1, 0 ); if ( fRewrite )
// Aig_ManStop( pAigTemp ); {
p->pFrames = Dar_ManRwsat( pAigTemp = p->pFrames, 1, 0 );
Aig_ManStop( pAigTemp );
// p->pFrames = Fra_FraigEquivence( pAigTemp = p->pFrames, 100, 0 ); // p->pFrames = Fra_FraigEquivence( pAigTemp = p->pFrames, 100, 0 );
// Aig_ManStop( pAigTemp ); // Aig_ManStop( pAigTemp );
}
p->timeRwr += clock() - clk; p->timeRwr += clock() - clk;
// can also do SAT sweeping on the timeframes... // can also do SAT sweeping on the timeframes...
clk = clock(); clk = clock();
...@@ -569,7 +573,7 @@ p->timeCnf += clock() - clk; ...@@ -569,7 +573,7 @@ p->timeCnf += clock() - clk;
RetValue = Saig_PerformOneStep( p ); RetValue = Saig_PerformOneStep( p );
if ( fVerbose ) if ( fVerbose )
{ {
printf( " I = %2d. Bmc =%3d. IntAnd =%6d. IntLev =%4d. Conf =%6d. ", printf( " I = %2d. Bmc =%3d. IntAnd =%6d. IntLev =%5d. Conf =%6d. ",
i+1, i + 1 + p->nFrames, Aig_ManNodeNum(p->pInter), Aig_ManLevelNum(p->pInter), p->nConfCur ); i+1, i + 1 + p->nFrames, Aig_ManNodeNum(p->pInter), Aig_ManLevelNum(p->pInter), p->nConfCur );
PRT( "Time", clock() - clk ); PRT( "Time", clock() - clk );
if ( Aig_ManNodeNum(p->pInter) == 0 ) if ( Aig_ManNodeNum(p->pInter) == 0 )
...@@ -623,7 +627,7 @@ p->timeEqu += clock() - clk; ...@@ -623,7 +627,7 @@ p->timeEqu += clock() - clk;
return 1; return 1;
} }
// save interpolant and convert it into CNF // save interpolant and convert it into CNF
if ( fUseTransRel ) if ( fTransLoop )
{ {
Aig_ManStop( p->pInter ); Aig_ManStop( p->pInter );
p->pInter = p->pInterNew; p->pInter = p->pInterNew;
......
...@@ -54,6 +54,7 @@ static int Abc_CommandPrintGates ( Abc_Frame_t * pAbc, int argc, char ** arg ...@@ -54,6 +54,7 @@ static int Abc_CommandPrintGates ( Abc_Frame_t * pAbc, int argc, char ** arg
static int Abc_CommandPrintSharing ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandPrintSharing ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandPrintXCut ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandPrintXCut ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandPrintDsd ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandPrintDsd ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandPrintCone ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandShow ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandShow ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandShowBdd ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandShowBdd ( Abc_Frame_t * pAbc, int argc, char ** argv );
...@@ -307,6 +308,7 @@ void Abc_Init( Abc_Frame_t * pAbc ) ...@@ -307,6 +308,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd( pAbc, "Printing", "print_sharing", Abc_CommandPrintSharing, 0 ); Cmd_CommandAdd( pAbc, "Printing", "print_sharing", Abc_CommandPrintSharing, 0 );
Cmd_CommandAdd( pAbc, "Printing", "print_xcut", Abc_CommandPrintXCut, 0 ); Cmd_CommandAdd( pAbc, "Printing", "print_xcut", Abc_CommandPrintXCut, 0 );
Cmd_CommandAdd( pAbc, "Printing", "print_dsd", Abc_CommandPrintDsd, 0 ); Cmd_CommandAdd( pAbc, "Printing", "print_dsd", Abc_CommandPrintDsd, 0 );
Cmd_CommandAdd( pAbc, "Printing", "print_cone", Abc_CommandPrintCone, 0 );
Cmd_CommandAdd( pAbc, "Printing", "show", Abc_CommandShow, 0 ); Cmd_CommandAdd( pAbc, "Printing", "show", Abc_CommandShow, 0 );
Cmd_CommandAdd( pAbc, "Printing", "show_bdd", Abc_CommandShowBdd, 0 ); Cmd_CommandAdd( pAbc, "Printing", "show_bdd", Abc_CommandShowBdd, 0 );
...@@ -1831,6 +1833,67 @@ usage: ...@@ -1831,6 +1833,67 @@ usage:
return 1; return 1;
} }
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int Abc_CommandPrintCone( Abc_Frame_t * pAbc, int argc, char ** argv )
{
FILE * pOut, * pErr;
Abc_Ntk_t * pNtk;
int c;
int fUseLibrary;
extern int Abc_NtkDarPrintCone( Abc_Ntk_t * pNtk );
pNtk = Abc_FrameReadNtk(pAbc);
pOut = Abc_FrameReadOut(pAbc);
pErr = Abc_FrameReadErr(pAbc);
// set defaults
fUseLibrary = 1;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "lh" ) ) != EOF )
{
switch ( c )
{
case 'l':
fUseLibrary ^= 1;
break;
case 'h':
goto usage;
default:
goto usage;
}
}
if ( pNtk == NULL )
{
fprintf( pErr, "Empty network.\n" );
return 1;
}
if ( Abc_NtkLatchNum(pNtk) == 0 )
{
fprintf( pErr, "The network is combinational.\n" );
return 1;
}
Abc_NtkDarPrintCone( pNtk );
return 0;
usage:
fprintf( pErr, "usage: print_cone [-h]\n" );
fprintf( pErr, "\t prints cones of influence info for each primary output\n" );
// fprintf( pErr, "\t-l : used library gate names (if mapped) [default = %s]\n", fUseLibrary? "yes": "no" );
fprintf( pErr, "\t-h : print the command usage\n");
return 1;
}
/**Function************************************************************* /**Function*************************************************************
...@@ -14561,22 +14624,23 @@ int Abc_CommandBmc( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -14561,22 +14624,23 @@ int Abc_CommandBmc( Abc_Frame_t * pAbc, int argc, char ** argv )
int nFrames; int nFrames;
int nBTLimit; int nBTLimit;
int fRewrite; int fRewrite;
int fNewAlgo;
int fVerbose; int fVerbose;
// extern void Abc_NtkBmc( Abc_Ntk_t * pNtk, int nFrames, int fInit, int fVerbose ); extern int Abc_NtkDarBmc( Abc_Ntk_t * pNtk, int nFrames, int nBTLimit, int fRewrite, int fNewAlgo, int fVerbose );
extern int Abc_NtkDarBmc( Abc_Ntk_t * pNtk, int nFrames, int nBTLimit, int fRewrite, int fVerbose );
pNtk = Abc_FrameReadNtk(pAbc); pNtk = Abc_FrameReadNtk(pAbc);
pOut = Abc_FrameReadOut(pAbc); pOut = Abc_FrameReadOut(pAbc);
pErr = Abc_FrameReadErr(pAbc); pErr = Abc_FrameReadErr(pAbc);
// set defaults // set defaults
nFrames = 5; nFrames = 10;
nBTLimit = 1000000; nBTLimit = 10000;
fRewrite = 0; fRewrite = 0;
fNewAlgo = 1;
fVerbose = 0; fVerbose = 0;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "FCrvh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "FCravh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -14605,6 +14669,9 @@ int Abc_CommandBmc( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -14605,6 +14669,9 @@ int Abc_CommandBmc( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'r': case 'r':
fRewrite ^= 1; fRewrite ^= 1;
break; break;
case 'a':
fNewAlgo ^= 1;
break;
case 'v': case 'v':
fVerbose ^= 1; fVerbose ^= 1;
break; break;
...@@ -14629,15 +14696,16 @@ int Abc_CommandBmc( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -14629,15 +14696,16 @@ int Abc_CommandBmc( Abc_Frame_t * pAbc, int argc, char ** argv )
fprintf( stdout, "Does not work for combinational networks.\n" ); fprintf( stdout, "Does not work for combinational networks.\n" );
return 0; return 0;
} }
Abc_NtkDarBmc( pNtk, nFrames, nBTLimit, fRewrite, fVerbose ); Abc_NtkDarBmc( pNtk, nFrames, nBTLimit, fRewrite, fNewAlgo, fVerbose );
return 0; return 0;
usage: usage:
fprintf( pErr, "usage: bmc [-F num] [-C num] [-rvh]\n" ); fprintf( pErr, "usage: bmc [-F num] [-C num] [-ravh]\n" );
fprintf( pErr, "\t perform bounded model checking\n" ); fprintf( pErr, "\t perform bounded model checking\n" );
fprintf( pErr, "\t-F num : the number of time frames [default = %d]\n", nFrames ); fprintf( pErr, "\t-F num : the number of time frames [default = %d]\n", nFrames );
fprintf( pErr, "\t-C num : the max number of conflicts at a node [default = %d]\n", nBTLimit ); fprintf( pErr, "\t-C num : the max number of conflicts at a node [default = %d]\n", nBTLimit );
fprintf( pErr, "\t-r : toggle the use of rewriting [default = %s]\n", fRewrite? "yes": "no" ); fprintf( pErr, "\t-r : toggle the use of rewriting [default = %s]\n", fRewrite? "yes": "no" );
fprintf( pErr, "\t-a : toggle SAT sweeping and SAT solving [default = %s]\n", fNewAlgo? "SAT solving": "SAT sweeping" );
fprintf( pErr, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); fprintf( pErr, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" );
fprintf( pErr, "\t-h : print the command usage\n"); fprintf( pErr, "\t-h : print the command usage\n");
return 1; return 1;
...@@ -14661,20 +14729,22 @@ int Abc_CommandBmcInter( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -14661,20 +14729,22 @@ int Abc_CommandBmcInter( Abc_Frame_t * pAbc, int argc, char ** argv )
int c; int c;
int nBTLimit; int nBTLimit;
int fRewrite; int fRewrite;
int fTransLoop;
int fVerbose; int fVerbose;
extern int Abc_NtkDarBmcInter( Abc_Ntk_t * pNtk, int nConfLimit, int fVerbose ); extern int Abc_NtkDarBmcInter( Abc_Ntk_t * pNtk, int nConfLimit, int fRewrite, int fTransLoop, int fVerbose );
pNtk = Abc_FrameReadNtk(pAbc); pNtk = Abc_FrameReadNtk(pAbc);
pOut = Abc_FrameReadOut(pAbc); pOut = Abc_FrameReadOut(pAbc);
pErr = Abc_FrameReadErr(pAbc); pErr = Abc_FrameReadErr(pAbc);
// set defaults // set defaults
nBTLimit = 20000; nBTLimit = 20000;
fRewrite = 0; fRewrite = 0;
fVerbose = 1; fTransLoop = 1;
fVerbose = 1;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "Crvh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "Crtvh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -14692,6 +14762,9 @@ int Abc_CommandBmcInter( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -14692,6 +14762,9 @@ int Abc_CommandBmcInter( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'r': case 'r':
fRewrite ^= 1; fRewrite ^= 1;
break; break;
case 't':
fTransLoop ^= 1;
break;
case 'v': case 'v':
fVerbose ^= 1; fVerbose ^= 1;
break; break;
...@@ -14721,14 +14794,15 @@ int Abc_CommandBmcInter( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -14721,14 +14794,15 @@ int Abc_CommandBmcInter( Abc_Frame_t * pAbc, int argc, char ** argv )
fprintf( stdout, "Currently only works for single-output miters (run \"orpos\").\n" ); fprintf( stdout, "Currently only works for single-output miters (run \"orpos\").\n" );
return 0; return 0;
} }
Abc_NtkDarBmcInter( pNtk, nBTLimit, fVerbose ); Abc_NtkDarBmcInter( pNtk, nBTLimit, fRewrite, fTransLoop, fVerbose );
return 0; return 0;
usage: usage:
fprintf( pErr, "usage: int [-C num] [-vh]\n" ); fprintf( pErr, "usage: int [-C num] [-rtvh]\n" );
fprintf( pErr, "\t uses interpolation to prove the property\n" ); fprintf( pErr, "\t uses interpolation to prove the property\n" );
fprintf( pErr, "\t-C num : the limit on conflicts for one SAT run [default = %d]\n", nBTLimit ); fprintf( pErr, "\t-C num : the limit on conflicts for one SAT run [default = %d]\n", nBTLimit );
// fprintf( pErr, "\t-r : toggle the use of rewriting [default = %s]\n", fRewrite? "yes": "no" ); fprintf( pErr, "\t-r : toggle the use of rewriting [default = %s]\n", fRewrite? "yes": "no" );
fprintf( pErr, "\t-t : toggle adding transition into the init state [default = %s]\n", fTransLoop? "yes": "no" );
fprintf( pErr, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); fprintf( pErr, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" );
fprintf( pErr, "\t-h : print the command usage\n"); fprintf( pErr, "\t-h : print the command usage\n");
return 1; return 1;
......
...@@ -346,7 +346,7 @@ int Abc_NodeBalanceCone_rec( Abc_Obj_t * pNode, Vec_Ptr_t * vSuper, bool fFirst, ...@@ -346,7 +346,7 @@ int Abc_NodeBalanceCone_rec( Abc_Obj_t * pNode, Vec_Ptr_t * vSuper, bool fFirst,
return 0; return 0;
} }
// if the new node is complemented or a PI, another gate begins // if the new node is complemented or a PI, another gate begins
if ( !fFirst && (Abc_ObjIsComplement(pNode) || !Abc_ObjIsNode(pNode) || !fDuplicate && !fSelective && (Abc_ObjFanoutNum(pNode) > 1)) ) if ( !fFirst && (Abc_ObjIsComplement(pNode) || !Abc_ObjIsNode(pNode) || (!fDuplicate && !fSelective && (Abc_ObjFanoutNum(pNode) > 1)) || Vec_PtrSize(vSuper) > 10000) )
{ {
Vec_PtrPush( vSuper, pNode ); Vec_PtrPush( vSuper, pNode );
Abc_ObjRegular(pNode)->fMarkB = 1; Abc_ObjRegular(pNode)->fMarkB = 1;
......
...@@ -1202,10 +1202,10 @@ Abc_Ntk_t * Abc_NtkDarLcorr( Abc_Ntk_t * pNtk, int nFramesP, int nConfMax, int f ...@@ -1202,10 +1202,10 @@ Abc_Ntk_t * Abc_NtkDarLcorr( Abc_Ntk_t * pNtk, int nFramesP, int nConfMax, int f
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
int Abc_NtkDarBmc( Abc_Ntk_t * pNtk, int nFrames, int nBTLimit, int fRewrite, int fVerbose ) int Abc_NtkDarBmc( Abc_Ntk_t * pNtk, int nFrames, int nBTLimit, int fRewrite, int fNewAlgo, int fVerbose )
{ {
Aig_Man_t * pMan; Aig_Man_t * pMan;
int clk = clock(); int RetValue, clk = clock();
// derive the AIG manager // derive the AIG manager
pMan = Abc_NtkToDar( pNtk, 0, 1 ); pMan = Abc_NtkToDar( pNtk, 0, 1 );
if ( pMan == NULL ) if ( pMan == NULL )
...@@ -1214,16 +1214,35 @@ int Abc_NtkDarBmc( Abc_Ntk_t * pNtk, int nFrames, int nBTLimit, int fRewrite, in ...@@ -1214,16 +1214,35 @@ int Abc_NtkDarBmc( Abc_Ntk_t * pNtk, int nFrames, int nBTLimit, int fRewrite, in
return -1; return -1;
} }
assert( pMan->nRegs > 0 ); assert( pMan->nRegs > 0 );
pMan->nTruePis = Aig_ManPiNum(pMan) - Aig_ManRegNum(pMan);
pMan->nTruePos = Aig_ManPoNum(pMan) - Aig_ManRegNum(pMan);
// perform verification // perform verification
Fra_BmcPerformSimple( pMan, nFrames, nBTLimit, fRewrite, fVerbose ); if ( fNewAlgo )
pNtk->pSeqModel = pMan->pSeqModel; pMan->pSeqModel = NULL;
if ( pNtk->pSeqModel )
{ {
Fra_Cex_t * pCex = pNtk->pSeqModel; int iFrame;
printf( "Output %d was asserted in frame %d (use \"write_counter\" to dump the trace). ", pCex->iPo, pCex->iFrame ); RetValue = Saig_ManBmcSimple( pMan, nFrames, nBTLimit, fRewrite, fVerbose, &iFrame );
if ( RetValue == 1 )
printf( "No output was asserted in %d frames. ", nFrames );
else if ( RetValue == -1 )
printf( "No output was asserted in %d frames. Reached conflict limit (%d). ", iFrame, nBTLimit );
else // if ( RetValue == 0 )
{
Fra_Cex_t * pCex = pNtk->pSeqModel;
printf( "Output %d was asserted in frame %d (use \"write_counter\" to dump the trace). ", pCex->iPo, pCex->iFrame );
}
} }
else else
printf( "No output was asserted after BMC with %d frames. ", nFrames ); {
Fra_BmcPerformSimple( pMan, nFrames, nBTLimit, fRewrite, fVerbose );
pNtk->pSeqModel = pMan->pSeqModel; pMan->pSeqModel = NULL;
if ( pNtk->pSeqModel )
{
Fra_Cex_t * pCex = pNtk->pSeqModel;
printf( "Output %d was asserted in frame %d (use \"write_counter\" to dump the trace). ", pCex->iPo, pCex->iFrame );
}
else
printf( "No output was asserted in %d frames. ", nFrames );
}
PRT( "Time", clock() - clk ); PRT( "Time", clock() - clk );
Aig_ManStop( pMan ); Aig_ManStop( pMan );
return 1; return 1;
...@@ -1240,7 +1259,7 @@ PRT( "Time", clock() - clk ); ...@@ -1240,7 +1259,7 @@ PRT( "Time", clock() - clk );
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
int Abc_NtkDarBmcInter( Abc_Ntk_t * pNtk, int nConfLimit, int fVerbose ) int Abc_NtkDarBmcInter( Abc_Ntk_t * pNtk, int nConfLimit, int fRewrite, int fTransLoop, int fVerbose )
{ {
Aig_Man_t * pMan; Aig_Man_t * pMan;
int RetValue, Depth, clk = clock(); int RetValue, Depth, clk = clock();
...@@ -1254,7 +1273,7 @@ int Abc_NtkDarBmcInter( Abc_Ntk_t * pNtk, int nConfLimit, int fVerbose ) ...@@ -1254,7 +1273,7 @@ int Abc_NtkDarBmcInter( Abc_Ntk_t * pNtk, int nConfLimit, int fVerbose )
assert( pMan->nRegs > 0 ); assert( pMan->nRegs > 0 );
pMan->nTruePis = Aig_ManPiNum(pMan) - Aig_ManRegNum(pMan); pMan->nTruePis = Aig_ManPiNum(pMan) - Aig_ManRegNum(pMan);
pMan->nTruePos = Aig_ManPoNum(pMan) - Aig_ManRegNum(pMan); pMan->nTruePos = Aig_ManPoNum(pMan) - Aig_ManRegNum(pMan);
RetValue = Saig_Interpolate( pMan, nConfLimit, fVerbose, &Depth ); RetValue = Saig_Interpolate( pMan, nConfLimit, fRewrite, fTransLoop, fVerbose, &Depth );
if ( RetValue == 1 ) if ( RetValue == 1 )
printf( "Property proved. " ); printf( "Property proved. " );
else if ( RetValue == 0 ) else if ( RetValue == 0 )
...@@ -1892,7 +1911,7 @@ timeInt = 0; ...@@ -1892,7 +1911,7 @@ timeInt = 0;
/**Function************************************************************* /**Function*************************************************************
Synopsis [Interplates two networks.] Synopsis []
Description [] Description []
...@@ -1915,7 +1934,32 @@ void Abc_NtkPrintSccs( Abc_Ntk_t * pNtk, int fVerbose ) ...@@ -1915,7 +1934,32 @@ void Abc_NtkPrintSccs( Abc_Ntk_t * pNtk, int fVerbose )
/**Function************************************************************* /**Function*************************************************************
Synopsis [Interplates two networks.] Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Abc_NtkDarPrintCone( Abc_Ntk_t * pNtk )
{
extern void Saig_ManPrintCones( Aig_Man_t * pAig );
Aig_Man_t * pMan;
pMan = Abc_NtkToDar( pNtk, 0, 1 );
if ( pMan == NULL )
return;
assert( Aig_ManRegNum(pMan) > 0 );
pMan->nTruePis = Aig_ManPiNum(pMan) - Aig_ManRegNum(pMan);
pMan->nTruePos = Aig_ManPoNum(pMan) - Aig_ManRegNum(pMan);
Saig_ManPrintCones( pMan );
Aig_ManStop( pMan );
}
/**Function*************************************************************
Synopsis []
Description [] Description []
...@@ -1947,7 +1991,6 @@ Abc_Ntk_t * Abc_NtkBalanceExor( Abc_Ntk_t * pNtk, int fUpdateLevel, int fVerbose ...@@ -1947,7 +1991,6 @@ Abc_Ntk_t * Abc_NtkBalanceExor( Abc_Ntk_t * pNtk, int fUpdateLevel, int fVerbose
return pNtkAig; return pNtkAig;
} }
/**Function************************************************************* /**Function*************************************************************
Synopsis [Performs phase abstraction.] Synopsis [Performs phase abstraction.]
......
...@@ -170,7 +170,7 @@ int * Sat_SolverGetModel( sat_solver * p, int * pVars, int nVars ) ...@@ -170,7 +170,7 @@ int * Sat_SolverGetModel( sat_solver * p, int * pVars, int nVars )
{ {
int * pModel; int * pModel;
int i; int i;
pModel = ALLOC( int, nVars ); pModel = ALLOC( int, nVars+1 );
for ( i = 0; i < nVars; i++ ) for ( i = 0; i < nVars; i++ )
{ {
assert( pVars[i] >= 0 && pVars[i] < p->size ); assert( pVars[i] >= 0 && pVars[i] < p->size );
......
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