195 assert( dd->size == Saig_ManCiNum(
p) );
196 Cudd_bddIthVar( dd, Saig_ManCiNum(
p) + Saig_ManRegNum(
p) - 1 );
200 Cudd_AutodynEnable( dd, CUDD_REORDER_SYMM_SIFT );
202 Cudd_AutodynDisable( dd );
205 pbParts =
ABC_ALLOC( DdNode *, Saig_ManRegNum(
p) );
208 bVar = Cudd_bddIthVar( dd, Saig_ManCiNum(
p) + i );
209 pbParts[i] = Cudd_bddXnor( dd, bVar, Aig_ObjGlobalBdd(pNode) ); Cudd_Ref( pbParts[i] );
218 fprintf( stdout,
"BDD nodes in the partitions before reordering %d.\n", Cudd_SharingSize(pbParts,Saig_ManRegNum(
p)) );
219 Cudd_ReduceHeap( dd, CUDD_REORDER_SYMM_SIFT, 100 );
220 Cudd_AutodynDisable( dd );
222 fprintf( stdout,
"BDD nodes in the partitions after reordering %d.\n", Cudd_SharingSize(pbParts,Saig_ManRegNum(
p)) );
240 int fInternalReorder = 0;
243 DdNode * bReached, * bCubeCs;
245 DdNode * bNext = NULL;
247 Cudd_ReorderingType method;
248 int i, nIters, nBddSize = 0, status;
249 int nThreshold = 10000;
254 status = Cudd_ReorderingStatus( dd, &method );
256 Cudd_AutodynDisable( dd );
264 Cudd_RecursiveDeref( dd, bCubeCs );
268 printf(
"BDDs blew up during qualitification scheduling. " );
273 Cudd_AutodynEnable( dd, method );
276 vOnionRings = Vec_PtrAlloc( 1000 );
279 bCurrent = bInitial; Cudd_Ref( bCurrent );
280 bReached = bInitial; Cudd_Ref( bReached );
281 Vec_PtrPush( vOnionRings, bCurrent ); Cudd_Ref( bCurrent );
282 for ( nIters = 0; nIters < pPars->
nIterMax; nIters++ )
287 printf(
"Reached timeout after image computation (%d seconds).\n", pPars->
TimeLimit );
288 Vec_PtrFree( vOnionRings );
294 pPars->
iFrame = nIters - 1;
306 printf(
"BDDs blew up during image computation. " );
311 Vec_PtrFree( vOnionRings );
312 pPars->
iFrame = nIters - 1;
316 Cudd_RecursiveDeref( dd, bCurrent );
319 bNext = Cudd_bddVarMap( dd, bTemp = bNext ); Cudd_Ref( bNext );
320 Cudd_RecursiveDeref( dd, bTemp );
322 if ( Cudd_bddLeq( dd, bNext, bReached ) ) {
327 nBddSize = Cudd_DagSize(bNext);
328 if ( nBddSize > pPars->
nBddMax )
331 for ( i = 0; i < Saig_ManPoNum(
p); i++ )
333 if ( fCheckOutputs && !Cudd_bddLeq( dd, bNext, Cudd_Not(pbOutputs[i]) ) )
336 bIntersect = Cudd_bddIntersect( dd, bNext, pbOutputs[i] ); Cudd_Ref( bIntersect );
337 assert(
p->pSeqModel == NULL );
340 Cudd_RecursiveDeref( dd, bIntersect );
342 Abc_Print( 1,
"Output %d of miter \"%s\" was asserted in frame %d. ", i,
p->pName, Vec_PtrSize(vOnionRings) );
343 Cudd_RecursiveDeref( dd, bReached );
349 if ( i < Saig_ManPoNum(
p) )
352 bCurrent = Cudd_bddAnd( dd, bNext, Cudd_Not(bReached) ); Cudd_Ref( bCurrent );
353 Vec_PtrPush( vOnionRings, bCurrent ); Cudd_Ref( bCurrent );
358 bReached = Cudd_bddOr( dd, bTemp = bReached, bNext ); Cudd_Ref( bReached );
359 Cudd_RecursiveDeref( dd, bTemp );
360 Cudd_RecursiveDeref( dd, bNext );
362 fprintf( stdout,
"Frame = %3d. BDD = %5d. ", nIters, nBddSize );
363 if ( fInternalReorder && pPars->
fReorder && nBddSize > nThreshold )
366 fprintf( stdout,
"Reordering... Before = %5d. ", Cudd_DagSize(bReached) );
367 Cudd_ReduceHeap( dd, CUDD_REORDER_SYMM_SIFT, 100 );
368 Cudd_AutodynDisable( dd );
370 fprintf( stdout,
"After = %5d.\r", Cudd_DagSize(bReached) );
375 fprintf( stdout,
"\n" );
379 double nMints = Cudd_CountMinterm(dd, bReached, Saig_ManRegNum(
p) );
381 fprintf( stdout,
"Reachable states = %.0f. (Ratio = %.4f %%)\n", nMints, 100.0*nMints/pow(2.0, Saig_ManRegNum(
p)) );
386 Cudd_RecursiveDeref( dd, bNext );
389 Cudd_RecursiveDeref( dd, bTemp );
390 Vec_PtrFree( vOnionRings );
396 if ( bReached == NULL )
401 double nMints = Cudd_CountMinterm(dd, bReached, Saig_ManRegNum(
p) );
403 fprintf( stdout,
"Reachability analysis is stopped after %d frames.\n", nIters );
405 fprintf( stdout,
"Reachability analysis completed after %d frames.\n", nIters );
406 fprintf( stdout,
"Reachable states = %.0f. (Ratio = %.4f %%)\n", nMints, 100.0*nMints/pow(2.0, Saig_ManRegNum(
p)) );
410 Cudd_RecursiveDeref( dd, bReached );
415 printf(
"The miter is proved unreachable after %d iterations. ", nIters );
417 pPars->
iFrame = nIters - 1;
422 printf(
"Verified only for states reachable in %d frames. ", nIters );
423 pPars->
iFrame = nIters - 1;
442 DdNode ** pbParts, ** pbOutputs;
443 DdNode * bInitial, * bTemp;
448 assert( Saig_ManRegNum(
p) > 0 );
455 printf(
"The number of intermediate BDD nodes exceeded the limit (%d).\n", pPars->
nBddMax );
459 printf(
"Shared BDD size is %6d nodes.\n", Cudd_ReadKeys(dd) - Cudd_ReadDead(dd) );
464 printf(
"Reached timeout after constructing global BDDs (%d seconds).\n", pPars->
TimeLimit );
470 vOnionRings = Vec_PtrAlloc( 1000 );
483 Cudd_AutodynEnable( dd, CUDD_REORDER_SYMM_SIFT );
487 for ( i = 0; i < Saig_ManPoNum(
p); i++ )
489 if ( fCheckOutputs && !Cudd_bddLeq( dd, bInitial, Cudd_Not(pbOutputs[i]) ) )
492 bIntersect = Cudd_bddIntersect( dd, bInitial, pbOutputs[i] ); Cudd_Ref( bIntersect );
493 assert(
p->pSeqModel == NULL );
496 Cudd_RecursiveDeref( dd, bIntersect );
498 Abc_Print( 1,
"Output %d of miter \"%s\" was asserted in frame %d. ", i,
p->pName, -1 );
505 Cudd_RecursiveDeref( dd, bTemp );
506 Vec_PtrFree( vOnionRings );
508 if ( RetValue == -1 )
512 Cudd_RecursiveDeref( dd, bInitial );
513 for ( i = 0; i < Saig_ManRegNum(
p); i++ )
514 Cudd_RecursiveDeref( dd, pbParts[i] );
516 for ( i = 0; i < Saig_ManPoNum(
p); i++ )
517 Cudd_RecursiveDeref( dd, pbOutputs[i] );
527 ABC_PRT(
"Time", Abc_Clock() - clk );
550 int i, k, Entry, iBitOld, iBitNew, RetValue;
554 if ( Aig_ObjRefs(pObj) == 0 )
556 if ( i == Saig_ManPiNum(pInit) )
560 assert( Aig_ManCiNum(
p) < Aig_ManCiNum(pInit) );
561 assert( Aig_ManRegNum(
p) == Aig_ManRegNum(pInit) );
569 pCexOld =
p->pSeqModel;
570 assert( pCexOld != NULL );
572 vInputMap = Vec_IntAlloc( Saig_ManPiNum(pInit) );
574 if ( pObj->
pData != NULL )
577 Vec_IntPush( vInputMap, -1 );
579 pCexNew =
Abc_CexAlloc( Saig_ManRegNum(pInit), Saig_ManPiNum(pInit), pCexOld->iFrame+1 );
580 pCexNew->iFrame = pCexOld->iFrame;
581 pCexNew->iPo = pCexOld->iPo;
583 for ( iBitOld = 0; iBitOld < pCexOld->nRegs; iBitOld++ )
584 if ( Abc_InfoHasBit( pCexOld->pData, iBitOld ) )
585 Abc_InfoSetBit( pCexNew->pData, iBitOld );
588 for ( i = 0; i <= pCexNew->iFrame; i++ )
594 if ( Abc_InfoHasBit( pCexOld->pData, iBitOld + Entry ) )
595 Abc_InfoSetBit( pCexNew->pData, iBitNew + k );
597 iBitOld += Saig_ManPiNum(
p);
598 iBitNew += Saig_ManPiNum(pInit);
600 assert( iBitOld < iBitNew );
601 assert( iBitOld == pCexOld->nBits );
602 assert( iBitNew == pCexNew->nBits );
603 Vec_IntFree( vInputMap );
604 pInit->pSeqModel = pCexNew;