56 for ( v = 0; v < nRegs; v++ )
57 if ( pStateI[v] >= 0 && pStateK[v] == -1 )
71 for ( v = 0; v < nRegs; v++ )
72 if ( pStateI[v] >= 0 )
95 int v, iVars, nSatVarsOld, RetValue, * pClause;
99 for ( v = 0; v < nRegs; v++ )
100 if ( pStateI[v] >= 0 && pStateK[v] == -1 )
103 printf(
"Cannot constrain an incomplete state.\n" );
107 nSatVarsOld = *pnSatVarNum;
108 for ( v = 0; v < nRegs; v++ )
109 if ( pStateI[v] >= 0 )
116 printf(
"SAT solver became UNSAT after adding a uniqueness constraint.\n" );
124 for ( v = nSatVarsOld; v < *pnSatVarNum; v++ )
132 printf(
"SAT solver became UNSAT after adding a uniqueness constraint.\n" );
149 int Saig_ManInduction(
Aig_Man_t *
p,
int nTimeOut,
int nFramesMax,
int nConfMax,
int fUnique,
int fUniqueAll,
int fGetCex,
int fVerbose,
int fVeryVerbose )
154 Vec_Int_t * vTopVarNums, * vState, * vTopVarIds = NULL;
156 Aig_Obj_t * pObjPi, * pObjPiCopy, * pObjPo;
157 int i, k, f, Lits[2], status = -1, RetValue, nSatVarNum, nConfPrev;
158 int nOldSize, iReg, iLast, fAdded, nConstrs = 0, nClauses = 0;
159 abctime clk, nTimeToStop = nTimeOut ? nTimeOut * CLOCKS_PER_SEC +
Abc_Clock() : 0;
160 assert( fUnique == 0 || fUniqueAll == 0 );
183 printf(
"Induction parameters: FramesMax = %5d. ConflictMax = %6d.\n", nFramesMax, nConfMax );
199 nSatVarNum += pCnfPart->
nVars;
203 if ( fGetCex && vTopVarIds == NULL )
208 if ( pObjPi->
pData == NULL )
247 for ( i = 0; i < pCnfPart->
nClauses; i++ )
250 if ( i < pCnfPart->nClauses )
269 assert( pObjPiCopy != NULL );
282 for ( i = 1; i < iLast-1; i++ )
286 printf(
"Adding constaint for state %2d and state %2d.\n", i, iLast-1 );
301 status =
sat_solver_solve( pSat, NULL, NULL, (ABC_INT64_T)nConfMax, 0, 0, 0 );
304 printf(
"Frame %4d : PI =%5d. PO =%5d. AIG =%5d. Var =%7d. Clau =%7d. Conf =%7d. ",
330 if ( nFramesMax && f == nFramesMax - 1 )
336 int VarNum, iBit = 0;
346 assert( iBit == pCex->nBits );
354 for ( i = 1; i < iLast; i++ )
356 for ( k = i+1; k < iLast; k++ )
363 printf(
"Adding constaint for state %2d and state %2d.\n", i, k );
381 if ( nTimeToStop &&
Abc_Clock() >= nTimeToStop )
382 printf(
"Timeout (%d sec) was reached during iteration %d.\n", nTimeOut, f+1 );
384 printf(
"Conflict limit (%d) was reached during iteration %d.\n", nConfMax, f+1 );
385 else if ( fUnique || fUniqueAll )
386 printf(
"Completed %d interations and added %d uniqueness constraints.\n", f+1, nConstrs );
388 printf(
"Completed %d interations.\n", f+1 );
static abctime sat_solver_set_runtime_limit(sat_solver *s, abctime Limit)
static int * Vec_IntArray(Vec_Int_t *p)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
static int Saig_ManPoNum(Aig_Man_t *p)
static int Saig_ObjIsLo(Aig_Man_t *p, Aig_Obj_t *pObj)
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)
static void Vec_IntFillExtra(Vec_Int_t *p, int nSize, int Fill)
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 Aig_Obj_t * Saig_ObjLoToLi(Aig_Man_t *p, Aig_Obj_t *pObj)
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)
void sat_solver_delete(sat_solver *s)
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
void Aig_SupportNodes(Aig_Man_t *p, Aig_Obj_t **ppObjs, int nObjs, Vec_Ptr_t *vSupp)
#define Aig_ManForEachCo(p, pObj, i)
#define ABC_ALLOC(type, num)
static abctime Abc_Clock()
static int Vec_PtrSize(Vec_Ptr_t *p)
static Vec_Int_t * Vec_IntStartFull(int nSize)
static int Aig_ManNodeNum(Aig_Man_t *p)
static int sat_solver_var_value(sat_solver *s, int v)
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
static int Aig_ManCoNum(Aig_Man_t *p)
int Saig_ManAddUniqueness(sat_solver *pSat, Vec_Int_t *vState, int nRegs, int i, int k, int *pnSatVarNum, int *pnClauses, int fVerbose)
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
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)
static int Aig_ManCiNum(Aig_Man_t *p)
#define ABC_NAMESPACE_IMPL_END
int Saig_ManInduction(Aig_Man_t *p, int nTimeOut, int nFramesMax, int nConfMax, int fUnique, int fUniqueAll, int fGetCex, int fVerbose, int fVeryVerbose)
int Cnf_DataAddXorClause(void *pSat, int iVarA, int iVarB, int iVarC)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
void Aig_ManSetCioIds(Aig_Man_t *p)
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
static void Vec_IntFreeP(Vec_Int_t **p)
static int Saig_ManRegNum(Aig_Man_t *p)
void Cnf_DataLift(Cnf_Dat_t *p, int nVarsPlus)
#define ABC_NAMESPACE_IMPL_START
static void Abc_InfoSetBit(unsigned *p, int i)
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
static int Aig_ManRegNum(Aig_Man_t *p)
sat_solver * sat_solver_new(void)
static int Vec_IntSize(Vec_Int_t *p)
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
void Cnf_DataFree(Cnf_Dat_t *p)
static int Aig_ObjId(Aig_Obj_t *pObj)
ABC_NAMESPACE_IMPL_START int Saig_ManStatesAreEqual(sat_solver *pSat, Vec_Int_t *vState, int nRegs, int i, int k)
DECLARATIONS ///.
static void Vec_PtrClear(Vec_Ptr_t *p)
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
static void Vec_IntFree(Vec_Int_t *p)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
void Abc_CexFree(Abc_Cex_t *p)
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
static void Vec_IntClear(Vec_Int_t *p)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
static void ** Vec_PtrArray(Vec_Ptr_t *p)
static int Saig_ObjIsPi(Aig_Man_t *p, Aig_Obj_t *pObj)
Aig_Man_t * Aig_ManDupSimpleDfsPart(Aig_Man_t *p, Vec_Ptr_t *vPis, Vec_Ptr_t *vCos)
static int Aig_ObjCioId(Aig_Obj_t *pObj)
static void Vec_PtrFree(Vec_Ptr_t *p)