abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
pdrInt.h File Reference
#include "aig/saig/saig.h"
#include "misc/vec/vecWec.h"
#include "sat/cnf/cnf.h"
#include "sat/bsat/satSolver.h"
#include "pdr.h"

Go to the source code of this file.

Data Structures

struct  Pdr_Set_t_
 
struct  Pdr_Obl_t_
 
struct  Pdr_Man_t_
 

Typedefs

typedef
typedefABC_NAMESPACE_HEADER_START
struct Pdr_Set_t_ 
Pdr_Set_t
 INCLUDES ///. More...
 
typedef struct Pdr_Obl_t_ Pdr_Obl_t
 
typedef struct Pdr_Man_t_ Pdr_Man_t
 

Functions

static sat_solverPdr_ManSolver (Pdr_Man_t *p, int k)
 MACRO DEFINITIONS ///. More...
 
static abctime Pdr_ManTimeLimit (Pdr_Man_t *p)
 
Abc_Cex_tPdr_ManDeriveCex (Pdr_Man_t *p)
 FUNCTION DECLARATIONS ///. More...
 
int Pdr_ObjSatVar (Pdr_Man_t *p, int k, int Pol, Aig_Obj_t *pObj)
 
int Pdr_ObjRegNum (Pdr_Man_t *p, int k, int iSatVar)
 
int Pdr_ManFreeVar (Pdr_Man_t *p, int k)
 
sat_solverPdr_ManNewSolver (sat_solver *pSat, Pdr_Man_t *p, int k, int fInit)
 
int Pdr_ManCheckContainment (Pdr_Man_t *p, int k, Pdr_Set_t *pSet)
 
void Pdr_ManPrintProgress (Pdr_Man_t *p, int fClose, abctime Time)
 DECLARATIONS ///. More...
 
void Pdr_ManPrintClauses (Pdr_Man_t *p, int kStart)
 
void Pdr_ManDumpClauses (Pdr_Man_t *p, char *pFileName, int fProved)
 
void Pdr_ManReportInvariant (Pdr_Man_t *p)
 
void Pdr_ManVerifyInvariant (Pdr_Man_t *p)
 
Pdr_Man_tPdr_ManStart (Aig_Man_t *pAig, Pdr_Par_t *pPars, Vec_Int_t *vPrioInit)
 DECLARATIONS ///. More...
 
void Pdr_ManStop (Pdr_Man_t *p)
 
sat_solverPdr_ManCreateSolver (Pdr_Man_t *p, int k)
 DECLARATIONS ///. More...
 
sat_solverPdr_ManFetchSolver (Pdr_Man_t *p, int k)
 
void Pdr_ManSetPropertyOutput (Pdr_Man_t *p, int k)
 
Vec_Int_tPdr_ManCubeToLits (Pdr_Man_t *p, int k, Pdr_Set_t *pCube, int fCompl, int fNext)
 
Vec_Int_tPdr_ManLitsToCube (Pdr_Man_t *p, int k, int *pArray, int nArray)
 
void Pdr_ManSolverAddClause (Pdr_Man_t *p, int k, Pdr_Set_t *pCube)
 
void Pdr_ManCollectValues (Pdr_Man_t *p, int k, Vec_Int_t *vObjIds, Vec_Int_t *vValues)
 
int Pdr_ManCheckCubeCs (Pdr_Man_t *p, int k, Pdr_Set_t *pCube)
 
int Pdr_ManCheckCube (Pdr_Man_t *p, int k, Pdr_Set_t *pCube, Pdr_Set_t **ppPred, int nConfLimit)
 
Pdr_Set_tPdr_ManTernarySim (Pdr_Man_t *p, int k, Pdr_Set_t *pCube)
 
Pdr_Set_tPdr_SetAlloc (int nSize)
 DECLARATIONS ///. More...
 
Pdr_Set_tPdr_SetCreate (Vec_Int_t *vLits, Vec_Int_t *vPiLits)
 
Pdr_Set_tPdr_SetCreateFrom (Pdr_Set_t *pSet, int iRemove)
 
Pdr_Set_tPdr_SetCreateSubset (Pdr_Set_t *pSet, int *pLits, int nLits)
 
Pdr_Set_tPdr_SetDup (Pdr_Set_t *pSet)
 
Pdr_Set_tPdr_SetRef (Pdr_Set_t *p)
 
void Pdr_SetDeref (Pdr_Set_t *p)
 
int Pdr_SetContains (Pdr_Set_t *pOld, Pdr_Set_t *pNew)
 
int Pdr_SetContainsSimple (Pdr_Set_t *pOld, Pdr_Set_t *pNew)
 
int Pdr_SetIsInit (Pdr_Set_t *p, int iRemove)
 
void Pdr_SetPrint (FILE *pFile, Pdr_Set_t *p, int nRegs, Vec_Int_t *vFlopCounts)
 
int Pdr_SetCompare (Pdr_Set_t **pp1, Pdr_Set_t **pp2)
 
Pdr_Obl_tPdr_OblStart (int k, int prio, Pdr_Set_t *pState, Pdr_Obl_t *pNext)
 
Pdr_Obl_tPdr_OblRef (Pdr_Obl_t *p)
 
void Pdr_OblDeref (Pdr_Obl_t *p)
 
int Pdr_QueueIsEmpty (Pdr_Man_t *p)
 
Pdr_Obl_tPdr_QueueHead (Pdr_Man_t *p)
 
Pdr_Obl_tPdr_QueuePop (Pdr_Man_t *p)
 
void Pdr_QueueClean (Pdr_Man_t *p)
 
void Pdr_QueuePush (Pdr_Man_t *p, Pdr_Obl_t *pObl)
 
void Pdr_QueuePrint (Pdr_Man_t *p)
 
void Pdr_QueueStop (Pdr_Man_t *p)
 
int Pdr_ManCubeJust (Pdr_Man_t *p, int k, Pdr_Set_t *pCube)
 

Typedef Documentation

typedef struct Pdr_Man_t_ Pdr_Man_t

Definition at line 65 of file pdrInt.h.

typedef struct Pdr_Obl_t_ Pdr_Obl_t

Definition at line 54 of file pdrInt.h.

typedef typedefABC_NAMESPACE_HEADER_START struct Pdr_Set_t_ Pdr_Set_t

INCLUDES ///.

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

FileName [pdrInt.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Property driven reachability.]

Synopsis [Internal declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - November 20, 2010.]

Revision [

Id:
pdrInt.h,v 1.00 2010/11/20 00:00:00 alanmi Exp

]PARAMETERS ///BASIC TYPES ///

Definition at line 44 of file pdrInt.h.

Function Documentation

int Pdr_ManCheckContainment ( Pdr_Man_t p,
int  k,
Pdr_Set_t pSet 
)

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

Synopsis [Returns 1 if the clause is contained in higher clauses.]

Description []

SideEffects []

SeeAlso []

Definition at line 241 of file pdrCore.c.

242 {
243  Pdr_Set_t * pThis;
244  Vec_Ptr_t * vArrayK;
245  int i, j, kMax = Vec_PtrSize(p->vSolvers)-1;
246  Vec_VecForEachLevelStartStop( p->vClauses, vArrayK, i, k, kMax+1 )
247  Vec_PtrForEachEntry( Pdr_Set_t *, vArrayK, pThis, j )
248  if ( Pdr_SetContains( pSet, pThis ) )
249  return 1;
250  return 0;
251 }
Vec_Ptr_t * vSolvers
Definition: pdrInt.h:83
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
int Pdr_SetContains(Pdr_Set_t *pOld, Pdr_Set_t *pNew)
Definition: pdrUtil.c:263
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
if(last==0)
Definition: sparse_int.h:34
typedefABC_NAMESPACE_HEADER_START struct Pdr_Set_t_ Pdr_Set_t
INCLUDES ///.
Definition: pdrInt.h:44
Vec_Vec_t * vClauses
Definition: pdrInt.h:84
#define Vec_VecForEachLevelStartStop(vGlob, vVec, i, LevelStart, LevelStop)
Definition: vecVec.h:61
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
int Pdr_ManCheckCube ( Pdr_Man_t p,
int  k,
Pdr_Set_t pCube,
Pdr_Set_t **  ppPred,
int  nConfLimit 
)

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

Synopsis [Checks if the cube holds (UNSAT) in the given timeframe.]

Description [Return 1/0 if cube or property are proved to hold/fail in k-th timeframe. Returns the predecessor bad state in ppPred.]

SideEffects []

SeeAlso []

Definition at line 286 of file pdrSat.c.

287 {
288  int fUseLit = 1;
289  int fLitUsed = 0;
290  sat_solver * pSat;
291  Vec_Int_t * vLits;
292  int Lit, RetValue;
293  abctime clk, Limit;
294  p->nCalls++;
295  pSat = Pdr_ManFetchSolver( p, k );
296  if ( pCube == NULL ) // solve the property
297  {
298  clk = Abc_Clock();
299  Lit = toLit( Pdr_ObjSatVar(p, k, 2, Aig_ManCo(p->pAig, p->iOutCur)) ); // pos literal (property fails)
301  RetValue = sat_solver_solve( pSat, &Lit, &Lit + 1, nConfLimit, 0, 0, 0 );
302  sat_solver_set_runtime_limit( pSat, Limit );
303  if ( RetValue == l_Undef )
304  return -1;
305  }
306  else // check relative containment in terms of next states
307  {
308  if ( fUseLit )
309  {
310  fLitUsed = 1;
311  Vec_IntAddToEntry( p->vActVars, k, 1 );
312  // add the cube in terms of current state variables
313  vLits = Pdr_ManCubeToLits( p, k, pCube, 1, 0 );
314  // add activation literal
315  Lit = toLit( Pdr_ManFreeVar(p, k) );
316  // add activation literal
317  Vec_IntPush( vLits, Lit );
318  RetValue = sat_solver_addclause( pSat, Vec_IntArray(vLits), Vec_IntArray(vLits) + Vec_IntSize(vLits) );
319  assert( RetValue == 1 );
320  sat_solver_compress( pSat );
321  // create assumptions
322  vLits = Pdr_ManCubeToLits( p, k, pCube, 0, 1 );
323  // add activation literal
324  Vec_IntPush( vLits, lit_neg(Lit) );
325  }
326  else
327  vLits = Pdr_ManCubeToLits( p, k, pCube, 0, 1 );
328 
329  // solve
330  clk = Abc_Clock();
332  RetValue = sat_solver_solve( pSat, Vec_IntArray(vLits), Vec_IntArray(vLits) + Vec_IntSize(vLits), nConfLimit, 0, 0, 0 );
333  sat_solver_set_runtime_limit( pSat, Limit );
334  if ( RetValue == l_Undef )
335  return -1;
336 /*
337  if ( RetValue == l_True )
338  {
339  int RetValue2 = Pdr_ManCubeJust( p, k, pCube );
340  if ( RetValue2 )
341  p->nCasesSS++;
342  else
343  p->nCasesSU++;
344  }
345  else
346  {
347  int RetValue2 = Pdr_ManCubeJust( p, k, pCube );
348  if ( RetValue2 )
349  p->nCasesUS++;
350  else
351  p->nCasesUU++;
352  }
353 */
354  }
355  clk = Abc_Clock() - clk;
356  p->tSat += clk;
357  assert( RetValue != l_Undef );
358  if ( RetValue == l_False )
359  {
360  p->tSatUnsat += clk;
361  p->nCallsU++;
362  if ( ppPred )
363  *ppPred = NULL;
364  RetValue = 1;
365  }
366  else // if ( RetValue == l_True )
367  {
368  p->tSatSat += clk;
369  p->nCallsS++;
370  if ( ppPred )
371  *ppPred = Pdr_ManTernarySim( p, k, pCube );
372  RetValue = 0;
373  }
374 
375 /* // for some reason, it does not work...
376  if ( fLitUsed )
377  {
378  int RetValue;
379  Lit = lit_neg(Lit);
380  RetValue = sat_solver_addclause( pSat, &Lit, &Lit + 1 );
381  assert( RetValue == 1 );
382  sat_solver_compress( pSat );
383  }
384 */
385  return RetValue;
386 }
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
Aig_Man_t * pAig
Definition: pdrInt.h:70
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
#define l_Undef
Definition: SolverTypes.h:86
int iOutCur
Definition: pdrInt.h:81
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
static void sat_solver_compress(sat_solver *s)
Definition: satSolver.h:217
abctime tSatSat
Definition: pdrInt.h:125
Vec_Int_t * vActVars
Definition: pdrInt.h:87
Vec_Int_t * Pdr_ManCubeToLits(Pdr_Man_t *p, int k, Pdr_Set_t *pCube, int fCompl, int fNext)
Definition: pdrSat.c:142
static abctime Abc_Clock()
Definition: abc_global.h:279
int Pdr_ObjSatVar(Pdr_Man_t *p, int k, int Pol, Aig_Obj_t *pObj)
Definition: pdrCnf.c:241
static abctime Pdr_ManTimeLimit(Pdr_Man_t *p)
Definition: pdrInt.h:141
static lit lit_neg(lit l)
Definition: satVec.h:144
sat_solver * Pdr_ManFetchSolver(Pdr_Man_t *p, int k)
Definition: pdrSat.c:76
abctime tSatUnsat
Definition: pdrInt.h:126
static lit toLit(int v)
Definition: satVec.h:142
int nCalls
Definition: pdrInt.h:108
static void Vec_IntAddToEntry(Vec_Int_t *p, int i, int Addition)
Definition: bblif.c:302
int nCallsU
Definition: pdrInt.h:110
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
Pdr_Set_t * Pdr_ManTernarySim(Pdr_Man_t *p, int k, Pdr_Set_t *pCube)
Definition: pdrTsim.c:351
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
abctime tSat
Definition: pdrInt.h:124
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define l_False
Definition: SolverTypes.h:85
int nCallsS
Definition: pdrInt.h:109
#define assert(ex)
Definition: util_old.h:213
int Pdr_ManFreeVar(Pdr_Man_t *p, int k)
Definition: pdrCnf.c:332
ABC_INT64_T abctime
Definition: abc_global.h:278
int Pdr_ManCheckCubeCs ( Pdr_Man_t p,
int  k,
Pdr_Set_t pCube 
)

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

