1395{
1396 int fPrintClauses = 0;
1400 int iFrame, RetValue = -1;
1401 int nOutDigits = Abc_Base10Log( Saig_ManPoNum(
p->pAig) );
1402 abctime clkStart = Abc_Clock(), clkOne = 0;
1403 p->timeToStop =
p->pPars->nTimeOut ?
p->pPars->nTimeOut * CLOCKS_PER_SEC + Abc_Clock(): 0;
1404 assert( Vec_PtrSize(
p->vSolvers) == 0 );
1405
1406 if (
p->pPars->fSolveAll )
1408 if ( Aig_ObjChild0(pObj) == Aig_ManConst0(
p->pAig) )
1409 {
1410 Vec_IntWriteEntry(
p->pPars->vOutMap, iFrame, 1 );
1411 p->pPars->nProveOuts++;
1412 if (
p->pPars->fUseBridge )
1414 }
1415
1416 p->pPars->timeLastSolved = Abc_Clock();
1418 while ( 1 )
1419 {
1420 int fRefined = 0;
1421 if (
p->pPars->fUseAbs &&
p->vAbsFlops == NULL && iFrame == 1 )
1422 {
1423
1424 assert(
p->vAbsFlops == NULL );
1425 p->vAbsFlops = Vec_IntStart( Saig_ManRegNum(
p->pAig) );
1426 p->vMapFf2Ppi = Vec_IntStartFull( Saig_ManRegNum(
p->pAig) );
1427 p->vMapPpi2Ff = Vec_IntAlloc( 100 );
1428
1429
1430
1431 }
1432
1433
1434 p->nFrames = iFrame;
1435 assert( iFrame == Vec_PtrSize(
p->vSolvers)-1 );
1436 p->iUseFrame = Abc_MaxInt(iFrame, 1);
1438 {
1439
1440 if (
p->vCexes && Vec_PtrEntry(
p->vCexes,
p->iOutCur) )
1441 continue;
1442
1443 if (
p->pTime4Outs &&
p->pTime4Outs[
p->iOutCur] == 0 )
1444 continue;
1445
1446 if ( Aig_ObjChild0(pObj) == Aig_ManConst0(
p->pAig) )
1447 continue;
1448
1449 if ( Aig_ObjChild0(pObj) == Aig_ManConst1(
p->pAig) )
1450 {
1451 if ( !
p->pPars->fSolveAll )
1452 {
1453 pCexNew =
Abc_CexMakeTriv( Aig_ManRegNum(
p->pAig), Saig_ManPiNum(
p->pAig), Saig_ManPoNum(
p->pAig), iFrame*Saig_ManPoNum(
p->pAig)+
p->iOutCur );
1454 p->pAig->pSeqModel = pCexNew;
1455 return 0;
1456 }
1457 pCexNew = (
p->pPars->fUseBridge ||
p->pPars->fStoreCex) ?
Abc_CexMakeTriv( Aig_ManRegNum(
p->pAig), Saig_ManPiNum(
p->pAig), Saig_ManPoNum(
p->pAig), iFrame*Saig_ManPoNum(
p->pAig)+
p->iOutCur ) : (
Abc_Cex_t *)(ABC_PTRINT_T)1;
1458 p->pPars->nFailOuts++;
1459 if (
p->pPars->vOutMap ) Vec_IntWriteEntry(
p->pPars->vOutMap,
p->iOutCur, 0 );
1460 if ( !
p->pPars->fNotVerbose )
1461 Abc_Print( 1, "Output %*d was trivially asserted in frame %2d (solved %*d out of %*d outputs).\n",
1462 nOutDigits,
p->iOutCur, iFrame, nOutDigits,
p->pPars->nFailOuts, nOutDigits, Saig_ManPoNum(
p->pAig) );
1463 assert( Vec_PtrEntry(
p->vCexes,
p->iOutCur) == NULL );
1464 if (
p->pPars->fUseBridge )
1466 Vec_PtrWriteEntry(
p->vCexes,
p->iOutCur, pCexNew );
1467 if (
p->pPars->pFuncOnFail &&
p->pPars->pFuncOnFail(
p->iOutCur,
p->pPars->fStoreCex ? (
Abc_Cex_t *)Vec_PtrEntry(
p->vCexes,
p->iOutCur) : NULL) )
1468 {
1469 if (
p->pPars->fVerbose )
1471 if ( !
p->pPars->fSilent )
1472 Abc_Print( 1, "Quitting due to callback on fail in frame %d.\n", iFrame );
1473 p->pPars->iFrame = iFrame;
1474 return -1;
1475 }
1476 if (
p->pPars->nFailOuts +
p->pPars->nDropOuts == Saig_ManPoNum(
p->pAig) )
1477 return p->pPars->nFailOuts ? 0 : -1;
1478 p->pPars->timeLastSolved = Abc_Clock();
1479 continue;
1480 }
1481
1482 if (
p->pTime4Outs )
1483 {
1484 assert(
p->pTime4Outs[
p->iOutCur] > 0 );
1485 clkOne = Abc_Clock();
1486 p->timeToStopOne =
p->pTime4Outs[
p->iOutCur] + Abc_Clock();
1487 }
1488 while ( 1 )
1489 {
1490 if (
p->pPars->nTimeOutGap &&
p->pPars->timeLastSolved && Abc_Clock() >
p->pPars->timeLastSolved +
p->pPars->nTimeOutGap * CLOCKS_PER_SEC )
1491 {
1492 if (
p->pPars->fVerbose )
1494 if ( !
p->pPars->fSilent )
1495 Abc_Print( 1,
"Reached gap timeout (%d seconds) in frame %d.\n",
p->pPars->nTimeOutGap, iFrame );
1496 p->pPars->iFrame = iFrame;
1497 return -1;
1498 }
1500 if ( RetValue == 1 )
1501 break;
1502 if ( RetValue == -1 )
1503 {
1504 if (
p->pPars->fVerbose )
1506 if (
p->timeToStop && Abc_Clock() >
p->timeToStop && !
p->pPars->fSilent )
1507 Abc_Print( 1,
"Reached timeout (%d seconds) in frame %d.\n",
p->pPars->nTimeOut, iFrame );
1508 else if (
p->pPars->nTimeOutGap &&
p->pPars->timeLastSolved && Abc_Clock() >
p->pPars->timeLastSolved +
p->pPars->nTimeOutGap * CLOCKS_PER_SEC )
1509 Abc_Print( 1,
"Reached gap timeout (%d seconds) in frame %d.\n",
p->pPars->nTimeOutGap, iFrame );
1510 else if (
p->timeToStopOne && Abc_Clock() >
p->timeToStopOne )
1511 {
1513 pCube = NULL;
1514 break;
1515 }
1516 else if (
p->pPars->nConfLimit )
1517 Abc_Print( 1,
"Reached conflict limit (%d) in frame %d.\n",
p->pPars->nConfLimit, iFrame );
1518 else if (
p->pPars->fVerbose )
1519 Abc_Print( 1, "Computation cancelled by the callback in frame %d.\n", iFrame );
1520 p->pPars->iFrame = iFrame;
1521 return -1;
1522 }
1523 if ( RetValue == 0 )
1524 {
1526 if ( RetValue == -1 )
1527 {
1528 if (
p->pPars->fVerbose )
1530 if (
p->timeToStop && Abc_Clock() >
p->timeToStop && !
p->pPars->fSilent )
1531 Abc_Print( 1,
"Reached timeout (%d seconds) in frame %d.\n",
p->pPars->nTimeOut, iFrame );
1532 else if (
p->pPars->nTimeOutGap &&
p->pPars->timeLastSolved && Abc_Clock() >
p->pPars->timeLastSolved +
p->pPars->nTimeOutGap * CLOCKS_PER_SEC )
1533 Abc_Print( 1,
"Reached gap timeout (%d seconds) in frame %d.\n",
p->pPars->nTimeOutGap, iFrame );
1534 else if (
p->timeToStopOne && Abc_Clock() >
p->timeToStopOne )
1535 {
1537 pCube = NULL;
1538 break;
1539 }
1540 else if (
p->pPars->nConfLimit )
1541 Abc_Print( 1,
"Reached conflict limit (%d) in frame %d.\n",
p->pPars->nConfLimit, iFrame );
1542 else if (
p->pPars->fVerbose )
1543 Abc_Print( 1, "Computation cancelled by the callback in frame %d.\n", iFrame );
1544 p->pPars->iFrame = iFrame;
1545 return -1;
1546 }
1547 if ( RetValue == 0 )
1548 {
1549 if ( fPrintClauses )
1550 {
1551 Abc_Print( 1, "*** Clauses after frame %d:\n", iFrame );
1553 }
1554 if (
p->pPars->fVerbose && !
p->pPars->fUseAbs )
1556 p->pPars->iFrame = iFrame;
1557 if ( !
p->pPars->fSolveAll )
1558 {
1561 p->tAbs += Abc_Clock() - clk;
1562 if ( pCex == NULL )
1563 {
1566 pCube = NULL;
1567 fRefined = 1;
1568 break;
1569 }
1570 p->pAig->pSeqModel = pCex;
1571 return 0;
1572 }
1573 p->pPars->nFailOuts++;
1575 if (
p->pPars->vOutMap ) Vec_IntWriteEntry(
p->pPars->vOutMap,
p->iOutCur, 0 );
1576 assert( Vec_PtrEntry(
p->vCexes,
p->iOutCur) == NULL );
1577 if (
p->pPars->fUseBridge )
1579 Vec_PtrWriteEntry(
p->vCexes,
p->iOutCur, pCexNew );
1580 if (
p->pPars->pFuncOnFail &&
p->pPars->pFuncOnFail(
p->iOutCur,
p->pPars->fStoreCex ? (
Abc_Cex_t *)Vec_PtrEntry(
p->vCexes,
p->iOutCur) : NULL) )
1581 {
1582 if (
p->pPars->fVerbose )
1584 if ( !
p->pPars->fSilent )
1585 Abc_Print( 1, "Quitting due to callback on fail in frame %d.\n", iFrame );
1586 p->pPars->iFrame = iFrame;
1587 return -1;
1588 }
1589 if ( !
p->pPars->fNotVerbose )
1590 Abc_Print( 1, "Output %*d was asserted in frame %2d (%2d) (solved %*d out of %*d outputs).\n",
1591 nOutDigits,
p->iOutCur, iFrame, iFrame, nOutDigits,
p->pPars->nFailOuts, nOutDigits, Saig_ManPoNum(
p->pAig) );
1592 if (
p->pPars->nFailOuts == Saig_ManPoNum(
p->pAig) )
1593 return 0;
1595 pCube = NULL;
1596 break;
1597 }
1598 if (
p->pPars->fVerbose )
1600 }
1601 }
1602 if ( fRefined )
1603 break;
1604 if (
p->pTime4Outs )
1605 {
1606 abctime timeSince = Abc_Clock() - clkOne;
1607 assert(
p->pTime4Outs[
p->iOutCur] > 0 );
1608 p->pTime4Outs[
p->iOutCur] = (
p->pTime4Outs[
p->iOutCur] > timeSince) ?
p->pTime4Outs[
p->iOutCur] - timeSince : 0;
1609 if (
p->pTime4Outs[
p->iOutCur] == 0 && Vec_PtrEntry(
p->vCexes,
p->iOutCur) == NULL )
1610 {
1611 p->pPars->nDropOuts++;
1612 if (
p->pPars->vOutMap )
1613 Vec_IntWriteEntry(
p->pPars->vOutMap,
p->iOutCur, -1 );
1614 if ( !
p->pPars->fNotVerbose )
1615 Abc_Print( 1,
"Timing out on output %*d in frame %d.\n", nOutDigits,
p->iOutCur, iFrame );
1616 }
1617 p->timeToStopOne = 0;
1618 }
1619 }
1620 if (
p->pPars->fUseAbs &&
p->vAbsFlops && !fRefined )
1621 {
1622 int i, Used;
1624 if ( Used && (Vec_IntEntry(
p->vPrio, i) >>
p->nPrioShift) == 0 )
1625 Vec_IntWriteEntry(
p->vAbsFlops, i, 0 );
1626 }
1627 if (
p->pPars->fVerbose )
1629 if ( fRefined )
1630 continue;
1631
1632
1633
1634 p->nQueLim =
p->pPars->nRestLimit;
1638 if ( fPrintClauses )
1639 {
1640 Abc_Print( 1, "*** Clauses after frame %d:\n", iFrame );
1642 }
1643
1644 if (
p->pPars->fBlocking)
1645 {
1647 if ( RetValue == -1 )
1648 {
1649 if (
p->pPars->fVerbose )
1651 if ( !
p->pPars->fSilent )
1652 {
1653 if (
p->timeToStop && Abc_Clock() >
p->timeToStop )
1654 Abc_Print( 1,
"Reached timeout (%d seconds) in frame %d.\n",
p->pPars->nTimeOut, iFrame );
1655 else
1656 Abc_Print( 1,
"Reached conflict limit (%d) in frame %d.\n",
p->pPars->nConfLimit, iFrame );
1657 }
1658 p->pPars->iFrame = iFrame;
1659 return -1;
1660 }
1661 }
1663 if ( RetValue == -1 )
1664 {
1665 if (
p->pPars->fVerbose )
1667 if ( !
p->pPars->fSilent )
1668 {
1669 if (
p->timeToStop && Abc_Clock() >
p->timeToStop )
1670 Abc_Print( 1,
"Reached timeout (%d seconds) in frame %d.\n",
p->pPars->nTimeOut, iFrame );
1671 else
1672 Abc_Print( 1,
"Reached conflict limit (%d) in frame %d.\n",
p->pPars->nConfLimit, iFrame );
1673 }
1674 p->pPars->iFrame = iFrame;
1675 return -1;
1676 }
1677 if ( RetValue )
1678 {
1679 if (
p->pPars->fVerbose )
1681 if ( !
p->pPars->fSilent )
1683 if ( !
p->pPars->fSilent )
1685 p->pPars->iFrame = iFrame;
1686
1687 p->pPars->nProveOuts = Saig_ManPoNum(
p->pAig) -
p->pPars->nFailOuts -
p->pPars->nDropOuts;
1688
1689 if (
p->pPars->vOutMap )
1690 for ( iFrame = 0; iFrame < Saig_ManPoNum(
p->pAig); iFrame++ )
1691 if ( Vec_IntEntry(
p->pPars->vOutMap, iFrame) == -2 )
1692 {
1693 Vec_IntWriteEntry(
p->pPars->vOutMap, iFrame, 1 );
1694 if (
p->pPars->fUseBridge )
1696 }
1697 if (
p->pPars->nProveOuts == Saig_ManPoNum(
p->pAig) )
1698 return 1;
1699 if (
p->pPars->nFailOuts > 0 )
1700 return 0;
1701 return -1;
1702 }
1703 if (
p->pPars->fVerbose )
1705
1706
1707 if (
p->pPars->pFuncStop &&
p->pPars->pFuncStop(
p->pPars->RunId) )
1708 {
1709 p->pPars->iFrame = iFrame;
1710 return -1;
1711 }
1712 if (
p->timeToStop && Abc_Clock() >
p->timeToStop )
1713 {
1714 if ( fPrintClauses )
1715 {
1716 Abc_Print( 1, "*** Clauses after frame %d:\n", iFrame );
1718 }
1719 if (
p->pPars->fVerbose )
1721 if ( !
p->pPars->fSilent )
1722 Abc_Print( 1,
"Reached timeout (%d seconds) in frame %d.\n",
p->pPars->nTimeOut, iFrame );
1723 p->pPars->iFrame = iFrame;
1724 return -1;
1725 }
1726 if (
p->pPars->nTimeOutGap &&
p->pPars->timeLastSolved && Abc_Clock() >
p->pPars->timeLastSolved +
p->pPars->nTimeOutGap * CLOCKS_PER_SEC )
1727 {
1728 if ( fPrintClauses )
1729 {
1730 Abc_Print( 1, "*** Clauses after frame %d:\n", iFrame );
1732 }
1733 if (
p->pPars->fVerbose )
1735 if ( !
p->pPars->fSilent )
1736 Abc_Print( 1,
"Reached gap timeout (%d seconds) in frame %d.\n",
p->pPars->nTimeOutGap, iFrame );
1737 p->pPars->iFrame = iFrame;
1738 return -1;
1739 }
1740 if (
p->pPars->nFrameMax && iFrame >=
p->pPars->nFrameMax )
1741 {
1742 if (
p->pPars->fVerbose )
1744 if ( !
p->pPars->fSilent )
1745 Abc_Print( 1,
"Reached limit on the number of timeframes (%d).\n",
p->pPars->nFrameMax );
1746 p->pPars->iFrame = iFrame;
1747 return -1;
1748 }
1749 }
1751 return -1;
1752}
struct Aig_Obj_t_ Aig_Obj_t
int Pdr_ManBlockCube(Pdr_Man_t *p, Pdr_Set_t *pCube)
int Pdr_ManPushClauses(Pdr_Man_t *p)
ABC_NAMESPACE_IMPL_START int Gia_ManToBridgeResult(FILE *pFile, int Result, Abc_Cex_t *pCex, int iPoProved)
DECLARATIONS ///.
int Pdr_ManPushAndBlockClauses(Pdr_Man_t *p)
void Pdr_ManPrintClauses(Pdr_Man_t *p, int kStart)
void Pdr_QueueClean(Pdr_Man_t *p)
Abc_Cex_t * Pdr_ManDeriveCexAbs(Pdr_Man_t *p)
void Pdr_ManPrintProgress(Pdr_Man_t *p, int fClose, abctime Time)
DECLARATIONS ///.
void Pdr_ManSetPropertyOutput(Pdr_Man_t *p, int k)
void Pdr_ManReportInvariant(Pdr_Man_t *p)
sat_solver * Pdr_ManCreateSolver(Pdr_Man_t *p, int k)
DECLARATIONS ///.
void Pdr_ManVerifyInvariant(Pdr_Man_t *p)
Abc_Cex_t * Pdr_ManDeriveCex(Pdr_Man_t *p)
#define Saig_ManForEachPo(p, pObj, i)
Abc_Cex_t * Abc_CexMakeTriv(int nRegs, int nTruePis, int nTruePos, int iFrameOut)
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.