208{
209 int * pLoc2Glo =
p->pPars->fBackward? Vec_IntArray(
p->vCs2Glo ) : Vec_IntArray(
p->vNs2Glo );
210 int * pLoc2GloR =
p->pPars->fBackward? Vec_IntArray(
p->vNs2Glo ) : Vec_IntArray(
p->vCs2Glo );
211 int * pGlo2Loc =
p->pPars->fBackward? Vec_IntArray(
p->vGlo2Ns ) : Vec_IntArray(
p->vGlo2Cs );
212 DdNode * bCurrent, * bReached, * bNext, * bTemp;
213 abctime clk2, clk = Abc_Clock();
214 int nIters, nBddSize;
215
216
217
218
219
220
221
222
223 if ( Abc_Clock() >
p->pPars->TimeTarget )
224 {
225 if ( !
p->pPars->fSilent )
226 printf(
"Reached timeout (%d seconds) before image computation.\n",
p->pPars->TimeLimit );
227 p->pPars->iFrame = -1;
228 return -1;
229 }
230
231
232 p->dd->TimeStop =
p->pPars->TimeTarget;
233 p->ddG->TimeStop =
p->pPars->TimeTarget;
234 p->ddR->TimeStop =
p->pPars->TimeTarget;
235
236
237 if (
p->pPars->fBackward )
238 {
239
241 if ( bTemp == NULL )
242 {
243 if ( !
p->pPars->fSilent )
244 printf(
"Reached timeout (%d seconds) while computing bad states.\n",
p->pPars->TimeLimit );
245 p->pPars->iFrame = -1;
246 return -1;
247 }
248 Cudd_Ref( bTemp );
249
252 Cudd_RecursiveDeref(
p->ddR, bTemp );
253 bReached = Cudd_bddTransfer(
p->ddR,
p->ddG, bCurrent ); Cudd_Ref( bReached );
254 Cudd_RecursiveDeref(
p->ddR, bCurrent );
255
257 if ( bCurrent == NULL )
258 {
259 Cudd_RecursiveDeref(
p->ddG, bReached );
260 if ( !
p->pPars->fSilent )
261 printf(
"Reached timeout (%d seconds) during transfer 0.\n",
p->pPars->TimeLimit );
262 p->pPars->iFrame = -1;
263 return -1;
264 }
265 Cudd_Ref( bCurrent );
266 }
267 else
268 {
269
271 if (
p->ddR->bFunc == NULL )
272 {
273 if ( !
p->pPars->fSilent )
274 printf(
"Reached timeout (%d seconds) while computing bad states.\n",
p->pPars->TimeLimit );
275 p->pPars->iFrame = -1;
276 return -1;
277 }
278 Cudd_Ref(
p->ddR->bFunc );
279
282
283
284 }
285
286
287 for ( nIters = 0; nIters <
p->pPars->nIterMax; nIters++ )
288 {
289 clk2 = Abc_Clock();
290
291 if (
p->pPars->TimeLimit && Abc_Clock() >
p->pPars->TimeTarget )
292 {
293 if ( !
p->pPars->fSilent )
294 printf(
"Reached timeout (%d seconds) during image computation.\n",
p->pPars->TimeLimit );
295 p->pPars->iFrame = nIters - 1;
296 Cudd_RecursiveDeref(
p->dd, bCurrent ); bCurrent = NULL;
297 Cudd_RecursiveDeref(
p->ddG, bReached ); bReached = NULL;
298 return -1;
299 }
300
301
303 if ( bTemp == NULL )
304 {
305 if ( !
p->pPars->fSilent )
306 printf(
"Reached timeout (%d seconds) during image computation.\n",
p->pPars->TimeLimit );
307 p->pPars->iFrame = nIters - 1;
308 Cudd_RecursiveDeref(
p->dd, bCurrent ); bCurrent = NULL;
309 Cudd_RecursiveDeref(
p->ddG, bReached ); bReached = NULL;
310 return -1;
311 }
312 Cudd_Ref( bTemp );
313 Vec_PtrPush(
p->vRings, bTemp );
314
315
316 if ( !
p->pPars->fSkipOutCheck && !Cudd_bddLeq(
p->ddR, bTemp, Cudd_Not(
p->ddR->bFunc) ) )
317 {
318 assert(
p->pInit->pSeqModel == NULL );
319 if ( !
p->pPars->fBackward )
321 Cudd_RecursiveDeref(
p->dd, bCurrent ); bCurrent = NULL;
322 Cudd_RecursiveDeref(
p->ddG, bReached ); bReached = NULL;
323 if ( !
p->pPars->fSilent )
324 {
325 if ( !
p->pPars->fBackward )
326 Abc_Print( 1,
"Output %d of miter \"%s\" was asserted in frame %d. ",
p->pInit->pSeqModel->iPo,
p->pInit->pName, nIters );
327 else
328 Abc_Print( 1, "Output ??? was asserted in frame %d (counter-example is not produced). ", nIters );
329 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
330 }
331 p->pPars->iFrame = nIters - 1;
332 return 0;
333 }
334
335
337 vQuant0, vQuant1,
p->vDriRefs,
p->pPars->TimeTarget,
338 p->pPars->fBackward,
p->pPars->fReorder,
p->pPars->fVeryVerbose );
339 if ( bNext == NULL )
340 {
341 if ( !
p->pPars->fSilent )
342 printf(
"Reached timeout (%d seconds) during image computation.\n",
p->pPars->TimeLimit );
343 p->pPars->iFrame = nIters - 1;
344 Cudd_RecursiveDeref(
p->dd, bCurrent ); bCurrent = NULL;
345 Cudd_RecursiveDeref(
p->ddG, bReached ); bReached = NULL;
346 return -1;
347 }
348 Cudd_Ref( bNext );
349 Cudd_RecursiveDeref(
p->dd, bCurrent ); bCurrent = NULL;
350
351
352
353
354
355
356
358 if ( bNext == NULL )
359 {
360 if ( !
p->pPars->fSilent )
361 printf(
"Reached timeout (%d seconds) during image computation in transfer 1.\n",
p->pPars->TimeLimit );
362 p->pPars->iFrame = nIters - 1;
363 Cudd_RecursiveDeref(
p->dd, bTemp );
364 Cudd_RecursiveDeref(
p->ddG, bReached ); bReached = NULL;
365 return -1;
366 }
367 Cudd_Ref( bNext );
368 Cudd_RecursiveDeref(
p->dd, bTemp );
369
370 nBddSize = Cudd_DagSize(bNext);
371
372 if ( Cudd_bddLeq(
p->ddG, bNext, bReached ) )
373 {
374 Cudd_RecursiveDeref(
p->ddG, bNext ); bNext = NULL;
375 break;
376 }
377
378
379 bCurrent = Cudd_bddAnd(
p->ddG, bNext, Cudd_Not(bReached) );
380 if ( bCurrent == NULL )
381 {
382 if ( !
p->pPars->fSilent )
383 printf(
"Reached timeout (%d seconds) during image computation in transfer 2.\n",
p->pPars->TimeLimit );
384 p->pPars->iFrame = nIters - 1;
385 Cudd_RecursiveDeref(
p->ddG, bNext );
386 Cudd_RecursiveDeref(
p->ddG, bReached ); bReached = NULL;
387 return -1;
388 }
389 Cudd_Ref( bCurrent );
390
391
392
393
394
395
397 if ( bCurrent == NULL )
398 {
399 if ( !
p->pPars->fSilent )
400 printf(
"Reached timeout (%d seconds) during image computation in transfer 2.\n",
p->pPars->TimeLimit );
401 p->pPars->iFrame = nIters - 1;
402 Cudd_RecursiveDeref(
p->ddG, bTemp );
403 Cudd_RecursiveDeref(
p->ddG, bReached ); bReached = NULL;
404 return -1;
405 }
406 Cudd_Ref( bCurrent );
407 Cudd_RecursiveDeref(
p->ddG, bTemp );
408
409
410 bReached = Cudd_bddOr(
p->ddG, bTemp = bReached, bNext ); Cudd_Ref( bReached );
411 Cudd_RecursiveDeref(
p->ddG, bTemp );
412 Cudd_RecursiveDeref(
p->ddG, bNext );
413 bNext = NULL;
414
415 if (
p->pPars->fVeryVerbose )
416 {
417 double nMints = Cudd_CountMinterm(
p->ddG, bReached, Saig_ManRegNum(
p->pAig) );
418
419 fprintf( stdout,
" Reachable states = %.0f. (Ratio = %.4f %%)\n", nMints, 100.0*nMints/pow(2.0, Saig_ManRegNum(
p->pAig)) );
420 fflush( stdout );
421 }
422 if (
p->pPars->fVerbose )
423 {
424 fprintf( stdout, "F =%3d : ", nIters );
425 fprintf( stdout, "Image =%6d ", nBddSize );
426 fprintf( stdout, "(%4d%4d) ",
427 Cudd_ReadReorderings(
p->dd), Cudd_ReadGarbageCollections(
p->dd) );
428 fprintf( stdout, "Reach =%6d ", Cudd_DagSize(bReached) );
429 fprintf( stdout, "(%4d%4d) ",
430 Cudd_ReadReorderings(
p->ddG), Cudd_ReadGarbageCollections(
p->ddG) );
431 Abc_PrintTime( 1, "Time", Abc_Clock() - clk2 );
432 }
433
434
435 if ( nIters ==
p->pPars->nIterMax - 1 )
436 {
437 if ( !
p->pPars->fSilent )
438 printf(
"Reached limit on the number of timeframes (%d).\n",
p->pPars->nIterMax );
439 p->pPars->iFrame = nIters;
440 Cudd_RecursiveDeref(
p->dd, bCurrent ); bCurrent = NULL;
441 Cudd_RecursiveDeref(
p->ddG, bReached ); bReached = NULL;
442 return -1;
443 }
444 }
445 if ( bReached == NULL )
446 {
447 p->pPars->iFrame = nIters - 1;
448 return 0;
449 }
450 if ( bCurrent )
451 Cudd_RecursiveDeref(
p->dd, bCurrent );
452
453 if (
p->pPars->fVerbose )
454 {
455 double nMints = Cudd_CountMinterm(
p->ddG, bReached, Saig_ManRegNum(
p->pAig) );
456 if ( nIters >=
p->pPars->nIterMax )
457 fprintf( stdout, "Reachability analysis is stopped after %d frames.\n", nIters );
458 else
459 fprintf( stdout, "Reachability analysis completed after %d frames.\n", nIters );
460 fprintf( stdout,
"Reachable states = %.0f. (Ratio = %.4f %%)\n", nMints, 100.0*nMints/pow(2.0, Saig_ManRegNum(
p->pAig)) );
461 fflush( stdout );
462 }
463 if (
p->pPars->fDumpReached )
464 {
466 printf( "Reached states with %d BDD nodes are dumpted into file \"reached.blif\".\n", Cudd_DagSize(bReached) );
467 }
468 Cudd_RecursiveDeref(
p->ddG, bReached );
469 if ( nIters >=
p->pPars->nIterMax )
470 {
471 if ( !
p->pPars->fSilent )
472 {
473 printf( "Verified only for states reachable in %d frames. ", nIters );
474 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
475 }
476 p->pPars->iFrame =
p->pPars->nIterMax;
477 return -1;
478 }
479 if ( !
p->pPars->fSilent )
480 {
481 printf( "The miter is proved unreachable after %d iterations. ", nIters );
482 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
483 }
484 p->pPars->iFrame = nIters - 1;
485 return 1;
486}
ABC_NAMESPACE_IMPL_START DdNode * Llb_BddComputeBad(Aig_Man_t *pInit, DdManager *dd, abctime TimeOut)
DECLARATIONS ///.
DdNode * Llb_BddQuantifyPis(Aig_Man_t *pInit, DdManager *dd, DdNode *bFunc)
Abc_Cex_t * Llb_CoreDeriveCex(Llb_Img_t *p)
void Llb_ManDumpReached(DdManager *ddG, DdNode *bReached, char *pModel, char *pFileName)