Synopsis [Checks if the cube holds (UNSAT) in the given timeframe.]

Description [Return 1/0 if cube or property are proved to hold/fail in k-th timeframe. Returns the predecessor bad state in ppPred.]

SideEffects []

SeeAlso []

Definition at line 258 of file pdrSat.c.

259 {
260  sat_solver * pSat;
261  Vec_Int_t * vLits;
262  abctime Limit;
263  int RetValue;
264  pSat = Pdr_ManFetchSolver( p, k );
265  vLits = Pdr_ManCubeToLits( p, k, pCube, 0, 0 );
267  RetValue = sat_solver_solve( pSat, Vec_IntArray(vLits), Vec_IntArray(vLits) + Vec_IntSize(vLits), 0, 0, 0, 0 );
268  sat_solver_set_runtime_limit( pSat, Limit );
269  if ( RetValue == l_Undef )
270  return -1;
271  return (RetValue == l_False);
272 }
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
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
Vec_Int_t * Pdr_ManCubeToLits(Pdr_Man_t *p, int k, Pdr_Set_t *pCube, int fCompl, int fNext)
Definition: pdrSat.c:142
static abctime Pdr_ManTimeLimit(Pdr_Man_t *p)
Definition: pdrInt.h:141
sat_solver * Pdr_ManFetchSolver(Pdr_Man_t *p, int k)
Definition: pdrSat.c:76
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define l_False
Definition: SolverTypes.h:85
ABC_INT64_T abctime
Definition: abc_global.h:278
void Pdr_ManCollectValues ( Pdr_Man_t p,
int  k,
Vec_Int_t vObjIds,
Vec_Int_t vValues 
)

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

