69 p->nFrameMax = nFrameMax;
70 p->nConfMax = nConfMax;
71 p->nTimeMax = nTimeMax;
72 p->fVerbose = fVerbose;
79 p->vCopies = Vec_IntAlloc( 1000 );
99 Vec_IntFree(
p->vCopies );
125 pObj = Gia_ManObj(
p->pFrames, i );
126 if ( Gia_ObjIsAnd(pObj) )
128 Gia_ObjFaninId0(pObj, i),
129 Gia_ObjFaninId1(pObj, i),
130 Gia_ObjFaninC0(pObj),
131 Gia_ObjFaninC1(pObj), 0 );
136static inline int Gia_Obj0Copy(
Vec_Int_t * vCopies,
int Fan0,
int fCompl0 )
137{
return Abc_LitNotCond( Vec_IntEntry(vCopies, Fan0), fCompl0 ); }
139static inline int Gia_Obj1Copy(
Vec_Int_t * vCopies,
int Fan1,
int fCompl1 )
140{
return Abc_LitNotCond( Vec_IntEntry(vCopies, Fan1), fCompl1 ); }
157 if ( Vec_IntEntry(
p->vCopies, Id) != -1 )
159 pObj = Gia_ManObj(
p->pFrames, Id);
160 assert( Gia_ObjIsCi(pObj) || Gia_ObjIsAnd(pObj) );
161 if ( Gia_ObjIsAnd(pObj) )
163 int fCompl0 = Gia_ObjFaninC0(pObj);
164 int fCompl1 = Gia_ObjFaninC1(pObj);
165 int Fan0 = Gia_ObjFaninId0p(
p->pFrames, pObj);
166 int Fan1 = Gia_ObjFaninId1p(
p->pFrames, pObj);
170 Gia_Obj0Copy(
p->vCopies, Fan0, fCompl0),
171 Gia_Obj1Copy(
p->vCopies, Fan1, fCompl1) );
173 else if ( Gia_ObjCioId(pObj) >= Gia_ManRegNum(
p->pGia) )
174 Res = sat_solver_var_value(
p->pSat, Id );
176 Res = Abc_Var2Lit( Id, 0 );
177 Vec_IntWriteEntry(
p->vCopies, Id, Res );
195 Vec_IntFill(
p->vCopies, Gia_ManObjNum(
p->pFrames), -1 );
197 LitOut = Vec_IntEntry(
p->vCopies, Abc_Lit2Var(LitProp) );
198 LitOut = Abc_LitNotCond( LitOut, Abc_LitIsCompl(LitProp) );
200 Gia_ManAppendCo(
p->pFrames, LitOut );
204 return Abc_LitNot(LitOut);
222 int ObjPrev = 0, ConfPrev = 0;
223 int Count = 0, LitOut, RetValue;
230 while ( RetValue ==
l_True )
243 printf(
"%3d : AIG =%7d Conf =%7d. ", Count++,
245 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
246 ObjPrev = Gia_ManObjNum(
p->pFrames);
271 int f, i, Lit, RetValue = -1, fFailed = 0;
272 abctime nTimeToStop = Abc_Clock() + nTimeMax * CLOCKS_PER_SEC;
274 assert( Gia_ManPoNum(pGia) == 1 );
277 p =
Ccf_ManStart( pGia, nFrameMax, nConfMax, nTimeMax, fVerbose );
281 sat_solver_set_runtime_limit(
p->pSat, nTimeToStop );
284 for ( f = 0; f < nFrameMax; f++ )
287 printf(
"ITER %3d :\n", f );
304 printf(
"Property failed in frame %d.\n", f );
308 if ( i < Gia_ManPoNum(
p->pFrames) )
313 if ( nTimeToStop && Abc_Clock() > nTimeToStop )
314 printf(
"Runtime limit (%d sec) is reached after %d frames. ", nTimeMax, f );
315 else if ( f == nFrameMax )
316 printf(
"Completed %d frames without converging. ", f );
317 else if ( RetValue == 1 )
318 printf(
"Backward reachability converged after %d iterations. ", f-1 );
319 else if ( RetValue == -1 )
320 printf(
"Conflict limit or timeout is reached after %d frames. ", f-1 );
321 Abc_PrintTime( 1,
"Runtime", Abc_Clock() - clk );
323 if ( !fFailed && RetValue == 1 )
324 printf(
"Property holds.\n" );
326 printf(
"Property is undecided.\n" );
330 pNew =
p->pFrames;
p->pFrames = NULL;
#define ABC_CALLOC(type, num)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
#define sat_solver_addclause
#define sat_solver_add_and
Ccf_Man_t * Ccf_ManStart(Gia_Man_t *pGia, int nFrameMax, int nConfMax, int nTimeMax, int fVerbose)
FUNCTION DEFINITIONS ///.
typedefABC_NAMESPACE_IMPL_START struct Ccf_Man_t_ Ccf_Man_t
DECLARATIONS ///.
Gia_Man_t * Gia_ManCofTest(Gia_Man_t *pGia, int nFrameMax, int nConfMax, int nTimeMax, int fVerbose)
void Gia_ManCofExtendSolver(Ccf_Man_t *p)
void Ccf_ManStop(Ccf_Man_t *p)
int Gia_ManCofGetReachable(Ccf_Man_t *p, int Lit)
void Gia_ManCofOneDerive_rec(Ccf_Man_t *p, int Id)
int Gia_ManCofOneDerive(Ccf_Man_t *p, int LitProp)
void Gia_ManStop(Gia_Man_t *p)
void Gia_ManUnrollStop(void *pMan)
#define Gia_ManForEachPo(p, pObj, i)
void Gia_ManStopP(Gia_Man_t **p)
struct Gia_ParFra_t_ Gia_ParFra_t
struct Gia_Obj_t_ Gia_Obj_t
void * Gia_ManUnrollAdd(void *pMan, int fMax)
struct Gia_Man_t_ Gia_Man_t
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
void * Gia_ManUnrollStart(Gia_Man_t *pAig, Gia_ParFra_t *pPars)
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
int Gia_ManUnrollLastLit(void *pMan)
void Gia_ManSetPhase(Gia_Man_t *p)
void Gia_ManHashStop(Gia_Man_t *p)
sat_solver * sat_solver_new(void)
int sat_solver_nconflicts(sat_solver *s)
void sat_solver_setnvars(sat_solver *s, int n)
int sat_solver_nvars(sat_solver *s)
void sat_solver_delete(sat_solver *s)