53 pNew->
pName = Abc_UtilStrsav(
p->pName );
54 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
55 Gia_ManConst0(
p)->Value = 0;
58 if ( i == Gia_ManPiNum(
p) )
59 iCtrl = Gia_ManAppendCi( pNew );
60 pObj->
Value = Gia_ManAppendCi( pNew );
66 pObj->
Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
68 Gia_ManAppendCo( pNew,
Gia_ManHashMux( pNew, iCtrl, pObjRo->
Value, Gia_ObjFanin0Copy(pObjRi) ) );
74 printf(
"Before cleanup = %d nodes. After cleanup = %d nodes.\n",
75 Gia_ManAndNum(pTemp), Gia_ManAndNum(pNew) );
99 int i, Lit, RetValue = 0;
100 assert( Gia_ManRegNum(
p) > 0 );
106 vLits = Vec_IntAlloc( Gia_ManRegNum(
p) );
109 Lit = pCnf->
pVarNums[ Gia_ObjId(pNew, Gia_ObjFanin0(pObj)) ];
110 Lit = Abc_Var2Lit( Lit, Gia_ObjFaninC0(pObj) );
111 Vec_IntPush( vLits, Abc_LitNot(Lit) );
113 if (
sat_solver_solve( pSat, Vec_IntArray(vLits), Vec_IntArray(vLits) + Vec_IntSize(vLits), 0, 0, 0, 0 ) ==
l_True )
115 Vec_IntFree( vLits );
142 pFrames->
pName = Abc_UtilStrsav(
p->pName );
143 pFrames->
pSpec = Abc_UtilStrsav(
p->pSpec );
144 Gia_ManConst0(
p)->Value = 0;
147 for ( f = 0; f < nFrames; f++ )
150 pObj->
Value = Gia_ManAppendCi( pFrames );
152 pObj->
Value = f ? Gia_ObjRoToRi(
p, pObj)->Value : 0;
156 pObj->
Value = Gia_ObjFanin0Copy(pObj);
161 pObj->
Value = Gia_ManAppendCo( pFrames, Gia_ObjFanin0Copy(pObj) );
165 printf(
"Before cleanup = %d nodes. After cleanup = %d nodes.\n",
166 Gia_ManAndNum(pTemp), Gia_ManAndNum(pFrames) );
177 assert( Gia_ManRegNum(pFrames) == 0 );
190 sat_solver_add_buffer( pSat, nVars + i, pCnf->
pVarNums[Gia_ObjId(pFrames, Gia_ObjFanin0(pObj))], Gia_ObjFaninC0(pObj) );
208static inline int Int2_ManCheckFrames(
Int2_Man_t *
p,
int iFrame,
int iObj )
211 return Vec_IntEntry(vMapFrame, iObj);
213static inline void Int2_ManWriteFrames(
Int2_Man_t *
p,
int iFrame,
int iObj,
int iRes )
216 assert( Vec_IntEntry(vMapFrame, iObj) == -1 );
217 Vec_IntWriteEntry( vMapFrame, iObj, iRes );
224 for ( i = Vec_PtrSize(
p->vMapFrames); i <= iFrame; i++ )
225 Vec_PtrPush(
p->vMapFrames, Vec_IntStartFull( Gia_ManObjNum(
p->pGia) ) );
226 assert( Vec_PtrSize(
p->vMapFrames) == iFrame + 1 );
231 Int2_ManWriteFrames(
p, iFrame, iObj, 0 );
235 Vec_IntClear(
p->vStack );
238 pObj = Gia_ManCo(
p->pGia, Entry );
239 Vec_IntPush(
p->vStack, iFrame );
240 Vec_IntPush(
p->vStack, Gia_ObjId(
p->pGia, pObj) );
243 while ( Vec_IntSize(
p->vStack) > 0 )
245 int iObj = Vec_IntPop(
p->vStack);
246 int iFrame = Vec_IntPop(
p->vStack);
247 if ( Int2_ManCheckFrames(
p, iFrame, iObj) >= 0 )
249 pObj = Gia_ManObj(
p->pGia, iObj );
250 if ( Gia_ObjIsPi(
p->pGia, pObj) )
251 Int2_ManWriteFrames(
p, iFrame, iObj, Gia_ManAppendCi(
p->pFrames) );
252 else if ( iFrame == 0 && Gia_ObjIsRo(
p->pGia, iObj) )
253 Int2_ManWriteFrames(
p, iFrame, iObj, 0 );
254 else if ( Gia_ObjIsRo(
p->pGia, iObj) )
256 int iObjF = Gia_ObjId(
p->pGia, Gia_ObjRoToRi(
p->pGia, pObj) );
257 int iLit = Int2_ManCheckFrames(
p, iFrame-1, iObjF );
259 Int2_ManWriteFrames(
p, iFrame, iObj, iLit );
262 Vec_IntPush(
p->vStack, iFrame );
263 Vec_IntPush(
p->vStack, iObj );
264 Vec_IntPush(
p->vStack, iFrame-1 );
265 Vec_IntPush(
p->vStack, iObjF );
268 else if ( Gia_ObjIsCo(pObj) )
270 int iObjF = Gia_ObjFaninId0(
p->pGia, iObj) );
271 int iLit = Int2_ManCheckFrames(
p, iFrame, iObjF );
273 Int2_ManWriteFrames(
p, iFrame, iObj, Abc_LitNotCond(iLit, Gia_ObjFaninC0(pObj)) );
276 Vec_IntPush(
p->vStack, iFrame );
277 Vec_IntPush(
p->vStack, iObj );
278 Vec_IntPush(
p->vStack, iFrame );
279 Vec_IntPush(
p->vStack, iObjF );
282 else if ( Gia_ObjIsAnd(pObj) )
284 int iObjF0 = Gia_ObjFaninId0(
p->pGia, iObj) );
285 int iLit0 = Int2_ManCheckFrames(
p, iFrame, iObjF0 );
286 int iObjF1 = Gia_ObjFaninId1(
p->pGia, iObj) );
287 int iLit1 = Int2_ManCheckFrames(
p, iFrame, iObjF1 );
288 if ( iLit0 >= 0 && iLit1 >= 0 )
290 Entry = Gia_ManObjNum(pFrames);
292 Int2_ManWriteFrames(
p, iFrame, iObj, iLit );
293 if ( Entry < Gia_ManObjNum(pFrames) )
295 assert( !Abc_LitIsCompl(iLit) );
296 sat_solver_add_and(
p->pGiaPref, Abc_Lit2Var(iLit), Abc_Lit2Var(iLit0), Abc_Lit2Var(iLit1), Abc_LitIsCompl(iLit0), Abc_LitIsCompl(iLit1), 0 );
301 Vec_IntPush(
p->vStack, iFrame );
302 Vec_IntPush(
p->vStack, iObj );
305 Vec_IntPush(
p->vStack, iFrame );
306 Vec_IntPush(
p->vStack, iObjF0 );
310 Vec_IntPush(
p->vStack, iFrame );
311 Vec_IntPush(
p->vStack, iObjF1 );
327 iLit = Int2_ManCheckFrames(
p, 0, Gia_ObjId(
p->pGia, pObj) );
341 status =
sat_solver_solve(
p->pSatPref, Vec_IntArray(vCube), Vec_IntArray(vCube) + Vec_IntSize(vCube), 0, 0, 0, 0 );
#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
struct Cnf_Dat_t_ Cnf_Dat_t
void Cnf_DataFree(Cnf_Dat_t *p)
void Gia_ManStop(Gia_Man_t *p)
#define Gia_ManForEachRo(p, pObj, i)
#define Gia_ManForEachPo(p, pObj, i)
#define Gia_ManForEachAnd(p, pObj, i)
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
void Gia_ManHashAlloc(Gia_Man_t *p)
#define Gia_ManForEachPi(p, pObj, i)
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
struct Gia_Obj_t_ Gia_Obj_t
struct Gia_Man_t_ Gia_Man_t
int Gia_ManHashMux(Gia_Man_t *p, int iCtrl, int iData1, int iData0)
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
#define Gia_ManForEachCo(p, pObj, i)
#define Gia_ManForEachCi(p, pObj, i)
#define Gia_ManForEachRiRo(p, pObjRi, pObjRo, i)
void Gia_ManHashStop(Gia_Man_t *p)
#define Gia_ManForEachRi(p, pObj, i)
Gia_Man_t * Jf_ManDeriveCnf(Gia_Man_t *p, int fCnfObjIds)
void Int2_ManCreateFrames(Int2_Man_t *p, int iFrame, Vec_Int_t *vPrefCos)
sat_solver * Int2_ManSetupBmcSolver(Gia_Man_t *p, int nFrames)
ABC_NAMESPACE_IMPL_START Gia_Man_t * Int2_ManDupInit(Gia_Man_t *p, int fVerbose)
DECLARATIONS ///.
int Int2_ManCheckBmc(Int2_Man_t *p, Vec_Int_t *vCube)
Gia_Man_t * Int2_ManFrameInit(Gia_Man_t *p, int nFrames, int fVerbose)
int Int2_ManCheckInit(Gia_Man_t *p)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Int2_Man_t_ Int2_Man_t
INCLUDES ///.
void * Cnf_DataWriteIntoSolver(Cnf_Dat_t *p, int nFrames, int fInit)
void sat_solver_setnvars(sat_solver *s, int n)
int sat_solver_nvars(sat_solver *s)
void sat_solver_delete(sat_solver *s)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.