129 unsigned * pInfo = (
unsigned *)
Vec_PtrEntry( vSimInfo, iFrame );
135 unsigned * pInfo = (
unsigned *)
Vec_PtrEntry( vSimInfo, iFrame );
154 int Value0, Value1, Value;
204 int i, f, nFramesLimit, nFrameWords;
209 nFramesLimit =
Abc_MinInt( nFramesLimit, nFramesMax );
213 for ( f = 0; f < nFramesLimit; f++ )
232 printf(
"Ternary sim found non-zero output in frame %d. Used %5.2f MB. ",
241 printf(
"Ternary sim proved all outputs in the first %d frames. Used %5.2f MB. ",
242 nFramesLimit, 0.25 * nFramesLimit *
Aig_ManObjNum(p) / (1<<20) );
289 p->nFramesMax = nFramesMax;
290 p->nNodesMax = nNodesMax;
291 p->nConfMaxOne = nConfMaxOne;
292 p->nConfMaxAll = nConfMaxAll;
293 p->fVerbose = fVerbose;
307 p->pSat->nLearntStart = 10000;
308 p->pSat->nLearntDelta = 5000;
309 p->pSat->nLearntRatio = 75;
310 p->pSat->nLearntMax = p->pSat->nLearntStart;
312 Lit =
toLit( p->nSatVars );
460 p->iFramePrev = p->iFrameLast;
461 for ( ; p->iFrameLast < p->nFramesMax; p->iFrameLast++, p->iOutputLast = 0 )
463 if ( p->iOutputLast == 0 )
467 for ( ; p->iOutputLast <
Saig_ManPoNum(p->pAig); p->iOutputLast++ )
559 int i, Lits[2], VarNumOld, VarNumNew;
566 if ( VarNumNew == -1 )
570 if ( VarNumOld == 0 )
586 for ( i = 0; i < pCnf->
nClauses; i++ )
589 if ( i < pCnf->nClauses )
590 printf(
"SAT solver became UNSAT after adding clauses.\n" );
607 p->iOutputFail = p->iOutputLast;
608 p->iFrameFail = p->iFrameLast;
609 for ( k =
Vec_PtrSize(p->vTargets); k > iTargetFail; k-- )
611 if ( p->iOutputFail == 0 )
638 pCex->iFrame = p->iFrameFail;
639 pCex->iPo = p->iOutputFail;
641 for ( f = 0; f <= p->iFrameFail; f++ )
646 if ( pObjFrm == NULL )
658 printf(
"Saig_BmcGenerateCounterExample(): Counter-example is invalid.\n" );
679 int i, k, VarNum, Lit, status, RetValue;
681 if ( p->pSat->qtail != p->pSat->qhead )
690 if ( p->nConfMaxAll && p->pSat->stats.conflicts > p->nConfMaxAll )
694 RetValue =
sat_solver_solve( p->pSat, &Lit, &Lit + 1, (ABC_INT64_T)p->nConfMaxOne, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
702 for ( k = 0; k <
veci_size(&p->pSat->unit_lits); k++ )
761 int Saig_BmcPerform(
Aig_Man_t * pAig,
int nStart,
int nFramesMax,
int nNodesMax,
int nTimeOut,
int nConfMaxOne,
int nConfMaxAll,
int fVerbose,
int fVerbOverwrite,
int * piFrames,
int fSilent )
767 int Iter, RetValue = -1;
768 abctime nTimeToStop = nTimeOut ? nTimeOut * CLOCKS_PER_SEC +
Abc_Clock(): 0;
778 printf(
"Running \"bmc2\". AIG: PI/PO/Reg = %d/%d/%d. Node = %6d. Lev = %5d.\n",
781 printf(
"Params: FramesMax = %d. NodesDelta = %d. ConfMaxOne = %d. ConfMaxAll = %d.\n",
782 nFramesMax, nNodesMax, nConfMaxOne, nConfMaxAll );
785 p =
Saig_BmcManStart( pAig, nFramesMax, nNodesMax, nConfMaxOne, nConfMaxAll, fVerbose );
789 for ( Iter = 0; ; Iter++ )
803 p->nSatVars += pCnf->
nVars;
812 printf(
"%4d : F =%5d. O =%4d. And =%8d. Var =%8d. Conf =%7d. ",
813 Iter, p->iFrameLast, p->iOutputLast,
Aig_ManNodeNum(p->pFrm), p->nSatVars, (
int)p->pSat->stats.conflicts );
814 printf(
"%4.0f MB", 4.0*(p->iFrameLast+1)*p->nObjs/(1<<20) );
815 printf(
"%9.2f sec", (
float)(
Abc_Clock() - clkTotal)/(
float)(CLOCKS_PER_SEC) );
822 if ( nTimeOut &&
Abc_Clock() > nTimeToStop )
825 printf(
"Reached timeout (%d seconds).\n", nTimeOut );
827 *piFrames = p->iFrameLast-1;
836 Abc_Print( 1,
"Output %d of miter \"%s\" was asserted in frame %d. ",
837 p->iOutputFail, p->pAig->pName, p->iFrameFail );
840 *piFrames = p->iFrameFail - 1;
848 if ( p->iOutputLast > 0 )
849 *piFrames = p->iFramePrev - 2;
851 *piFrames = p->iFramePrev - 1;
856 if ( fVerbOverwrite )
866 if ( p->iFrameLast >= p->nFramesMax )
867 printf(
"Reached limit on the number of timeframes (%d).\n", p->nFramesMax );
868 else if ( p->nConfMaxAll && p->pSat->stats.conflicts > p->nConfMaxAll )
869 printf(
"Reached global conflict limit (%d).\n", p->nConfMaxAll );
870 else if ( nTimeOut &&
Abc_Clock() > nTimeToStop )
871 printf(
"Reached timeout (%d seconds).\n", nTimeOut );
873 printf(
"Reached local conflict limit (%d).\n", p->nConfMaxOne );
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
static abctime sat_solver_set_runtime_limit(sat_solver *s, abctime Limit)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Aig_Man_t * Saig_BmcIntervalToAig(Saig_Bmc_t *p)
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
static int Saig_ManPoNum(Aig_Man_t *p)
static int Saig_ObjIsLo(Aig_Man_t *p, Aig_Obj_t *pObj)
#define Aig_ManForEachObjVec(vIds, p, pObj, i)
Cnf_Dat_t * Cnf_Derive(Aig_Man_t *pAig, int nOutputs)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
int sat_solver_addclause(sat_solver *s, lit *begin, lit *end)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
void Aig_ManStop(Aig_Man_t *p)
ABC_NAMESPACE_IMPL_START Abc_Cex_t * Abc_CexAlloc(int nRegs, int nRealPis, int nFrames)
DECLARATIONS ///.
static int Aig_ManObjNum(Aig_Man_t *p)
static Aig_Obj_t * Saig_ObjLoToLi(Aig_Man_t *p, Aig_Obj_t *pObj)
int Saig_ManVerifyCex(Aig_Man_t *pAig, Abc_Cex_t *p)
int sat_solver_solve(sat_solver *s, lit *begin, lit *end, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, ABC_INT64_T nConfLimitGlobal, ABC_INT64_T nInsLimitGlobal)
static void sat_solver_compress(sat_solver *s)
void sat_solver_delete(sat_solver *s)
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
static int Abs_ManSimInfoAnd(int Value0, int Value1)
static int Abc_Var2Lit(int Var, int fCompl)
int Saig_BmcSolveTargets(Saig_Bmc_t *p, int nStart, int *pnOutsSolved)
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
void Aig_ManPrintStats(Aig_Man_t *p)
static int Aig_IsComplement(Aig_Obj_t *p)
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
static void Vec_IntSetEntry(Vec_Int_t *p, int i, int Entry)
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
#define ABS_ZER
FUNCTION DEFINITIONS ///.
static int Abs_ManSimInfoNot(int Value)
#define ABC_ALLOC(type, num)
static Aig_Obj_t * Aig_ManObj(Aig_Man_t *p, int i)
static int Vec_IntGetEntry(Vec_Int_t *p, int i)
void Saig_BmcAddTargetsAsPos(Saig_Bmc_t *p)
static void veci_resize(veci *v, int k)
static abctime Abc_Clock()
static int Abc_MaxInt(int a, int b)
int Abs_ManExtendOneEval_rec(Vec_Ptr_t *vSimInfo, Aig_Man_t *p, Aig_Obj_t *pObj, int iFrame)
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
static int Vec_PtrSize(Vec_Ptr_t *p)
static void Vec_VecFree(Vec_Vec_t *p)
Aig_Obj_t * Saig_BmcIntervalConstruct_rec(Saig_Bmc_t *p, Aig_Obj_t *pObj, int i, Vec_Int_t *vVisited)
static Vec_Int_t * Vec_IntStartFull(int nSize)
void Saig_BmcLoadCnf(Saig_Bmc_t *p, Cnf_Dat_t *pCnf)
Aig_Obj_t * Saig_BmcIntervalToAig_rec(Saig_Bmc_t *p, Aig_Man_t *pNew, Aig_Obj_t *pObj)
static int Aig_ManNodeNum(Aig_Man_t *p)
static int sat_solver_var_value(sat_solver *s, int v)
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
static lit lit_neg(lit l)
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
static int Aig_ManCoNum(Aig_Man_t *p)
static int Abc_MinInt(int a, int b)
static int Abc_LitIsCompl(int Lit)
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
static int Abs_ManSimInfoGet(Vec_Ptr_t *vSimInfo, Aig_Obj_t *pObj, int iFrame)
static lit toLitCond(int v, int c)
void sat_solver_setnvars(sat_solver *s, int n)
static int Vec_IntEntry(Vec_Int_t *p, int i)
#define ABC_NAMESPACE_IMPL_END
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
#define Saig_ManForEachLo(p, pObj, i)
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
static void Abs_ManSimInfoSet(Vec_Ptr_t *vSimInfo, Aig_Obj_t *pObj, int iFrame, int Value)
static Aig_Obj_t * Saig_BmcObjFrame(Saig_Bmc_t *p, Aig_Obj_t *pObj, int i)
static void Abc_Print(int level, const char *format,...)
static void Saig_BmcObjSetFrame(Saig_Bmc_t *p, Aig_Obj_t *pObj, int i, Aig_Obj_t *pNode)
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)
static int Saig_ManRegNum(Aig_Man_t *p)
static void Saig_BmcSetSatNum(Saig_Bmc_t *p, Aig_Obj_t *pObj, int Num)
static int Aig_ManObjNumMax(Aig_Man_t *p)
void Cnf_DataLift(Cnf_Dat_t *p, int nVarsPlus)
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
#define ABC_NAMESPACE_IMPL_START
void Saig_BmcDeriveFailed(Saig_Bmc_t *p, int iTargetFail)
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
static void Abc_InfoSetBit(unsigned *p, int i)
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
int Aig_ManLevelNum(Aig_Man_t *p)
static int Aig_ManRegNum(Aig_Man_t *p)
int sat_solver_simplify(sat_solver *s)
sat_solver * sat_solver_new(void)
#define Aig_ManForEachObj(p, pObj, i)
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
void Abs_ManFreeAray(Vec_Ptr_t *p)
int Saig_BmcPerform(Aig_Man_t *pAig, int nStart, int nFramesMax, int nNodesMax, int nTimeOut, int nConfMaxOne, int nConfMaxAll, int fVerbose, int fVerbOverwrite, int *piFrames, int fSilent)
#define ABC_CALLOC(type, num)
static int Abc_Lit2Var(int Lit)
static int Saig_BmcSatNum(Saig_Bmc_t *p, Aig_Obj_t *pObj)
void Cnf_DataFree(Cnf_Dat_t *p)
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
void Saig_BmcManStop(Saig_Bmc_t *p)
#define ABC_INFINITY
MACRO DEFINITIONS ///.
static Aig_Obj_t * Saig_BmcObjChild1(Saig_Bmc_t *p, Aig_Obj_t *pObj, int i)
Saig_Bmc_t * Saig_BmcManStart(Aig_Man_t *pAig, int nFramesMax, int nNodesMax, int nConfMaxOne, int nConfMaxAll, int fVerbose)
static int Abc_BitWordNum(int nBits)
#define Saig_ManForEachPo(p, pObj, i)
static int Aig_ObjId(Aig_Obj_t *pObj)
static void Vec_PtrClear(Vec_Ptr_t *p)
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Vec_Ptr_t * Abs_ManTernarySimulate(Aig_Man_t *p, int nFramesMax, int fVerbose)
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
void Saig_BmcInterval(Saig_Bmc_t *p)
static void Vec_IntFree(Vec_Int_t *p)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
static Aig_Obj_t * Saig_BmcObjChild0(Saig_Bmc_t *p, Aig_Obj_t *pObj, int i)
void Abc_CexFree(Abc_Cex_t *p)
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
static void Vec_IntClear(Vec_Int_t *p)
static int * veci_begin(veci *v)
static int Saig_ObjIsPi(Aig_Man_t *p, Aig_Obj_t *pObj)
int Aig_ManCleanup(Aig_Man_t *p)
typedefABC_NAMESPACE_IMPL_START struct Saig_Bmc_t_ Saig_Bmc_t
DECLARATIONS ///.
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
static int veci_size(veci *v)
Abc_Cex_t * Saig_BmcGenerateCounterExample(Saig_Bmc_t *p)
static void Vec_PtrFree(Vec_Ptr_t *p)
#define Saig_ManForEachPi(p, pObj, i)