abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
pdrInv.c File Reference
#include "pdrInt.h"
#include "base/abc/abc.h"
#include "base/main/main.h"
#include "aig/ioa/ioa.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START void Pdr_ManPrintProgress (Pdr_Man_t *p, int fClose, abctime Time)
 DECLARATIONS ///. More...
 
Vec_Int_tPdr_ManCountFlops (Pdr_Man_t *p, Vec_Ptr_t *vCubes)
 
int Pdr_ManFindInvariantStart (Pdr_Man_t *p)
 
Vec_Ptr_tPdr_ManCollectCubes (Pdr_Man_t *p, int kStart)
 
int Pdr_ManCountVariables (Pdr_Man_t *p, int kStart)
 
void Pdr_ManPrintClauses (Pdr_Man_t *p, int kStart)
 
void Pdr_SetPrintOne (Pdr_Set_t *p)
 
Aig_Man_tPdr_ManDupAigWithClauses (Aig_Man_t *p, Vec_Ptr_t *vCubes)
 
void Pdr_ManDumpAig (Aig_Man_t *p, Vec_Ptr_t *vCubes)
 
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)
 

Function Documentation

Vec_Ptr_t* Pdr_ManCollectCubes ( Pdr_Man_t p,
int  kStart 
)

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

Synopsis [Counts the number of variables used in the clauses.]

Description []

SideEffects []

SeeAlso []

Definition at line 156 of file pdrInv.c.

157 {
158  Vec_Ptr_t * vResult;
159  Vec_Ptr_t * vArrayK;
160  Pdr_Set_t * pSet;
161  int i, j;
162  vResult = Vec_PtrAlloc( 100 );
163  Vec_VecForEachLevelStart( p->vClauses, vArrayK, i, kStart )
164  Vec_PtrForEachEntry( Pdr_Set_t *, vArrayK, pSet, j )
165  Vec_PtrPush( vResult, pSet );
166  return vResult;
167 }
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_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
typedefABC_NAMESPACE_HEADER_START struct Pdr_Set_t_ Pdr_Set_t
INCLUDES ///.
Definition: pdrInt.h:44
Vec_Vec_t * vClauses
Definition: pdrInt.h:84
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#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 
)

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

Synopsis [Counts how many times each flop appears in the set of cubes.]

Description []

SideEffects []

SeeAlso []

Definition at line 106 of file pdrInv.c.

107 {
108  Vec_Int_t * vFlopCount;
109  Pdr_Set_t * pCube;
110  int i, n;
111  vFlopCount = Vec_IntStart( Aig_ManRegNum(p->pAig) );
112  Vec_PtrForEachEntry( Pdr_Set_t *, vCubes, pCube, i )
113  for ( n = 0; n < pCube->nLits; n++ )
114  {
115  assert( pCube->Lits[n] >= 0 && pCube->Lits[n] < 2*Aig_ManRegNum(p->pAig) );
116  Vec_IntAddToEntry( vFlopCount, pCube->Lits[n] >> 1, 1 );
117  }
118  return vFlopCount;
119 }
Aig_Man_t * pAig
Definition: pdrInt.h:70
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
for(p=first;p->value< newval;p=p->next)
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static void Vec_IntAddToEntry(Vec_Int_t *p, int i, int Addition)
Definition: bblif.c:302
typedefABC_NAMESPACE_HEADER_START struct Pdr_Set_t_ Pdr_Set_t
INCLUDES ///.
Definition: pdrInt.h:44
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
int Pdr_ManCountVariables ( Pdr_Man_t p,
int  kStart 
)

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

Synopsis [Counts the number of variables used in the clauses.]

Description []

SideEffects []

SeeAlso []

Definition at line 180 of file pdrInv.c.

181 {
182  Vec_Int_t * vFlopCounts;
183  Vec_Ptr_t * vCubes;
184  int i, Entry, Counter = 0;
185  vCubes = Pdr_ManCollectCubes( p, kStart );
186  vFlopCounts = Pdr_ManCountFlops( p, vCubes );
187  Vec_IntForEachEntry( vFlopCounts, Entry, i )
188  Counter += (Entry > 0);
189  Vec_IntFreeP( &vFlopCounts );
190  Vec_PtrFree( vCubes );
191  return Counter;
192 }
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
Vec_Ptr_t * Pdr_ManCollectCubes(Pdr_Man_t *p, int kStart)
Definition: pdrInv.c:156
static int Counter
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
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
void Pdr_ManDumpAig ( Aig_Man_t p,
Vec_Ptr_t vCubes 
)

Definition at line 294 of file pdrInv.c.

