50 Vec_Int_t * vPivots = Vec_IntAlloc( 100 );
51 FILE * pFile = fopen( pName,
"r" );
52 while ( fscanf( pFile,
"%d", &Num ) == 1 )
53 Vec_IntPush( vPivots, Num );
61 Vec_Int_t * vPivots = Vec_IntAlloc( 100 );
66 if ( iVar > 0 && iVar < Gia_ManObjNum(
p) )
67 Gia_ManObj(
p, iVar )->fMark0 = 1;
69 printf(
"Cannot find object with Id %d in the given AIG.\n", iVar );
71 if ( Gia_ManObj(
p, iVar )->fMark0 )
72 Vec_IntPush( vPivots, Abc_Lit2Var(i) );
92 pObj->
Value = Abc_Lit2Var(Vec_IntSize(vNodes));
93 Vec_IntPush( vNodes, Gia_ObjId(
p, pObj) );
94 Vec_IntPush( vNodes, f );
101 if ( Gia_ObjIsTravIdCurrentId(
p, Id) )
103 Gia_ObjSetTravIdCurrentId(
p, Id);
104 pObj = Gia_ManObj(
p, Id );
105 Bmc_ManBCoreAssignVar(
p, pObj, f, vNodes );
106 if ( Gia_ObjIsPi(
p, pObj) )
108 if ( Gia_ObjIsRo(
p, pObj) )
110 Vec_IntPush( vRootsNew, Gia_ObjId(
p, Gia_ObjRoToRi(
p, pObj)) );
113 assert( Gia_ObjIsAnd(pObj) );
120 int f, i, iObj, nNodesOld;
121 Vec_Int_t * vNodes = Vec_IntAlloc( 100 );
122 Vec_Int_t * vRoots = Vec_IntAlloc( 100 );
123 Vec_Int_t * vRoots2 = Vec_IntAlloc( 100 );
124 assert( iFrame >= 0 && iOut >= 0 );
126 Vec_IntPush( vNodes, -1 );
127 Vec_IntPush( vNodes, -1 );
128 Bmc_ManBCoreAssignVar(
p, Gia_ManPo(
p, iOut), iFrame, vNodes );
130 Vec_IntPush( vRoots, Gia_ObjId(
p, Gia_ManPo(
p, iOut)) );
132 for ( f = iFrame; f >= 0; f-- )
136 Gia_ObjSetTravIdCurrent(
p, Gia_ManConst0(
p) );
137 Bmc_ManBCoreAssignVar(
p, Gia_ManConst0(
p), f, vNodes );
138 sat_solver_add_const( pSat, Gia_ManConst0(
p)->Value, 1 );
140 Vec_IntClear( vRoots2 );
141 nNodesOld = Vec_IntSize(vNodes);
147 pObj = Gia_ManPo(
p, iOut);
149 assert( Gia_ObjFanin0(pObj)->Value == 3 );
151 sat_solver_add_constraint( pSat, Gia_ObjFanin0(pObj)->Value, pObj->
Value, Gia_ObjFaninC0(pObj) );
157 sat_solver_add_buffer( pSat, pObj->
Value, Gia_ObjFanin0(pObj)->Value, Gia_ObjFaninC0(pObj) );
160 pObj->
Value = Gia_ObjRiToRo(
p, pObj)->Value;
164 pObj = Gia_ManObj(
p, iObj); i++;
165 if ( Gia_ObjIsCi(pObj) )
167 assert( Gia_ObjIsAnd(pObj) );
168 sat_solver_add_and( pSat, pObj->
Value, Gia_ObjFanin0(pObj)->Value, Gia_ObjFanin1(pObj)->Value, Gia_ObjFaninC0(pObj), Gia_ObjFaninC1(pObj), 0 );
176 sat_solver_add_constraint( pSat, pObj->
Value, Abc_Lit2Var(Vec_IntSize(vNodes)), 1 );
177 pObj = Gia_ObjRiToRo(
p, pObj);
178 Bmc_ManBCoreAssignVar(
p, pObj, -1, vNodes );
180 Vec_IntFree( vRoots );
181 Vec_IntFree( vRoots2 );
198 clock_t clk = clock();
209 sat_solver_set_runtime_limit( pSat, pPars->
nTimeOut ? pPars->
nTimeOut * CLOCKS_PER_SEC + Abc_Clock(): 0 );
216 sat_solver_set_pivot_variables( pSat, Vec_IntArray(vPivots), Vec_IntSize(vPivots) );
217 Vec_IntReleaseArray( vPivots );
218 Vec_IntFree( vPivots );
221 RetValue =
sat_solver_solve( pSat, NULL, NULL, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
224 Vec_IntFree( vVarMap );
226 printf(
"Timeout of conflict limit is reached.\n" );
231 Vec_IntFree( vVarMap );
233 printf(
"The BMC problem is SAT.\n" );
238 printf(
"SAT solver returned UNSAT after %7d conflicts. ", (
int)pSat->
stats.
conflicts );
239 Abc_PrintTime( 1,
"Time", clock() - clk );
251 printf(
"UNSAT core contains %d (out of %d) learned clauses. ", Vec_IntSize(vCore),
sat_solver_nconflicts(pSat) );
252 Abc_PrintTime( 1,
"Time", clock() - clk );
255 Vec_IntSort( vCore, 0 );
258 if ( pFile != stdout )
262 Vec_IntFree( vVarMap );
263 Vec_IntFree( vCore );
#define ABC_SWAP(Type, a, b)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
void Bmc_ManBCoreCollect_rec(Gia_Man_t *p, int Id, int f, Vec_Int_t *vNodes, Vec_Int_t *vRootsNew)
Vec_Int_t * Bmc_ManBCoreCollectPivots(Gia_Man_t *p, char *pName, Vec_Int_t *vVarMap)
Vec_Int_t * Bmc_ManBCoreCollect(Gia_Man_t *p, int iFrame, int iOut, sat_solver *pSat)
void Bmc_ManBCorePerform(Gia_Man_t *p, Bmc_BCorePar_t *pPars)
MACRO DEFINITIONS ///.
ABC_NAMESPACE_IMPL_START Vec_Int_t * Bmc_ManBCoreReadPivots(char *pName)
DECLARATIONS ///.
struct Bmc_BCorePar_t_ Bmc_BCorePar_t
#define sat_solver_add_and
struct Gia_Obj_t_ Gia_Obj_t
struct Gia_Man_t_ Gia_Man_t
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
void Gia_ManIncrementTravId(Gia_Man_t *p)
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
void * Intp_ManUnsatCore(Intp_Man_t *p, Sto_Man_t *pCnf, int fLearned, int fVerbose)
void Intp_ManFree(Intp_Man_t *p)
void Intp_ManUnsatCorePrintForBmc(FILE *pFile, Sto_Man_t *pCnf, void *vCore0, void *vVarMap0)
Intp_Man_t * Intp_ManAlloc()
FUNCTION DEFINITIONS ///.
sat_solver * sat_solver_new(void)
int sat_solver_nconflicts(sat_solver *s)
void sat_solver_setnvars(sat_solver *s, int n)
void sat_solver_store_alloc(sat_solver *s)
void sat_solver_store_mark_roots(sat_solver *s)
void * sat_solver_store_release(sat_solver *s)
void sat_solver_delete(sat_solver *s)
void Sto_ManFree(Sto_Man_t *p)
struct Intp_Man_t_ Intp_Man_t
struct Sto_Man_t_ Sto_Man_t
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)