abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
bmc.h File Reference
#include "aig/saig/saig.h"
#include "aig/gia/gia.h"

Go to the source code of this file.

Data Structures

struct  Saig_ParBmc_t_
 
struct  Bmc_AndPar_t_
 
struct  Bmc_BCorePar_t_
 
struct  Bmc_MulPar_t_
 
struct  Bmc_ParFf_t_
 

Typedefs

typedef
typedefABC_NAMESPACE_HEADER_START
struct Unr_Man_t_ 
Unr_Man_t
 INCLUDES ///. More...
 
typedef struct Saig_ParBmc_t_ Saig_ParBmc_t
 
typedef struct Bmc_AndPar_t_ Bmc_AndPar_t
 
typedef struct Bmc_BCorePar_t_ Bmc_BCorePar_t
 
typedef struct Bmc_MulPar_t_ Bmc_MulPar_t
 
typedef struct Bmc_ParFf_t_ Bmc_ParFf_t
 

Functions

void Bmc_ManBCorePerform (Gia_Man_t *pGia, Bmc_BCorePar_t *pPars)
 MACRO DEFINITIONS ///. More...
 
int Saig_ManBmcSimple (Aig_Man_t *pAig, int nFrames, int nSizeMax, int nBTLimit, int fRewrite, int fVerbose, int *piFrame, int nCofFanLit)
 
int Saig_BmcPerform (Aig_Man_t *pAig, int nStart, int nFramesMax, int nNodesMax, int nTimeOut, int nConfMaxOne, int nConfMaxAll, int fVerbose, int fVerbOverwrite, int *piFrames, int fSilent)
 
void Saig_ParBmcSetDefaultParams (Saig_ParBmc_t *p)
 
int Saig_ManBmcScalable (Aig_Man_t *pAig, Saig_ParBmc_t *pPars)
 
int Gia_ManBmcPerform (Gia_Man_t *p, Bmc_AndPar_t *pPars)
 
Abc_Cex_tBmc_CexCareMinimize (Aig_Man_t *p, Abc_Cex_t *pCex, int fCheck, int fVerbose)
 
void Bmc_CexCareVerify (Aig_Man_t *p, Abc_Cex_t *pCex, Abc_Cex_t *pCexMin, int fVerbose)
 
Gia_Man_tBmc_GiaTargetStates (Gia_Man_t *p, Abc_Cex_t *pCex, int iFrBeg, int iFrEnd, int fCombOnly, int fGenAll, int fAllFrames, int fVerbose)
 
Aig_Man_tBmc_AigTargetStates (Aig_Man_t *p, Abc_Cex_t *pCex, int iFrBeg, int iFrEnd, int fCombOnly, int fGenAll, int fAllFrames, int fVerbose)
 
Abc_Cex_tSaig_ManCexMinPerform (Aig_Man_t *pAig, Abc_Cex_t *pCex)
 
void Bmc_CexPrint (Abc_Cex_t *pCex, int nInputs, int fVerbose)
 
int Bmc_CexVerify (Gia_Man_t *p, Abc_Cex_t *pCex, Abc_Cex_t *pCexCare)
 
void Bmc_PerformICheck (Gia_Man_t *p, int nFramesMax, int nTimeOut, int fEmpty, int fVerbose)
 
Vec_Int_tBmc_PerformISearch (Gia_Man_t *p, int nFramesMax, int nTimeOut, int fReverse, int fDump, int fVerbose)
 
Unr_Man_tUnr_ManUnrollStart (Gia_Man_t *pGia, int fVerbose)
 
Gia_Man_tUnr_ManUnrollFrame (Unr_Man_t *p, int f)
 
void Unr_ManFree (Unr_Man_t *p)
 

Typedef Documentation

typedef struct Bmc_AndPar_t_ Bmc_AndPar_t

Definition at line 78 of file bmc.h.

Definition at line 98 of file bmc.h.

typedef struct Bmc_MulPar_t_ Bmc_MulPar_t

Definition at line 109 of file bmc.h.

typedef struct Bmc_ParFf_t_ Bmc_ParFf_t

Definition at line 123 of file bmc.h.

typedef struct Saig_ParBmc_t_ Saig_ParBmc_t

Definition at line 45 of file bmc.h.

typedef typedefABC_NAMESPACE_HEADER_START struct Unr_Man_t_ Unr_Man_t

INCLUDES ///.

CFile****************************************************************