Synopsis [Collects values of the RO/RI variables in k-th SAT solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 232 of file pdrSat.c.

233 {
234  sat_solver * pSat;
235  Aig_Obj_t * pObj;
236  int iVar, i;
237  Vec_IntClear( vValues );
238  pSat = Pdr_ManSolver(p, k);
239  Aig_ManForEachObjVec( vObjIds, p->pAig, pObj, i )
240  {
241  iVar = Pdr_ObjSatVar( p, k, 3, pObj ); assert( iVar >= 0 );
242  Vec_IntPush( vValues, sat_solver_var_value(pSat, iVar) );
243  }
244 }
Aig_Man_t * pAig
Definition: pdrInt.h:70
#define Aig_ManForEachObjVec(vIds, p, pObj, i)
Definition: aig.h:408
int Pdr_ObjSatVar(Pdr_Man_t *p, int k, int Pol, Aig_Obj_t *pObj)
Definition: pdrCnf.c:241
static int sat_solver_var_value(sat_solver *s, int v)
Definition: satSolver.h:200
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static sat_solver * Pdr_ManSolver(Pdr_Man_t *p, int k)
MACRO DEFINITIONS ///.
Definition: pdrInt.h:139
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
sat_solver* Pdr_ManCreateSolver ( Pdr_Man_t p,
int  k 
)

DECLARATIONS ///.

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

FileName [pdrSat.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Property driven reachability.]

Synopsis [SAT solver procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - November 20, 2010.]

Revision [

Id:
pdrSat.c,v 1.00 2010/11/20 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Creates new SAT solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file pdrSat.c.

46 {
47  sat_solver * pSat;
48  Aig_Obj_t * pObj;
49  int i;
50  assert( Vec_PtrSize(p->vSolvers) == k );
51  assert( Vec_VecSize(p->vClauses) == k );
52  assert( Vec_IntSize(p->vActVars) == k );
53  // create new solver
54  pSat = sat_solver_new();
55  pSat = Pdr_ManNewSolver( pSat, p, k, (int)(k == 0) );
56  Vec_PtrPush( p->vSolvers, pSat );
57  Vec_VecExpand( p->vClauses, k );
58  Vec_IntPush( p->vActVars, 0 );
59  // add property cone
60  Saig_ManForEachPo( p->pAig, pObj, i )
61  Pdr_ObjSatVar( p, k, 1, pObj );
62  return pSat;
63 }
sat_solver * Pdr_ManNewSolver(sat_solver *pSat, Pdr_Man_t *p, int k, int fInit)
Definition: pdrCnf.c:435
Aig_Man_t * pAig
Definition: pdrInt.h:70
Vec_Ptr_t * vSolvers
Definition: pdrInt.h:83
Vec_Int_t * vActVars
Definition: pdrInt.h:87
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int Pdr_ObjSatVar(Pdr_Man_t *p, int k, int Pol, Aig_Obj_t *pObj)
Definition: pdrCnf.c:241
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
Vec_Vec_t * vClauses
Definition: pdrInt.h:84
sat_solver * sat_solver_new(void)
Definition: satSolver.c:1001
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static void Vec_VecExpand(Vec_Vec_t *p, int Level)
Definition: vecVec.h:190
static int Vec_VecSize(Vec_Vec_t *p)
Definition: vecVec.h:222
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
#define assert(ex)
Definition: util_old.h:213
int Pdr_ManCubeJust ( Pdr_Man_t p,
int  k,
Pdr_Set_t pCube 
)

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

Synopsis [Returns 1 if SAT assignment is found; 0 otherwise.]

Description []

SideEffects []

SeeAlso []

Definition at line 688 of file pdrUtil.c.

689 {
690  Aig_Obj_t * pNode;
691  int i, v, fCompl;
692 // return 0;
693  for ( i = 0; i < 4; i++ )
694  {
695  // derive new assignment
696  p->pCubeJust->nLits = 0;
697  p->pCubeJust->Sign = 0;
699  for ( v = 0; v < pCube->nLits; v++ )
700  {
701  if ( pCube->Lits[v] == -1 )
702  continue;
703  pNode = Saig_ManLi( p->pAig, lit_var(pCube->Lits[v]) );
704  fCompl = lit_sign(pCube->Lits[v]) ^ Aig_ObjFaninC0(pNode);
705  if ( !Pdr_NtkFindSatAssign_rec( p->pAig, Aig_ObjFanin0(pNode), !fCompl, p->pCubeJust, i ) )
706  break;
707  }
708  if ( v < pCube->nLits )
709  continue;
710  // figure this out!!!
711  if ( p->pCubeJust->nLits == 0 )
712  continue;
713  // successfully derived new assignment
714  Vec_IntSelectSort( p->pCubeJust->Lits, p->pCubeJust->nLits );
715  // check assignment against this cube
716  if ( Pdr_SetContainsSimple( p->pCubeJust, pCube ) )
717  continue;
718 //printf( "\n" );
719 //Pdr_SetPrint( stdout, pCube, Saig_ManRegNum(p->pAig), NULL ); printf( "\n" );
720 //Pdr_SetPrint( stdout, p->pCubeJust, Saig_ManRegNum(p->pAig), NULL ); printf( "\n" );
721  // check assignment against the clauses
722  if ( Pdr_ManCheckContainment( p, k, p->pCubeJust ) )
723  continue;
724  // find good assignment
725  return 1;
726  }
727  return 0;
728 }
Aig_Man_t * pAig
Definition: pdrInt.h:70
static int lit_var(lit l)
Definition: satVec.h:145
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
Pdr_Set_t * pCubeJust
Definition: pdrInt.h:102
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
static void Vec_IntSelectSort(int *pArray, int nSize)
Definition: vecInt.h:1740
int Pdr_NtkFindSatAssign_rec(Aig_Man_t *pAig, Aig_Obj_t *pNode, int Value, Pdr_Set_t *pCube, int Heur)
Definition: pdrUtil.c:626
static Aig_Obj_t * Saig_ManLi(Aig_Man_t *p, int i)
Definition: saig.h:80
Definition: aig.h:69
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
int Pdr_ManCheckContainment(Pdr_Man_t *p, int k, Pdr_Set_t *pSet)
Definition: pdrCore.c:241
static int lit_sign(lit l)
Definition: satVec.h:146
int Pdr_SetContainsSimple(Pdr_Set_t *pOld, Pdr_Set_t *pNew)
Definition: pdrUtil.c:301
Vec_Int_t* Pdr_ManCubeToLits ( Pdr_Man_t p,
int  k,
Pdr_Set_t pCube,
int  fCompl,
int  fNext 
)

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

Synopsis [Converts the cube in terms of RO numbers into array of CNF literals.]

Description []

SideEffects []

SeeAlso []

Definition at line 142 of file pdrSat.c.

143 {
144  Aig_Obj_t * pObj;
145  int i, iVar, iVarMax = 0;
146  abctime clk = Abc_Clock();
147  Vec_IntClear( p->vLits );
148  assert( !(fNext && fCompl) );
149  for ( i = 0; i < pCube->nLits; i++ )
150  {
151  if ( pCube->Lits[i] == -1 )
152  continue;
153  if ( fNext )
154  pObj = Saig_ManLi( p->pAig, lit_var(pCube->Lits[i]) );
155  else
156  pObj = Saig_ManLo( p->pAig, lit_var(pCube->Lits[i]) );
157  iVar = Pdr_ObjSatVar( p, k, fNext ? 2 - lit_sign(pCube->Lits[i]) : 3, pObj ); assert( iVar >= 0 );
158  iVarMax = Abc_MaxInt( iVarMax, iVar );
159  Vec_IntPush( p->vLits, toLitCond( iVar, fCompl ^ lit_sign(pCube->Lits[i]) ) );
160  }
161 // sat_solver_setnvars( Pdr_ManSolver(p, k), iVarMax + 1 );
162  p->tCnf += Abc_Clock() - clk;
163  return p->vLits;
164 }
Aig_Man_t * pAig
Definition: pdrInt.h:70
static int lit_var(lit l)
Definition: satVec.h:145
static Aig_Obj_t * Saig_ManLo(Aig_Man_t *p, int i)
Definition: saig.h:79
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
int Pdr_ObjSatVar(Pdr_Man_t *p, int k, int Pol, Aig_Obj_t *pObj)
Definition: pdrCnf.c:241
static lit toLitCond(int v, int c)
Definition: satVec.h:143
static Aig_Obj_t * Saig_ManLi(Aig_Man_t *p, int i)
Definition: saig.h:80
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
abctime tCnf
Definition: pdrInt.h:131
Vec_Int_t * vLits
Definition: pdrInt.h:91
static int lit_sign(lit l)
Definition: satVec.h:146
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
ABC_INT64_T abctime
Definition: abc_global.h:278
Abc_Cex_t * Pdr_ManDeriveCex ( Pdr_Man_t p)

FUNCTION DECLARATIONS ///.

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

Synopsis [Derives counter-example.]

Description []

SideEffects []

SeeAlso []

Definition at line 189 of file pdrMan.c.

190 {
191  Abc_Cex_t * pCex;
192  Pdr_Obl_t * pObl;
193  int i, f, Lit, nFrames = 0;
194  // count the number of frames
195  for ( pObl = p->pQueue; pObl; pObl = pObl->pNext )
196  nFrames++;
197  // create the counter-example
198  pCex = Abc_CexAlloc( Aig_ManRegNum(p->pAig), Saig_ManPiNum(p->pAig), nFrames );
199 // pCex->iPo = (p->pPars->iOutput==-1)? 0 : p->pPars->iOutput;
200  pCex->iPo = p->iOutCur;
201  pCex->iFrame = nFrames-1;
202  for ( pObl = p->pQueue, f = 0; pObl; pObl = pObl->pNext, f++ )
203  for ( i = pObl->pState->nLits; i < pObl->pState->nTotal; i++ )
204  {
205  Lit = pObl->pState->Lits[i];
206  if ( lit_sign(Lit) )
207  continue;
208  assert( lit_var(Lit) < pCex->nPis );
209  Abc_InfoSetBit( pCex->pData, pCex->nRegs + f * pCex->nPis + lit_var(Lit) );
210  }
211  assert( f == nFrames );
212  if ( !Saig_ManVerifyCex(p->pAig, pCex) )
213  printf( "CEX for output %d is not valid.\n", p->iOutCur );
214  return pCex;
215 }
Pdr_Obl_t * pQueue
Definition: pdrInt.h:85
Aig_Man_t * pAig
Definition: pdrInt.h:70
Pdr_Set_t * pState
Definition: pdrInt.h:60
ABC_NAMESPACE_IMPL_START Abc_Cex_t * Abc_CexAlloc(int nRegs, int nRealPis, int nFrames)
DECLARATIONS ///.
Definition: utilCex.c:51
int Saig_ManVerifyCex(Aig_Man_t *pAig, Abc_Cex_t *p)
Definition: saigDup.c:279
int iOutCur
Definition: pdrInt.h:81
static int lit_var(lit l)
Definition: satVec.h:145
Pdr_Obl_t * pNext
Definition: pdrInt.h:61
static void Abc_InfoSetBit(unsigned *p, int i)
Definition: abc_global.h:259
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int lit_sign(lit l)
Definition: satVec.h:146
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition: utilCex.h:39
void Pdr_ManDumpClauses ( Pdr_Man_t p,
char *  pFileName,
int  fProved 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 313 of file pdrInv.c.

314 {
315  int fUseSupp = 1;
316  FILE * pFile;
317  Vec_Int_t * vFlopCounts;
318  Vec_Ptr_t * vCubes;
319  Pdr_Set_t * pCube;
320  char ** pNamesCi;
321  int i, kStart;
322  // create file
323  pFile = fopen( pFileName, "w" );
324  if ( pFile == NULL )
325  {
326  Abc_Print( 1, "Cannot open file \"%s\" for writing invariant.\n", pFileName );
327  return;
328  }
329  // collect cubes
330  kStart = Pdr_ManFindInvariantStart( p );
331  vCubes = Pdr_ManCollectCubes( p, kStart );
332  Vec_PtrSort( vCubes, (int (*)(void))Pdr_SetCompare );
333 // Pdr_ManDumpAig( p->pAig, vCubes );
334  // collect variable appearances
335  vFlopCounts = fUseSupp ? Pdr_ManCountFlops( p, vCubes ) : NULL;
336  // output the header
337  if ( fProved )
338  fprintf( pFile, "# Inductive invariant for \"%s\"\n", p->pAig->pName );
339  else
340  fprintf( pFile, "# Clauses of the last timeframe for \"%s\"\n", p->pAig->pName );
341  fprintf( pFile, "# generated by PDR in ABC on %s\n", Aig_TimeStamp() );
342  fprintf( pFile, ".i %d\n", fUseSupp ? Pdr_ManCountVariables(p, kStart) : Aig_ManRegNum(p->pAig) );
343  fprintf( pFile, ".o 1\n" );
344  fprintf( pFile, ".p %d\n", Vec_PtrSize(vCubes) );
345  // output flop names
347  if ( pNamesCi )
348  {
349  fprintf( pFile, ".ilb" );
350  for ( i = 0; i < Aig_ManRegNum(p->pAig); i++ )
351  if ( !fUseSupp || Vec_IntEntry( vFlopCounts, i ) )
352  fprintf( pFile, " %s", pNamesCi[Saig_ManPiNum(p->pAig) + i] );
353  fprintf( pFile, "\n" );
354  ABC_FREE( pNamesCi );
355  fprintf( pFile, ".ob inv\n" );
356  }
357  // output cubes
358  Vec_PtrForEachEntry( Pdr_Set_t *, vCubes, pCube, i )
359  {
360  Pdr_SetPrint( pFile, pCube, Aig_ManRegNum(p->pAig), vFlopCounts );
361  fprintf( pFile, " 1\n" );
362  }
363  fprintf( pFile, ".e\n\n" );
364  fclose( pFile );
365  Vec_IntFreeP( &vFlopCounts );
366  Vec_PtrFree( vCubes );
367  if ( fProved )
368  Abc_Print( 1, "Inductive invariant was written into file \"%s\".\n", pFileName );
369  else
370  Abc_Print( 1, "Clauses of the last timeframe were written into file \"%s\".\n", pFileName );
371 }
Aig_Man_t * pAig
Definition: pdrInt.h:70
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
char * Aig_TimeStamp()
Definition: aigUtil.c:62
int Pdr_ManCountVariables(Pdr_Man_t *p, int kStart)
Definition: pdrInv.c:180
ABC_DLL char ** Abc_NtkCollectCioNames(Abc_Ntk_t *pNtk, int fCollectCos)
Definition: abcNames.c:278
static void Vec_PtrSort(Vec_Ptr_t *p, int(*Vec_PtrSortCompare)()) ___unused
Definition: vecPtr.h:851
void Pdr_SetPrint(FILE *pFile, Pdr_Set_t *p, int nRegs, Vec_Int_t *vFlopCounts)
Definition: pdrUtil.c:225
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Vec_Ptr_t * Pdr_ManCollectCubes(Pdr_Man_t *p, int kStart)
Definition: pdrInv.c:156
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
typedefABC_NAMESPACE_HEADER_START struct Pdr_Set_t_ Pdr_Set_t
INCLUDES ///.
Definition: pdrInt.h:44
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
int Pdr_SetCompare(Pdr_Set_t **pp1, Pdr_Set_t **pp2)
Definition: pdrUtil.c:366
ABC_DLL Abc_Ntk_t * Abc_FrameReadNtk(Abc_Frame_t *p)
Definition: mainFrame.c:282
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
#define ABC_FREE(obj)
Definition: abc_global.h:232
ABC_DLL Abc_Frame_t * Abc_FrameReadGlobalFrame()
Definition: mainFrame.c:616
int Pdr_ManFindInvariantStart(Pdr_Man_t *p)
Definition: pdrInv.c:132
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Vec_Int_t * Pdr_ManCountFlops(Pdr_Man_t *p, Vec_Ptr_t *vCubes)
Definition: pdrInv.c:106
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
sat_solver* Pdr_ManFetchSolver ( Pdr_Man_t p,
int  k 
)

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

Synopsis [Returns old or restarted solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 76 of file pdrSat.c.

77 {
78  sat_solver * pSat;
79  Vec_Ptr_t * vArrayK;
80  Pdr_Set_t * pCube;
81  int i, j;
82  pSat = Pdr_ManSolver(p, k);
83  if ( Vec_IntEntry(p->vActVars, k) < p->pPars->nRecycle )
84  return pSat;
85  assert( k < Vec_PtrSize(p->vSolvers) - 1 );
86  p->nStarts++;
87 // sat_solver_delete( pSat );
88 // pSat = sat_solver_new();
89  sat_solver_restart( pSat );
90  // create new SAT solver
91  pSat = Pdr_ManNewSolver( pSat, p, k, (int)(k == 0) );
92  // write new SAT solver
93  Vec_PtrWriteEntry( p->vSolvers, k, pSat );
94  Vec_IntWriteEntry( p->vActVars, k, 0 );
95  // set the property output
97  // add the clauses
98  Vec_VecForEachLevelStart( p->vClauses, vArrayK, i, k )
99  Vec_PtrForEachEntry( Pdr_Set_t *, vArrayK, pCube, j )
100  Pdr_ManSolverAddClause( p, k, pCube );
101  return pSat;
102 }
sat_solver * Pdr_ManNewSolver(sat_solver *pSat, Pdr_Man_t *p, int k, int fInit)
Definition: pdrCnf.c:435
Vec_Ptr_t * vSolvers
Definition: pdrInt.h:83
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
#define Vec_VecForEachLevelStart(vGlob, vVec, i, LevelStart)
Definition: vecVec.h:57
Vec_Int_t * vActVars
Definition: pdrInt.h:87
void Pdr_ManSolverAddClause(Pdr_Man_t *p, int k, Pdr_Set_t *pCube)
Definition: pdrSat.c:209
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Pdr_Par_t * pPars
Definition: pdrInt.h:69
typedefABC_NAMESPACE_HEADER_START struct Pdr_Set_t_ Pdr_Set_t
INCLUDES ///.
Definition: pdrInt.h:44
int nStarts
Definition: pdrInt.h:111
void Pdr_ManSetPropertyOutput(Pdr_Man_t *p, int k)
Definition: pdrSat.c:177
Vec_Vec_t * vClauses
Definition: pdrInt.h:84
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static sat_solver * Pdr_ManSolver(Pdr_Man_t *p, int k)
MACRO DEFINITIONS ///.
Definition: pdrInt.h:139
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void sat_solver_restart(sat_solver *s)
Definition: satSolver.c:1186
int Pdr_ManFreeVar ( Pdr_Man_t p,
int  k 
)

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

Synopsis [Returns the index of unused SAT variable.]

Description []

SideEffects []

SeeAlso []

Definition at line 332 of file pdrCnf.c.

333 {
334  if ( p->pPars->fMonoCnf )
335  return sat_solver_nvars( Pdr_ManSolver(p, k) );
336  else
337  {
338  Vec_Int_t * vVar2Ids = (Vec_Int_t *)Vec_PtrEntry( &p->vVar2Ids, k );
339  Vec_IntPush( vVar2Ids, -1 );
340  return Vec_IntSize( vVar2Ids ) - 1;
341  }
342 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Vec_Ptr_t vVar2Ids
Definition: pdrInt.h:78
Pdr_Par_t * pPars
Definition: pdrInt.h:69
int sat_solver_nvars(sat_solver *s)
Definition: satSolver.c:1896
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static sat_solver * Pdr_ManSolver(Pdr_Man_t *p, int k)
MACRO DEFINITIONS ///.
Definition: pdrInt.h:139
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Vec_Int_t* Pdr_ManLitsToCube ( Pdr_Man_t p,
int  k,
int *  pArray,
int  nArray 
)

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

Synopsis [Converts SAT variables into register IDs.]

Description []

SideEffects []

SeeAlso []

Definition at line 115 of file pdrSat.c.

116 {
117  int i, RegId;
118  Vec_IntClear( p->vLits );
119  for ( i = 0; i < nArray; i++ )
120  {
121  RegId = Pdr_ObjRegNum( p, k, lit_var(pArray[i]) );
122  if ( RegId == -1 )
123  continue;
124  assert( RegId >= 0 && RegId < Aig_ManRegNum(p->pAig) );
125  Vec_IntPush( p->vLits, toLitCond(RegId, !lit_sign(pArray[i])) );
126  }
127  assert( Vec_IntSize(p->vLits) >= 0 && Vec_IntSize(p->vLits) <= nArray );
128  return p->vLits;
129 }
Aig_Man_t * pAig
Definition: pdrInt.h:70
static int lit_var(lit l)
Definition: satVec.h:145
static lit toLitCond(int v, int c)
Definition: satVec.h:143
int Pdr_ObjRegNum(Pdr_Man_t *p, int k, int iSatVar)
Definition: pdrCnf.c:312
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
Vec_Int_t * vLits
Definition: pdrInt.h:91
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int lit_sign(lit l)
Definition: satVec.h:146
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
sat_solver* Pdr_ManNewSolver ( sat_solver pSat,
Pdr_Man_t p,
int  k,
int  fInit 
)

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

Synopsis [Creates SAT solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 435 of file pdrCnf.c.

436 {
437  assert( pSat != NULL );
438  if ( p->pPars->fMonoCnf )
439  return Pdr_ManNewSolver1( pSat, p, k, fInit );
440  else
441  return Pdr_ManNewSolver2( pSat, p, k, fInit );
442 }
static sat_solver * Pdr_ManNewSolver2(sat_solver *pSat, Pdr_Man_t *p, int k, int fInit)
Definition: pdrCnf.c:387
static sat_solver * Pdr_ManNewSolver1(sat_solver *pSat, Pdr_Man_t *p, int k, int fInit)
Definition: pdrCnf.c:355
Pdr_Par_t * pPars
Definition: pdrInt.h:69
#define assert(ex)
Definition: util_old.h:213
void Pdr_ManPrintClauses ( Pdr_Man_t p,
int  kStart 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 205 of file pdrInv.c.

206 {
207  Vec_Ptr_t * vArrayK;
208  Pdr_Set_t * pCube;
209  int i, k, Counter = 0;
210  Vec_VecForEachLevelStart( p->vClauses, vArrayK, k, kStart )
211  {
212  Vec_PtrSort( vArrayK, (int (*)(void))Pdr_SetCompare );
213  Vec_PtrForEachEntry( Pdr_Set_t *, vArrayK, pCube, i )
214  {
215  Abc_Print( 1, "C=%4d. F=%4d ", Counter++, k );
216  Pdr_SetPrint( stdout, pCube, Aig_ManRegNum(p->pAig), NULL );
217  Abc_Print( 1, "\n" );
218  }
219  }
220 }
Aig_Man_t * pAig
Definition: pdrInt.h:70
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
#define Vec_VecForEachLevelStart(vGlob, vVec, i, LevelStart)
Definition: vecVec.h:57
static void Vec_PtrSort(Vec_Ptr_t *p, int(*Vec_PtrSortCompare)()) ___unused
Definition: vecPtr.h:851
void Pdr_SetPrint(FILE *pFile, Pdr_Set_t *p, int nRegs, Vec_Int_t *vFlopCounts)
Definition: pdrUtil.c:225
typedefABC_NAMESPACE_HEADER_START struct Pdr_Set_t_ Pdr_Set_t
INCLUDES ///.
Definition: pdrInt.h:44
static int Counter
Vec_Vec_t * vClauses
Definition: pdrInt.h:84
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
int Pdr_SetCompare(Pdr_Set_t **pp1, Pdr_Set_t **pp2)
Definition: pdrUtil.c:366
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Pdr_ManPrintProgress ( Pdr_Man_t p,
int  fClose,
abctime  Time 
)

DECLARATIONS ///.

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

FileName [pdrInv.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Property driven reachability.]

Synopsis [Invariant computation, printing, verification.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - November 20, 2010.]

Revision [

Id:
pdrInv.c,v 1.00 2010/11/20 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 48 of file pdrInv.c.

49 {
50  Vec_Ptr_t * vVec;
51  int i, ThisSize, Length, LengthStart;
52  if ( Vec_PtrSize(p->vSolvers) < 2 )
53  return;
54  if ( Abc_FrameIsBatchMode() && !fClose )
55  return;
56  // count the total length of the printout
57  Length = 0;
58  Vec_VecForEachLevel( p->vClauses, vVec, i )
59  Length += 1 + Abc_Base10Log(Vec_PtrSize(vVec)+1);
60  // determine the starting point
61  LengthStart = Abc_MaxInt( 0, Length - 60 );
62  Abc_Print( 1, "%3d :", Vec_PtrSize(p->vSolvers)-1 );
63  ThisSize = 5;
64  if ( LengthStart > 0 )
65  {
66  Abc_Print( 1, " ..." );
67  ThisSize += 4;
68  }
69  Length = 0;
70  Vec_VecForEachLevel( p->vClauses, vVec, i )
71  {
72  if ( Length < LengthStart )
73  {
74  Length += 1 + Abc_Base10Log(Vec_PtrSize(vVec)+1);
75  continue;
76  }
77  Abc_Print( 1, " %d", Vec_PtrSize(vVec) );
78  Length += 1 + Abc_Base10Log(Vec_PtrSize(vVec)+1);
79  ThisSize += 1 + Abc_Base10Log(Vec_PtrSize(vVec)+1);
80  }
81  for ( i = ThisSize; i < 70; i++ )
82  Abc_Print( 1, " " );
83  Abc_Print( 1, "%6d", p->nQueMax );
84  Abc_Print( 1, "%10.2f sec", 1.0*Time/CLOCKS_PER_SEC );
85  if ( p->pPars->fSolveAll )
86  Abc_Print( 1, " CEX =%4d", p->pPars->nFailOuts );
87  if ( p->pPars->nTimeOutOne )
88  Abc_Print( 1, " T/O =%3d", p->pPars->nDropOuts );
89  Abc_Print( 1, "%s", fClose ? "\n":"\r" );
90  if ( fClose )
91  p->nQueMax = 0;
92  fflush( stdout );
93 }
#define Vec_VecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
Definition: vecVec.h:55
Vec_Ptr_t * vSolvers
Definition: pdrInt.h:83
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_DLL int Abc_FrameIsBatchMode()
Definition: mainFrame.c:92
int nQueMax
Definition: pdrInt.h:118
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
static int Abc_Base10Log(unsigned n)
Definition: abc_global.h:252
Pdr_Par_t * pPars
Definition: pdrInt.h:69
if(last==0)
Definition: sparse_int.h:34
Vec_Vec_t * vClauses
Definition: pdrInt.h:84
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
void Pdr_ManReportInvariant ( Pdr_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 385 of file pdrInv.c.

386 {
387  Vec_Ptr_t * vCubes;
388  int kStart = Pdr_ManFindInvariantStart( p );
389  vCubes = Pdr_ManCollectCubes( p, kStart );
390  Abc_Print( 1, "Invariant F[%d] : %d clauses with %d flops (out of %d)\n",
391  kStart, Vec_PtrSize(vCubes), Pdr_ManCountVariables(p, kStart), Aig_ManRegNum(p->pAig) );
392  Vec_PtrFree( vCubes );
393 }
Aig_Man_t * pAig
Definition: pdrInt.h:70
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
int Pdr_ManCountVariables(Pdr_Man_t *p, int kStart)
Definition: pdrInv.c:180
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Vec_Ptr_t * Pdr_ManCollectCubes(Pdr_Man_t *p, int kStart)
Definition: pdrInv.c:156
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
int Pdr_ManFindInvariantStart(Pdr_Man_t *p)
Definition: pdrInv.c:132
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Pdr_ManSetPropertyOutput ( Pdr_Man_t p,
int  k 
)

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

Synopsis [Sets the property output to 0 (sat) forever.]

Description []

SideEffects []

SeeAlso []

Definition at line 177 of file pdrSat.c.

178 {
179  sat_solver * pSat;
180  Aig_Obj_t * pObj;
181  int Lit, RetValue, i;
182  pSat = Pdr_ManSolver(p, k);
183  Saig_ManForEachPo( p->pAig, pObj, i )
184  {
185  // skip solved outputs
186  if ( p->vCexes && Vec_PtrEntry(p->vCexes, i) )
187  continue;
188  // skip timedout outputs
189  if ( p->pPars->vOutMap && Vec_IntEntry(p->pPars->vOutMap, i) == -1 )
190  continue;
191  Lit = toLitCond( Pdr_ObjSatVar(p, k, 1, pObj), 1 ); // neg literal
192  RetValue = sat_solver_addclause( pSat, &Lit, &Lit + 1 );
193  assert( RetValue == 1 );
194  }
195  sat_solver_compress( pSat );
196 }
Aig_Man_t * pAig
Definition: pdrInt.h:70
int sat_solver_addclause(sat_solver *s, lit *begin, lit *end)
Definition: satSolver.c:1492
static void sat_solver_compress(sat_solver *s)
Definition: satSolver.h:217
int Pdr_ObjSatVar(Pdr_Man_t *p, int k, int Pol, Aig_Obj_t *pObj)
Definition: pdrCnf.c:241
static lit toLitCond(int v, int c)
Definition: satVec.h:143
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Pdr_Par_t * pPars
Definition: pdrInt.h:69
Definition: aig.h:69
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static sat_solver * Pdr_ManSolver(Pdr_Man_t *p, int k)
MACRO DEFINITIONS ///.
Definition: pdrInt.h:139
Vec_Ptr_t * vCexes
Definition: pdrInt.h:82
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
#define assert(ex)
Definition: util_old.h:213
static sat_solver* Pdr_ManSolver ( Pdr_Man_t p,
int  k 
)
inlinestatic

MACRO DEFINITIONS ///.

Definition at line 139 of file pdrInt.h.

139 { return (sat_solver *)Vec_PtrEntry(p->vSolvers, k); }
Vec_Ptr_t * vSolvers
Definition: pdrInt.h:83
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
void Pdr_ManSolverAddClause ( Pdr_Man_t p,
int  k,
Pdr_Set_t pCube 
)

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

Synopsis [Adds one clause in terms of ROs to the k-th SAT solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 209 of file pdrSat.c.

210 {
211  sat_solver * pSat;
212  Vec_Int_t * vLits;
213  int RetValue;
214  pSat = Pdr_ManSolver(p, k);
215  vLits = Pdr_ManCubeToLits( p, k, pCube, 1, 0 );
216  RetValue = sat_solver_addclause( pSat, Vec_IntArray(vLits), Vec_IntArray(vLits) + Vec_IntSize(vLits) );
217  assert( RetValue == 1 );
218  sat_solver_compress( pSat );
219 }
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
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
static void sat_solver_compress(sat_solver *s)
Definition: satSolver.h:217
Vec_Int_t * Pdr_ManCubeToLits(Pdr_Man_t *p, int k, Pdr_Set_t *pCube, int fCompl, int fNext)
Definition: pdrSat.c:142
static sat_solver * Pdr_ManSolver(Pdr_Man_t *p, int k)
MACRO DEFINITIONS ///.
Definition: pdrInt.h:139
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define assert(ex)
Definition: util_old.h:213
Pdr_Man_t* Pdr_ManStart ( Aig_Man_t pAig,
Pdr_Par_t pPars,
Vec_Int_t vPrioInit 
)

DECLARATIONS ///.

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

FileName [pdrMan.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Property driven reachability.]

Synopsis [Manager procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - November 20, 2010.]

Revision [

Id:
pdrMan.c,v 1.00 2010/11/20 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Creates manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file pdrMan.c.

46 {
47  Pdr_Man_t * p;
48  p = ABC_CALLOC( Pdr_Man_t, 1 );
49  p->pPars = pPars;
50  p->pAig = pAig;
51  p->vSolvers = Vec_PtrAlloc( 0 );
52  p->vClauses = Vec_VecAlloc( 0 );
53  p->pQueue = NULL;
54  p->pOrder = ABC_ALLOC( int, Aig_ManRegNum(pAig) );
55  p->vActVars = Vec_IntAlloc( 256 );
56  if ( !p->pPars->fMonoCnf )
57  p->vVLits = Vec_WecStart( 1+Abc_MaxInt(1, Aig_ManLevels(pAig)) );
58  // internal use
59  p->vPrio = vPrioInit ? vPrioInit : Vec_IntStart( Aig_ManRegNum(pAig) ); // priority flops
60  p->vLits = Vec_IntAlloc( 100 ); // array of literals
61  p->vCiObjs = Vec_IntAlloc( 100 ); // cone leaves
62  p->vCoObjs = Vec_IntAlloc( 100 ); // cone roots
63  p->vCiVals = Vec_IntAlloc( 100 ); // cone leaf values
64  p->vCoVals = Vec_IntAlloc( 100 ); // cone root values
65  p->vNodes = Vec_IntAlloc( 100 ); // cone nodes
66  p->vUndo = Vec_IntAlloc( 100 ); // cone undos
67  p->vVisits = Vec_IntAlloc( 100 ); // intermediate
68  p->vCi2Rem = Vec_IntAlloc( 100 ); // CIs to be removed
69  p->vRes = Vec_IntAlloc( 100 ); // final result
70  p->vSuppLits= Vec_IntAlloc( 100 ); // support literals
72  p->pCnfMan = Cnf_ManStart();
73  // additional AIG data-members
74  if ( pAig->pFanData == NULL )
75  Aig_ManFanoutStart( pAig );
76  if ( pAig->pTerSimData == NULL )
77  pAig->pTerSimData = ABC_CALLOC( unsigned, 1 + (Aig_ManObjNumMax(pAig) / 16) );
78  // time spent on each outputs
79  if ( pPars->nTimeOutOne )
80  {
81  int i;
83  for ( i = 0; i < Saig_ManPoNum(pAig); i++ )
84  p->pTime4Outs[i] = pPars->nTimeOutOne * CLOCKS_PER_SEC / 1000 + 1;
85  }
86  if ( pPars->fSolveAll )
87  {
89  p->pPars->vOutMap = Vec_IntAlloc( Saig_ManPoNum(pAig) );
90  Vec_IntFill( p->pPars->vOutMap, Saig_ManPoNum(pAig), -2 );
91  }
92  return p;
93 }
Pdr_Obl_t * pQueue
Definition: pdrInt.h:85
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
Aig_Man_t * pAig
Definition: pdrInt.h:70
Vec_Ptr_t * vSolvers
Definition: pdrInt.h:83
static Vec_Vec_t * Vec_VecAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecVec.h:145
Vec_Int_t * vPrio
Definition: pdrInt.h:90
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Vec_Wec_t * Vec_WecStart(int nSize)
Definition: vecWec.h:98
Vec_Int_t * vRes
Definition: pdrInt.h:100
Vec_Int_t * vActVars
Definition: pdrInt.h:87
Pdr_Set_t * pCubeJust
Definition: pdrInt.h:102
Vec_Int_t * vCiVals
Definition: pdrInt.h:94
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int * pOrder
Definition: pdrInt.h:86
abctime * pTime4Outs
Definition: pdrInt.h:103
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
void Aig_ManFanoutStart(Aig_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition: aigFanout.c:56
Cnf_Man_t * pCnfMan
Definition: pdrInt.h:72
Vec_Wec_t * vVLits
Definition: pdrInt.h:79
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
Vec_Int_t * vCi2Rem
Definition: pdrInt.h:99
Vec_Int_t * vCoVals
Definition: pdrInt.h:95
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
Pdr_Par_t * pPars
Definition: pdrInt.h:69
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
Vec_Int_t * vNodes
Definition: pdrInt.h:96
Vec_Vec_t * vClauses
Definition: pdrInt.h:84
Vec_Int_t * vVisits
Definition: pdrInt.h:98
static int Saig_ManRegNum(Aig_Man_t *p)
Definition: saig.h:77
Vec_Int_t * vLits
Definition: pdrInt.h:91
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
Cnf_Man_t * Cnf_ManStart()
FUNCTION DEFINITIONS ///.
Definition: cnfMan.c:51
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
Vec_Ptr_t * vCexes
Definition: pdrInt.h:82
Vec_Int_t * vSuppLits
Definition: pdrInt.h:101
Pdr_Set_t * Pdr_SetAlloc(int nSize)
DECLARATIONS ///.
Definition: pdrUtil.c:46
Vec_Int_t * vCiObjs
Definition: pdrInt.h:92
ABC_INT64_T abctime
Definition: abc_global.h:278
int Aig_ManLevels(Aig_Man_t *p)
Definition: aigUtil.c:102
Vec_Int_t * vUndo
Definition: pdrInt.h:97
Vec_Int_t * vCoObjs
Definition: pdrInt.h:93
void Pdr_ManStop ( Pdr_Man_t p)

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

Synopsis [Frees manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 106 of file pdrMan.c.

107 {
108  Pdr_Set_t * pCla;
109  sat_solver * pSat;
110  int i, k;
111  Aig_ManCleanMarkAB( p->pAig );
112  if ( p->pPars->fVerbose )
113  {
114  Abc_Print( 1, "Block =%5d Oblig =%6d Clause =%6d Call =%6d (sat=%.1f%%) Start =%4d\n",
115  p->nBlocks, p->nObligs, p->nCubes, p->nCalls, 100.0 * p->nCallsS / p->nCalls, p->nStarts );
116  ABC_PRTP( "SAT solving", p->tSat, p->tTotal );
117  ABC_PRTP( " unsat ", p->tSatUnsat, p->tTotal );
118  ABC_PRTP( " sat ", p->tSatSat, p->tTotal );
119  ABC_PRTP( "Generalize ", p->tGeneral, p->tTotal );
120  ABC_PRTP( "Push clause", p->tPush, p->tTotal );
121  ABC_PRTP( "Ternary sim", p->tTsim, p->tTotal );
122  ABC_PRTP( "Containment", p->tContain, p->tTotal );
123  ABC_PRTP( "CNF compute", p->tCnf, p->tTotal );
124  ABC_PRTP( "TOTAL ", p->tTotal, p->tTotal );
125  fflush( stdout );
126  }
127 // Abc_Print( 1, "SS =%6d. SU =%6d. US =%6d. UU =%6d.\n", p->nCasesSS, p->nCasesSU, p->nCasesUS, p->nCasesUU );
128  Vec_PtrForEachEntry( sat_solver *, p->vSolvers, pSat, i )
129  sat_solver_delete( pSat );
130  Vec_PtrFree( p->vSolvers );
131  Vec_VecForEachEntry( Pdr_Set_t *, p->vClauses, pCla, i, k )
132  Pdr_SetDeref( pCla );
133  Vec_VecFree( p->vClauses );
134  Pdr_QueueStop( p );
135  ABC_FREE( p->pOrder );
136  Vec_IntFree( p->vActVars );
137  // static CNF
138  Cnf_DataFree( p->pCnf1 );
139  Vec_IntFreeP( &p->vVar2Reg );
140  // dynamic CNF
141  Cnf_DataFree( p->pCnf2 );
142  if ( p->pvId2Vars )
143  for ( i = 0; i < Aig_ManObjNumMax(p->pAig); i++ )
144  ABC_FREE( p->pvId2Vars[i].pArray );
145  ABC_FREE( p->pvId2Vars );
146 // Vec_VecFreeP( (Vec_Vec_t **)&p->vVar2Ids );
147  for ( i = 0; i < Vec_PtrSize(&p->vVar2Ids); i++ )
148  Vec_IntFree( (Vec_Int_t *)Vec_PtrEntry(&p->vVar2Ids, i) );
149  ABC_FREE( p->vVar2Ids.pArray );
150  Vec_WecFreeP( &p->vVLits );
151  // CNF manager
152  Cnf_ManStop( p->pCnfMan );
153  // internal use
154  Vec_IntFreeP( &p->vPrio ); // priority flops
155  Vec_IntFree( p->vLits ); // array of literals
156  Vec_IntFree( p->vCiObjs ); // cone leaves
157  Vec_IntFree( p->vCoObjs ); // cone roots
158  Vec_IntFree( p->vCiVals ); // cone leaf values
159  Vec_IntFree( p->vCoVals ); // cone root values
160  Vec_IntFree( p->vNodes ); // cone nodes
161  Vec_IntFree( p->vUndo ); // cone undos
162  Vec_IntFree( p->vVisits ); // intermediate
163  Vec_IntFree( p->vCi2Rem ); // CIs to be removed
164  Vec_IntFree( p->vRes ); // final result
165  Vec_IntFree( p->vSuppLits ); // support literals
166  ABC_FREE( p->pCubeJust );
167  ABC_FREE( p->pTime4Outs );
168  if ( p->vCexes )
169  Vec_PtrFreeFree( p->vCexes );
170  // additional AIG data-members
171  if ( p->pAig->pFanData != NULL )
172  Aig_ManFanoutStop( p->pAig );
173  if ( p->pAig->pTerSimData != NULL )
174  ABC_FREE( p->pAig->pTerSimData );
175  ABC_FREE( p );
176 }
Aig_Man_t * pAig
Definition: pdrInt.h:70
Vec_Ptr_t * vSolvers
Definition: pdrInt.h:83
abctime tGeneral
Definition: pdrInt.h:127
int nObligs
Definition: pdrInt.h:106
abctime tContain
Definition: pdrInt.h:130
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
#define Vec_VecForEachEntry(Type, vGlob, pEntry, i, k)
Definition: vecVec.h:87
void Cnf_ManStop(Cnf_Man_t *p)
Definition: cnfMan.c:82
void sat_solver_delete(sat_solver *s)
Definition: satSolver.c:1141
static void Vec_PtrFreeFree(Vec_Ptr_t *p)
Definition: vecPtr.h:569
abctime tSatSat
Definition: pdrInt.h:125
void Pdr_SetDeref(Pdr_Set_t *p)
Definition: pdrUtil.c:208
int nCubes
Definition: pdrInt.h:107
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
for(p=first;p->value< newval;p=p->next)
void Aig_ManFanoutStop(Aig_Man_t *p)
Definition: aigFanout.c:89
#define ABC_PRTP(a, t, T)
Definition: abc_global.h:223
abctime tSatUnsat
Definition: pdrInt.h:126
int nCalls
Definition: pdrInt.h:108
void Pdr_QueueStop(Pdr_Man_t *p)
Definition: pdrUtil.c:580
Pdr_Par_t * pPars
Definition: pdrInt.h:69
if(last==0)
Definition: sparse_int.h:34
int nBlocks
Definition: pdrInt.h:105
typedefABC_NAMESPACE_HEADER_START struct Pdr_Set_t_ Pdr_Set_t
INCLUDES ///.
Definition: pdrInt.h:44
int nStarts
Definition: pdrInt.h:111
abctime tTsim
Definition: pdrInt.h:129
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
abctime tCnf
Definition: pdrInt.h:131
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
abctime tTotal
Definition: pdrInt.h:132
abctime tSat
Definition: pdrInt.h:124
void Aig_ManCleanMarkAB(Aig_Man_t *p)
Definition: aigUtil.c:186
#define ABC_FREE(obj)
Definition: abc_global.h:232
void Cnf_DataFree(Cnf_Dat_t *p)
Definition: cnfMan.c:180
static void Vec_WecFreeP(Vec_Wec_t **p)
Definition: vecWec.h:350
int nCallsS
Definition: pdrInt.h:109
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
abctime tPush
Definition: pdrInt.h:128
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Pdr_Set_t* Pdr_ManTernarySim ( Pdr_Man_t p,
int  k,
Pdr_Set_t pCube 
)

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

Synopsis [Shrinks values using ternary simulation.]

Description [The cube contains the set of flop index literals which, when converted into a clause and applied to the combinational outputs, led to a satisfiable SAT run in frame k (values stored in the SAT solver). If the cube is NULL, it is assumed that the first property output was asserted and failed. The resulting array is a set of flop index literals that asserts the COs. Priority contains 0 for i-th entry if the i-th FF is desirable to remove.]

SideEffects []

SeeAlso []

Definition at line 351 of file pdrTsim.c.

352 {
353  Pdr_Set_t * pRes;
354  Vec_Int_t * vPrio = p->vPrio; // priority flops (flop indices)
355  Vec_Int_t * vPiLits = p->vLits; // array of literals (0/1 PI values)
356  Vec_Int_t * vCiObjs = p->vCiObjs; // cone leaves (CI obj IDs)
357  Vec_Int_t * vCoObjs = p->vCoObjs; // cone roots (CO obj IDs)
358  Vec_Int_t * vCiVals = p->vCiVals; // cone leaf values (0/1 CI values)
359  Vec_Int_t * vCoVals = p->vCoVals; // cone root values (0/1 CO values)
360  Vec_Int_t * vNodes = p->vNodes; // cone nodes (node obj IDs)
361  Vec_Int_t * vUndo = p->vUndo; // cone undos (node obj IDs)
362  Vec_Int_t * vVisits = p->vVisits; // intermediate (obj IDs)
363  Vec_Int_t * vCi2Rem = p->vCi2Rem; // CIs to be removed (CI obj IDs)
364  Vec_Int_t * vRes = p->vRes; // final result (flop literals)
365  Aig_Obj_t * pObj;
366  int i, Entry, RetValue;
367  abctime clk = Abc_Clock();
368 
369  // collect CO objects
370  Vec_IntClear( vCoObjs );
371  if ( pCube == NULL ) // the target is the property output
372  {
373 // Vec_IntPush( vCoObjs, Aig_ObjId(Aig_ManCo(p->pAig, (p->pPars->iOutput==-1)?0:p->pPars->iOutput)) );
374  Vec_IntPush( vCoObjs, Aig_ObjId(Aig_ManCo(p->pAig, p->iOutCur)) );
375  }
376  else // the target is the cube
377  {
378  for ( i = 0; i < pCube->nLits; i++ )
379  {
380  if ( pCube->Lits[i] == -1 )
381  continue;
382  pObj = Saig_ManLi(p->pAig, (pCube->Lits[i] >> 1));
383  Vec_IntPush( vCoObjs, Aig_ObjId(pObj) );
384  }
385  }
386 if ( p->pPars->fVeryVerbose )
387 {
388 Abc_Print( 1, "Trying to justify cube " );
389 if ( pCube )
390  Pdr_SetPrint( stdout, pCube, Aig_ManRegNum(p->pAig), NULL );
391 else
392  Abc_Print( 1, "<prop=fail>" );
393 Abc_Print( 1, " in frame %d.\n", k );
394 }
395 
396  // collect CI objects
397  Pdr_ManCollectCone( p->pAig, vCoObjs, vCiObjs, vNodes );
398  // collect values
399  Pdr_ManCollectValues( p, k, vCiObjs, vCiVals );
400  Pdr_ManCollectValues( p, k, vCoObjs, vCoVals );
401  // simulate for the first time
402 if ( p->pPars->fVeryVerbose )
403 Pdr_ManPrintCex( p->pAig, vCiObjs, vCiVals, NULL );
404  RetValue = Pdr_ManSimDataInit( p->pAig, vCiObjs, vCiVals, vNodes, vCoObjs, vCoVals, NULL );
405  assert( RetValue );
406 
407 #if 1
408  // try removing high-priority flops
409  Vec_IntClear( vCi2Rem );
410  Aig_ManForEachObjVec( vCiObjs, p->pAig, pObj, i )
411  {
412  if ( !Saig_ObjIsLo( p->pAig, pObj ) )
413  continue;
414  Entry = Aig_ObjCioId(pObj) - Saig_ManPiNum(p->pAig);
415  if ( vPrio != NULL && Vec_IntEntry( vPrio, Entry ) != 0 )
416  continue;
417  Vec_IntClear( vUndo );
418  if ( Pdr_ManExtendOne( p->pAig, pObj, vUndo, vVisits ) )
419  Vec_IntPush( vCi2Rem, Aig_ObjId(pObj) );
420  else
421  Pdr_ManExtendUndo( p->pAig, vUndo );
422  }
423  // try removing low-priority flops
424  Aig_ManForEachObjVec( vCiObjs, p->pAig, pObj, i )
425  {
426  if ( !Saig_ObjIsLo( p->pAig, pObj ) )
427  continue;
428  Entry = Aig_ObjCioId(pObj) - Saig_ManPiNum(p->pAig);
429  if ( vPrio == NULL || Vec_IntEntry( vPrio, Entry ) == 0 )
430  continue;
431  Vec_IntClear( vUndo );
432  if ( Pdr_ManExtendOne( p->pAig, pObj, vUndo, vVisits ) )
433  Vec_IntPush( vCi2Rem, Aig_ObjId(pObj) );
434  else
435  Pdr_ManExtendUndo( p->pAig, vUndo );
436  }
437 #else
438  // try removing low-priority flops
439  Aig_ManForEachObjVec( vCiObjs, p->pAig, pObj, i )
440  {
441  if ( !Saig_ObjIsLo( p->pAig, pObj ) )
442  continue;
443  Entry = Aig_ObjCioId(pObj) - Saig_ManPiNum(p->pAig);
444  if ( vPrio == NULL || Vec_IntEntry( vPrio, Entry ) == 0 )
445  continue;
446  Vec_IntClear( vUndo );
447  if ( Pdr_ManExtendOne( p->pAig, pObj, vUndo, vVisits ) )
448  Vec_IntPush( vCi2Rem, Aig_ObjId(pObj) );
449  else
450  Pdr_ManExtendUndo( p->pAig, vUndo );
451  }
452  // try removing high-priority flops
453  Vec_IntClear( vCi2Rem );
454  Aig_ManForEachObjVec( vCiObjs, p->pAig, pObj, i )
455  {
456  if ( !Saig_ObjIsLo( p->pAig, pObj ) )
457  continue;
458  Entry = Aig_ObjCioId(pObj) - Saig_ManPiNum(p->pAig);
459  if ( vPrio != NULL && Vec_IntEntry( vPrio, Entry ) != 0 )
460  continue;
461  Vec_IntClear( vUndo );
462  if ( Pdr_ManExtendOne( p->pAig, pObj, vUndo, vVisits ) )
463  Vec_IntPush( vCi2Rem, Aig_ObjId(pObj) );
464  else
465  Pdr_ManExtendUndo( p->pAig, vUndo );
466  }
467 #endif
468 
469 if ( p->pPars->fVeryVerbose )
470 Pdr_ManPrintCex( p->pAig, vCiObjs, vCiVals, vCi2Rem );
471  RetValue = Pdr_ManSimDataInit( p->pAig, vCiObjs, vCiVals, vNodes, vCoObjs, vCoVals, vCi2Rem );
472  assert( RetValue );
473 
474  // derive the set of resulting registers
475  Pdr_ManDeriveResult( p->pAig, vCiObjs, vCiVals, vCi2Rem, vRes, vPiLits );
476  assert( Vec_IntSize(vRes) > 0 );
477  p->tTsim += Abc_Clock() - clk;
478  pRes = Pdr_SetCreate( vRes, vPiLits );
479  assert( k == 0 || !Pdr_SetIsInit(pRes, -1) );
480  return pRes;
481 }
Aig_Man_t * pAig
Definition: pdrInt.h:70
void Pdr_ManExtendUndo(Aig_Man_t *pAig, Vec_Int_t *vUndo)
Definition: pdrTsim.c:251
Pdr_Set_t * Pdr_SetCreate(Vec_Int_t *vLits, Vec_Int_t *vPiLits)
Definition: pdrUtil.c:65
Vec_Int_t * vPrio
Definition: pdrInt.h:90
static int Saig_ObjIsLo(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:84
#define Aig_ManForEachObjVec(vIds, p, pObj, i)
Definition: aig.h:408
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
int iOutCur
Definition: pdrInt.h:81
void Pdr_ManCollectCone(Aig_Man_t *pAig, Vec_Int_t *vCoObjs, Vec_Int_t *vCiObjs, Vec_Int_t *vNodes)
Definition: pdrTsim.c:107
Vec_Int_t * vRes
Definition: pdrInt.h:100
Vec_Int_t * vCiVals
Definition: pdrInt.h:94
void Pdr_SetPrint(FILE *pFile, Pdr_Set_t *p, int nRegs, Vec_Int_t *vFlopCounts)
Definition: pdrUtil.c:225
static abctime Abc_Clock()
Definition: abc_global.h:279
Vec_Int_t * vCi2Rem
Definition: pdrInt.h:99
Vec_Int_t * vCoVals
Definition: pdrInt.h:95
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Pdr_Par_t * pPars
Definition: pdrInt.h:69
Vec_Int_t * vNodes
Definition: pdrInt.h:96
static Aig_Obj_t * Saig_ManLi(Aig_Man_t *p, int i)
Definition: saig.h:80
typedefABC_NAMESPACE_HEADER_START struct Pdr_Set_t_ Pdr_Set_t
INCLUDES ///.
Definition: pdrInt.h:44
int Pdr_ManSimDataInit(Aig_Man_t *pAig, Vec_Int_t *vCiObjs, Vec_Int_t *vCiVals, Vec_Int_t *vNodes, Vec_Int_t *vCoObjs, Vec_Int_t *vCoVals, Vec_Int_t *vCi2Rem)
Definition: pdrTsim.c:161
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
abctime tTsim
Definition: pdrInt.h:129
Vec_Int_t * vVisits
Definition: pdrInt.h:98
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
Vec_Int_t * vLits
Definition: pdrInt.h:91
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
void Pdr_ManCollectValues(Pdr_Man_t *p, int k, Vec_Int_t *vObjIds, Vec_Int_t *vValues)
Definition: pdrSat.c:232
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
#define assert(ex)
Definition: util_old.h:213
Vec_Int_t * vCiObjs
Definition: pdrInt.h:92
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
ABC_INT64_T abctime
Definition: abc_global.h:278
void Pdr_ManDeriveResult(Aig_Man_t *pAig, Vec_Int_t *vCiObjs, Vec_Int_t *vCiVals, Vec_Int_t *vCi2Rem, Vec_Int_t *vRes, Vec_Int_t *vPiLits)
Definition: pdrTsim.c:274
int Pdr_SetIsInit(Pdr_Set_t *p, int iRemove)
Definition: pdrUtil.c:341
Vec_Int_t * vUndo
Definition: pdrInt.h:97
Vec_Int_t * vCoObjs
Definition: pdrInt.h:93
static int Aig_ObjCioId(Aig_Obj_t *pObj)
Definition: aig.h:285
int Pdr_ManExtendOne(Aig_Man_t *pAig, Aig_Obj_t *pObj, Vec_Int_t *vUndo, Vec_Int_t *vVis)
Definition: pdrTsim.c:199
void Pdr_ManPrintCex(Aig_Man_t *pAig, Vec_Int_t *vCiObjs, Vec_Int_t *vCiVals, Vec_Int_t *vCi2Rem)
Definition: pdrTsim.c:317
static abctime Pdr_ManTimeLimit ( Pdr_Man_t p)
inlinestatic

Definition at line 141 of file pdrInt.h.

142 {
143  if ( p->timeToStop == 0 )
144  return p->timeToStopOne;
145  if ( p->timeToStopOne == 0 )
146  return p->timeToStop;
147  if ( p->timeToStop < p->timeToStopOne )
148  return p->timeToStop;
149  return p->timeToStopOne;
150 }
abctime timeToStop
Definition: pdrInt.h:121
abctime timeToStopOne
Definition: pdrInt.h:122
void Pdr_ManVerifyInvariant ( Pdr_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 406 of file pdrInv.c.

407 {
408  sat_solver * pSat;
409  Vec_Int_t * vLits;
410  Vec_Ptr_t * vCubes;
411  Pdr_Set_t * pCube;
412  int i, kStart, kThis, RetValue, Counter = 0;
413  abctime clk = Abc_Clock();
414  // collect cubes used in the inductive invariant
415  kStart = Pdr_ManFindInvariantStart( p );
416  vCubes = Pdr_ManCollectCubes( p, kStart );
417  // create solver with the cubes
418  kThis = Vec_PtrSize(p->vSolvers);
419  pSat = Pdr_ManCreateSolver( p, kThis );
420  // add the property output
421 // Pdr_ManSetPropertyOutput( p, kThis );
422  // add the clauses
423  Vec_PtrForEachEntry( Pdr_Set_t *, vCubes, pCube, i )
424  {
425  vLits = Pdr_ManCubeToLits( p, kThis, pCube, 1, 0 );
426  RetValue = sat_solver_addclause( pSat, Vec_IntArray(vLits), Vec_IntArray(vLits) + Vec_IntSize(vLits) );
427  assert( RetValue );
428  sat_solver_compress( pSat );
429  }
430  // check each clause
431  Vec_PtrForEachEntry( Pdr_Set_t *, vCubes, pCube, i )
432  {
433  vLits = Pdr_ManCubeToLits( p, kThis, pCube, 0, 1 );
434  RetValue = sat_solver_solve( pSat, Vec_IntArray(vLits), Vec_IntArray(vLits) + Vec_IntSize(vLits), 0, 0, 0, 0 );
435  if ( RetValue != l_False )
436  {
437  Abc_Print( 1, "Verification of clause %d failed.\n", i );
438  Counter++;
439  }
440  }
441  if ( Counter )
442  Abc_Print( 1, "Verification of %d clauses has failed.\n", Counter );
443  else
444  {
445  Abc_Print( 1, "Verification of invariant with %d clauses was successful. ", Vec_PtrSize(vCubes) );
446  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
447  }
448 // sat_solver_delete( pSat );
449  Vec_PtrFree( vCubes );
450 }
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
Vec_Ptr_t * vSolvers
Definition: pdrInt.h:83
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
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
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
static void sat_solver_compress(sat_solver *s)
Definition: satSolver.h:217
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
Vec_Ptr_t * Pdr_ManCollectCubes(Pdr_Man_t *p, int kStart)
Definition: pdrInv.c:156
typedefABC_NAMESPACE_HEADER_START struct Pdr_Set_t_ Pdr_Set_t
INCLUDES ///.
Definition: pdrInt.h:44
static int Counter
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
Vec_Int_t * Pdr_ManCubeToLits(Pdr_Man_t *p, int k, Pdr_Set_t *pCube, int fCompl, int fNext)
Definition: pdrSat.c:142
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define l_False
Definition: SolverTypes.h:85
sat_solver * Pdr_ManCreateSolver(Pdr_Man_t *p, int k)
DECLARATIONS ///.
Definition: pdrSat.c:45
int Pdr_ManFindInvariantStart(Pdr_Man_t *p)
Definition: pdrInv.c:132
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_INT64_T abctime
Definition: abc_global.h:278
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
int Pdr_ObjRegNum ( Pdr_Man_t p,
int  k,
int  iSatVar 
)

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

Synopsis [Returns register number for the given SAT variable.]

Description []

SideEffects []

SeeAlso []

Definition at line 312 of file pdrCnf.c.

313 {
314  if ( p->pPars->fMonoCnf )
315  return Pdr_ObjRegNum1( p, k, iSatVar );
316  else
317  return Pdr_ObjRegNum2( p, k, iSatVar );
318 }
Pdr_Par_t * pPars
Definition: pdrInt.h:69
static int Pdr_ObjRegNum1(Pdr_Man_t *p, int k, int iSatVar)
Definition: pdrCnf.c:261
static int Pdr_ObjRegNum2(Pdr_Man_t *p, int k, int iSatVar)
Definition: pdrCnf.c:285
int Pdr_ObjSatVar ( Pdr_Man_t p,
int  k,
int  Pol,
Aig_Obj_t pObj 
)

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

Synopsis [Returns SAT variable of the given object.]

Description []

SideEffects []

SeeAlso []

Definition at line 241 of file pdrCnf.c.

242 {
243  if ( p->pPars->fMonoCnf )
244  return Pdr_ObjSatVar1( p, k, pObj );
245  else
246  return Pdr_ObjSatVar2( p, k, pObj, 0, Pol );
247 }
int Pdr_ObjSatVar2(Pdr_Man_t *p, int k, Aig_Obj_t *pObj, int Level, int Pol)
Definition: pdrCnf.c:200
Pdr_Par_t * pPars
Definition: pdrInt.h:69
static ABC_NAMESPACE_IMPL_START int Pdr_ObjSatVar1(Pdr_Man_t *p, int k, Aig_Obj_t *pObj)
DECLARATIONS ///.
Definition: pdrCnf.c:54
void Pdr_OblDeref ( Pdr_Obl_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 437 of file pdrUtil.c.

438 {
439  if ( --p->nRefs == 0 )
440  {
441  if ( p->pNext )
442  Pdr_OblDeref( p->pNext );
443  Pdr_SetDeref( p->pState );
444  ABC_FREE( p );
445  }
446 }
Pdr_Set_t * pState
Definition: pdrInt.h:60
int nRefs
Definition: pdrInt.h:59
Pdr_Obl_t * pNext
Definition: pdrInt.h:61
void Pdr_SetDeref(Pdr_Set_t *p)
Definition: pdrUtil.c:208
void Pdr_OblDeref(Pdr_Obl_t *p)
Definition: pdrUtil.c:437
#define ABC_FREE(obj)
Definition: abc_global.h:232
Pdr_Obl_t* Pdr_OblRef ( Pdr_Obl_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 420 of file pdrUtil.c.

421 {
422  p->nRefs++;
423  return p;
424 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nRefs
Definition: pdrInt.h:59
Pdr_Obl_t* Pdr_OblStart ( int  k,
int  prio,
Pdr_Set_t pState,
Pdr_Obl_t pNext 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 396 of file pdrUtil.c.

397 {
398  Pdr_Obl_t * p;
399  p = ABC_ALLOC( Pdr_Obl_t, 1 );
400  p->iFrame = k;
401  p->prio = prio;
402  p->nRefs = 1;
403  p->pState = pState;
404  p->pNext = pNext;
405  p->pLink = NULL;
406  return p;
407 }
int prio
Definition: pdrInt.h:58
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Pdr_Set_t * pState
Definition: pdrInt.h:60
int nRefs
Definition: pdrInt.h:59
Pdr_Obl_t * pNext
Definition: pdrInt.h:61
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int iFrame
Definition: pdrInt.h:57
Pdr_Obl_t * pLink
Definition: pdrInt.h:62
void Pdr_QueueClean ( Pdr_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 513 of file pdrUtil.c.

514 {
515  Pdr_Obl_t * pThis;
516  while ( (pThis = Pdr_QueuePop(p)) )
517  Pdr_OblDeref( pThis );
518  pThis = NULL;
519 }
Pdr_Obl_t * Pdr_QueuePop(Pdr_Man_t *p)
Definition: pdrUtil.c:491
void Pdr_OblDeref(Pdr_Obl_t *p)
Definition: pdrUtil.c:437
Pdr_Obl_t* Pdr_QueueHead ( Pdr_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 475 of file pdrUtil.c.

476 {
477  return p->pQueue;
478 }
Pdr_Obl_t * pQueue
Definition: pdrInt.h:85
int Pdr_QueueIsEmpty ( Pdr_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 459 of file pdrUtil.c.

460 {
461  return p->pQueue == NULL;
462 }
Pdr_Obl_t * pQueue
Definition: pdrInt.h:85
Pdr_Obl_t* Pdr_QueuePop ( Pdr_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 491 of file pdrUtil.c.

492 {
493  Pdr_Obl_t * pRes = p->pQueue;
494  if ( p->pQueue == NULL )
495  return NULL;
496  p->pQueue = p->pQueue->pLink;
497  Pdr_OblDeref( pRes );
498  p->nQueCur--;
499  return pRes;
500 }
Pdr_Obl_t * pQueue
Definition: pdrInt.h:85
Pdr_Obl_t * pLink
Definition: pdrInt.h:62
void Pdr_OblDeref(Pdr_Obl_t *p)
Definition: pdrUtil.c:437
int nQueCur
Definition: pdrInt.h:117
void Pdr_QueuePrint ( Pdr_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 562 of file pdrUtil.c.

563 {
564  Pdr_Obl_t * pObl;
565  for ( pObl = p->pQueue; pObl; pObl = pObl->pLink )
566  Abc_Print( 1, "Frame = %2d. Prio = %8d.\n", pObl->iFrame, pObl->prio );
567 }
Pdr_Obl_t * pQueue
Definition: pdrInt.h:85
int prio
Definition: pdrInt.h:58
int iFrame
Definition: pdrInt.h:57
Pdr_Obl_t * pLink
Definition: pdrInt.h:62
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
void Pdr_QueuePush ( Pdr_Man_t p,
Pdr_Obl_t pObl 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 532 of file pdrUtil.c.

533 {
534  Pdr_Obl_t * pTemp, ** ppPrev;
535  p->nObligs++;
536  p->nQueCur++;
537  p->nQueMax = Abc_MaxInt( p->nQueMax, p->nQueCur );
538  Pdr_OblRef( pObl );
539  if ( p->pQueue == NULL )
540  {
541  p->pQueue = pObl;
542  return;
543  }
544  for ( ppPrev = &p->pQueue, pTemp = p->pQueue; pTemp; ppPrev = &pTemp->pLink, pTemp = pTemp->pLink )
545  if ( pTemp->iFrame > pObl->iFrame || (pTemp->iFrame == pObl->iFrame && pTemp->prio > pObl->prio) )
546  break;
547  *ppPrev = pObl;
548  pObl->pLink = pTemp;
549 }
Pdr_Obl_t * pQueue
Definition: pdrInt.h:85
int nObligs
Definition: pdrInt.h:106
int prio
Definition: pdrInt.h:58
int nQueMax
Definition: pdrInt.h:118
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
int iFrame
Definition: pdrInt.h:57
Pdr_Obl_t * pLink
Definition: pdrInt.h:62
Pdr_Obl_t * Pdr_OblRef(Pdr_Obl_t *p)
Definition: pdrUtil.c:420
int nQueCur
Definition: pdrInt.h:117
void Pdr_QueueStop ( Pdr_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 580 of file pdrUtil.c.

581 {
582  Pdr_Obl_t * pObl;
583  while ( !Pdr_QueueIsEmpty(p) )
584  {
585  pObl = Pdr_QueuePop(p);
586  Pdr_OblDeref( pObl );
587  }
588  p->pQueue = NULL;
589  p->nQueCur = 0;
590 }
Pdr_Obl_t * pQueue
Definition: pdrInt.h:85
int Pdr_QueueIsEmpty(Pdr_Man_t *p)
Definition: pdrUtil.c:459
Pdr_Obl_t * Pdr_QueuePop(Pdr_Man_t *p)
Definition: pdrUtil.c:491
void Pdr_OblDeref(Pdr_Obl_t *p)
Definition: pdrUtil.c:437
int nQueCur
Definition: pdrInt.h:117
Pdr_Set_t* Pdr_SetAlloc ( int  nSize)

DECLARATIONS ///.

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

FileName [pdrUtil.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Property driven reachability.]

Synopsis [Various utilities.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - November 20, 2010.]

Revision [

Id:
pdrUtil.c,v 1.00 2010/11/20 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file pdrUtil.c.

47 {
48  Pdr_Set_t * p;
49  assert( nSize >= 0 && nSize < (1<<30) );
50  p = (Pdr_Set_t *)ABC_CALLOC( char, sizeof(Pdr_Set_t) + nSize * sizeof(int) );
51  return p;
52 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_HEADER_START struct Pdr_Set_t_ Pdr_Set_t
INCLUDES ///.
Definition: pdrInt.h:44
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
int Pdr_SetCompare ( Pdr_Set_t **  pp1,
Pdr_Set_t **  pp2 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 366 of file pdrUtil.c.

367 {
368  Pdr_Set_t * p1 = *pp1;
369  Pdr_Set_t * p2 = *pp2;
370  int i;
371  for ( i = 0; i < p1->nLits && i < p2->nLits; i++ )
372  {
373  if ( p1->Lits[i] > p2->Lits[i] )
374  return -1;
375  if ( p1->Lits[i] < p2->Lits[i] )
376  return 1;
377  }
378  if ( i == p1->nLits && i < p2->nLits )
379  return -1;
380  if ( i < p1->nLits && i == p2->nLits )
381  return 1;
382  return 0;
383 }
typedefABC_NAMESPACE_HEADER_START struct Pdr_Set_t_ Pdr_Set_t
INCLUDES ///.
Definition: pdrInt.h:44
int Pdr_SetContains ( Pdr_Set_t pOld,
Pdr_Set_t pNew 
)

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

Synopsis [Return 1 if pOld set-theoretically contains pNew.]

Description []

SideEffects []

SeeAlso []

Definition at line 263 of file pdrUtil.c.

264 {
265  int * pOldInt, * pNewInt;
266  assert( pOld->nLits > 0 );
267  assert( pNew->nLits > 0 );
268  if ( pOld->nLits < pNew->nLits )
269  return 0;
270  if ( (pOld->Sign & pNew->Sign) != pNew->Sign )
271  return 0;
272  pOldInt = pOld->Lits + pOld->nLits - 1;
273  pNewInt = pNew->Lits + pNew->nLits - 1;
274  while ( pNew->Lits <= pNewInt )
275  {
276  if ( pOld->Lits > pOldInt )
277  return 0;
278  assert( *pNewInt != -1 );
279  assert( *pOldInt != -1 );
280  if ( *pNewInt == *pOldInt )
281  pNewInt--, pOldInt--;
282  else if ( *pNewInt < *pOldInt )
283  pOldInt--;
284  else
285  return 0;
286  }
287  return 1;
288 }
#define assert(ex)
Definition: util_old.h:213
int Pdr_SetContainsSimple ( Pdr_Set_t pOld,
Pdr_Set_t pNew 
)

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

Synopsis [Return 1 if pOld set-theoretically contains pNew.]

Description []

SideEffects []

SeeAlso []

Definition at line 301 of file pdrUtil.c.

302 {
303  int * pOldInt, * pNewInt;
304  assert( pOld->nLits > 0 );
305  assert( pNew->nLits > 0 );
306  pOldInt = pOld->Lits + pOld->nLits - 1;
307  pNewInt = pNew->Lits + pNew->nLits - 1;
308  while ( pNew->Lits <= pNewInt )
309  {
310  assert( *pOldInt != -1 );
311  if ( *pNewInt == -1 )
312  {
313  pNewInt--;
314  continue;
315  }
316  if ( pOld->Lits > pOldInt )
317  return 0;
318  assert( *pNewInt != -1 );
319  assert( *pOldInt != -1 );
320  if ( *pNewInt == *pOldInt )
321  pNewInt--, pOldInt--;
322  else if ( *pNewInt < *pOldInt )
323  pOldInt--;
324  else
325  return 0;
326  }
327  return 1;
328 }
#define assert(ex)
Definition: util_old.h:213
Pdr_Set_t* Pdr_SetCreate ( Vec_Int_t vLits,
Vec_Int_t vPiLits 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 65 of file pdrUtil.c.

66 {
67  Pdr_Set_t * p;
68  int i;
69  assert( Vec_IntSize(vLits) + Vec_IntSize(vPiLits) < (1<<30) );
70  p = (Pdr_Set_t *)ABC_ALLOC( char, sizeof(Pdr_Set_t) + (Vec_IntSize(vLits) + Vec_IntSize(vPiLits)) * sizeof(int) );
71  p->nLits = Vec_IntSize(vLits);
72  p->nTotal = Vec_IntSize(vLits) + Vec_IntSize(vPiLits);
73  p->nRefs = 1;
74  p->Sign = 0;
75  for ( i = 0; i < p->nLits; i++ )
76  {
77  p->Lits[i] = Vec_IntEntry(vLits, i);
78  p->Sign |= ((word)1 << (p->Lits[i] % 63));
79  }
80  Vec_IntSelectSort( p->Lits, p->nLits );
81  // remember PI literals
82  for ( i = p->nLits; i < p->nTotal; i++ )
83  p->Lits[i] = Vec_IntEntry(vPiLits, i-p->nLits);
84  return p;
85 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static void Vec_IntSelectSort(int *pArray, int nSize)
Definition: vecInt.h:1740
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
typedefABC_NAMESPACE_HEADER_START struct Pdr_Set_t_ Pdr_Set_t
INCLUDES ///.
Definition: pdrInt.h:44
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define assert(ex)
Definition: util_old.h:213
int nTotal
DECLARATIONS ///.
Definition: cutTruth.c:37
Pdr_Set_t* Pdr_SetCreateFrom ( Pdr_Set_t pSet,
int  iRemove 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 98 of file pdrUtil.c.

99 {
100  Pdr_Set_t * p;
101  int i, k = 0;
102  assert( iRemove >= 0 && iRemove < pSet->nLits );
103  p = (Pdr_Set_t *)ABC_ALLOC( char, sizeof(Pdr_Set_t) + (pSet->nTotal - 1) * sizeof(int) );
104  p->nLits = pSet->nLits - 1;
105  p->nTotal = pSet->nTotal - 1;
106  p->nRefs = 1;
107  p->Sign = 0;
108  for ( i = 0; i < pSet->nTotal; i++ )
109  {
110  if ( i == iRemove )
111  continue;
112  p->Lits[k++] = pSet->Lits[i];
113  if ( i >= pSet->nLits )
114  continue;
115  p->Sign |= ((word)1 << (pSet->Lits[i] % 63));
116  }
117  assert( k == p->nTotal );
118  return p;
119 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
typedefABC_NAMESPACE_HEADER_START struct Pdr_Set_t_ Pdr_Set_t
INCLUDES ///.
Definition: pdrInt.h:44
#define assert(ex)
Definition: util_old.h:213
Pdr_Set_t* Pdr_SetCreateSubset ( Pdr_Set_t pSet,
int *  pLits,
int  nLits 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 132 of file pdrUtil.c.

133 {
134  Pdr_Set_t * p;
135  int i, k = 0;
136  assert( nLits >= 0 && nLits <= pSet->nLits );
137  p = (Pdr_Set_t *)ABC_ALLOC( char, sizeof(Pdr_Set_t) + (nLits + pSet->nTotal - pSet->nLits) * sizeof(int) );
138  p->nLits = nLits;
139  p->nTotal = nLits + pSet->nTotal - pSet->nLits;
140  p->nRefs = 1;
141  p->Sign = 0;
142  for ( i = 0; i < nLits; i++ )
143  {
144  assert( pLits[i] >= 0 );
145  p->Lits[k++] = pLits[i];
146  p->Sign |= ((word)1 << (pLits[i] % 63));
147  }
148  Vec_IntSelectSort( p->Lits, p->nLits );
149  for ( i = pSet->nLits; i < pSet->nTotal; i++ )
150  p->Lits[k++] = pSet->Lits[i];
151  assert( k == p->nTotal );
152  return p;
153 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static void Vec_IntSelectSort(int *pArray, int nSize)
Definition: vecInt.h:1740
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
typedefABC_NAMESPACE_HEADER_START struct Pdr_Set_t_ Pdr_Set_t
INCLUDES ///.
Definition: pdrInt.h:44
#define assert(ex)
Definition: util_old.h:213
int nTotal
DECLARATIONS ///.
Definition: cutTruth.c:37
void Pdr_SetDeref ( Pdr_Set_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 208 of file pdrUtil.c.

209 {
210  if ( --p->nRefs == 0 )
211  ABC_FREE( p );
212 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_FREE(obj)
Definition: abc_global.h:232
Pdr_Set_t* Pdr_SetDup ( Pdr_Set_t pSet)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 166 of file pdrUtil.c.

167 {
168  Pdr_Set_t * p;
169  int i;
170  p = (Pdr_Set_t *)ABC_ALLOC( char, sizeof(Pdr_Set_t) + pSet->nTotal * sizeof(int) );
171  p->nLits = pSet->nLits;
172  p->nTotal = pSet->nTotal;
173  p->nRefs = 1;
174  p->Sign = pSet->Sign;
175  for ( i = 0; i < pSet->nTotal; i++ )
176  p->Lits[i] = pSet->Lits[i];
177  return p;
178 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
typedefABC_NAMESPACE_HEADER_START struct Pdr_Set_t_ Pdr_Set_t
INCLUDES ///.
Definition: pdrInt.h:44
int Pdr_SetIsInit ( Pdr_Set_t pCube,
int  iRemove 
)

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

Synopsis [Return 1 if the state cube contains init state (000...0).]

Description []

SideEffects []

SeeAlso []

Definition at line 341 of file pdrUtil.c.

342 {
343  int i;
344  for ( i = 0; i < pCube->nLits; i++ )
345  {
346  assert( pCube->Lits[i] != -1 );
347  if ( i == iRemove )
348  continue;
349  if ( lit_sign( pCube->Lits[i] ) == 0 )
350  return 0;
351  }
352  return 1;
353 }
static int lit_sign(lit l)
Definition: satVec.h:146
#define assert(ex)
Definition: util_old.h:213
void Pdr_SetPrint ( FILE *  pFile,
Pdr_Set_t p,
int  nRegs,
Vec_Int_t vFlopCounts 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 225 of file pdrUtil.c.

226 {
227  char * pBuff;
228  int i, k, Entry;
229  pBuff = ABC_ALLOC( char, nRegs + 1 );
230  for ( i = 0; i < nRegs; i++ )
231  pBuff[i] = '-';
232  pBuff[i] = 0;
233  for ( i = 0; i < p->nLits; i++ )
234  {
235  if ( p->Lits[i] == -1 )
236  continue;
237  pBuff[lit_var(p->Lits[i])] = (lit_sign(p->Lits[i])? '0':'1');
238  }
239  if ( vFlopCounts )
240  {
241  // skip some literals
242  k = 0;
243  Vec_IntForEachEntry( vFlopCounts, Entry, i )
244  if ( Entry )
245  pBuff[k++] = pBuff[i];
246  pBuff[k] = 0;
247  }
248  fprintf( pFile, "%s", pBuff );
249  ABC_FREE( pBuff );
250 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int lit_var(lit l)
Definition: satVec.h:145
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
if(last==0)
Definition: sparse_int.h:34
static int lit_sign(lit l)
Definition: satVec.h:146
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
Pdr_Set_t* Pdr_SetRef ( Pdr_Set_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 191 of file pdrUtil.c.

192 {
193  p->nRefs++;
194  return p;
195 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950