295 {
296  Aig_Man_t * pNew = Pdr_ManDupAigWithClauses( p, vCubes );
297  Ioa_WriteAiger( pNew, "aig_with_clauses.aig", 0, 0 );
298  Aig_ManStop( pNew );
299  printf( "Dumped modified AIG into file \"aig_with_clauses.aig\".\n" );
300 }
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
void Ioa_WriteAiger(Aig_Man_t *pMan, char *pFileName, int fWriteSymbols, int fCompact)
Definition: ioaWriteAig.c:446
Aig_Man_t * Pdr_ManDupAigWithClauses(Aig_Man_t *p, Vec_Ptr_t *vCubes)
Definition: pdrInv.c:253
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
Aig_Man_t* Pdr_ManDupAigWithClauses ( Aig_Man_t p,
Vec_Ptr_t vCubes 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 253 of file pdrInv.c.

254 {
255  Aig_Man_t * pNew;
256  Aig_Obj_t * pObj, * pObjNew, * pLit;
257  Pdr_Set_t * pCube;
258  int i, n;
259  // create the new manager
260  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
261  pNew->pName = Abc_UtilStrsav( p->pName );
262  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
263  // create the PIs
264  Aig_ManCleanData( p );
266  Aig_ManForEachCi( p, pObj, i )
267  pObj->pData = Aig_ObjCreateCi( pNew );
268  // create outputs for each cube
269  Vec_PtrForEachEntry( Pdr_Set_t *, vCubes, pCube, i )
270  {
271 // Pdr_SetPrintOne( pCube );
272  pObjNew = Aig_ManConst1(pNew);
273  for ( n = 0; n < pCube->nLits; n++ )
274  {
275  assert( Abc_Lit2Var(pCube->Lits[n]) < Saig_ManRegNum(p) );
276  pLit = Aig_NotCond( Aig_ManCi(pNew, Saig_ManPiNum(p) + Abc_Lit2Var(pCube->Lits[n])), Abc_LitIsCompl(pCube->Lits[n]) );
277  pObjNew = Aig_And( pNew, pObjNew, pLit );
278  }
279  Aig_ObjCreateCo( pNew, pObjNew );
280  }
281  // duplicate internal nodes
282  Aig_ManForEachNode( p, pObj, i )
283  pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
284  // add the POs
285  Saig_ManForEachLi( p, pObj, i )
286  Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
287  Aig_ManCleanup( pNew );
288  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
289  // check the resulting network
290  if ( !Aig_ManCheck(pNew) )
291  printf( "Aig_ManDupSimple(): The check has failed.\n" );
292  return pNew;
293 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
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 * pData
Definition: aig.h:87
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static void check(int expr)
Definition: satSolver.c:46
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
static Aig_Obj_t * Aig_ManCi(Aig_Man_t *p, int i)
Definition: aig.h:266
if(last==0)
Definition: sparse_int.h:34
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
typedefABC_NAMESPACE_HEADER_START struct Pdr_Set_t_ Pdr_Set_t
INCLUDES ///.
Definition: pdrInt.h:44
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static int Saig_ManRegNum(Aig_Man_t *p)
Definition: saig.h:77
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
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
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define assert(ex)
Definition: util_old.h:213
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
Aig_Man_t * Aig_ManDupSimple(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigDup.c:46
int Pdr_ManFindInvariantStart ( Pdr_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 132 of file pdrInv.c.

133 {
134  Vec_Ptr_t * vArrayK;
135  int k, kMax = Vec_PtrSize(p->vSolvers)-1;
136  Vec_VecForEachLevelStartStop( p->vClauses, vArrayK, k, 1, kMax+1 )
137  if ( Vec_PtrSize(vArrayK) == 0 )
138  return k;
139 // return -1;
140  // if there is no starting point (as in case of SAT or undecided), return the last frame
141 // Abc_Print( 1, "The last timeframe contains %d clauses.\n", Vec_PtrSize(Vec_VecEntry(p->vClauses, kMax)) );
142  return kMax;
143 }
Vec_Ptr_t * vSolvers
Definition: pdrInt.h:83
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
if(last==0)
Definition: sparse_int.h:34
Vec_Vec_t * vClauses
Definition: pdrInt.h:84
#define Vec_VecForEachLevelStartStop(vGlob, vVec, i, LevelStart, LevelStop)
Definition: vecVec.h:61
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
ABC_NAMESPACE_IMPL_START 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_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
void Pdr_SetPrintOne ( Pdr_Set_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 233 of file pdrInv.c.

234 {
235  int i;
236  printf( "Clause: {" );
237  for ( i = 0; i < p->nLits; i++ )
238  printf( " %s%d", Abc_LitIsCompl(p->Lits[i])? "!":"", Abc_Lit2Var(p->Lits[i]) );
239  printf( " }\n" );
240 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264