50 Gia_Obj_t * pObj, * pObj1, * pPrev = NULL;
51 int i, CtrlValue = 0, iPrevValue = -1;
52 pObj = Gia_ManObj(
p, Vec_IntEntry(vHook, 0) );
53 if ( Vec_IntSize(vHook) == 1 )
58 assert( Vec_IntSize(vHook) >= 2 );
60 pObj1 = Gia_ManObj(
p, Vec_IntEntry(vHook, 1) );
61 if ( Gia_ObjFanin0(pObj1) == pObj )
62 CtrlValue = Gia_ObjFaninC0(pObj1);
63 else if ( Gia_ObjFanin1(pObj1) == pObj )
64 CtrlValue = Gia_ObjFaninC1(pObj1);
70 int iObjValue = pObj->
Value;
71 pObj->
Value = i ?
Gia_ManHashAnd(pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj)) : CtrlValue;
73 pPrev->
Value = iPrevValue;
74 iPrevValue = iObjValue;
79 printf(
"Eliminated path: " );
80 Vec_IntPrint( vHook );
83 printf(
"Level %3d : ", Gia_ObjLevel(
p, pObj) );
172 Vec_Int_t * vLits = Vec_IntAlloc(
p->nLevels );
174 int nLits = 0, * pLits = NULL;
175 int i, Shift[2], status;
176 abctime clkStart = Abc_Clock();
178 int iFanin = Gia_ObjFaninId0p(
p, pPivot );
181 pObj->
Value = Vec_IntSize(vObjs) - 1 - i;
182 assert( Gia_ObjIsCo(pPivot) );
185 sat_solver_set_runtime_limit( pSat, nTimeOut ? nTimeOut * CLOCKS_PER_SEC + Abc_Clock(): 0 );
187 Shift[0] = 3 * Vec_IntSize(vPath);
188 Shift[1] = 3 * Vec_IntSize(vPath) + Vec_IntSize(vObjs);
192 if ( !Gia_ObjIsAnd(pObj) )
195 Gia_ObjFanin0(pObj)->Value + Shift[0], Gia_ObjFanin1(pObj)->Value + Shift[0],
196 Gia_ObjFaninC0(pObj), Gia_ObjFaninC1(pObj), 0 );
198 Gia_ObjFanin0(pObj)->Value + Shift[1], Gia_ObjFanin1(pObj)->Value + Shift[1],
199 Gia_ObjFaninC0(pObj), Gia_ObjFaninC1(pObj), 0 );
204 if ( Gia_ObjIsAnd(pObj) )
207 pFanin = Gia_ManObj(
p, Vec_IntEntry(vPath, i-1) );
208 if ( pFanin == Gia_ObjFanin0(pObj) )
211 i-1 + 1*Vec_IntSize(vPath), Gia_ObjFanin1(pObj)->Value + Shift[0],
212 Gia_ObjFaninC0(pObj), Gia_ObjFaninC1(pObj), 0 );
214 i-1 + 2*Vec_IntSize(vPath), Gia_ObjFanin1(pObj)->Value + Shift[1],
215 Gia_ObjFaninC0(pObj), Gia_ObjFaninC1(pObj), 0 );
217 else if ( pFanin == Gia_ObjFanin1(pObj) )
220 Gia_ObjFanin0(pObj)->Value + Shift[0], i-1 + 1*Vec_IntSize(vPath),
221 Gia_ObjFaninC0(pObj), Gia_ObjFaninC1(pObj), 0 );
223 Gia_ObjFanin0(pObj)->Value + Shift[1], i-1 + 2*Vec_IntSize(vPath),
224 Gia_ObjFaninC0(pObj), Gia_ObjFaninC1(pObj), 0 );
229 else if ( Gia_ObjIsCi(pObj) )
232 Vec_IntPush( vLits, Abc_Var2Lit(i, 0) );
235 status =
sat_solver_solve( pSat, Vec_IntArray(vLits), Vec_IntArray(vLits) + Vec_IntSize(vLits), (ABC_INT64_T)nTimeOut, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
239 nLits = sat_solver_final( pSat, &pLits );
240 iBeg = Abc_Lit2Var(pLits[nLits-1]);
241 iEnd = Abc_Lit2Var(pLits[0]);
242 if ( iEnd - iBeg < 20 )
245 for ( i = Abc_MaxInt(iBeg-1, 0); i <= iEnd; i++ )
246 if ( Vec_WecLevelSize(vHooks, Vec_IntEntry(vPath, i)) > 0 )
250 Vec_Int_t * vHook = Vec_WecEntry(vHooks, Vec_IntEntry(vPath, iEnd));
251 for ( i = Abc_MaxInt(iBeg-1, 0); i <= iEnd; i++ )
252 Vec_IntPush( vHook, Vec_IntEntry(vPath, i) );
258 printf(
"PO %6d : Level = %3d ", iOut, Gia_ObjLevel(
p, pPivot) );
260 printf(
"Timeout reached after %d seconds. ", nTimeOut );
261 else if ( status ==
l_True )
262 printf(
"There is no false path. " );
265 printf(
"False path contains %d nodes (out of %d): ", nLits, Vec_IntSize(vPath) );
266 printf(
"top = %d ", Vec_IntEntry(vPath, Abc_Lit2Var(pLits[0])) );
268 for ( i = 0; i < nLits; i++ )
269 printf(
"%d ", Abc_Lit2Var(pLits[i]) );
272 Abc_PrintTime( 1,
"Time", Abc_Clock() - clkStart );
275 Vec_IntFree( vObjs );
276 Vec_IntFree( vPath );
277 Vec_IntFree( vLits );
290 vWeights = Vec_FltAlloc( Gia_ManCoNum(
p) );
292 Vec_FltPush( vWeights, Gia_ObjLevel(
p, pObj) );
294 vPrio = Vec_QueAlloc( Gia_ManCoNum(
p) );
295 Vec_QueSetPriority( vPrio, Vec_FltArrayP(vWeights) );
297 Vec_QuePush( vPrio, i );
299 vHooks = Vec_WecStart( Gia_ManObjNum(
p) );
300 while ( Vec_QueTopPriority(vPrio) >=
p->nLevels - nSlackMax )
303 printf(
"Collected %d non-overlapping false paths.\n", Vec_WecSizeUsed(vHooks) );
307 Vec_WecFree( vHooks );
308 Vec_FltFree( vWeights );
309 Vec_QueFree( vPrio );
362 Vec_Int_t * vLits = Vec_IntAlloc(
p->nLevels );
364 int nLits = 0, * pLits = NULL;
365 int i, Shift[2], status;
366 abctime clkStart = Abc_Clock();
370 pObj->
Value = Vec_IntSize(vObjs) - 1 - i;
373 sat_solver_set_runtime_limit( pSat, nTimeOut ? nTimeOut * CLOCKS_PER_SEC + Abc_Clock(): 0 );
375 Shift[0] = 3 * Vec_IntSize(vPath);
376 Shift[1] = 3 * Vec_IntSize(vPath) + Vec_IntSize(vObjs);
380 if ( !Gia_ObjIsAnd(pObj) )
383 Gia_ObjFanin0(pObj)->Value + Shift[0], Gia_ObjFanin1(pObj)->Value + Shift[0],
384 Gia_ObjFaninC0(pObj), Gia_ObjFaninC1(pObj), 0 );
386 Gia_ObjFanin0(pObj)->Value + Shift[1], Gia_ObjFanin1(pObj)->Value + Shift[1],
387 Gia_ObjFaninC0(pObj), Gia_ObjFaninC1(pObj), 0 );
392 if ( !Gia_ObjIsAnd(pObj) )
395 pFanin = Gia_ManObj(
p, Vec_IntEntry(vPath, i-1) );
396 if ( pFanin == Gia_ObjFanin0(pObj) )
399 i-1 + 1*Vec_IntSize(vPath), Gia_ObjFanin1(pObj)->Value + Shift[0],
400 Gia_ObjFaninC0(pObj), Gia_ObjFaninC1(pObj), 0 );
402 i-1 + 2*Vec_IntSize(vPath), Gia_ObjFanin1(pObj)->Value + Shift[1],
403 Gia_ObjFaninC0(pObj), Gia_ObjFaninC1(pObj), 0 );
405 else if ( pFanin == Gia_ObjFanin1(pObj) )
408 Gia_ObjFanin0(pObj)->Value + Shift[0], i-1 + 1*Vec_IntSize(vPath),
409 Gia_ObjFaninC0(pObj), Gia_ObjFaninC1(pObj), 0 );
411 Gia_ObjFanin0(pObj)->Value + Shift[1], i-1 + 2*Vec_IntSize(vPath),
412 Gia_ObjFaninC0(pObj), Gia_ObjFaninC1(pObj), 0 );
416 Vec_IntPush( vLits, Abc_Var2Lit(i, 0) );
419 status =
sat_solver_solve( pSat, Vec_IntArray(vLits), Vec_IntArray(vLits) + Vec_IntSize(vLits), (ABC_INT64_T)nTimeOut, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
420 Vec_IntClear( vLits );
424 nLits = sat_solver_final( pSat, &pLits );
425 iBeg = Abc_Lit2Var(pLits[nLits-1]);
426 iEnd = Abc_Lit2Var(pLits[0]);
429 for ( i = Abc_MaxInt(iBeg-1, 0); i <= iEnd; i++ )
431 Vec_IntPush( vLits, Vec_IntEntry(vPath, i) );
435 printf(
"PO %6d : Level = %3d ", iOut, Gia_ObjLevelId(
p, iObj) );
437 printf(
"Timeout reached after %d seconds. ", nTimeOut );
438 else if ( status ==
l_True )
439 printf(
"There is no false path. " );
442 printf(
"False path contains %d nodes (out of %d): ", Vec_IntSize(vLits), Vec_IntSize(vPath) );
444 for ( i = nLits-1; i >= 0; i-- )
445 printf(
"%d ", Vec_IntEntry(vPath, Abc_Lit2Var(pLits[i])) );
448 Abc_PrintTime( 1,
"Time", Abc_Clock() - clkStart );
451 Vec_IntFree( vObjs );
452 Vec_IntFree( vPath );
455 Vec_IntFree( vLits );