50 return 3 & (pInfo[i >> 4] >> ((i & 15) << 1));
56 pInfo[i >> 4] ^= (Value << ((i & 15) << 1));
92 if ( nFrames && f == nFrames )
95 if ( !nFrames && *iFirst >= 0 && f == *iFirst + nFramesAdd )
103 pState =
ABC_ALLOC(
unsigned, nStateWords );
115 Count[0] = Count[1] = Count[2] = Count[3] = 0;
117 Count[pObj->
Value]++;
118 printf(
"%5d : 0 =%7d 1 =%7d x =%7d all =%7d out = %s\n",
120 Gia_ManPo(p, 0)->Value == GIA_UND ?
"x" :
"0" );
124 printf(
"Finished %d frames. First x-valued PO is in frame %d. ", nFrames, *iFirst );
236 int iLit0 = 1, iLit1 = 1;
289 Vec_Int_t * vRoots, * vCone, * vLeaves, * vMap;
290 unsigned * pStateF, * pStateP;
296 vStates =
Bmc_MnaTernary( pGia, nFramesMax, nFramesAdd, fVerbose, &iFirst );
304 pStateP = f ? (
unsigned *)
Vec_PtrEntry(vStates, f-1) : 0;
317 printf(
"Frame %4d : Roots = %6d Leaves = %6d Cone = %6d\n",
332 if ( vRoots == NULL )
340 pStateP = f ? (
unsigned *)
Vec_PtrEntry(vStates, f-1) : 0;
347 Bmc_MnaBuild( pGia, vRoots, vCone, pNew, vMap, *pvPiMap );
349 printf(
"Frame %4d : Roots = %6d Leaves = %6d Cone = %6d\n",
469 int i, iObj, VarC0 = p->nSatVars++;
544 for ( i = 0; i < pCnf->
nClauses; i++ )
555 if ( i < pCnf->nClauses )
556 printf(
"SAT solver became UNSAT after adding clauses.\n" );
597 for ( i = iStart; i < iStop; i++ )
626 for ( i = iStart; i < iStop; i++ )
657 int f, i=0, Lit, status, RetValue = -2;
660 for ( f = 0; f < nFramesMax; f++ )
676 status =
sat_solver_solve( p->pSat, &Lit, &Lit + 1, (ABC_INT64_T)pPars->
nConfLimit, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
689 printf(
"%4d : PI =%9d. AIG =%9d. Var =%8d. In =%6d. And =%9d. Cla =%9d. Conf =%9d. Mem =%7.1f MB ",
695 if ( RetValue != -2 )
697 if ( RetValue == -1 )
698 printf(
"SAT solver reached conflict/runtime limit in frame %d.\n", f );
701 printf(
"Output %d of miter \"%s\" was asserted in frame %d. ",
708 if ( RetValue == -2 )
715 printf(
"Dumped unfolded frames into file \"frames.aig\".\n" );
738 int i, iObjId, iSatVar, iOrigPi;
739 int iFramePi = 0, iFrame = -1;
776 int nFramesMax, f, i=0, Lit, status, RetValue = -2;
783 printf(
"Unfolding for %d frames with first non-trivial PO %d. ", nFramesMax,
Gia_ManBmcFindFirst(p->pFrames) );
797 printf(
"Dumped unfolded frames into file \"frames.aig\".\n" );
799 for ( f = 0; f < nFramesMax; f++ )
814 status =
sat_solver_solve( p->pSat, &Lit, &Lit + 1, (ABC_INT64_T)pPars->
nConfLimit, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
826 printf(
"%4d : PI =%9d. AIG =%9d. Var =%8d. In =%6d. And =%9d. Cla =%9d. Conf =%9d. Mem =%7.1f MB ",
833 if ( RetValue != -2 )
835 if ( RetValue == -1 )
836 printf(
"SAT solver reached conflict/runtime limit in frame %d.\n", f );
841 printf(
"Output %d of miter \"%s\" was asserted in frame %d. ",
849 if ( RetValue == -2 )
870 int iObj =
Gia_ObjId( p->pFrames, pObj );
871 if (
Gia_ObjIsAnd(pObj) && p->pCnf->pObj2Count[iObj] == -1 )
890 nClas = p->pCnf->pObj2Count[iObj];
891 iCla = p->pCnf->pObj2Clause[iObj];
892 for ( i = 0; i < nClas; i++ )
895 int * pClauseThis = p->pCnf->pClauses[iCla+i];
896 int * pClauseNext = p->pCnf->pClauses[iCla+i+1];
897 for ( nLits = 0; pClauseThis + nLits < pClauseNext; nLits++ )
899 if ( pClauseThis[nLits] < 2 )
900 printf(
"\n\n\nError in CNF generation: Constant literal!\n\n\n" );
909 printf(
"SAT solver became UNSAT after adding clauses.\n" );
917 for ( i = iStart; i < iStop; i++ )
960 int nFramesMax, f, i=0, Lit = 1, status, RetValue = -2;
968 printf(
"Unfolding for %d frames with first non-trivial PO %d. ", nFramesMax,
Gia_ManBmcFindFirst(p->pFrames) );
980 printf(
"Dumped unfolded frames into file \"frames.aig\".\n" );
987 p->pCnf = (
Cnf_Dat_t *)p->pFrames->pData; p->pFrames->pData = NULL;
994 for ( f = 0; f < nFramesMax; f++ )
1008 printf(
"Output %d is trivially SAT.\n", i );
1012 status =
sat_solver_solve( p->pSat, &Lit, &Lit + 1, (ABC_INT64_T)pPars->
nConfLimit, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
1024 printf(
"%4d : PI =%9d. AIG =%9d. Var =%8d. In =%6d. And =%9d. Cla =%9d. Conf =%9d. Mem =%7.1f MB ",
1031 if ( RetValue != -2 )
1033 if ( RetValue == -1 )
1034 printf(
"SAT solver reached conflict/runtime limit in frame %d.\n", f );
1039 printf(
"Output %d of miter \"%s\" was asserted in frame %d. ",
1047 if ( RetValue == -2 )
1075 if ( TimeToStop && TimeToStop <
Abc_Clock() )
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 Unr_Man_t_ Unr_Man_t
INCLUDES ///.
void Gia_ManCleanPhase(Gia_Man_t *p)
static Vec_Ptr_t * Vec_PtrStart(int nSize)
static Gia_Obj_t * Gia_ObjChild0(Gia_Obj_t *pObj)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
static int Abc_Lit2LitV(int *pMap, int Lit)
int Gia_ManBmcPerformInt(Gia_Man_t *pGia, Bmc_AndPar_t *pPars)
void Gia_ManStop(Gia_Man_t *p)
Aig_Man_t * Gia_ManToAigSimple(Gia_Man_t *p)
void Bmc_MnaBuild_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Gia_Man_t *pNew, Vec_Int_t *vMap, Vec_Int_t *vPiMap)
#define Gia_ManForEachCo(p, pObj, i)
void Bmc_MnaCollect_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vNodes, unsigned *pState)
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
void Gia_ManPrintStats(Gia_Man_t *p, Gps_Par_t *pPars)
static int Gia_ManPoNum(Gia_Man_t *p)
static int Gia_ObjFaninC1(Gia_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 ///.
Gia_Man_t * Gia_ManBmcUnroll(Gia_Man_t *pGia, int nFramesMax, int nFramesAdd, int fVerbose, Vec_Int_t **pvPiMap)
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
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 ///.
Gia_Man_t * Unr_ManUnrollFrame(Unr_Man_t *p, int f)
void Aig_ManStop(Aig_Man_t *p)
ABC_NAMESPACE_IMPL_START Abc_Cex_t * Abc_CexAlloc(int nRegs, int nRealPis, int nFrames)
DECLARATIONS ///.
static char * Gia_ManName(Gia_Man_t *p)
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Bmc_Mna_t * Bmc_MnaAlloc()
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)
Abc_Cex_t * Gia_ManBmcCexGen(Bmc_Mna_t *pMan, Gia_Man_t *p, int iOut)
static void Gia_ManTerSimInfoSet(unsigned *pInfo, int i, int Value)
static int Gia_ManAppendCi(Gia_Man_t *p)
void sat_solver_delete(sat_solver *s)
static void Vec_PtrFreeFree(Vec_Ptr_t *p)
static int Abc_Var2Lit(int Var, int fCompl)
#define Vec_IntForEachEntryReverse(vVec, pEntry, i)
int sat_solver_nconflicts(sat_solver *s)
static int Gia_ObjFaninId1p(Gia_Man_t *p, Gia_Obj_t *pObj)
int Gia_ManBmcPerform_Unr(Gia_Man_t *pGia, Bmc_AndPar_t *pPars)
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
#define ABC_ALLOC(type, num)
void Bmc_MnaFree(Bmc_Mna_t *p)
Gia_Man_t * Jf_ManDeriveCnf(Gia_Man_t *p, int fCnfObjIds)
static int Gia_XsimNotCond(int Value, int fCompl)
static int Gia_XsimAndCond(int Value0, int fCompl0, int Value1, int fCompl1)
static abctime Abc_Clock()
Unr_Man_t * Unr_ManUnrollStart(Gia_Man_t *pGia, int fVerbose)
Gia_Man_t * Gia_ManBmcDupCone(Gia_Man_t *p, Vec_Int_t *vIns, Vec_Int_t *vNodes, Vec_Int_t *vOuts)
static int Vec_PtrSize(Vec_Ptr_t *p)
static void Vec_VecFree(Vec_Vec_t *p)
static Vec_Int_t * Vec_IntStartFull(int nSize)
static int Abc_LitNotCond(int Lit, int c)
Gia_Man_t * Gia_ManDupFromVecs(Gia_Man_t *p, Vec_Int_t *vCis, Vec_Int_t *vAnds, Vec_Int_t *vCos, int nRegs)
static Gia_Obj_t * Gia_ManConst1(Gia_Man_t *p)
static int sat_solver_var_value(sat_solver *s, int v)
void Gia_ManBmcAddCnfNew(Bmc_Mna_t *p, int iStart, int iStop)
static int Gia_ManTerSimInfoGet(unsigned *pInfo, int i)
int Gia_ManBmcPerform(Gia_Man_t *pGia, Bmc_AndPar_t *pPars)
typedefABC_NAMESPACE_IMPL_START struct Bmc_Mna_t_ Bmc_Mna_t
DECLARATIONS ///.
#define Gia_ManForEachRiRo(p, pObjRi, pObjRo, i)
static void Abc_PrintTime(int level, const char *pStr, abctime time)
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
static int Gia_ManAndNum(Gia_Man_t *p)
static int Aig_ManCoNum(Aig_Man_t *p)
static int Abc_MinInt(int a, int b)
void Gia_ManBmcAddCnfNew_rec(Bmc_Mna_t *p, Gia_Obj_t *pObj)
static Gia_Obj_t * Gia_ManPi(Gia_Man_t *p, int v)
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
void Bmc_MnaBuild(Gia_Man_t *p, Vec_Int_t *vCos, Vec_Int_t *vNodes, Gia_Man_t *pNew, Vec_Int_t *vMap, Vec_Int_t *vPiMap)
void Gia_ManBmcAddCone(Bmc_Mna_t *p, int iStart, int iStop)
Gia_Man_t * Gia_ManAigSyn2(Gia_Man_t *p, int fOldAlgo, int fCoarsen, int fCutMin, int nRelaxRatio, int fDelayMin, int fVerbose, int fVeryVerbose)
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
static Gia_Obj_t * Gia_ObjRoToRi(Gia_Man_t *p, Gia_Obj_t *pObj)
static int Gia_ObjIsRi(Gia_Man_t *p, Gia_Obj_t *pObj)
void sat_solver_setnvars(sat_solver *s, int n)
static int Vec_IntEntry(Vec_Int_t *p, int i)
int sat_solver_nvars(sat_solver *s)
#define ABC_NAMESPACE_IMPL_END
void Gia_ManHashStart(Gia_Man_t *p)
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
void Gia_ManBmcAddCnf(Bmc_Mna_t *p, Gia_Man_t *pGia, Vec_Int_t *vIns, Vec_Int_t *vNodes, Vec_Int_t *vOuts)
#define Gia_ManForEachAnd(p, pObj, i)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
void Unr_ManFree(Unr_Man_t *p)
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Cnf_Dat_t * Cnf_DeriveOther(Aig_Man_t *pAig, int fSkipTtMin)
static void Vec_IntFreeP(Vec_Int_t **p)
#define Gia_ManForEachPi(p, pObj, i)
void Bmc_MnaCollect(Gia_Man_t *p, Vec_Int_t *vCos, Vec_Int_t *vNodes, unsigned *pState)
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact)
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
int sat_solver_nclauses(sat_solver *s)
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
#define ABC_NAMESPACE_IMPL_START
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
static void Abc_InfoSetBit(unsigned *p, int i)
Vec_Ptr_t * Bmc_MnaTernary(Gia_Man_t *p, int nFrames, int nFramesAdd, int fVerbose, int *iFirst)
FUNCTION DEFINITIONS ///.
void Bmc_MnaSelect_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vLeaves)
sat_solver * sat_solver_new(void)
static int Vec_IntSize(Vec_Int_t *p)
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
void Bmc_MnaSelect(Gia_Man_t *p, Vec_Int_t *vCos, Vec_Int_t *vNodes, Vec_Int_t *vLeaves)
int Gia_ManBmcAssignVarIds(Bmc_Mna_t *p, Vec_Int_t *vIns, Vec_Int_t *vUsed, Vec_Int_t *vOuts)
static Gia_Obj_t * Gia_ObjRiToRo(Gia_Man_t *p, Gia_Obj_t *pObj)
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
#define ABC_CALLOC(type, num)
static int Gia_ObjFaninId0p(Gia_Man_t *p, Gia_Obj_t *pObj)
static int Gia_ObjIsPo(Gia_Man_t *p, Gia_Obj_t *pObj)
void Cnf_DataFree(Cnf_Dat_t *p)
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
#define ABC_INFINITY
MACRO DEFINITIONS ///.
void Gia_ManBmcAddCone_rec(Bmc_Mna_t *p, Gia_Obj_t *pObj)
static int Abc_BitWordNum(int nBits)
double Gia_ManMemory(Gia_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
#define Gia_ManForEachRi(p, pObj, i)
#define Gia_ManForEachObj1(p, pObj, i)
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
static void Vec_IntFree(Vec_Int_t *p)
static int Gia_ManPiNum(Gia_Man_t *p)
static void Vec_IntClear(Vec_Int_t *p)
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
char * Abc_UtilStrsav(char *s)
#define Gia_ManForEachPo(p, pObj, i)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
int Gia_ManBmcFindFirst(Gia_Man_t *pFrames)
static Cnf_Dat_t * Cnf_DeriveGia(Gia_Man_t *p)
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
static int Gia_ObjCioId(Gia_Obj_t *pObj)
static int Gia_ManObjNum(Gia_Man_t *p)
int Gia_ManBmcPerform_old_cnf(Gia_Man_t *pGia, Bmc_AndPar_t *pPars)
void Gia_ManHashStop(Gia_Man_t *p)
static int Gia_ObjIsPi(Gia_Man_t *p, Gia_Obj_t *pObj)
static int Gia_ManCoNum(Gia_Man_t *p)
static int Gia_ManRegNum(Gia_Man_t *p)
int Gia_ManBmcCheckOutputs(Gia_Man_t *pFrames, int iStart, int iStop)