FileName [bmc.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [SAT-based bounded model checking.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
bmc.h,v 1.00 2005/06/20 00:00:00 alanmi Exp

]PARAMETERS ///BASIC TYPES ///

Definition at line 43 of file bmc.h.

Function Documentation

Aig_Man_t* Bmc_AigTargetStates ( Aig_Man_t p,
Abc_Cex_t pCex,
int  iFrBeg,
int  iFrEnd,
int  fCombOnly,
int  fUseOne,
int  fAllFrames,
int  fVerbose 
)

Function*************************************************************

Synopsis [Generate AIG for target bad states.]

Description []

SideEffects []

SeeAlso []

Definition at line 513 of file bmcCexCut.c.

514 {
515  Aig_Man_t * pAig;
516  Gia_Man_t * pGia, * pRes;
517  pGia = Gia_ManFromAigSimple( p );
518  if ( !Gia_ManVerifyCex( pGia, pCex, 0 ) )
519  {
520  Abc_Print( 1, "Current CEX does not fail AIG \"%s\".\n", p->pName );
521  Gia_ManStop( pGia );
522  return NULL;
523  }
524  pRes = Bmc_GiaTargetStates( pGia, pCex, iFrBeg, iFrEnd, fCombOnly, fUseOne, fAllFrames, fVerbose );
525  Gia_ManStop( pGia );
526  pAig = Gia_ManToAigSimple( pRes );
527  Gia_ManStop( pRes );
528  return pAig;
529 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
Aig_Man_t * Gia_ManToAigSimple(Gia_Man_t *p)
Definition: giaAig.c:367
int Gia_ManVerifyCex(Gia_Man_t *pAig, Abc_Cex_t *p, int fDualOut)
DECLARATIONS ///.
Definition: giaCex.c:44
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Gia_Man_t * Bmc_GiaTargetStates(Gia_Man_t *p, Abc_Cex_t *pCex, int iFrBeg, int iFrEnd, int fCombOnly, int fUseOne, int fAllFrames, int fVerbose)
Definition: bmcCexCut.c:461
Gia_Man_t * Gia_ManFromAigSimple(Aig_Man_t *p)
Definition: giaAig.c:171
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
Definition: gia.h:95
Abc_Cex_t* Bmc_CexCareMinimize ( Aig_Man_t p,
Abc_Cex_t pCex,
int  fCheck,
int  fVerbose 
)

Definition at line 255 of file bmcCexCare.c.

256 {
257  Gia_Man_t * pGia = Gia_ManFromAigSimple( p );
258  Abc_Cex_t * pCexMin = Bmc_CexCareMinimizeAig( pGia, pCex, fCheck, fVerbose );
259  Gia_ManStop( pGia );
260  return pCexMin;
261 }
Abc_Cex_t * Bmc_CexCareMinimizeAig(Gia_Man_t *p, Abc_Cex_t *pCex, int fCheck, int fVerbose)
Definition: bmcCexCare.c:177
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Gia_Man_t * Gia_ManFromAigSimple(Aig_Man_t *p)
Definition: giaAig.c:171
Definition: gia.h:95
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition: utilCex.h:39
void Bmc_CexCareVerify ( Aig_Man_t p,
Abc_Cex_t pCex,
Abc_Cex_t pCexMin,
int  fVerbose 
)

Function*************************************************************

Synopsis [Verifies the care set of the counter-example.]

Description []

SideEffects []

SeeAlso []

Definition at line 274 of file bmcCexCare.c.

275 {
276  Gia_Man_t * pGia = Gia_ManFromAigSimple( p );
277  if ( fVerbose )
278  {
279  printf( "Original : " );
280  Bmc_CexPrint( pCex, Gia_ManPiNum(pGia), 0 );
281  printf( "Minimized: " );
282  Bmc_CexPrint( pCexMin, Gia_ManPiNum(pGia), 0 );
283  }
284  if ( !Bmc_CexVerify( pGia, pCex, pCexMin ) )
285  printf( "Counter-example verification has failed.\n" );
286  else
287  printf( "Counter-example verification succeeded.\n" );
288  Gia_ManStop( pGia );
289 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Gia_Man_t * Gia_ManFromAigSimple(Aig_Man_t *p)
Definition: giaAig.c:171
int Bmc_CexVerify(Gia_Man_t *p, Abc_Cex_t *pCex, Abc_Cex_t *pCexCare)
Definition: bmcCexTools.c:346
Definition: gia.h:95
void Bmc_CexPrint(Abc_Cex_t *pCex, int nInputs, int fVerbose)
Definition: bmcCexTools.c:307
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
void Bmc_CexPrint ( Abc_Cex_t pCex,
int  nInputs,
int  fVerbose 
)

Function*************************************************************

Synopsis [Prints one counter-example.]

Description []

SideEffects []

SeeAlso []

Definition at line 307 of file bmcCexTools.c.

308 {
309  int i, k, Count, iBit = pCex->nRegs;
310  Abc_CexPrintStatsInputs( pCex, nInputs );
311  if ( !fVerbose )
312  return;
313 
314  for ( i = 0; i <= pCex->iFrame; i++ )
315  {
316  Count = 0;
317  printf( "%3d : ", i );
318  for ( k = 0; k < nInputs; k++ )
319  {
320  Count += Abc_InfoHasBit(pCex->pData, iBit);
321  printf( "%d", Abc_InfoHasBit(pCex->pData, iBit++) );
322  }
323  printf( " %3d ", Count );
324  Count = 0;
325  for ( ; k < pCex->nPis; k++ )
326  {
327  Count += Abc_InfoHasBit(pCex->pData, iBit);
328  printf( "%d", Abc_InfoHasBit(pCex->pData, iBit++) );
329  }
330  printf( " %3d\n", Count );
331  }
332  assert( iBit == pCex->nBits );
333 }
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
void Abc_CexPrintStatsInputs(Abc_Cex_t *p, int nInputs)
Definition: utilCex.c:275
#define assert(ex)
Definition: util_old.h:213
int Bmc_CexVerify ( Gia_Man_t p,
Abc_Cex_t pCex,
Abc_Cex_t pCexCare 
)

Function*************************************************************

Synopsis [Verifies the care set of the counter-example.]

Description []

SideEffects []

SeeAlso []

Definition at line 346 of file bmcCexTools.c.

347 {
348  Gia_Obj_t * pObj;
349  int i, k;
350  assert( pCex->nRegs > 0 );
351 // assert( pCexCare->nRegs == 0 );
353  Gia_ManForEachRi( p, pObj, k )
354  Gia_ObjTerSimSet0( pObj );
355  for ( i = 0; i <= pCex->iFrame; i++ )
356  {
357  Gia_ManForEachPi( p, pObj, k )
358  {
359  if ( !Abc_InfoHasBit( pCexCare->pData, pCexCare->nRegs + i * pCexCare->nPis + k ) )
360  Gia_ObjTerSimSetX( pObj );
361  else if ( Abc_InfoHasBit( pCex->pData, pCex->nRegs + i * pCex->nPis + k ) )
362  Gia_ObjTerSimSet1( pObj );
363  else
364  Gia_ObjTerSimSet0( pObj );
365  }
366  Gia_ManForEachRo( p, pObj, k )
367  Gia_ObjTerSimRo( p, pObj );
368  Gia_ManForEachAnd( p, pObj, k )
369  Gia_ObjTerSimAnd( pObj );
370  Gia_ManForEachCo( p, pObj, k )
371  Gia_ObjTerSimCo( pObj );
372  }
373  pObj = Gia_ManPo( p, pCex->iPo );
374  return Gia_ObjTerSimGet1(pObj);
375 }
static void Gia_ObjTerSimCo(Gia_Obj_t *pObj)
Definition: gia.h:797
static void Gia_ObjTerSimRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:808
static void Gia_ObjTerSimSet0(Gia_Obj_t *pObj)
Definition: gia.h:770
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
for(p=first;p->value< newval;p=p->next)
Definition: gia.h:75
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static int Gia_ObjTerSimGet1(Gia_Obj_t *pObj)
Definition: gia.h:776
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
static void Gia_ObjTerSimSet1(Gia_Obj_t *pObj)
Definition: gia.h:771
#define Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
#define assert(ex)
Definition: util_old.h:213
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
static void Gia_ObjTerSimSetX(Gia_Obj_t *pObj)
Definition: gia.h:772
static void Gia_ObjTerSimAnd(Gia_Obj_t *pObj)
Definition: gia.h:785
Gia_Man_t* Bmc_GiaTargetStates ( Gia_Man_t p,
Abc_Cex_t pCex,
int  iFrBeg,
int  iFrEnd,
int  fCombOnly,
int  fUseOne,
int  fAllFrames,
int  fVerbose 
)

Function*************************************************************

Synopsis [Generate GIA for target bad states.]

Description []

SideEffects []

SeeAlso []

Definition at line 461 of file bmcCexCut.c.

462 {
463  Gia_Man_t * pNew, * pTemp;
464  Vec_Bit_t * vInitNew;
465 
466  if ( iFrBeg < 0 )
467  { printf( "Starting frame is less than 0.\n" ); return NULL; }
468  if ( iFrEnd < 0 )
469  { printf( "Stopping frame is less than 0.\n" ); return NULL; }
470  if ( iFrBeg > pCex->iFrame )
471  { printf( "Starting frame is more than the last frame of CEX (%d).\n", pCex->iFrame ); return NULL; }
472  if ( iFrEnd > pCex->iFrame )
473  { printf( "Stopping frame is more than the last frame of CEX (%d).\n", pCex->iFrame ); return NULL; }
474  if ( iFrBeg > iFrEnd )
475  { printf( "Starting frame (%d) should be less than stopping frame (%d).\n", iFrBeg, iFrEnd ); return NULL; }
476  assert( iFrBeg >= 0 && iFrBeg <= pCex->iFrame );
477  assert( iFrEnd >= 0 && iFrEnd <= pCex->iFrame );
478  assert( iFrBeg < iFrEnd );
479 
480  if ( fUseOne )
481  pNew = Bmc_GiaGenerateGiaOne( p, pCex, &vInitNew, iFrBeg, iFrEnd );
482  else if ( fAllFrames )
483  pNew = Bmc_GiaGenerateGiaAllFrames( p, pCex, &vInitNew, iFrBeg, iFrEnd );
484  else
485  pNew = Bmc_GiaGenerateGiaAllOne( p, pCex, &vInitNew, iFrBeg, iFrEnd );
486 
487  if ( !fCombOnly )
488  {
489  // create new GIA
490  pNew = Gia_ManDupWithNewPo( p, pTemp = pNew );
491  Gia_ManStop( pTemp );
492 
493  // create new initial state
494  pNew = Gia_ManDupFlip( pTemp = pNew, Vec_BitArray(vInitNew) );
495  Gia_ManStop( pTemp );
496  }
497 
498  Vec_BitFree( vInitNew );
499  return pNew;
500 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
typedefABC_NAMESPACE_HEADER_START struct Vec_Bit_t_ Vec_Bit_t
INCLUDES ///.
Definition: vecBit.h:42
static int * Vec_BitArray(Vec_Bit_t *p)
Definition: vecBit.h:223
Gia_Man_t * Gia_ManDupWithNewPo(Gia_Man_t *p1, Gia_Man_t *p2)
Definition: giaDup.c:1816
Gia_Man_t * Gia_ManDupFlip(Gia_Man_t *p, int *pInitState)
Definition: giaDup.c:460
Definition: gia.h:95
Gia_Man_t * Bmc_GiaGenerateGiaAllOne(Gia_Man_t *p, Abc_Cex_t *pCex, Vec_Bit_t **pvInits, int iFrBeg, int iFrEnd)
Definition: bmcCexCut.c:365
static void Vec_BitFree(Vec_Bit_t *p)
Definition: vecBit.h:167
#define assert(ex)
Definition: util_old.h:213
Gia_Man_t * Bmc_GiaGenerateGiaAllFrames(Gia_Man_t *p, Abc_Cex_t *pCex, Vec_Bit_t **pvInits, int iFrBeg, int iFrEnd)
Definition: bmcCexCut.c:237
Gia_Man_t * Bmc_GiaGenerateGiaOne(Gia_Man_t *p, Abc_Cex_t *pCex, Vec_Bit_t **pvInits, int iFrBeg, int iFrEnd)
Definition: bmcCexCut.c:192
void Bmc_ManBCorePerform ( Gia_Man_t p,
Bmc_BCorePar_t pPars 
)

MACRO DEFINITIONS ///.

FUNCTION DECLARATIONS ///

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 196 of file bmcBCore.c.

197 {
198  clock_t clk = clock();
199  Intp_Man_t * pManProof;
200  Vec_Int_t * vVarMap, * vCore;
201  sat_solver * pSat;
202  FILE * pFile;
203  void * pSatCnf;
204  int RetValue;
205  // create SAT solver
206  pSat = sat_solver_new();
207  sat_solver_store_alloc( pSat );
208  sat_solver_setnvars( pSat, 1000 );
209  sat_solver_set_runtime_limit( pSat, pPars->nTimeOut ? pPars->nTimeOut * CLOCKS_PER_SEC + Abc_Clock(): 0 );
210  vVarMap = Bmc_ManBCoreCollect( p, pPars->iFrame, pPars->iOutput, pSat );
212  // create pivot variables
213  if ( pPars->pFilePivots )
214  {
215  Vec_Int_t * vPivots = Bmc_ManBCoreCollectPivots(p, pPars->pFilePivots, vVarMap);
216  sat_solver_set_pivot_variables( pSat, Vec_IntArray(vPivots), Vec_IntSize(vPivots) );
217  Vec_IntReleaseArray( vPivots );
218  Vec_IntFree( vPivots );
219  }
220  // solve the problem
221  RetValue = sat_solver_solve( pSat, NULL, NULL, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
222  if ( RetValue == l_Undef )
223  {
224  Vec_IntFree( vVarMap );
225  sat_solver_delete( pSat );
226  printf( "Timeout of conflict limit is reached.\n" );
227  return;
228  }
229  if ( RetValue == l_True )
230  {
231  Vec_IntFree( vVarMap );
232  sat_solver_delete( pSat );
233  printf( "The BMC problem is SAT.\n" );
234  return;
235  }
236  if ( pPars->fVerbose )
237  {
238  printf( "SAT solver returned UNSAT after %7d conflicts. ", (int)pSat->stats.conflicts );
239  Abc_PrintTime( 1, "Time", clock() - clk );
240  }
241  assert( RetValue == l_False );
242  pSatCnf = sat_solver_store_release( pSat );
243 // Sto_ManDumpClauses( (Sto_Man_t *)pSatCnf, "cnf_store.txt" );
244  // derive the UNSAT core
245  clk = clock();
246  pManProof = Intp_ManAlloc();
247  vCore = (Vec_Int_t *)Intp_ManUnsatCore( pManProof, (Sto_Man_t *)pSatCnf, 1, pPars->fVerbose );
248  Intp_ManFree( pManProof );
249  if ( pPars->fVerbose )
250  {
251  printf( "UNSAT core contains %d (out of %d) learned clauses. ", Vec_IntSize(vCore), sat_solver_nconflicts(pSat) );
252  Abc_PrintTime( 1, "Time", clock() - clk );
253  }
254  // write the problem
255  Vec_IntSort( vCore, 0 );
256  pFile = pPars->pFileProof ? fopen( pPars->pFileProof, "wb" ) : stdout;
257  Intp_ManUnsatCorePrintForBmc( pFile, (Sto_Man_t *)pSatCnf, vCore, vVarMap );
258  if ( pFile != stdout )
259  fclose( pFile );
260  // cleanup
261  Sto_ManFree( (Sto_Man_t *)pSatCnf );
262  Vec_IntFree( vVarMap );
263  Vec_IntFree( vCore );
264  sat_solver_delete( pSat );
265 }
static abctime sat_solver_set_runtime_limit(sat_solver *s, abctime Limit)
Definition: satSolver.h:233
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
int nTimeOut
Definition: bmc.h:103
void * Intp_ManUnsatCore(Intp_Man_t *p, Sto_Man_t *pCnf, int fLearned, int fVerbose)
Definition: satInterP.c:963
char * pFileProof
Definition: bmc.h:105
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
#define l_Undef
Definition: SolverTypes.h:86
int sat_solver_solve(sat_solver *s, lit *begin, lit *end, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, ABC_INT64_T nConfLimitGlobal, ABC_INT64_T nInsLimitGlobal)
Definition: satSolver.c:1700
void sat_solver_delete(sat_solver *s)
Definition: satSolver.c:1141
static void sat_solver_set_pivot_variables(sat_solver *s, int *pPivots, int nPivots)
Definition: satSolver.h:259
Vec_Int_t * Bmc_ManBCoreCollectPivots(Gia_Man_t *p, char *pName, Vec_Int_t *vVarMap)
Definition: bmcBCore.c:57
int sat_solver_nconflicts(sat_solver *s)
Definition: satSolver.c:1908
void * sat_solver_store_release(sat_solver *s)
Definition: satSolver.c:1949
#define l_True
Definition: SolverTypes.h:84
int fVerbose
Definition: bmc.h:106
static abctime Abc_Clock()
Definition: abc_global.h:279
stats_t stats
Definition: satSolver.h:156
static void Vec_IntSort(Vec_Int_t *p, int fReverse)
Definition: vecInt.h:1293
Vec_Int_t * Bmc_ManBCoreCollect(Gia_Man_t *p, int iFrame, int iOut, sat_solver *pSat)
Definition: bmcBCore.c:117
Intp_Man_t * Intp_ManAlloc()
FUNCTION DEFINITIONS ///.
Definition: satInterP.c:96
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
void Intp_ManFree(Intp_Man_t *p)
Definition: satInterP.c:178
int iOutput
Definition: bmc.h:102
void sat_solver_store_alloc(sat_solver *s)
Definition: satSolver.c:1916
void sat_solver_setnvars(sat_solver *s, int n)
Definition: satSolver.c:1072
int iFrame
Definition: bmc.h:101
void sat_solver_store_mark_roots(sat_solver *s)
Definition: satSolver.c:1939
ABC_INT64_T conflicts
Definition: satVec.h:154
sat_solver * sat_solver_new(void)
Definition: satSolver.c:1001
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
void Sto_ManFree(Sto_Man_t *p)
Definition: satStore.c:143
#define l_False
Definition: SolverTypes.h:85
#define assert(ex)
Definition: util_old.h:213
void Intp_ManUnsatCorePrintForBmc(FILE *pFile, Sto_Man_t *pCnf, void *vCore0, void *vVarMap0)
Definition: satInterP.c:1059
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
char * pFilePivots
Definition: bmc.h:104
static int * Vec_IntReleaseArray(Vec_Int_t *p)
Definition: extraZddTrunc.c:89
void Bmc_PerformICheck ( Gia_Man_t p,
int  nFramesMax,
int  nTimeOut,
int  fEmpty,
int  fVerbose 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 196 of file bmcICheck.c.

197 {
198  int fUseOldCnf = 0;
199  Gia_Man_t * pMiter, * pTemp;
200  Cnf_Dat_t * pCnf;
201  sat_solver * pSat;
202  Vec_Int_t * vLits, * vUsed;
203  int i, status, Lit;
204  int nLitsUsed, nLits, * pLits;
205  abctime clkStart = Abc_Clock();
206  assert( nFramesMax > 0 );
207  assert( Gia_ManRegNum(p) > 0 );
208 
209  if ( fVerbose )
210  printf( "Solving M-inductiveness for design %s with %d AND nodes and %d flip-flops:\n",
212 
213  // create miter
214  pTemp = Gia_ManDup( p );
215  pMiter = Gia_ManMiter( p, pTemp, 0, 1, 1, 0, 0 );
216  Gia_ManStop( pTemp );
217  assert( Gia_ManPoNum(pMiter) == 2 * Gia_ManPoNum(p) );
218  assert( Gia_ManRegNum(pMiter) == 2 * Gia_ManRegNum(p) );
219  // derive CNF
220  if ( fUseOldCnf )
221  pCnf = Cnf_DeriveGiaRemapped( pMiter );
222  else
223  {
224  pMiter = Jf_ManDeriveCnf( pTemp = pMiter, 0 );
225  Gia_ManStop( pTemp );
226  pCnf = (Cnf_Dat_t *)pMiter->pData; pMiter->pData = NULL;
227  }
228 
229  // collect positive literals
230  vLits = Vec_IntAlloc( Gia_ManCoNum(p) );
231  for ( i = 0; i < Gia_ManRegNum(p); i++ )
232  Vec_IntPush( vLits, Abc_Var2Lit(i, fEmpty) );
233 
234  // iteratively compute a minimal M-inductive set of next-state functions
235  nLitsUsed = fEmpty ? 0 : Vec_IntSize(vLits);
236  vUsed = Vec_IntAlloc( Vec_IntSize(vLits) );
237  while ( 1 )
238  {
239  int fChanges = 0;
240  // derive SAT solver
241  pSat = Bmc_DeriveSolver( p, pMiter, pCnf, nFramesMax, nTimeOut, fVerbose );
242 // sat_solver_bookmark( pSat );
243  status = sat_solver_solve( pSat, Vec_IntArray(vLits), Vec_IntArray(vLits) + Vec_IntSize(vLits), (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
244  if ( status == l_Undef )
245  {
246  printf( "Timeout reached after %d seconds.\n", nTimeOut );
247  break;
248  }
249  if ( status == l_True )
250  {
251  printf( "The problem is satisfiable (the current set is not M-inductive).\n" );
252  break;
253  }
254  assert( status == l_False );
255  // call analize_final
256  nLits = sat_solver_final( pSat, &pLits );
257  // mark used literals
258  Vec_IntFill( vUsed, Vec_IntSize(vLits), 0 );
259  for ( i = 0; i < nLits; i++ )
260  Vec_IntWriteEntry( vUsed, Abc_Lit2Var(pLits[i]), 1 );
261 
262  // check if there are any positive unused
263  Vec_IntForEachEntry( vLits, Lit, i )
264  {
265  assert( i == Abc_Lit2Var(Lit) );
266  if ( Abc_LitIsCompl(Lit) )
267  continue;
268  if ( Vec_IntEntry(vUsed, i) )
269  continue;
270  // positive literal became unused
271  Vec_IntWriteEntry( vLits, i, Abc_LitNot(Lit) );
272  nLitsUsed--;
273  fChanges = 1;
274  }
275  // report the results
276  if ( fVerbose )
277  printf( "M =%4d : AIG =%8d. SAT vars =%8d. SAT conf =%8d. S =%6d. (%6.2f %%) ",
278  nFramesMax, (nFramesMax+1) * Gia_ManAndNum(pMiter),
280  sat_solver_nconflicts(pSat), nLitsUsed, 100.0 * nLitsUsed / Gia_ManRegNum(p) );
281  if ( fVerbose )
282  Abc_PrintTime( 1, "Time", Abc_Clock() - clkStart );
283  // count the number of negative literals
284  sat_solver_delete( pSat );
285  if ( !fChanges || fEmpty )
286  break;
287 // break;
288 // sat_solver_rollback( pSat );
289  }
290  Cnf_DataFree( pCnf );
291  Gia_ManStop( pMiter );
292  Vec_IntFree( vLits );
293  Vec_IntFree( vUsed );
294 }
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition: giaDup.c:552
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static ABC_NAMESPACE_IMPL_START Cnf_Dat_t * Cnf_DeriveGiaRemapped(Gia_Man_t *p)
DECLARATIONS ///.
Definition: bmcICheck.c:48
#define l_Undef
Definition: SolverTypes.h:86
static char * Gia_ManName(Gia_Man_t *p)
Definition: gia.h:382
int sat_solver_solve(sat_solver *s, lit *begin, lit *end, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, ABC_INT64_T nConfLimitGlobal, ABC_INT64_T nInsLimitGlobal)
Definition: satSolver.c:1700
void sat_solver_delete(sat_solver *s)
Definition: satSolver.c:1141
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
int sat_solver_nconflicts(sat_solver *s)
Definition: satSolver.c:1908
#define l_True
Definition: SolverTypes.h:84
Gia_Man_t * Jf_ManDeriveCnf(Gia_Man_t *p, int fCnfObjIds)
Definition: giaJf.c:1746
static abctime Abc_Clock()
Definition: abc_global.h:279
Definition: cnf.h:56
static int sat_solver_final(sat_solver *s, int **ppArray)
Definition: satSolver.h:227
sat_solver * Bmc_DeriveSolver(Gia_Man_t *p, Gia_Man_t *pMiter, Cnf_Dat_t *pCnf, int nFramesMax, int nTimeOut, int fVerbose)
Definition: bmcICheck.c:91
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
void * pData
Definition: gia.h:169
int sat_solver_nvars(sat_solver *s)
Definition: satSolver.c:1896
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Abc_LitNot(int Lit)
Definition: abc_global.h:266
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Definition: gia.h:95
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define l_False
Definition: SolverTypes.h:85
void Cnf_DataFree(Cnf_Dat_t *p)
Definition: cnfMan.c:180
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
ABC_INT64_T abctime
Definition: abc_global.h:278
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
Gia_Man_t * Gia_ManMiter(Gia_Man_t *pAig0, Gia_Man_t *pAig1, int nInsDup, int fDualOut, int fSeq, int fImplic, int fVerbose)
Definition: giaDup.c:2128
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Vec_Int_t* Bmc_PerformISearch ( Gia_Man_t p,
int  nFramesMax,
int  nTimeOut,
int  fReverse,
int  fDump,
int  fVerbose 
)

Definition at line 417 of file bmcICheck.c.

418 {
419  Vec_Int_t * vLits, * vFlops;
420  int i, f;
421  if ( fVerbose )
422  printf( "Solving M-inductiveness for design %s with %d AND nodes and %d flip-flops:\n",
424  fflush( stdout );
425 
426  // collect positive literals
427  vLits = Vec_IntAlloc( Gia_ManCoNum(p) );
428  for ( i = 0; i < Gia_ManRegNum(p); i++ )
429  Vec_IntPush( vLits, Abc_Var2Lit(i, 0) );
430 
431  for ( f = 1; f <= nFramesMax; f++ )
432  if ( Bmc_PerformISearchOne( p, f, nTimeOut, fReverse, fVerbose, vLits ) )
433  {
434  Vec_IntFree( vLits );
435  return NULL;
436  }
437 
438  // dump the numbers of the flops
439  if ( fDump )
440  {
441  int nLitsUsed = 0;
442  for ( i = 0; i < Gia_ManRegNum(p); i++ )
443  if ( !Abc_LitIsCompl(Vec_IntEntry(vLits, i)) )
444  nLitsUsed++;
445  printf( "The set contains %d (out of %d) next-state functions with 0-based numbers:\n", nLitsUsed, Gia_ManRegNum(p) );
446  for ( i = 0; i < Gia_ManRegNum(p); i++ )
447  if ( !Abc_LitIsCompl(Vec_IntEntry(vLits, i)) )
448  printf( "%d ", i );
449  printf( "\n" );
450  }
451  // save flop indexes
452  vFlops = Vec_IntAlloc( Gia_ManRegNum(p) );
453  for ( i = 0; i < Gia_ManRegNum(p); i++ )
454  if ( !Abc_LitIsCompl(Vec_IntEntry(vLits, i)) )
455  Vec_IntPush( vFlops, 1 );
456  else
457  Vec_IntPush( vFlops, 0 );
458  Vec_IntFree( vLits );
459  return vFlops;
460 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static char * Gia_ManName(Gia_Man_t *p)
Definition: gia.h:382
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
int Bmc_PerformISearchOne(Gia_Man_t *p, int nFramesMax, int nTimeOut, int fReverse, int fVerbose, Vec_Int_t *vLits)
Definition: bmcICheck.c:307
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
int Gia_ManBmcPerform ( Gia_Man_t pGia,
Bmc_AndPar_t pPars 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1066 of file bmcBmcAnd.c.

1067 {
1068  abctime TimeToStop = pPars->nTimeOut ? pPars->nTimeOut * CLOCKS_PER_SEC + Abc_Clock() : 0;
1069  if ( pPars->nFramesAdd == 0 )
1070  return Gia_ManBmcPerformInt( pGia, pPars );
1071  // iterate over the engine until we read the global timeout
1072  assert( pPars->nTimeOut >= 0 );
1073  while ( 1 )
1074  {
1075  if ( TimeToStop && TimeToStop < Abc_Clock() )
1076  return -1;
1077  if ( Gia_ManBmcPerformInt( pGia, pPars ) == 0 )
1078  return 0;
1079  // set the new runtime limit
1080  if ( pPars->nTimeOut )
1081  {
1082  pPars->nTimeOut = Abc_MinInt( pPars->nTimeOut-1, (int)((TimeToStop - Abc_Clock()) / CLOCKS_PER_SEC) );
1083  if ( pPars->nTimeOut <= 0 )
1084  return -1;
1085  }
1086  else
1087  return -1;
1088  // set the new frames limit
1089  pPars->nFramesAdd *= 2;
1090  }
1091  return -1;
1092 }
int Gia_ManBmcPerformInt(Gia_Man_t *pGia, Bmc_AndPar_t *pPars)
Definition: bmcBmcAnd.c:956
int nFramesAdd
Definition: bmc.h:83
int nTimeOut
Definition: bmc.h:85
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Abc_MinInt(int a, int b)
Definition: abc_global.h:239
#define assert(ex)
Definition: util_old.h:213
ABC_INT64_T abctime
Definition: abc_global.h:278
int Saig_BmcPerform ( Aig_Man_t pAig,
int  nStart,
int  nFramesMax,
int  nNodesMax,
int  nTimeOut,
int  nConfMaxOne,
int  nConfMaxAll,
int  fVerbose,
int  fVerbOverwrite,
int *  piFrames,
int  fSilent 
)

Function*************************************************************

Synopsis [Performs BMC with the given parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 761 of file bmcBmc2.c.

762 {
763  Saig_Bmc_t * p;
764  Aig_Man_t * pNew;
765  Cnf_Dat_t * pCnf;
766  int nOutsSolved = 0;
767  int Iter, RetValue = -1;
768  abctime nTimeToStop = nTimeOut ? nTimeOut * CLOCKS_PER_SEC + Abc_Clock(): 0;
769  abctime clk = Abc_Clock(), clk2, clkTotal = Abc_Clock();
770  int Status = -1;
771 /*
772  Vec_Ptr_t * vSimInfo;
773  vSimInfo = Abs_ManTernarySimulate( pAig, nFramesMax, fVerbose );
774  Abs_ManFreeAray( vSimInfo );
775 */
776  if ( fVerbose )
777  {
778  printf( "Running \"bmc2\". AIG: PI/PO/Reg = %d/%d/%d. Node = %6d. Lev = %5d.\n",
779  Saig_ManPiNum(pAig), Saig_ManPoNum(pAig), Saig_ManRegNum(pAig),
780  Aig_ManNodeNum(pAig), Aig_ManLevelNum(pAig) );
781  printf( "Params: FramesMax = %d. NodesDelta = %d. ConfMaxOne = %d. ConfMaxAll = %d.\n",
782  nFramesMax, nNodesMax, nConfMaxOne, nConfMaxAll );
783  }
784  nFramesMax = nFramesMax ? nFramesMax : ABC_INFINITY;
785  p = Saig_BmcManStart( pAig, nFramesMax, nNodesMax, nConfMaxOne, nConfMaxAll, fVerbose );
786  // set runtime limit
787  if ( nTimeOut )
788  sat_solver_set_runtime_limit( p->pSat, nTimeToStop );
789  for ( Iter = 0; ; Iter++ )
790  {
791  clk2 = Abc_Clock();
792  // add new logic interval to frames
793  Saig_BmcInterval( p );
794 // Saig_BmcAddTargetsAsPos( p );
795  if ( Vec_PtrSize(p->vTargets) == 0 )
796  break;
797  // convert logic slice into new AIG
798  pNew = Saig_BmcIntervalToAig( p );
799 //printf( "StitchVars = %d.\n", p->nStitchVars );
800  // derive CNF for the new AIG
801  pCnf = Cnf_Derive( pNew, Aig_ManCoNum(pNew) );
802  Cnf_DataLift( pCnf, p->nSatVars );
803  p->nSatVars += pCnf->nVars;
804  // add this CNF to the solver
805  Saig_BmcLoadCnf( p, pCnf );
806  Cnf_DataFree( pCnf );
807  Aig_ManStop( pNew );
808  // solve the targets
809  RetValue = Saig_BmcSolveTargets( p, nStart, &nOutsSolved );
810  if ( fVerbose )
811  {
812  printf( "%4d : F =%5d. O =%4d. And =%8d. Var =%8d. Conf =%7d. ",
813  Iter, p->iFrameLast, p->iOutputLast, Aig_ManNodeNum(p->pFrm), p->nSatVars, (int)p->pSat->stats.conflicts );
814  printf( "%4.0f MB", 4.0*(p->iFrameLast+1)*p->nObjs/(1<<20) );
815  printf( "%9.2f sec", (float)(Abc_Clock() - clkTotal)/(float)(CLOCKS_PER_SEC) );
816  printf( "\n" );
817  fflush( stdout );
818  }
819  if ( RetValue != l_False )
820  break;
821  // check the timeout
822  if ( nTimeOut && Abc_Clock() > nTimeToStop )
823  {
824  if ( !fSilent )
825  printf( "Reached timeout (%d seconds).\n", nTimeOut );
826  if ( piFrames )
827  *piFrames = p->iFrameLast-1;
828  Saig_BmcManStop( p );
829  return Status;
830  }
831  }
832  if ( RetValue == l_True )
833  {
834  assert( p->iFrameFail * Saig_ManPoNum(p->pAig) + p->iOutputFail + 1 == nOutsSolved );
835  if ( !fSilent )
836  Abc_Print( 1, "Output %d of miter \"%s\" was asserted in frame %d. ",
837  p->iOutputFail, p->pAig->pName, p->iFrameFail );
838  Status = 0;
839  if ( piFrames )
840  *piFrames = p->iFrameFail - 1;
841  }
842  else // if ( RetValue == l_False || RetValue == l_Undef )
843  {
844  if ( !fSilent )
845  Abc_Print( 1, "No output failed in %d frames. ", Abc_MaxInt(p->iFramePrev-1, 0) );
846  if ( piFrames )
847  {
848  if ( p->iOutputLast > 0 )
849  *piFrames = p->iFramePrev - 2;
850  else
851  *piFrames = p->iFramePrev - 1;
852  }
853  }
854  if ( !fSilent )
855  {
856  if ( fVerbOverwrite )
857  {
858  ABC_PRTr( "Time", Abc_Clock() - clk );
859  }
860  else
861  {
862  ABC_PRT( "Time", Abc_Clock() - clk );
863  }
864  if ( RetValue != l_True )
865  {
866  if ( p->iFrameLast >= p->nFramesMax )
867  printf( "Reached limit on the number of timeframes (%d).\n", p->nFramesMax );
868  else if ( p->nConfMaxAll && p->pSat->stats.conflicts > p->nConfMaxAll )
869  printf( "Reached global conflict limit (%d).\n", p->nConfMaxAll );
870  else if ( nTimeOut && Abc_Clock() > nTimeToStop )
871  printf( "Reached timeout (%d seconds).\n", nTimeOut );
872  else
873  printf( "Reached local conflict limit (%d).\n", p->nConfMaxOne );
874  }
875  }
876  Saig_BmcManStop( p );
877  fflush( stdout );
878  return Status;
879 }
static abctime sat_solver_set_runtime_limit(sat_solver *s, abctime Limit)
Definition: satSolver.h:233
Aig_Man_t * Saig_BmcIntervalToAig(Saig_Bmc_t *p)
Definition: bmcBmc2.c:523
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
Cnf_Dat_t * Cnf_Derive(Aig_Man_t *pAig, int nOutputs)
Definition: cnfCore.c:165
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
int nVars
Definition: cnf.h:59
int Saig_BmcSolveTargets(Saig_Bmc_t *p, int nStart, int *pnOutsSolved)
Definition: bmcBmc2.c:676
#define l_True
Definition: SolverTypes.h:84
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Definition: cnf.h:56
void Saig_BmcLoadCnf(Saig_Bmc_t *p, Cnf_Dat_t *pCnf)
Definition: bmcBmc2.c:556
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
#define ABC_PRTr(a, t)
Definition: abc_global.h:221
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Saig_ManRegNum(Aig_Man_t *p)
Definition: saig.h:77
void Cnf_DataLift(Cnf_Dat_t *p, int nVarsPlus)
Definition: cnfMan.c:205
int Aig_ManLevelNum(Aig_Man_t *p)
Definition: aigDfs.c:486
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
#define ABC_PRT(a, t)
Definition: abc_global.h:220
#define l_False
Definition: SolverTypes.h:85
void Cnf_DataFree(Cnf_Dat_t *p)
Definition: cnfMan.c:180
void Saig_BmcManStop(Saig_Bmc_t *p)
Definition: bmcBmc2.c:334
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
Saig_Bmc_t * Saig_BmcManStart(Aig_Man_t *pAig, int nFramesMax, int nNodesMax, int nConfMaxOne, int nConfMaxAll, int fVerbose)
Definition: bmcBmc2.c:280
#define assert(ex)
Definition: util_old.h:213
void Saig_BmcInterval(Saig_Bmc_t *p)
Definition: bmcBmc2.c:454
ABC_INT64_T abctime
Definition: abc_global.h:278
typedefABC_NAMESPACE_IMPL_START struct Saig_Bmc_t_ Saig_Bmc_t
DECLARATIONS ///.
Definition: bmcBmc2.c:34
int Saig_ManBmcScalable ( Aig_Man_t pAig,
Saig_ParBmc_t pPars 
)

Function*************************************************************

Synopsis [Bounded model checking engine.]

Description []

SideEffects []

SeeAlso []

Definition at line 1390 of file bmcBmc3.c.

1391 {
1392  Gia_ManBmc_t * p;
1393  Aig_Obj_t * pObj;
1394  Abc_Cex_t * pCexNew, * pCexNew0;
1395  FILE * pLogFile = NULL;
1396  unsigned * pInfo;
1397  int RetValue = -1, fFirst = 1, nJumpFrame = 0, fUnfinished = 0;
1398  int nOutDigits = Abc_Base10Log( Saig_ManPoNum(pAig) );
1399  int i, f, k, Lit, status;
1400  abctime clk, clk2, clkSatRun, clkOther = 0, clkTotal = Abc_Clock();
1401  abctime nTimeUnsat = 0, nTimeSat = 0, nTimeUndec = 0, clkOne = 0;
1402  abctime nTimeToStopNG, nTimeToStop;
1403  if ( pPars->pLogFileName )
1404  pLogFile = fopen( pPars->pLogFileName, "wb" );
1405  if ( pPars->nTimeOutOne && pPars->nTimeOut == 0 )
1406  pPars->nTimeOut = pPars->nTimeOutOne * Saig_ManPoNum(pAig) / 1000 + 1;
1407  if ( pPars->nTimeOutOne && !pPars->fSolveAll )
1408  pPars->nTimeOutOne = 0;
1409  nTimeToStopNG = pPars->nTimeOut ? pPars->nTimeOut * CLOCKS_PER_SEC + Abc_Clock(): 0;
1410  nTimeToStop = Saig_ManBmcTimeToStop( pPars, nTimeToStopNG );
1411  // create BMC manager
1412  p = Saig_Bmc3ManStart( pAig, pPars->nTimeOutOne );
1413  p->pPars = pPars;
1414  p->pSat->nLearntStart = p->pPars->nLearnedStart;
1415  p->pSat->nLearntDelta = p->pPars->nLearnedDelta;
1416  p->pSat->nLearntRatio = p->pPars->nLearnedPerce;
1417  p->pSat->nLearntMax = p->pSat->nLearntStart;
1418  if ( pPars->fSolveAll && p->vCexes == NULL )
1419  p->vCexes = Vec_PtrStart( Saig_ManPoNum(pAig) );
1420  if ( pPars->fVerbose )
1421  {
1422  Abc_Print( 1, "Running \"bmc3\". PI/PO/Reg = %d/%d/%d. And =%7d. Lev =%6d. ObjNums =%6d.\n",// Sect =%3d.\n",
1423  Saig_ManPiNum(pAig), Saig_ManPoNum(pAig), Saig_ManRegNum(pAig),
1424  Aig_ManNodeNum(pAig), Aig_ManLevelNum(pAig), p->nObjNums );//, Vec_VecSize(p->vSects) );
1425  Abc_Print( 1, "Params: FramesMax = %d. Start = %d. ConfLimit = %d. TimeOut = %d. SolveAll = %d.\n",
1426  pPars->nFramesMax, pPars->nStart, pPars->nConfLimit, pPars->nTimeOut, pPars->fSolveAll );
1427  }
1428  pPars->nFramesMax = pPars->nFramesMax ? pPars->nFramesMax : ABC_INFINITY;
1429  // set runtime limit
1430  if ( nTimeToStop )
1431  sat_solver_set_runtime_limit( p->pSat, nTimeToStop );
1432  // perform frames
1433  Aig_ManRandom( 1 );
1434  pPars->timeLastSolved = Abc_Clock();
1435  for ( f = 0; f < pPars->nFramesMax; f++ )
1436  {
1437  // stop BMC after exploring all reachable states
1438  if ( !pPars->nFramesJump && Aig_ManRegNum(pAig) < 30 && f == (1 << Aig_ManRegNum(pAig)) )
1439  {
1440  Abc_Print( 1, "Stopping BMC because all 2^%d reachable states are visited.\n", Aig_ManRegNum(pAig) );
1441  if ( p->pPars->fUseBridge )
1442  Saig_ManForEachPo( pAig, pObj, i )
1443  if ( !(p->vCexes && Vec_PtrEntry(p->vCexes, i)) && !(p->pTime4Outs && p->pTime4Outs[i] == 0) ) // not SAT and not timed out
1444  Gia_ManToBridgeResult( stdout, 1, NULL, i );
1445  RetValue = pPars->nFailOuts ? 0 : 1;
1446  goto finish;
1447  }
1448  // stop BMC if all targets are solved
1449  if ( pPars->fSolveAll && pPars->nFailOuts + pPars->nDropOuts >= Saig_ManPoNum(pAig) )
1450  {
1451  Abc_Print( 1, "Stopping BMC because all targets are disproved or timed out.\n" );
1452  RetValue = pPars->nFailOuts ? 0 : 1;
1453  goto finish;
1454  }
1455  // consider the next timeframe
1456  if ( (RetValue == -1 || pPars->fSolveAll) && pPars->nStart == 0 && !nJumpFrame )
1457  pPars->iFrame = f-1;
1458  // map nodes of this section
1459  Vec_PtrPush( p->vId2Var, Vec_IntStartFull(p->nObjNums) );
1460  Vec_PtrPush( p->vTerInfo, (pInfo = ABC_CALLOC(unsigned, p->nWordNum)) );
1461 /*
1462  // cannot remove mapping of frame values for any timeframes
1463  // because with constant propagation they may be needed arbitrarily far
1464  if ( f > 2*Vec_VecSize(p->vSects) )
1465  {
1466  int iFrameOld = f - 2*Vec_VecSize( p->vSects );
1467  void * pMemory = Vec_IntReleaseArray( Vec_PtrEntry(p->vId2Var, iFrameOld) );
1468  ABC_FREE( pMemory );
1469  }
1470 */
1471  // prepare some nodes
1472  Saig_ManBmcSetLiteral( p, Aig_ManConst1(pAig), f, 1 );
1474  Saig_ManForEachPi( pAig, pObj, i )
1475  Saig_ManBmcSimInfoSet( pInfo, pObj, SAIG_TER_UND );
1476  if ( f == 0 )
1477  {
1478  Saig_ManForEachLo( p->pAig, pObj, i )
1479  {
1480  Saig_ManBmcSetLiteral( p, pObj, 0, 0 );
1481  Saig_ManBmcSimInfoSet( pInfo, pObj, SAIG_TER_ZER );
1482  }
1483  }
1484  if ( (pPars->nStart && f < pPars->nStart) || (nJumpFrame && f < nJumpFrame) )
1485  continue;
1486  // create CNF upfront
1487  if ( pPars->fSolveAll )
1488  {
1489  Saig_ManForEachPo( pAig, pObj, i )
1490  {
1491  if ( i >= Saig_ManPoNum(pAig) )
1492  break;
1493  // check for timeout
1494  if ( pPars->nTimeOutGap && pPars->timeLastSolved && Abc_Clock() > pPars->timeLastSolved + pPars->nTimeOutGap * CLOCKS_PER_SEC )
1495  {
1496  Abc_Print( 1, "Reached gap timeout (%d seconds).\n", pPars->nTimeOutGap );
1497  goto finish;
1498  }
1499  if ( nTimeToStop && Abc_Clock() > nTimeToStop )
1500  {
1501  if ( !pPars->fSilent )
1502  Abc_Print( 1, "Reached timeout (%d seconds).\n", pPars->nTimeOut );
1503  goto finish;
1504  }
1505  // skip solved outputs
1506  if ( p->vCexes && Vec_PtrEntry(p->vCexes, i) )
1507  continue;
1508  // skip output whose time has run out
1509  if ( p->pTime4Outs && p->pTime4Outs[i] == 0 )
1510  continue;
1511  // add constraints for this output
1512 clk2 = Abc_Clock();
1513  Saig_ManBmcCreateCnf( p, pObj, f );
1514 clkOther += Abc_Clock() - clk2;
1515  }
1516  }
1517  // solve SAT
1518  clk = Abc_Clock();
1519  Saig_ManForEachPo( pAig, pObj, i )
1520  {
1521  if ( i >= Saig_ManPoNum(pAig) )
1522  break;
1523  // check for timeout
1524  if ( pPars->nTimeOutGap && pPars->timeLastSolved && Abc_Clock() > pPars->timeLastSolved + pPars->nTimeOutGap * CLOCKS_PER_SEC )
1525  {
1526  Abc_Print( 1, "Reached gap timeout (%d seconds).\n", pPars->nTimeOutGap );
1527  goto finish;
1528  }
1529  if ( nTimeToStop && Abc_Clock() > nTimeToStop )
1530  {
1531  if ( !pPars->fSilent )
1532  Abc_Print( 1, "Reached timeout (%d seconds).\n", pPars->nTimeOut );
1533  goto finish;
1534  }
1535  // skip solved outputs
1536  if ( p->vCexes && Vec_PtrEntry(p->vCexes, i) )
1537  continue;
1538  // skip output whose time has run out
1539  if ( p->pTime4Outs && p->pTime4Outs[i] == 0 )
1540  continue;
1541  // add constraints for this output
1542 clk2 = Abc_Clock();
1543  Lit = Saig_ManBmcCreateCnf( p, pObj, f );
1544 clkOther += Abc_Clock() - clk2;
1545  // solve this output
1546  fUnfinished = 0;
1547  sat_solver_compress( p->pSat );
1548  if ( p->pTime4Outs )
1549  {
1550  assert( p->pTime4Outs[i] > 0 );
1551  clkOne = Abc_Clock();
1552  sat_solver_set_runtime_limit( p->pSat, p->pTime4Outs[i] + Abc_Clock() );
1553  }
1554 clk2 = Abc_Clock();
1555  status = Saig_ManCallSolver( p, Lit );
1556 clkSatRun = Abc_Clock() - clk2;
1557  if ( pLogFile )
1558  fprintf( pLogFile, "Frame %5d Output %5d Time(ms) %8d %8d\n", f, i,
1559  Lit < 2 ? 0 : (int)(clkSatRun * 1000 / CLOCKS_PER_SEC),
1560  Lit < 2 ? 0 : Abc_MaxInt(0, Abc_MinInt(pPars->nTimeOutOne, pPars->nTimeOutOne - (int)((p->pTime4Outs[i] - clkSatRun) * 1000 / CLOCKS_PER_SEC))) );
1561  if ( p->pTime4Outs )
1562  {
1563  abctime timeSince = Abc_Clock() - clkOne;
1564  assert( p->pTime4Outs[i] > 0 );
1565  p->pTime4Outs[i] = (p->pTime4Outs[i] > timeSince) ? p->pTime4Outs[i] - timeSince : 0;
1566  if ( p->pTime4Outs[i] == 0 && status != l_True )
1567  pPars->nDropOuts++;
1568  }
1569  if ( status == l_False )
1570  {
1571 nTimeUnsat += clkSatRun;
1572  if ( Lit != 0 )
1573  {
1574  // add final unit clause
1575  Lit = lit_neg( Lit );
1576  status = sat_solver_addclause( p->pSat, &Lit, &Lit + 1 );
1577  assert( status );
1578  // add learned units
1579  for ( k = 0; k < veci_size(&p->pSat->unit_lits); k++ )
1580  {
1581  Lit = veci_begin(&p->pSat->unit_lits)[k];
1582  status = sat_solver_addclause( p->pSat, &Lit, &Lit + 1 );
1583  assert( status );
1584  }
1585  veci_resize(&p->pSat->unit_lits, 0);
1586  // propagate units
1587  sat_solver_compress( p->pSat );
1588  }
1589  if ( p->pPars->fUseBridge )
1590  Gia_ManReportProgress( stdout, i, f );
1591  }
1592  else if ( status == l_True )
1593  {
1594 nTimeSat += clkSatRun;
1595  RetValue = 0;
1596  fFirst = 0;
1597  if ( !pPars->fSolveAll )
1598  {
1599  if ( pPars->fVerbose )
1600  {
1601  Abc_Print( 1, "%4d %s : ", f, fUnfinished ? "-" : "+" );
1602  Abc_Print( 1, "Var =%8.0f. ", (double)p->nSatVars );
1603  Abc_Print( 1, "Cla =%9.0f. ", (double)p->pSat->stats.clauses );
1604  Abc_Print( 1, "Conf =%7.0f. ", (double)p->pSat->stats.conflicts );
1605 // Abc_Print( 1, "Imp =%10.0f. ", (double)p->pSat->stats.propagations );
1606  Abc_Print( 1, "Uni =%7.0f. ",(double)sat_solver_count_assigned(p->pSat) );
1607 // ABC_PRT( "Time", Abc_Clock() - clk );
1608  Abc_Print( 1, "%4.0f MB", 4.25*(f+1)*p->nObjNums /(1<<20) );
1609  Abc_Print( 1, "%4.0f MB", 1.0*sat_solver_memory(p->pSat)/(1<<20) );
1610  Abc_Print( 1, "%9.2f sec ", (float)(Abc_Clock() - clkTotal)/(float)(CLOCKS_PER_SEC) );
1611 // Abc_Print( 1, "\n" );
1612 // ABC_PRMn( "Id2Var", (f+1)*p->nObjNums*4 );
1613 // ABC_PRMn( "SAT", 42 * p->pSat->size + 16 * (int)p->pSat->stats.clauses + 4 * (int)p->pSat->stats.clauses_literals );
1614 // Abc_Print( 1, "S =%6d. ", p->nBufNum );
1615 // Abc_Print( 1, "D =%6d. ", p->nDupNum );
1616  Abc_Print( 1, "\n" );
1617  fflush( stdout );
1618  }
1619  ABC_FREE( pAig->pSeqModel );
1620  pAig->pSeqModel = Saig_ManGenerateCex( p, f, i );
1621  goto finish;
1622  }
1623  pPars->nFailOuts++;
1624  if ( !pPars->fNotVerbose )
1625  Abc_Print( 1, "Output %*d was asserted in frame %2d (solved %*d out of %*d outputs).\n",
1626  nOutDigits, i, f, nOutDigits, pPars->nFailOuts, nOutDigits, Saig_ManPoNum(pAig) );
1627  if ( p->vCexes == NULL )
1628  p->vCexes = Vec_PtrStart( Saig_ManPoNum(pAig) );
1629  pCexNew = (p->pPars->fUseBridge || pPars->fStoreCex) ? Saig_ManGenerateCex( p, f, i ) : (Abc_Cex_t *)(ABC_PTRINT_T)1;
1630  pCexNew0 = NULL;
1631  if ( p->pPars->fUseBridge )
1632  {
1633  Gia_ManToBridgeResult( stdout, 0, pCexNew, pCexNew->iPo );
1634  //Abc_CexFree( pCexNew );
1635  pCexNew0 = pCexNew;
1636  pCexNew = (Abc_Cex_t *)(ABC_PTRINT_T)1;
1637  }
1638  Vec_PtrWriteEntry( p->vCexes, i, Abc_CexDup(pCexNew, Saig_ManRegNum(pAig)) );
1639  if ( pPars->pFuncOnFail && pPars->pFuncOnFail(i, pPars->fStoreCex ? (Abc_Cex_t *)Vec_PtrEntry(p->vCexes, i) : NULL) )
1640  {
1641  Abc_CexFreeP( &pCexNew0 );
1642  Abc_Print( 1, "Quitting due to callback on fail.\n" );
1643  goto finish;
1644  }
1645  // reset the timeout
1646  pPars->timeLastSolved = Abc_Clock();
1647  nTimeToStop = Saig_ManBmcTimeToStop( pPars, nTimeToStopNG );
1648  if ( nTimeToStop )
1649  sat_solver_set_runtime_limit( p->pSat, nTimeToStop );
1650 
1651  // check if other outputs failed under the same counter-example
1652  Saig_ManForEachPo( pAig, pObj, k )
1653  {
1654  if ( k >= Saig_ManPoNum(pAig) )
1655  break;
1656  // skip solved outputs
1657  if ( p->vCexes && Vec_PtrEntry(p->vCexes, k) )
1658  continue;
1659  // check if this output is solved
1660  Lit = Saig_ManBmcCreateCnf( p, pObj, f );
1661  if ( sat_solver_var_value(p->pSat, lit_var(Lit)) == Abc_LitIsCompl(Lit) )
1662  continue;
1663  // write entry
1664  pPars->nFailOuts++;
1665  if ( !pPars->fNotVerbose )
1666  Abc_Print( 1, "Output %*d was asserted in frame %2d (solved %*d out of %*d outputs).\n",
1667  nOutDigits, k, f, nOutDigits, pPars->nFailOuts, nOutDigits, Saig_ManPoNum(pAig) );
1668  // report to the bridge
1669  if ( p->pPars->fUseBridge )
1670  {
1671  // set the output number
1672  pCexNew0->iPo = k;
1673  Gia_ManToBridgeResult( stdout, 0, pCexNew0, pCexNew0->iPo );
1674  }
1675  // remember solved output
1676  Vec_PtrWriteEntry( p->vCexes, k, Abc_CexDup(pCexNew, Saig_ManRegNum(pAig)) );
1677  }
1678  Abc_CexFreeP( &pCexNew0 );
1679  Abc_CexFree( pCexNew );
1680  }
1681  else
1682  {
1683 nTimeUndec += clkSatRun;
1684  assert( status == l_Undef );
1685  if ( pPars->nFramesJump )
1686  {
1687  pPars->nConfLimit = pPars->nConfLimitJump;
1688  nJumpFrame = f + pPars->nFramesJump;
1689  fUnfinished = 1;
1690  break;
1691  }
1692  if ( p->pTime4Outs == NULL )
1693  goto finish;
1694  }
1695  }
1696  if ( pPars->fVerbose )
1697  {
1698  if ( fFirst == 1 && f > 0 && p->pSat->stats.conflicts > 1 )
1699  {
1700  fFirst = 0;
1701 // Abc_Print( 1, "Outputs of frames up to %d are trivially UNSAT.\n", f );
1702  }
1703  Abc_Print( 1, "%4d %s : ", f, fUnfinished ? "-" : "+" );
1704  Abc_Print( 1, "Var =%8.0f. ", (double)p->nSatVars );
1705 // Abc_Print( 1, "Used =%8.0f. ", (double)sat_solver_count_usedvars(p->pSat) );
1706  Abc_Print( 1, "Cla =%9.0f. ", (double)p->pSat->stats.clauses );
1707  Abc_Print( 1, "Conf =%7.0f. ",(double)p->pSat->stats.conflicts );
1708 // Abc_Print( 1, "Imp =%10.0f. ", (double)p->pSat->stats.propagations );
1709  Abc_Print( 1, "Uni =%7.0f. ",(double)sat_solver_count_assigned(p->pSat) );
1710  if ( pPars->fSolveAll )
1711  Abc_Print( 1, "CEX =%5d. ", pPars->nFailOuts );
1712  if ( pPars->nTimeOutOne )
1713  Abc_Print( 1, "T/O =%4d. ", pPars->nDropOuts );
1714 // ABC_PRT( "Time", Abc_Clock() - clk );
1715 // Abc_Print( 1, "%4.0f MB", 4.0*Vec_IntSize(p->vVisited) /(1<<20) );
1716  Abc_Print( 1, "%4.0f MB", 4.0*(f+1)*p->nObjNums /(1<<20) );
1717  Abc_Print( 1, "%4.0f MB", 1.0*sat_solver_memory(p->pSat)/(1<<20) );
1718 // Abc_Print( 1, " %6d %6d ", p->nLitUsed, p->nLitUseless );
1719  Abc_Print( 1, "%9.2f sec ", 1.0*(Abc_Clock() - clkTotal)/CLOCKS_PER_SEC );
1720 // Abc_Print( 1, "\n" );
1721 // ABC_PRMn( "Id2Var", (f+1)*p->nObjNums*4 );
1722 // ABC_PRMn( "SAT", 42 * p->pSat->size + 16 * (int)p->pSat->stats.clauses + 4 * (int)p->pSat->stats.clauses_literals );
1723 // Abc_Print( 1, "Simples = %6d. ", p->nBufNum );
1724 // Abc_Print( 1, "Dups = %6d. ", p->nDupNum );
1725  Abc_Print( 1, "\n" );
1726  fflush( stdout );
1727  }
1728  }
1729  // consider the next timeframe
1730  if ( nJumpFrame && pPars->nStart == 0 )
1731  pPars->iFrame = nJumpFrame - pPars->nFramesJump;
1732  else if ( RetValue == -1 && pPars->nStart == 0 )
1733  pPars->iFrame = f-1;
1734 //ABC_PRT( "CNF generation runtime", clkOther );
1735 finish:
1736  if ( pPars->fVerbose )
1737  {
1738  Abc_Print( 1, "Runtime: " );
1739  Abc_Print( 1, "CNF = %.1f sec (%.1f %%) ", 1.0*clkOther/CLOCKS_PER_SEC, 100.0*clkOther/(Abc_Clock() - clkTotal) );
1740  Abc_Print( 1, "UNSAT = %.1f sec (%.1f %%) ", 1.0*nTimeUnsat/CLOCKS_PER_SEC, 100.0*nTimeUnsat/(Abc_Clock() - clkTotal) );
1741  Abc_Print( 1, "SAT = %.1f sec (%.1f %%) ", 1.0*nTimeSat/CLOCKS_PER_SEC, 100.0*nTimeSat/(Abc_Clock() - clkTotal) );
1742  Abc_Print( 1, "UNDEC = %.1f sec (%.1f %%)", 1.0*nTimeUndec/CLOCKS_PER_SEC, 100.0*nTimeUndec/(Abc_Clock() - clkTotal) );
1743  Abc_Print( 1, "\n" );
1744  }
1745  Saig_Bmc3ManStop( p );
1746  fflush( stdout );
1747  if ( pLogFile )
1748  fclose( pLogFile );
1749  return RetValue;
1750 }
static abctime sat_solver_set_runtime_limit(sat_solver *s, abctime Limit)
Definition: satSolver.h:233
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
int nConfLimitJump
Definition: bmc.h:51
int Saig_ManCallSolver(Gia_ManBmc_t *p, int Lit)
Definition: bmcBmc3.c:1370
int nDropOuts
Definition: bmc.h:72
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
Abc_Cex_t * Saig_ManGenerateCex(Gia_ManBmc_t *p, int f, int i)
Definition: bmcBmc3.c:1343
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int sat_solver_addclause(sat_solver *s, lit *begin, lit *end)
Definition: satSolver.c:1492
#define l_Undef
Definition: SolverTypes.h:86
int nLearnedStart
Definition: bmc.h:63
static void sat_solver_compress(sat_solver *s)
Definition: satSolver.h:217
static int lit_var(lit l)
Definition: satVec.h:145
int nTimeOutOne
Definition: bmc.h:55
int fVerbose
Definition: bmc.h:66
#define SAIG_TER_UND
Definition: bmcBmc3.c:86
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define l_True
Definition: SolverTypes.h:84
int nFailOuts
Definition: bmc.h:71
int nStart
Definition: bmc.h:48
unsigned Aig_ManRandom(int fReset)
Definition: aigUtil.c:1157
int(* pFuncOnFail)(int, Abc_Cex_t *)
Definition: bmc.h:74
int nTimeOutGap
Definition: bmc.h:54
int iFrame
Definition: bmc.h:70
static void veci_resize(veci *v, int k)
Definition: satVec.h:47
static abctime Abc_Clock()
Definition: abc_global.h:279
int nConfLimit
Definition: bmc.h:50
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
double sat_solver_memory(sat_solver *s)
Definition: satSolver.c:1236
static Vec_Int_t * Vec_IntStartFull(int nSize)
Definition: vecInt.h:119
int sat_solver_count_assigned(sat_solver *s)
Definition: satSolver.c:609
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
static int sat_solver_var_value(sat_solver *s, int v)
Definition: satSolver.h:200
int nTimeOut
Definition: bmc.h:53
static lit lit_neg(lit l)
Definition: satVec.h:144
int nFramesMax
Definition: bmc.h:49
abctime timeLastSolved
Definition: bmc.h:73
static int Abc_MinInt(int a, int b)
Definition: abc_global.h:239
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
static void Saig_ManBmcSimInfoSet(unsigned *pInfo, Aig_Obj_t *pObj, int Value)
Definition: bmcBmc3.c:111
Gia_ManBmc_t * Saig_Bmc3ManStart(Aig_Man_t *pAig, int nTimeOutOne)
Definition: bmcBmc3.c:717
void Saig_Bmc3ManStop(Gia_ManBmc_t *p)
Definition: bmcBmc3.c:776
int nFramesJump
Definition: bmc.h:52
int fStoreCex
Definition: bmc.h:58
static int Saig_ManBmcSetLiteral(Gia_ManBmc_t *p, Aig_Obj_t *pObj, int iFrame, int iLit)
Definition: bmcBmc3.c:866
typedefABC_NAMESPACE_IMPL_START struct Gia_ManBmc_t_ Gia_ManBmc_t
DECLARATIONS ///.
Definition: bmcBmc3.c:34
static int Abc_Base10Log(unsigned n)
Definition: abc_global.h:252
void Abc_CexFreeP(Abc_Cex_t **p)
Definition: utilCex.c:350
int fNotVerbose
Definition: bmc.h:67
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
#define Saig_ManForEachLo(p, pObj, i)
Definition: saig.h:96
#define SAIG_TER_ONE
Definition: bmcBmc3.c:85
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Saig_ManRegNum(Aig_Man_t *p)
Definition: saig.h:77
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
int Aig_ManLevelNum(Aig_Man_t *p)
Definition: aigDfs.c:486
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
abctime Saig_ManBmcTimeToStop(Saig_ParBmc_t *pPars, abctime nTimeToStopNG)
Definition: bmcBmc3.c:1319
int fSilent
Definition: bmc.h:69
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
#define ABC_FREE(obj)
Definition: abc_global.h:232
Abc_Cex_t * Abc_CexDup(Abc_Cex_t *p, int nRegsNew)
Definition: utilCex.c:145
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define l_False
Definition: SolverTypes.h:85
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition: utilCex.h:39
char * pLogFileName
Definition: bmc.h:68
int Saig_ManBmcCreateCnf(Gia_ManBmc_t *p, Aig_Obj_t *pObj, int iFrame)
Definition: bmcBmc3.c:1211
void Gia_ManReportProgress(FILE *pFile, int prop_no, int depth)
Definition: bmcBmc3.c:71
void Abc_CexFree(Abc_Cex_t *p)
Definition: utilCex.c:371
ABC_INT64_T abctime
Definition: abc_global.h:278
static int * veci_begin(veci *v)
Definition: satVec.h:45
#define SAIG_TER_ZER
Definition: bmcBmc3.c:84
static int veci_size(veci *v)
Definition: satVec.h:46
int Gia_ManToBridgeResult(FILE *pFile, int Result, Abc_Cex_t *pCex, int iPoProved)
DECLARATIONS ///.
Definition: utilBridge.c:284
int fSolveAll
Definition: bmc.h:57
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
int Saig_ManBmcSimple ( Aig_Man_t pAig,
int  nFrames,
int  nSizeMax,
int  nConfLimit,
int  fRewrite,
int  fVerbose,
int *  piFrame,
int  nCofFanLit 
)

Function*************************************************************

Synopsis [Performs BMC for the given AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 186 of file bmcBmc.c.

187 {
188  extern Aig_Man_t * Gia_ManCofactorAig( Aig_Man_t * p, int nFrames, int nCofFanLit );
189  sat_solver * pSat;
190  Cnf_Dat_t * pCnf;
191  Aig_Man_t * pFrames, * pAigTemp;
192  Aig_Obj_t * pObj;
193  int status, Lit, i, RetValue = -1;
194  abctime clk;
195 
196  // derive the timeframes
197  clk = Abc_Clock();
198  if ( nCofFanLit )
199  {
200  pFrames = Gia_ManCofactorAig( pAig, nFrames, nCofFanLit );
201  if ( pFrames == NULL )
202  return -1;
203  }
204  else if ( nSizeMax > 0 )
205  {
206  pFrames = Saig_ManFramesBmcLimit( pAig, nFrames, nSizeMax );
207  nFrames = Aig_ManCoNum(pFrames) / Saig_ManPoNum(pAig) + ((Aig_ManCoNum(pFrames) % Saig_ManPoNum(pAig)) > 0);
208  }
209  else
210  pFrames = Saig_ManFramesBmc( pAig, nFrames );
211  if ( piFrame )
212  *piFrame = nFrames;
213  if ( fVerbose )
214  {
215  printf( "Running \"bmc\". AIG: PI/PO/Reg = %d/%d/%d. Node = %6d. Lev = %5d.\n",
216  Saig_ManPiNum(pAig), Saig_ManPoNum(pAig), Saig_ManRegNum(pAig),
217  Aig_ManNodeNum(pAig), Aig_ManLevelNum(pAig) );
218  printf( "Time-frames (%d): PI/PO = %d/%d. Node = %6d. Lev = %5d. ",
219  nFrames, Aig_ManCiNum(pFrames), Aig_ManCoNum(pFrames),
220  Aig_ManNodeNum(pFrames), Aig_ManLevelNum(pFrames) );
221  ABC_PRT( "Time", Abc_Clock() - clk );
222  fflush( stdout );
223  }
224  // rewrite the timeframes
225  if ( fRewrite )
226  {
227  clk = Abc_Clock();
228 // pFrames = Dar_ManBalance( pAigTemp = pFrames, 0 );
229  pFrames = Dar_ManRwsat( pAigTemp = pFrames, 1, 0 );
230  Aig_ManStop( pAigTemp );
231  if ( fVerbose )
232  {
233  printf( "Time-frames after rewriting: Node = %6d. Lev = %5d. ",
234  Aig_ManNodeNum(pFrames), Aig_ManLevelNum(pFrames) );
235  ABC_PRT( "Time", Abc_Clock() - clk );
236  fflush( stdout );
237  }
238  }
239  // create the SAT solver
240  clk = Abc_Clock();
241  pCnf = Cnf_Derive( pFrames, Aig_ManCoNum(pFrames) );
242 //if ( s_fInterrupt )
243 //return -1;
244  pSat = sat_solver_new();
245  sat_solver_setnvars( pSat, pCnf->nVars );
246  for ( i = 0; i < pCnf->nClauses; i++ )
247  {
248  if ( !sat_solver_addclause( pSat, pCnf->pClauses[i], pCnf->pClauses[i+1] ) )
249  assert( 0 );
250  }
251  if ( fVerbose )
252  {
253  printf( "CNF: Variables = %6d. Clauses = %7d. Literals = %8d. ", pCnf->nVars, pCnf->nClauses, pCnf->nLiterals );
254  ABC_PRT( "Time", Abc_Clock() - clk );
255  fflush( stdout );
256  }
257  status = sat_solver_simplify(pSat);
258  if ( status == 0 )
259  {
260  if ( fVerbose )
261  {
262  printf( "The BMC problem is trivially UNSAT\n" );
263  fflush( stdout );
264  }
265  }
266  else
267  {
268  abctime clkPart = Abc_Clock();
269  Aig_ManForEachCo( pFrames, pObj, i )
270  {
271 //if ( s_fInterrupt )
272 //return -1;
273  Lit = toLitCond( pCnf->pVarNums[pObj->Id], 0 );
274  if ( fVerbose )
275  {
276  printf( "Solving output %2d of frame %3d ... \r",
277  i % Saig_ManPoNum(pAig), i / Saig_ManPoNum(pAig) );
278  }
279  clk = Abc_Clock();
280  status = sat_solver_solve( pSat, &Lit, &Lit + 1, (ABC_INT64_T)nConfLimit, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
281  if ( fVerbose && (i % Saig_ManPoNum(pAig) == Saig_ManPoNum(pAig) - 1) )
282  {
283  printf( "Solved %2d outputs of frame %3d. ",
284  Saig_ManPoNum(pAig), i / Saig_ManPoNum(pAig) );
285  printf( "Conf =%8.0f. Imp =%11.0f. ", (double)pSat->stats.conflicts, (double)pSat->stats.propagations );
286  ABC_PRT( "T", Abc_Clock() - clkPart );
287  clkPart = Abc_Clock();
288  fflush( stdout );
289  }
290  if ( status == l_False )
291  {
292 /*
293  Lit = lit_neg( Lit );
294  RetValue = sat_solver_addclause( pSat, &Lit, &Lit + 1 );
295  assert( RetValue );
296  if ( pSat->qtail != pSat->qhead )
297  {
298  RetValue = sat_solver_simplify(pSat);
299  assert( RetValue );
300  }
301 */
302  }
303  else if ( status == l_True )
304  {
305  Vec_Int_t * vCiIds = Cnf_DataCollectPiSatNums( pCnf, pFrames );
306  int * pModel = Sat_SolverGetModel( pSat, vCiIds->pArray, vCiIds->nSize );
307  pModel[Aig_ManCiNum(pFrames)] = pObj->Id;
308  pAig->pSeqModel = Fra_SmlCopyCounterExample( pAig, pFrames, pModel );
309  ABC_FREE( pModel );
310  Vec_IntFree( vCiIds );
311 
312  if ( piFrame )
313  *piFrame = i / Saig_ManPoNum(pAig);
314  RetValue = 0;
315  break;
316  }
317  else
318  {
319  if ( piFrame )
320  *piFrame = i / Saig_ManPoNum(pAig);
321  RetValue = -1;
322  break;
323  }
324  }
325  }
326  sat_solver_delete( pSat );
327  Cnf_DataFree( pCnf );
328  Aig_ManStop( pFrames );
329  return RetValue;
330 }
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
ABC_NAMESPACE_IMPL_START Aig_Man_t * Saig_ManFramesBmc(Aig_Man_t *pAig, int nFrames)
DECLARATIONS ///.
Definition: bmcBmc.c:48
Cnf_Dat_t * Cnf_Derive(Aig_Man_t *pAig, int nOutputs)
Definition: cnfCore.c:165
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int sat_solver_addclause(sat_solver *s, lit *begin, lit *end)
Definition: satSolver.c:1492
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
int nClauses
Definition: cnf.h:61
int sat_solver_solve(sat_solver *s, lit *begin, lit *end, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, ABC_INT64_T nConfLimitGlobal, ABC_INT64_T nInsLimitGlobal)
Definition: satSolver.c:1700
int nVars
Definition: cnf.h:59
void sat_solver_delete(sat_solver *s)
Definition: satSolver.c:1141
int * pVarNums
Definition: cnf.h:63
#define l_True
Definition: SolverTypes.h:84
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
Abc_Cex_t * Fra_SmlCopyCounterExample(Aig_Man_t *pAig, Aig_Man_t *pFrames, int *pModel)
Definition: fraSim.c:1117
static abctime Abc_Clock()
Definition: abc_global.h:279
Aig_Man_t * Saig_ManFramesBmcLimit(Aig_Man_t *pAig, int nFrames, int nSizeMax)
Definition: bmcBmc.c:121
stats_t stats
Definition: satSolver.h:156
Definition: cnf.h:56
ABC_NAMESPACE_IMPL_START Aig_Man_t * Dar_ManRwsat(Aig_Man_t *pAig, int fBalance, int fVerbose)
DECLARATIONS ///.
Definition: darScript.c:71
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
int ** pClauses
Definition: cnf.h:62
Vec_Int_t * Cnf_DataCollectPiSatNums(Cnf_Dat_t *pCnf, Aig_Man_t *p)
Definition: cnfMan.c:104
static lit toLitCond(int v, int c)
Definition: satVec.h:143
void sat_solver_setnvars(sat_solver *s, int n)
Definition: satSolver.c:1072
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
Definition: aig.h:69
static int Saig_ManRegNum(Aig_Man_t *p)
Definition: saig.h:77
int Aig_ManLevelNum(Aig_Man_t *p)
Definition: aigDfs.c:486
ABC_INT64_T conflicts
Definition: satVec.h:154
int sat_solver_simplify(sat_solver *s)
Definition: satSolver.c:1276
sat_solver * sat_solver_new(void)
Definition: satSolver.c:1001
Aig_Man_t * Gia_ManCofactorAig(Aig_Man_t *p, int nFrames, int nCofFanLit)
Definition: giaAig.c:411
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define ABC_PRT(a, t)
Definition: abc_global.h:220
#define l_False
Definition: SolverTypes.h:85
ABC_INT64_T propagations
Definition: satVec.h:154
void Cnf_DataFree(Cnf_Dat_t *p)
Definition: cnfMan.c:180
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
ABC_INT64_T abctime
Definition: abc_global.h:278
int nLiterals
Definition: cnf.h:60
int Id
Definition: aig.h:85
int * Sat_SolverGetModel(sat_solver *p, int *pVars, int nVars)
Definition: satUtil.c:266
Abc_Cex_t* Saig_ManCexMinPerform ( Aig_Man_t pAig,
Abc_Cex_t pCex 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 547 of file bmcCexMin1.c.

548 {
549  int fReasonPi = 0;
550 
551  Abc_Cex_t * pCexMin = NULL;
552  Aig_Man_t * pManNew = NULL;
553  Vec_Vec_t * vFrameReas;
554  vFrameReas = Saig_ManCexMinComputeReason( pAig, pCex, fReasonPi );
555  printf( "Reason size = %d. Ave = %d.\n", Vec_VecSizeSize(vFrameReas), Vec_VecSizeSize(vFrameReas)/(pCex->iFrame + 1) );
556 
557  // try reducing the frames
558  if ( !fReasonPi )
559  {
560  char * pFileName = "aigcube.aig";
561  pManNew = Saig_ManCexMinDupWithCubes( pAig, vFrameReas );
562  Ioa_WriteAiger( pManNew, pFileName, 0, 0 );
563  Aig_ManStop( pManNew );
564  printf( "Intermediate AIG is written into file \"%s\".\n", pFileName );
565  }
566 
567  // find reduced counter-example
568  Vec_VecFree( vFrameReas );
569  return pCexMin;
570 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
Aig_Man_t * Saig_ManCexMinDupWithCubes(Aig_Man_t *pAig, Vec_Vec_t *vReg2Value)
Definition: bmcCexMin1.c:494
void Ioa_WriteAiger(Aig_Man_t *pMan, char *pFileName, int fWriteSymbols, int fCompact)
Definition: ioaWriteAig.c:446
static int Vec_VecSizeSize(Vec_Vec_t *p)
Definition: vecVec.h:417
Vec_Vec_t * Saig_ManCexMinComputeReason(Aig_Man_t *pAig, Abc_Cex_t *pCex, int fPiReason)
Definition: bmcCexMin1.c:464
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition: utilCex.h:39
void Saig_ParBmcSetDefaultParams ( Saig_ParBmc_t p)

Function*************************************************************

Synopsis [This procedure sets default parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 1284 of file bmcBmc3.c.

1285 {
1286  memset( p, 0, sizeof(Saig_ParBmc_t) );
1287  p->nStart = 0; // maximum number of timeframes
1288  p->nFramesMax = 0; // maximum number of timeframes
1289  p->nConfLimit = 0; // maximum number of conflicts at a node
1290  p->nConfLimitJump = 0; // maximum number of conflicts after jumping
1291  p->nFramesJump = 0; // the number of tiemframes to jump
1292  p->nTimeOut = 0; // approximate timeout in seconds
1293  p->nTimeOutGap = 0; // time since the last CEX found
1294  p->nPisAbstract = 0; // the number of PIs to abstract
1295  p->fSolveAll = 0; // stops on the first SAT instance
1296  p->fDropSatOuts = 0; // replace sat outputs by constant 0
1297  p->nLearnedStart = 10000; // starting learned clause limit
1298  p->nLearnedDelta = 2000; // delta of learned clause limit
1299  p->nLearnedPerce = 80; // ratio of learned clause limit
1300  p->fVerbose = 0; // verbose
1301  p->fNotVerbose = 0; // skip line-by-line print-out
1302  p->iFrame = -1; // explored up to this frame
1303  p->nFailOuts = 0; // the number of failed outputs
1304  p->nDropOuts = 0; // the number of timed out outputs
1305  p->timeLastSolved = 0; // time when the last one was solved
1306 }
char * memset()
int nConfLimitJump
Definition: bmc.h:51
int nLearnedPerce
Definition: bmc.h:65
int nDropOuts
Definition: bmc.h:72
int nLearnedStart
Definition: bmc.h:63
int fVerbose
Definition: bmc.h:66
int nFailOuts
Definition: bmc.h:71
int nStart
Definition: bmc.h:48
int nTimeOutGap
Definition: bmc.h:54
int iFrame
Definition: bmc.h:70
int nConfLimit
Definition: bmc.h:50
int nTimeOut
Definition: bmc.h:53
int nFramesMax
Definition: bmc.h:49
abctime timeLastSolved
Definition: bmc.h:73
int fDropSatOuts
Definition: bmc.h:60
int nFramesJump
Definition: bmc.h:52
int fNotVerbose
Definition: bmc.h:67
int nPisAbstract
Definition: bmc.h:56
int nLearnedDelta
Definition: bmc.h:64
int fSolveAll
Definition: bmc.h:57
void Unr_ManFree ( Unr_Man_t p)

Definition at line 340 of file bmcUnroll.c.

341 {
342  Gia_ManStop( p->pFrames );
343  // intermediate data
344  Vec_IntFreeP( &p->vOrder );
345  Vec_IntFreeP( &p->vOrderLim );
346  Vec_IntFreeP( &p->vTents );
347  Vec_IntFreeP( &p->vRanks );
348  // unrolling data
349  Vec_IntFreeP( &p->vObjLim );
350  Vec_IntFreeP( &p->vCiMap );
351  Vec_IntFreeP( &p->vCoMap );
352  Vec_IntFreeP( &p->vPiLits );
353  ABC_FREE( p->pObjs );
354  ABC_FREE( p );
355 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
#define ABC_FREE(obj)
Definition: abc_global.h:232
Gia_Man_t* Unr_ManUnrollFrame ( Unr_Man_t p,
int  f 
)

Definition at line 379 of file bmcUnroll.c.

380 {
381  int i, iLit, iLit0, iLit1, hStart;
382  for ( i = 0; i < Gia_ManPiNum(p->pGia); i++ )
383  Vec_IntPush( p->vPiLits, Gia_ManAppendCi(p->pFrames) );
384  hStart = Vec_IntEntry( p->vObjLim, Abc_MaxInt(0, Vec_IntSize(p->vObjLim)-1-f) );
385  while ( p->pObjs + hStart < p->pEnd )
386  {
387  Unr_Obj_t * pUnrObj = Unr_ManObj( p, hStart );
388  if ( pUnrObj->uRDiff0 != UNR_DIFF_NULL && pUnrObj->uRDiff1 != UNR_DIFF_NULL ) // AND node
389  {
390  iLit0 = Unr_ManFanin0Value( p, pUnrObj );
391  iLit1 = Unr_ManFanin1Value( p, pUnrObj );
392  iLit = Gia_ManHashAnd( p->pFrames, iLit0, iLit1 );
393  Unr_ManObjSetValue( pUnrObj, iLit );
394  }
395  else if ( pUnrObj->uRDiff0 != UNR_DIFF_NULL && pUnrObj->uRDiff1 == UNR_DIFF_NULL ) // PO/RI/RO
396  {
397  iLit = Unr_ManFanin0Value( p, pUnrObj );
398  Unr_ManObjSetValue( pUnrObj, iLit );
399  if ( pUnrObj->fItIsPo )
400  Gia_ManAppendCo( p->pFrames, iLit );
401  }
402  else // PI (pUnrObj->hFan0 is CioId; pUnrObj->hFan1 is tent)
403  {
404  assert( pUnrObj->fItIsPi && f >= (int)pUnrObj->hFan1 );
405  iLit = Vec_IntEntry( p->vPiLits, Gia_ManPiNum(p->pGia) * (f - pUnrObj->hFan1) + pUnrObj->hFan0 );
406  Unr_ManObjSetValue( pUnrObj, iLit );
407  }
408  hStart += Unr_ObjSize( pUnrObj );
409  }
410  assert( p->pObjs + hStart == p->pEnd );
411  assert( Gia_ManPoNum(p->pFrames) == (f + 1) * Gia_ManPoNum(p->pGia) );
412  return p->pFrames;
413 }
unsigned hFan0
Definition: bmcUnroll.c:34
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define UNR_DIFF_NULL
DECLARATIONS ///.
Definition: bmcUnroll.c:29
unsigned fItIsPo
Definition: bmcUnroll.c:41
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
static Unr_Obj_t * Unr_ManObj(Unr_Man_t *p, int h)
Definition: bmcUnroll.c:68
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static int Unr_ObjSize(Unr_Obj_t *pObj)
Definition: bmcUnroll.c:70
unsigned hFan1
Definition: bmcUnroll.c:35
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Unr_ManFanin1Value(Unr_Man_t *p, Unr_Obj_t *pObj)
Definition: bmcUnroll.c:80
unsigned fItIsPi
Definition: bmcUnroll.c:40
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static void Unr_ManObjSetValue(Unr_Obj_t *pObj, int Value)
Definition: bmcUnroll.c:93
static int Unr_ManFanin0Value(Unr_Man_t *p, Unr_Obj_t *pObj)
Definition: bmcUnroll.c:72
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define assert(ex)
Definition: util_old.h:213
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
unsigned uRDiff1
Definition: bmcUnroll.c:39
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
unsigned uRDiff0
Definition: bmcUnroll.c:38
Unr_Man_t* Unr_ManUnrollStart ( Gia_Man_t pGia,
int  fVerbose 
)

Function*************************************************************

Synopsis [Perform smart unrolling.]

Description []

SideEffects []

SeeAlso []

Definition at line 368 of file bmcUnroll.c.

369 {
370  int i, iHandle;
371  Unr_Man_t * p;
372  p = Unr_ManAlloc( pGia );
373  Unr_ManSetup( p, fVerbose );
374  for ( i = 0; i < Gia_ManRegNum(p->pGia); i++ )
375  if ( (iHandle = Vec_IntEntry(p->vCoMap, Gia_ManPoNum(p->pGia) + i)) != -1 )
376  Unr_ManObjSetValue( Unr_ManObj(p, iHandle), 0 );
377  return p;
378 }
typedefABC_NAMESPACE_HEADER_START struct Unr_Man_t_ Unr_Man_t
INCLUDES ///.
Definition: bmc.h:43
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Unr_Obj_t * Unr_ManObj(Unr_Man_t *p, int h)
Definition: bmcUnroll.c:68
void Unr_ManSetup(Unr_Man_t *p, int fVerbose)
Definition: bmcUnroll.c:186
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static void Unr_ManObjSetValue(Unr_Obj_t *pObj, int Value)
Definition: bmcUnroll.c:93
Unr_Man_t * Unr_ManAlloc(Gia_Man_t *pGia)
Definition: bmcUnroll.c:321
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387