ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
pdrInt.h File Reference
#include "aig/saig/saig.h"
#include "misc/vec/vecWec.h"
#include "sat/cnf/cnf.h"
#include "pdr.h"
#include "misc/hash/hashInt.h"
#include "aig/gia/giaAig.h"
#include "sat/bsat/satSolver.h"
Include dependency graph for pdrInt.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Pdr_Set_t_
 
struct  Pdr_Obl_t_
 
struct  Pdr_Man_t_
 

Typedefs

typedef typedefABC_NAMESPACE_HEADER_START struct Txs_Man_t_ Txs_Man_t
 INCLUDES ///.
 
typedef struct Txs3_Man_t_ Txs3_Man_t
 
typedef struct Pdr_Set_t_ Pdr_Set_t
 
typedef struct Pdr_Obl_t_ Pdr_Obl_t
 
typedef struct Pdr_Man_t_ Pdr_Man_t
 

Functions

int Pdr_ObjSatVar (Pdr_Man_t *p, int k, int Pol, Aig_Obj_t *pObj)
 FUNCTION DECLARATIONS ///.
 
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)
 
Vec_Int_tPdr_ManCountFlopsInv (Pdr_Man_t *p)
 
void Pdr_ManPrintProgress (Pdr_Man_t *p, int fClose, abctime Time)
 DECLARATIONS ///.
 
void Pdr_ManPrintClauses (Pdr_Man_t *p, int kStart)
 
void Pdr_ManDumpClauses (Pdr_Man_t *p, char *pFileName, int fProved)
 
Vec_Str_tPdr_ManDumpString (Pdr_Man_t *p)
 
void Pdr_ManReportInvariant (Pdr_Man_t *p)
 
void Pdr_ManVerifyInvariant (Pdr_Man_t *p)
 
Vec_Int_tPdr_ManDeriveInfinityClauses (Pdr_Man_t *p, int fReduce)
 
Pdr_Man_tPdr_ManStart (Aig_Man_t *pAig, Pdr_Par_t *pPars, Vec_Int_t *vPrioInit)
 
void Pdr_ManStop (Pdr_Man_t *p)
 
Abc_Cex_tPdr_ManDeriveCex (Pdr_Man_t *p)
 
Abc_Cex_tPdr_ManDeriveCexAbs (Pdr_Man_t *p)
 
sat_solverPdr_ManCreateSolver (Pdr_Man_t *p, int k)
 DECLARATIONS ///.
 
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, int fTryConf, int fUseLit)
 
Pdr_Set_tPdr_ManTernarySim (Pdr_Man_t *p, int k, Pdr_Set_t *pCube)
 
Txs_Man_tTxs_ManStart (Pdr_Man_t *pMan, Aig_Man_t *pAig, Vec_Int_t *vPrio)
 FUNCTION DEFINITIONS ///.
 
void Txs_ManStop (Txs_Man_t *)
 
Pdr_Set_tTxs_ManTernarySim (Txs_Man_t *p, int k, Pdr_Set_t *pCube)
 
Txs3_Man_tTxs3_ManStart (Pdr_Man_t *pMan, Aig_Man_t *pAig, Vec_Int_t *vPrio)
 FUNCTION DEFINITIONS ///.
 
void Txs3_ManStop (Txs3_Man_t *)
 
Pdr_Set_tTxs3_ManTernarySim (Txs3_Man_t *p, int k, Pdr_Set_t *pCube)
 
Pdr_Set_tPdr_SetAlloc (int nSize)
 DECLARATIONS ///.
 
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)
 
Pdr_Set_tZPdr_SetIntersection (Pdr_Set_t *p1, Pdr_Set_t *p2, Hash_Int_t *keep)
 
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)
 
int ZPdr_SetIsInit (Pdr_Set_t *p)
 
void Pdr_SetPrint (FILE *pFile, Pdr_Set_t *p, int nRegs, Vec_Int_t *vFlopCounts)
 
void ZPdr_SetPrint (Pdr_Set_t *p)
 
void Pdr_SetPrintStr (Vec_Str_t *vStr, 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)
 

Typedef Documentation

◆ Pdr_Man_t

typedef struct Pdr_Man_t_ Pdr_Man_t

Definition at line 95 of file pdrInt.h.

◆ Pdr_Obl_t

typedef struct Pdr_Obl_t_ Pdr_Obl_t

Definition at line 84 of file pdrInt.h.

◆ Pdr_Set_t

typedef struct Pdr_Set_t_ Pdr_Set_t

Definition at line 74 of file pdrInt.h.

◆ Txs3_Man_t

typedef struct Txs3_Man_t_ Txs3_Man_t

Definition at line 72 of file pdrInt.h.

◆ Txs_Man_t

typedef typedefABC_NAMESPACE_HEADER_START struct Txs_Man_t_ Txs_Man_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 71 of file pdrInt.h.

Function Documentation

◆ Pdr_ManCheckContainment()

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

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 390 of file pdrCore.c.

391{
392 Pdr_Set_t * pThis;
393 Vec_Ptr_t * vArrayK;
394 int i, j, kMax = Vec_PtrSize(p->vSolvers)-1;
395 Vec_VecForEachLevelStartStop( p->vClauses, vArrayK, i, k, kMax+1 )
396 Vec_PtrForEachEntry( Pdr_Set_t *, vArrayK, pThis, j )
397 if ( Pdr_SetContains( pSet, pThis ) )
398 return 1;
399 return 0;
400}
Cube * p
Definition exorList.c:222
struct Pdr_Set_t_ Pdr_Set_t
Definition pdrInt.h:74
int Pdr_SetContains(Pdr_Set_t *pOld, Pdr_Set_t *pNew)
Definition pdrUtil.c:382
if(last==0)
Definition sparse_int.h:34
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
#define Vec_VecForEachLevelStartStop(vGlob, vVec, i, LevelStart, LevelStop)
Definition vecVec.h:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pdr_ManCheckCube()

int Pdr_ManCheckCube ( Pdr_Man_t * p,
int k,
Pdr_Set_t * pCube,
Pdr_Set_t ** ppPred,
int nConfLimit,
int fTryConf,
int fUseLit )
extern

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 290 of file pdrSat.c.

291{
292 //int fUseLit = 0;
293 int fLitUsed = 0;
294 sat_solver * pSat;
295 Vec_Int_t * vLits;
296 int Lit, RetValue;
297 abctime clk, Limit;
298 p->nCalls++;
299 pSat = Pdr_ManFetchSolver( p, k );
300 if ( pCube == NULL ) // solve the property
301 {
302 clk = Abc_Clock();
303 Lit = Abc_Var2Lit( Pdr_ObjSatVar(p, k, 2, Aig_ManCo(p->pAig, p->iOutCur)), 0 ); // pos literal (property fails)
304 Limit = sat_solver_set_runtime_limit( pSat, Pdr_ManTimeLimit(p) );
305 RetValue = sat_solver_solve( pSat, &Lit, &Lit + 1, nConfLimit, 0, 0, 0 );
306 sat_solver_set_runtime_limit( pSat, Limit );
307 if ( RetValue == l_Undef )
308 return -1;
309 }
310 else // check relative containment in terms of next states
311 {
312 if ( fUseLit )
313 {
314 fLitUsed = 1;
315 Vec_IntAddToEntry( p->vActVars, k, 1 );
316 // add the cube in terms of current state variables
317 vLits = Pdr_ManCubeToLits( p, k, pCube, 1, 0 );
318 // add activation literal
319 Lit = Abc_Var2Lit( Pdr_ManFreeVar(p, k), 0 );
320 // add activation literal
321 Vec_IntPush( vLits, Lit );
322 RetValue = sat_solver_addclause( pSat, Vec_IntArray(vLits), Vec_IntArray(vLits) + Vec_IntSize(vLits) );
323 assert( RetValue == 1 );
324 sat_solver_compress( pSat );
325 // create assumptions
326 vLits = Pdr_ManCubeToLits( p, k, pCube, 0, 1 );
327 // add activation literal
328 Vec_IntPush( vLits, Abc_LitNot(Lit) );
329 }
330 else
331 vLits = Pdr_ManCubeToLits( p, k, pCube, 0, 1 );
332
333 // solve
334 clk = Abc_Clock();
335 Limit = sat_solver_set_runtime_limit( pSat, Pdr_ManTimeLimit(p) );
336 RetValue = sat_solver_solve( pSat, Vec_IntArray(vLits), Vec_IntArray(vLits) + Vec_IntSize(vLits), fTryConf ? p->pPars->nConfGenLimit : nConfLimit, 0, 0, 0 );
337 sat_solver_set_runtime_limit( pSat, Limit );
338 if ( RetValue == l_Undef )
339 {
340 if ( fTryConf && p->pPars->nConfGenLimit )
341 RetValue = l_True;
342 else
343 return -1;
344 }
345 }
346 clk = Abc_Clock() - clk;
347 p->tSat += clk;
348 assert( RetValue != l_Undef );
349 if ( RetValue == l_False )
350 {
351 p->tSatUnsat += clk;
352 p->nCallsU++;
353 if ( ppPred )
354 *ppPred = NULL;
355 RetValue = 1;
356 }
357 else // if ( RetValue == l_True )
358 {
359 p->tSatSat += clk;
360 p->nCallsS++;
361 if ( ppPred )
362 {
363 abctime clk = Abc_Clock();
364 if ( p->pPars->fNewXSim )
365 *ppPred = Txs3_ManTernarySim( p->pTxs3, k, pCube );
366 else
367 *ppPred = Pdr_ManTernarySim( p, k, pCube );
368 p->tTsim += Abc_Clock() - clk;
369 p->nXsimLits += (*ppPred)->nLits;
370 p->nXsimRuns++;
371 }
372 RetValue = 0;
373 }
374
375/* // for some reason, it does not work...
376 if ( fLitUsed )
377 {
378 int RetValue;
379 Lit = Abc_LitNot(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}
ABC_INT64_T abctime
Definition abc_global.h:332
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
#define l_True
Definition bmcBmcS.c:35
#define l_Undef
Definition bmcBmcS.c:34
#define l_False
Definition bmcBmcS.c:36
#define sat_solver_addclause
Definition cecSatG2.c:37
#define sat_solver
Definition cecSatG2.c:34
#define sat_solver_solve
Definition cecSatG2.c:45
int Pdr_ManFreeVar(Pdr_Man_t *p, int k)
Definition pdrCnf.c:332
int Pdr_ObjSatVar(Pdr_Man_t *p, int k, int Pol, Aig_Obj_t *pObj)
FUNCTION DECLARATIONS ///.
Definition pdrCnf.c:241
Pdr_Set_t * Txs3_ManTernarySim(Txs3_Man_t *p, int k, Pdr_Set_t *pCube)
Definition pdrTsim3.c:188
Pdr_Set_t * Pdr_ManTernarySim(Pdr_Man_t *p, int k, Pdr_Set_t *pCube)
Definition pdrTsim.c:351
sat_solver * Pdr_ManFetchSolver(Pdr_Man_t *p, int k)
Definition pdrSat.c:77
Vec_Int_t * Pdr_ManCubeToLits(Pdr_Man_t *p, int k, Pdr_Set_t *pCube, int fCompl, int fNext)
Definition pdrSat.c:144
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pdr_ManCheckCubeCs()

int Pdr_ManCheckCubeCs ( Pdr_Man_t * p,
int k,
Pdr_Set_t * pCube )
extern

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 262 of file pdrSat.c.

263{
264 sat_solver * pSat;
265 Vec_Int_t * vLits;
266 abctime Limit;
267 int RetValue;
268 pSat = Pdr_ManFetchSolver( p, k );
269 vLits = Pdr_ManCubeToLits( p, k, pCube, 0, 0 );
270 Limit = sat_solver_set_runtime_limit( pSat, Pdr_ManTimeLimit(p) );
271 RetValue = sat_solver_solve( pSat, Vec_IntArray(vLits), Vec_IntArray(vLits) + Vec_IntSize(vLits), 0, 0, 0, 0 );
272 sat_solver_set_runtime_limit( pSat, Limit );
273 if ( RetValue == l_Undef )
274 return -1;
275 return (RetValue == l_False);
276}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pdr_ManCollectValues()

void Pdr_ManCollectValues ( Pdr_Man_t * p,
int k,
Vec_Int_t * vObjIds,
Vec_Int_t * vValues )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 236 of file pdrSat.c.

237{
238 sat_solver * pSat;
239 Aig_Obj_t * pObj;
240 int iVar, i;
241 Vec_IntClear( vValues );
242 pSat = Pdr_ManSolver(p, k);
243 Aig_ManForEachObjVec( vObjIds, p->pAig, pObj, i )
244 {
245 iVar = Pdr_ObjSatVar( p, k, 3, pObj ); assert( iVar >= 0 );
246 Vec_IntPush( vValues, sat_solver_var_value(pSat, iVar) );
247 }
248}
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
#define Aig_ManForEachObjVec(vIds, p, pObj, i)
Definition aig.h:408
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pdr_ManCountFlopsInv()

Vec_Int_t * Pdr_ManCountFlopsInv ( Pdr_Man_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 196 of file pdrInv.c.

197{
198 int kStart = Pdr_ManFindInvariantStart(p);
199 Vec_Ptr_t *vCubes = Pdr_ManCollectCubes(p, kStart);
200 Vec_Int_t * vInv = Pdr_ManCountFlops( p, vCubes );
201 Vec_PtrFree(vCubes);
202 return vInv;
203}
int Pdr_ManFindInvariantStart(Pdr_Man_t *p)
Definition pdrInv.c:148
Vec_Ptr_t * Pdr_ManCollectCubes(Pdr_Man_t *p, int kStart)
Definition pdrInv.c:172
Vec_Int_t * Pdr_ManCountFlops(Pdr_Man_t *p, Vec_Ptr_t *vCubes)
Definition pdrInv.c:118
Here is the call graph for this function:

◆ Pdr_ManCreateSolver()

sat_solver * Pdr_ManCreateSolver ( Pdr_Man_t * p,
int k )
extern

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 = zsat_solver_new_seed(p->pPars->nRandomSeed);
56 pSat = Pdr_ManNewSolver( pSat, p, k, (int)(k == 0) );
57 Vec_PtrPush( p->vSolvers, pSat );
58 Vec_VecExpand( p->vClauses, k );
59 Vec_IntPush( p->vActVars, 0 );
60 // add property cone
61 Saig_ManForEachPo( p->pAig, pObj, i )
62 Pdr_ObjSatVar( p, k, 1, pObj );
63 return pSat;
64}
sat_solver * Pdr_ManNewSolver(sat_solver *pSat, Pdr_Man_t *p, int k, int fInit)
Definition pdrCnf.c:439
#define Saig_ManForEachPo(p, pObj, i)
Definition saig.h:93
sat_solver * zsat_solver_new_seed(double seed)
Definition satSolver.c:1202
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pdr_ManCubeToLits()

Vec_Int_t * Pdr_ManCubeToLits ( Pdr_Man_t * p,
int k,
Pdr_Set_t * pCube,
int fCompl,
int fNext )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 144 of file pdrSat.c.

145{
146 Aig_Obj_t * pObj;
147 int i, iVar, iVarMax = 0;
148 abctime clk = Abc_Clock();
149 Vec_IntClear( p->vLits );
150// assert( !(fNext && fCompl) );
151 for ( i = 0; i < pCube->nLits; i++ )
152 {
153 if ( pCube->Lits[i] == -1 )
154 continue;
155 if ( fNext )
156 pObj = Saig_ManLi( p->pAig, Abc_Lit2Var(pCube->Lits[i]) );
157 else
158 pObj = Saig_ManLo( p->pAig, Abc_Lit2Var(pCube->Lits[i]) );
159 iVar = Pdr_ObjSatVar( p, k, fNext ? 2 - Abc_LitIsCompl(pCube->Lits[i]) : 3, pObj ); assert( iVar >= 0 );
160 iVarMax = Abc_MaxInt( iVarMax, iVar );
161 Vec_IntPush( p->vLits, Abc_Var2Lit( iVar, fCompl ^ Abc_LitIsCompl(pCube->Lits[i]) ) );
162 }
163// sat_solver_setnvars( Pdr_ManSolver(p, k), iVarMax + 1 );
164 p->tCnf += Abc_Clock() - clk;
165 return p->vLits;
166}
int Lits[0]
Definition pdrInt.h:81
int nLits
Definition pdrInt.h:80
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pdr_ManDeriveCex()

Abc_Cex_t * Pdr_ManDeriveCex ( Pdr_Man_t * p)
extern

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

Synopsis [Derives counter-example.]

Description []

SideEffects []

SeeAlso []

Definition at line 408 of file pdrMan.c.

409{
410 Abc_Cex_t * pCex;
411 Pdr_Obl_t * pObl;
412 int i, f, Lit, nFrames = 0;
413 // count the number of frames
414 for ( pObl = p->pQueue; pObl; pObl = pObl->pNext )
415 nFrames++;
416 // create the counter-example
417 pCex = Abc_CexAlloc( Aig_ManRegNum(p->pAig), Saig_ManPiNum(p->pAig), nFrames );
418 pCex->iPo = p->iOutCur;
419 pCex->iFrame = nFrames-1;
420 for ( pObl = p->pQueue, f = 0; pObl; pObl = pObl->pNext, f++ )
421 for ( i = pObl->pState->nLits; i < pObl->pState->nTotal; i++ )
422 {
423 Lit = pObl->pState->Lits[i];
424 if ( Abc_LitIsCompl(Lit) )
425 continue;
426 if ( Abc_Lit2Var(Lit) >= pCex->nPis ) // allows PPI literals to be thrown away
427 continue;
428 assert( Abc_Lit2Var(Lit) < pCex->nPis );
429 Abc_InfoSetBit( pCex->pData, pCex->nRegs + f * pCex->nPis + Abc_Lit2Var(Lit) );
430 }
431 assert( f == nFrames );
432 if ( !Saig_ManVerifyCex(p->pAig, pCex) )
433 printf( "CEX for output %d is not valid.\n", p->iOutCur );
434 return pCex;
435}
struct Pdr_Obl_t_ Pdr_Obl_t
Definition pdrInt.h:84
int Saig_ManVerifyCex(Aig_Man_t *pAig, Abc_Cex_t *p)
Definition saigDup.c:281
Pdr_Obl_t * pNext
Definition pdrInt.h:91
Pdr_Set_t * pState
Definition pdrInt.h:90
ABC_NAMESPACE_IMPL_START Abc_Cex_t * Abc_CexAlloc(int nRegs, int nRealPis, int nFrames)
DECLARATIONS ///.
Definition utilCex.c:51
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition utilCex.h:39
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pdr_ManDeriveCexAbs()

Abc_Cex_t * Pdr_ManDeriveCexAbs ( Pdr_Man_t * p)
extern

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

Synopsis [Derives counter-example when abstraction is used.]

Description []

SideEffects []

SeeAlso []

Definition at line 448 of file pdrMan.c.

449{
450 extern Gia_Man_t * Gia_ManDupAbs( Gia_Man_t * p, Vec_Int_t * vMapPpi2Ff, Vec_Int_t * vMapFf2Ppi );
451
452 Gia_Man_t * pAbs;
453 Abc_Cex_t * pCex, * pCexCare;
454 Pdr_Obl_t * pObl;
455 int i, f, Lit, Flop, nFrames = 0;
456 int nPis = Saig_ManPiNum(p->pAig);
457 int nFfRefined = 0;
458 if ( !p->pPars->fUseAbs || !p->vMapPpi2Ff )
459 return Pdr_ManDeriveCex(p);
460 // restore previous map
461 Vec_IntForEachEntry( p->vMapPpi2Ff, Flop, i )
462 {
463 assert( Vec_IntEntry( p->vMapFf2Ppi, Flop ) == i );
464 Vec_IntWriteEntry( p->vMapFf2Ppi, Flop, -1 );
465 }
466 Vec_IntClear( p->vMapPpi2Ff );
467 // count the number of frames
468 for ( pObl = p->pQueue; pObl; pObl = pObl->pNext )
469 {
470 for ( i = pObl->pState->nLits; i < pObl->pState->nTotal; i++ )
471 {
472 Lit = pObl->pState->Lits[i];
473 if ( Abc_Lit2Var(Lit) < nPis ) // PI literal
474 continue;
475 Flop = Abc_Lit2Var(Lit) - nPis;
476 if ( Vec_IntEntry(p->vMapFf2Ppi, Flop) >= 0 ) // already used PPI literal
477 continue;
478 Vec_IntWriteEntry( p->vMapFf2Ppi, Flop, Vec_IntSize(p->vMapPpi2Ff) );
479 Vec_IntPush( p->vMapPpi2Ff, Flop );
480 }
481 nFrames++;
482 }
483 if ( Vec_IntSize(p->vMapPpi2Ff) == 0 ) // no PPIs -- this is a real CEX
484 return Pdr_ManDeriveCex(p);
485 if ( p->pPars->fUseSimpleRef )
486 {
487 // rely on ternary simulation to perform refinement
488 Vec_IntForEachEntry( p->vMapPpi2Ff, Flop, i )
489 {
490 assert( Vec_IntEntry(p->vAbsFlops, Flop) == 0 );
491 Vec_IntWriteEntry( p->vAbsFlops, Flop, 1 );
492 nFfRefined++;
493 }
494 }
495 else
496 {
497 // create the counter-example
498 pCex = Abc_CexAlloc( Aig_ManRegNum(p->pAig) - Vec_IntSize(p->vMapPpi2Ff), Saig_ManPiNum(p->pAig) + Vec_IntSize(p->vMapPpi2Ff), nFrames );
499 pCex->iPo = p->iOutCur;
500 pCex->iFrame = nFrames-1;
501 for ( pObl = p->pQueue, f = 0; pObl; pObl = pObl->pNext, f++ )
502 for ( i = pObl->pState->nLits; i < pObl->pState->nTotal; i++ )
503 {
504 Lit = pObl->pState->Lits[i];
505 if ( Abc_LitIsCompl(Lit) )
506 continue;
507 if ( Abc_Lit2Var(Lit) < nPis ) // PI literal
508 Abc_InfoSetBit( pCex->pData, pCex->nRegs + f * pCex->nPis + Abc_Lit2Var(Lit) );
509 else
510 {
511 int iPPI = nPis + Vec_IntEntry(p->vMapFf2Ppi, Abc_Lit2Var(Lit) - nPis);
512 assert( iPPI < pCex->nPis );
513 Abc_InfoSetBit( pCex->pData, pCex->nRegs + f * pCex->nPis + iPPI );
514 }
515 }
516 assert( f == nFrames );
517 // perform CEX minimization
518 pAbs = Gia_ManDupAbs( p->pGia, p->vMapPpi2Ff, p->vMapFf2Ppi );
519 pCexCare = Bmc_CexCareMinimizeAig( pAbs, nPis, pCex, 1, 0, 0 );
520 Gia_ManStop( pAbs );
521 assert( pCexCare->nPis == pCex->nPis );
522 Abc_CexFree( pCex );
523 // detect care PPIs
524 for ( f = 0; f < nFrames; f++ )
525 {
526 for ( i = nPis; i < pCexCare->nPis; i++ )
527 if ( Abc_InfoHasBit(pCexCare->pData, pCexCare->nRegs + pCexCare->nPis * f + i) )
528 {
529 if ( Vec_IntEntry(p->vAbsFlops, Vec_IntEntry(p->vMapPpi2Ff, i-nPis)) == 0 ) // currently abstracted
530 Vec_IntWriteEntry( p->vAbsFlops, Vec_IntEntry(p->vMapPpi2Ff, i-nPis), 1 ), nFfRefined++;
531 }
532 }
533 Abc_CexFree( pCexCare );
534 if ( nFfRefined == 0 ) // no refinement -- this is a real CEX
535 return Pdr_ManDeriveCex(p);
536 }
537 //printf( "CEX-based refinement refined %d flops.\n", nFfRefined );
538 p->nCexesTotal++;
539 p->nCexes++;
540 return NULL;
541}
Abc_Cex_t * Bmc_CexCareMinimizeAig(Gia_Man_t *p, int nRealPis, Abc_Cex_t *pCex, int nTryCexes, int fCheck, int fVerbose)
Definition bmcCexCare.c:254
Gia_Man_t * Gia_ManDupAbs(Gia_Man_t *p, Vec_Int_t *vMapPpi2Ff, Vec_Int_t *vMapFf2Ppi)
Definition giaDup.c:239
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
Abc_Cex_t * Pdr_ManDeriveCex(Pdr_Man_t *p)
Definition pdrMan.c:408
void Abc_CexFree(Abc_Cex_t *p)
Definition utilCex.c:382
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pdr_ManDeriveInfinityClauses()

Vec_Int_t * Pdr_ManDeriveInfinityClauses ( Pdr_Man_t * p,
int fReduce )
extern

Definition at line 595 of file pdrInv.c.

596{
597 Vec_Int_t * vResult;
598 Vec_Ptr_t * vCubes;
599 Pdr_Set_t * pCube;
600 int i, v, kStart;
601 // collect cubes used in the inductive invariant
602 kStart = Pdr_ManFindInvariantStart( p );
603 vCubes = Pdr_ManCollectCubes( p, kStart );
604 // refine as long as there are changes
605 if ( fReduce )
606 while ( Pdr_ManDeriveMarkNonInductive(p, vCubes) );
607 // collect remaining clauses
608 vResult = Vec_IntAlloc( 1000 );
609 Vec_IntPush( vResult, 0 );
610 Vec_PtrForEachEntry( Pdr_Set_t *, vCubes, pCube, i )
611 {
612 if ( pCube->nRefs == -1 ) // skip non-inductive
613 continue;
614 Vec_IntAddToEntry( vResult, 0, 1 );
615 Vec_IntPush( vResult, pCube->nLits );
616 for ( v = 0; v < pCube->nLits; v++ )
617 Vec_IntPush( vResult, pCube->Lits[v] );
618 }
619 //Vec_PtrFree( vCubes );
620 Vec_PtrFreeP( &p->vInfCubes );
621 p->vInfCubes = vCubes;
622 Vec_IntPush( vResult, Aig_ManRegNum(p->pAig) );
623 return vResult;
624}
int Pdr_ManDeriveMarkNonInductive(Pdr_Man_t *p, Vec_Ptr_t *vCubes)
Definition pdrInv.c:557
int nRefs
Definition pdrInt.h:78
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pdr_ManDumpClauses()

void Pdr_ManDumpClauses ( Pdr_Man_t * p,
char * pFileName,
int fProved )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 352 of file pdrInv.c.

353{
354 FILE * pFile;
355 Vec_Int_t * vFlopCounts;
356 Vec_Ptr_t * vCubes;
357 Pdr_Set_t * pCube;
358 char ** pNamesCi;
359 int i, kStart, Count = 0;
360 // create file
361 pFile = fopen( pFileName, "w" );
362 if ( pFile == NULL )
363 {
364 Abc_Print( 1, "Cannot open file \"%s\" for writing invariant.\n", pFileName );
365 return;
366 }
367 // collect cubes
368 kStart = Pdr_ManFindInvariantStart( p );
369 if ( fProved )
370 vCubes = Pdr_ManCollectCubes( p, kStart );
371 else
372 vCubes = Vec_PtrDup( p->vInfCubes );
373 Vec_PtrSort( vCubes, (int (*)(const void *, const void *))Pdr_SetCompare );
374// Pdr_ManDumpAig( p->pAig, vCubes );
375 // count cubes
376 Count = 0;
377 Vec_PtrForEachEntry( Pdr_Set_t *, vCubes, pCube, i )
378 {
379 if ( pCube->nRefs == -1 )
380 continue;
381 Count++;
382 }
383 // collect variable appearances
384 vFlopCounts = p->pPars->fUseSupp ? Pdr_ManCountFlops( p, vCubes ) : NULL;
385 // output the header
386 if ( fProved )
387 fprintf( pFile, "# Inductive invariant for \"%s\"\n", p->pAig->pName );
388 else
389 fprintf( pFile, "# Clauses of the last timeframe for \"%s\"\n", p->pAig->pName );
390 fprintf( pFile, "# generated by PDR in ABC on %s\n", Aig_TimeStamp() );
391 fprintf( pFile, ".i %d\n", p->pPars->fUseSupp ? Pdr_ManCountVariables(p, kStart) : Aig_ManRegNum(p->pAig) );
392 fprintf( pFile, ".o 1\n" );
393 fprintf( pFile, ".p %d\n", Count );
394 // output flop names
396 if ( pNamesCi )
397 {
398 fprintf( pFile, ".ilb" );
399 for ( i = 0; i < Aig_ManRegNum(p->pAig); i++ )
400 if ( !p->pPars->fUseSupp || Vec_IntEntry( vFlopCounts, i ) )
401 fprintf( pFile, " %s", pNamesCi[Saig_ManPiNum(p->pAig) + i] );
402 fprintf( pFile, "\n" );
403 ABC_FREE( pNamesCi );
404 fprintf( pFile, ".ob inv\n" );
405 }
406 // output cubes
407 Vec_PtrForEachEntry( Pdr_Set_t *, vCubes, pCube, i )
408 {
409 if ( pCube->nRefs == -1 )
410 continue;
411 Pdr_SetPrint( pFile, pCube, Aig_ManRegNum(p->pAig), vFlopCounts );
412 fprintf( pFile, " 1\n" );
413 }
414 fprintf( pFile, ".e\n\n" );
415 fclose( pFile );
416 Vec_IntFreeP( &vFlopCounts );
417 Vec_PtrFree( vCubes );
418 if ( fProved )
419 Abc_Print( 1, "Inductive invariant was written into file \"%s\".\n", pFileName );
420 else
421 Abc_Print( 1, "Clauses of the last timeframe were written into file \"%s\".\n", pFileName );
422}
ABC_DLL char ** Abc_NtkCollectCioNames(Abc_Ntk_t *pNtk, int fCollectCos)
Definition abcNames.c:285
#define ABC_FREE(obj)
Definition abc_global.h:267
char * Aig_TimeStamp()
Definition aigUtil.c:62
ABC_DLL Abc_Frame_t * Abc_FrameReadGlobalFrame()
Definition mainFrame.c:666
ABC_DLL Abc_Ntk_t * Abc_FrameReadNtk(Abc_Frame_t *p)
Definition mainFrame.c:327
void Pdr_SetPrint(FILE *pFile, Pdr_Set_t *p, int nRegs, Vec_Int_t *vFlopCounts)
Definition pdrUtil.c:225
int Pdr_SetCompare(Pdr_Set_t **pp1, Pdr_Set_t **pp2)
Definition pdrUtil.c:485
int Pdr_ManCountVariables(Pdr_Man_t *p, int kStart)
Definition pdrInv.c:216
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pdr_ManDumpString()

Vec_Str_t * Pdr_ManDumpString ( Pdr_Man_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 435 of file pdrInv.c.

436{
437 Vec_Str_t * vStr;
438 Vec_Int_t * vFlopCounts;
439 Vec_Ptr_t * vCubes;
440 Pdr_Set_t * pCube;
441 int i, kStart;
442 vStr = Vec_StrAlloc( 1000 );
443 // collect cubes
444 kStart = Pdr_ManFindInvariantStart( p );
445 if ( p->vInfCubes == NULL )
446 vCubes = Pdr_ManCollectCubes( p, kStart );
447 else
448 vCubes = Vec_PtrDup( p->vInfCubes );
449 Vec_PtrSort( vCubes, (int (*)(const void *, const void *))Pdr_SetCompare );
450 // collect variable appearances
451 vFlopCounts = p->pPars->fUseSupp ? Pdr_ManCountFlops( p, vCubes ) : NULL;
452 // output cubes
453 Vec_PtrForEachEntry( Pdr_Set_t *, vCubes, pCube, i )
454 {
455 if ( pCube->nRefs == -1 )
456 continue;
457 Pdr_SetPrintStr( vStr, pCube, Aig_ManRegNum(p->pAig), vFlopCounts );
458 }
459 Vec_IntFreeP( &vFlopCounts );
460 Vec_PtrFree( vCubes );
461 Vec_StrPush( vStr, '\0' );
462 return vStr;
463}
struct Vec_Str_t_ Vec_Str_t
Definition bblif.c:46
void Pdr_SetPrintStr(Vec_Str_t *vStr, Pdr_Set_t *p, int nRegs, Vec_Int_t *vFlopCounts)
Definition pdrUtil.c:342
Here is the call graph for this function:

◆ Pdr_ManFetchSolver()

sat_solver * Pdr_ManFetchSolver ( Pdr_Man_t * p,
int k )
extern

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

Synopsis [Returns old or restarted solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 77 of file pdrSat.c.

78{
79 sat_solver * pSat;
80 Vec_Ptr_t * vArrayK;
81 Pdr_Set_t * pCube;
82 int i, j;
83 pSat = Pdr_ManSolver(p, k);
84 if ( Vec_IntEntry(p->vActVars, k) < p->pPars->nRecycle )
85 return pSat;
86 assert( k < Vec_PtrSize(p->vSolvers) - 1 );
87 p->nStarts++;
88// sat_solver_delete( pSat );
89// pSat = sat_solver_new();
90// sat_solver_restart( pSat );
91 zsat_solver_restart_seed( pSat, p->pPars->nRandomSeed );
92 // create new SAT solver
93 pSat = Pdr_ManNewSolver( pSat, p, k, (int)(k == 0) );
94 // write new SAT solver
95 Vec_PtrWriteEntry( p->vSolvers, k, pSat );
96 Vec_IntWriteEntry( p->vActVars, k, 0 );
97 // set the property output
99 // add the clauses
100 Vec_VecForEachLevelStart( p->vClauses, vArrayK, i, k )
101 Vec_PtrForEachEntry( Pdr_Set_t *, vArrayK, pCube, j )
102 Pdr_ManSolverAddClause( p, k, pCube );
103 return pSat;
104}
void Pdr_ManSetPropertyOutput(Pdr_Man_t *p, int k)
Definition pdrSat.c:179
void Pdr_ManSolverAddClause(Pdr_Man_t *p, int k, Pdr_Set_t *pCube)
Definition pdrSat.c:213
void zsat_solver_restart_seed(sat_solver *s, double seed)
Definition satSolver.c:1435
#define Vec_VecForEachLevelStart(vGlob, vVec, i, LevelStart)
Definition vecVec.h:57
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pdr_ManFreeVar()

int Pdr_ManFreeVar ( Pdr_Man_t * p,
int k )
extern

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}
int sat_solver_nvars(sat_solver *s)
Definition satSolver.c:2369
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pdr_ManLitsToCube()

Vec_Int_t * Pdr_ManLitsToCube ( Pdr_Man_t * p,
int k,
int * pArray,
int nArray )
extern

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

Synopsis [Converts SAT variables into register IDs.]

Description []

SideEffects []

SeeAlso []

Definition at line 117 of file pdrSat.c.

118{
119 int i, RegId;
120 Vec_IntClear( p->vLits );
121 for ( i = 0; i < nArray; i++ )
122 {
123 RegId = Pdr_ObjRegNum( p, k, Abc_Lit2Var(pArray[i]) );
124 if ( RegId == -1 )
125 continue;
126 assert( RegId >= 0 && RegId < Aig_ManRegNum(p->pAig) );
127 Vec_IntPush( p->vLits, Abc_Var2Lit(RegId, !Abc_LitIsCompl(pArray[i])) );
128 }
129 assert( Vec_IntSize(p->vLits) >= 0 && Vec_IntSize(p->vLits) <= nArray );
130 return p->vLits;
131}
int Pdr_ObjRegNum(Pdr_Man_t *p, int k, int iSatVar)
Definition pdrCnf.c:312
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pdr_ManNewSolver()

sat_solver * Pdr_ManNewSolver ( sat_solver * pSat,
Pdr_Man_t * p,
int k,
int fInit )
extern

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

Synopsis [Creates SAT solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 439 of file pdrCnf.c.

440{
441 assert( pSat != NULL );
442 if ( p->pPars->fMonoCnf )
443 return Pdr_ManNewSolver1( pSat, p, k, fInit );
444 else
445 return Pdr_ManNewSolver2( pSat, p, k, fInit );
446}
Here is the caller graph for this function:

◆ Pdr_ManPrintClauses()

void Pdr_ManPrintClauses ( Pdr_Man_t * p,
int kStart )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 244 of file pdrInv.c.

245{
246 Vec_Ptr_t * vArrayK;
247 Pdr_Set_t * pCube;
248 int i, k, Counter = 0;
249 Vec_VecForEachLevelStart( p->vClauses, vArrayK, k, kStart )
250 {
251 Vec_PtrSort( vArrayK, (int (*)(const void *, const void *))Pdr_SetCompare );
252 Vec_PtrForEachEntry( Pdr_Set_t *, vArrayK, pCube, i )
253 {
254 Abc_Print( 1, "C=%4d. F=%4d ", Counter++, k );
255 Pdr_SetPrint( stdout, pCube, Aig_ManRegNum(p->pAig), NULL );
256 Abc_Print( 1, "\n" );
257 }
258 }
259}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pdr_ManPrintProgress()

void Pdr_ManPrintProgress ( Pdr_Man_t * p,
int fClose,
abctime Time )
extern

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 {
54 Abc_Print(1, "Frame " );
55 Abc_Print(1, "Clauses " );
56 Abc_Print(1, "Max Queue " );
57 Abc_Print(1, "Flops " );
58 Abc_Print(1, "Cex " );
59 Abc_Print(1, "Time" );
60 Abc_Print(1, "\n" );
61 return;
62 }
63 if ( Abc_FrameIsBatchMode() && !fClose )
64 return;
65 // count the total length of the printout
66 Length = 0;
67 Vec_VecForEachLevel( p->vClauses, vVec, i )
68 Length += 1 + Abc_Base10Log(Vec_PtrSize(vVec)+1);
69 // determine the starting point
70 LengthStart = Abc_MaxInt( 0, Length - 60 );
71 Abc_Print( 1, "%3d :", Vec_PtrSize(p->vSolvers)-1 );
72 ThisSize = 5;
73 if ( LengthStart > 0 )
74 {
75 Abc_Print( 1, " ..." );
76 ThisSize += 4;
77 }
78 Length = 0;
79 Vec_VecForEachLevel( p->vClauses, vVec, i )
80 {
81 if ( Length < LengthStart )
82 {
83 Length += 1 + Abc_Base10Log(Vec_PtrSize(vVec)+1);
84 continue;
85 }
86 Abc_Print( 1, " %d", Vec_PtrSize(vVec) );
87 Length += 1 + Abc_Base10Log(Vec_PtrSize(vVec)+1);
88 ThisSize += 1 + Abc_Base10Log(Vec_PtrSize(vVec)+1);
89 }
90 for ( i = ThisSize; i < 70; i++ )
91 Abc_Print( 1, " " );
92 Abc_Print( 1, "%5d", p->nQueMax );
93 Abc_Print( 1, "%6d", p->vAbsFlops ? Vec_IntCountPositive(p->vAbsFlops) : p->nAbsFlops );
94 if ( p->pPars->fUseAbs )
95 Abc_Print( 1, "%4d", p->nCexes );
96 Abc_Print( 1, "%10.2f sec", 1.0*Time/CLOCKS_PER_SEC );
97 if ( p->pPars->fSolveAll )
98 Abc_Print( 1, " CEX =%4d", p->pPars->nFailOuts );
99 if ( p->pPars->nTimeOutOne )
100 Abc_Print( 1, " T/O =%3d", p->pPars->nDropOuts );
101 Abc_Print( 1, "%s", fClose ? "\n":"\r" );
102 if ( fClose )
103 p->nQueMax = 0, p->nCexes = 0;
104 fflush( stdout );
105}
ABC_DLL int Abc_FrameIsBatchMode()
Definition mainFrame.c:110
#define Vec_VecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
Definition vecVec.h:55
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pdr_ManReportInvariant()

void Pdr_ManReportInvariant ( Pdr_Man_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 477 of file pdrInv.c.

478{
479 Vec_Ptr_t * vCubes;
480 int kStart = Pdr_ManFindInvariantStart( p );
481 vCubes = Pdr_ManCollectCubes( p, kStart );
482 Abc_Print( 1, "Invariant F[%d] : %d clauses with %d flops (out of %d) (cex = %d, ave = %.2f)\n",
483 kStart, Vec_PtrSize(vCubes), Pdr_ManCountVariables(p, kStart), Aig_ManRegNum(p->pAig), p->nCexesTotal, 1.0*p->nXsimLits/p->nXsimRuns );
484// Abc_Print( 1, "Invariant F[%d] : %d clauses with %d flops (out of %d)\n",
485// kStart, Vec_PtrSize(vCubes), Pdr_ManCountVariables(p, kStart), Aig_ManRegNum(p->pAig) );
486 Vec_PtrFree( vCubes );
487}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pdr_ManSetPropertyOutput()

void Pdr_ManSetPropertyOutput ( Pdr_Man_t * p,
int k )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 179 of file pdrSat.c.

180{
181 sat_solver * pSat;
182 Aig_Obj_t * pObj;
183 int Lit, RetValue, i;
184 if ( !p->pPars->fUsePropOut )
185 return;
186 pSat = Pdr_ManSolver(p, k);
187 Saig_ManForEachPo( p->pAig, pObj, i )
188 {
189 // skip solved outputs
190 if ( p->vCexes && Vec_PtrEntry(p->vCexes, i) )
191 continue;
192 // skip timedout outputs
193 if ( p->pPars->vOutMap && Vec_IntEntry(p->pPars->vOutMap, i) == -1 )
194 continue;
195 Lit = Abc_Var2Lit( Pdr_ObjSatVar(p, k, 1, pObj), 1 ); // neg literal
196 RetValue = sat_solver_addclause( pSat, &Lit, &Lit + 1 );
197 assert( RetValue == 1 );
198 }
199 sat_solver_compress( pSat );
200}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pdr_ManSolverAddClause()

void Pdr_ManSolverAddClause ( Pdr_Man_t * p,
int k,
Pdr_Set_t * pCube )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 213 of file pdrSat.c.

214{
215 sat_solver * pSat;
216 Vec_Int_t * vLits;
217 int RetValue;
218 pSat = Pdr_ManSolver(p, k);
219 vLits = Pdr_ManCubeToLits( p, k, pCube, 1, 0 );
220 RetValue = sat_solver_addclause( pSat, Vec_IntArray(vLits), Vec_IntArray(vLits) + Vec_IntSize(vLits) );
221 assert( RetValue == 1 );
222 sat_solver_compress( pSat );
223}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pdr_ManStart()

Pdr_Man_t * Pdr_ManStart ( Aig_Man_t * pAig,
Pdr_Par_t * pPars,
Vec_Int_t * vPrioInit )
extern

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

Synopsis [Creates manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 248 of file pdrMan.c.

249{
250 Pdr_Man_t * p;
251 p = ABC_CALLOC( Pdr_Man_t, 1 );
252 p->pPars = pPars;
253 p->pAig = pAig;
254 p->pGia = (pPars->fFlopPrio || p->pPars->fNewXSim || p->pPars->fUseAbs) ? Gia_ManFromAigSimple(pAig) : NULL;
255 p->vSolvers = Vec_PtrAlloc( 0 );
256 p->vClauses = Vec_VecAlloc( 0 );
257 p->pQueue = NULL;
258 p->pOrder = ABC_ALLOC( int, Aig_ManRegNum(pAig) );
259 p->vActVars = Vec_IntAlloc( 256 );
260 if ( !p->pPars->fMonoCnf )
261 p->vVLits = Vec_WecStart( 1+Abc_MaxInt(1, Aig_ManLevels(pAig)) );
262 // internal use
263 p->nPrioShift = Abc_Base2Log(Aig_ManRegNum(pAig));
264 if ( vPrioInit )
265 p->vPrio = vPrioInit;
266 else if ( pPars->fFlopPrio )
267 p->vPrio = Pdr_ManDeriveFlopPriorities2(p->pGia, 1);
268// else if ( p->pPars->fNewXSim )
269// p->vPrio = Vec_IntStartNatural( Aig_ManRegNum(pAig) );
270 else
271 p->vPrio = Vec_IntStart( Aig_ManRegNum(pAig) );
272 p->vLits = Vec_IntAlloc( 100 ); // array of literals
273 p->vCiObjs = Vec_IntAlloc( 100 ); // cone leaves
274 p->vCoObjs = Vec_IntAlloc( 100 ); // cone roots
275 p->vCiVals = Vec_IntAlloc( 100 ); // cone leaf values
276 p->vCoVals = Vec_IntAlloc( 100 ); // cone root values
277 p->vNodes = Vec_IntAlloc( 100 ); // cone nodes
278 p->vUndo = Vec_IntAlloc( 100 ); // cone undos
279 p->vVisits = Vec_IntAlloc( 100 ); // intermediate
280 p->vCi2Rem = Vec_IntAlloc( 100 ); // CIs to be removed
281 p->vRes = Vec_IntAlloc( 100 ); // final result
282 p->pCnfMan = Cnf_ManStart();
283 // ternary simulation
284 p->pTxs3 = pPars->fNewXSim ? Txs3_ManStart( p, pAig, p->vPrio ) : NULL;
285 // additional AIG data-members
286 if ( pAig->pFanData == NULL )
287 Aig_ManFanoutStart( pAig );
288 if ( pAig->pTerSimData == NULL )
289 pAig->pTerSimData = ABC_CALLOC( unsigned, 1 + (Aig_ManObjNumMax(pAig) / 16) );
290 // time spent on each outputs
291 if ( pPars->nTimeOutOne )
292 {
293 int i;
294 p->pTime4Outs = ABC_ALLOC( abctime, Saig_ManPoNum(pAig) );
295 for ( i = 0; i < Saig_ManPoNum(pAig); i++ )
296 p->pTime4Outs[i] = pPars->nTimeOutOne * CLOCKS_PER_SEC / 1000 + 1;
297 }
298 if ( pPars->fSolveAll )
299 {
300 p->vCexes = Vec_PtrStart( Saig_ManPoNum(p->pAig) );
301 p->pPars->vOutMap = Vec_IntAlloc( Saig_ManPoNum(pAig) );
302 Vec_IntFill( p->pPars->vOutMap, Saig_ManPoNum(pAig), -2 );
303 }
304 return p;
305}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
void Aig_ManFanoutStart(Aig_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition aigFanout.c:56
int Aig_ManLevels(Aig_Man_t *p)
Definition aigUtil.c:102
Cnf_Man_t * Cnf_ManStart()
FUNCTION DEFINITIONS ///.
Definition cnfMan.c:51
Gia_Man_t * Gia_ManFromAigSimple(Aig_Man_t *p)
Definition giaAig.c:212
Txs3_Man_t * Txs3_ManStart(Pdr_Man_t *pMan, Aig_Man_t *pAig, Vec_Int_t *vPrio)
FUNCTION DEFINITIONS ///.
Definition pdrTsim3.c:63
struct Pdr_Man_t_ Pdr_Man_t
Definition pdrInt.h:95
Vec_Int_t * Pdr_ManDeriveFlopPriorities2(Gia_Man_t *p, int fMuxCtrls)
Definition pdrMan.c:153
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pdr_ManStop()

void Pdr_ManStop ( Pdr_Man_t * p)
extern

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

Synopsis [Frees manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 318 of file pdrMan.c.

319{
320 Pdr_Set_t * pCla;
321 sat_solver * pSat;
322 int i, k;
323 Gia_ManStopP( &p->pGia );
324 Aig_ManCleanMarkAB( p->pAig );
325 if ( p->pPars->fVerbose )
326 {
327 Abc_Print( 1, "Block =%5d Oblig =%6d Clause =%6d Call =%6d (sat=%.1f%%) Cex =%4d Start =%4d\n",
328 p->nBlocks, p->nObligs, p->nCubes, p->nCalls, 100.0 * p->nCallsS / p->nCalls, p->nCexesTotal, p->nStarts );
329 ABC_PRTP( "SAT solving", p->tSat, p->tTotal );
330 ABC_PRTP( " unsat ", p->tSatUnsat, p->tTotal );
331 ABC_PRTP( " sat ", p->tSatSat, p->tTotal );
332 ABC_PRTP( "Generalize ", p->tGeneral, p->tTotal );
333 ABC_PRTP( "Push clause", p->tPush, p->tTotal );
334 ABC_PRTP( "Ternary sim", p->tTsim, p->tTotal );
335 ABC_PRTP( "Containment", p->tContain, p->tTotal );
336 ABC_PRTP( "CNF compute", p->tCnf, p->tTotal );
337 ABC_PRTP( "Refinement ", p->tAbs, p->tTotal );
338 ABC_PRTP( "TOTAL ", p->tTotal, p->tTotal );
339 fflush( stdout );
340 }
341// Abc_Print( 1, "SS =%6d. SU =%6d. US =%6d. UU =%6d.\n", p->nCasesSS, p->nCasesSU, p->nCasesUS, p->nCasesUU );
342 Vec_PtrForEachEntry( sat_solver *, p->vSolvers, pSat, i )
343 sat_solver_delete( pSat );
344 Vec_PtrFree( p->vSolvers );
345 Vec_VecForEachEntry( Pdr_Set_t *, p->vClauses, pCla, i, k )
346 Pdr_SetDeref( pCla );
347 Vec_VecFree( p->vClauses );
348 Pdr_QueueStop( p );
349 ABC_FREE( p->pOrder );
350 Vec_IntFree( p->vActVars );
351 // static CNF
352 Cnf_DataFree( p->pCnf1 );
353 Vec_IntFreeP( &p->vVar2Reg );
354 // dynamic CNF
355 Cnf_DataFree( p->pCnf2 );
356 if ( p->pvId2Vars )
357 for ( i = 0; i < Aig_ManObjNumMax(p->pAig); i++ )
358 ABC_FREE( p->pvId2Vars[i].pArray );
359 ABC_FREE( p->pvId2Vars );
360// Vec_VecFreeP( (Vec_Vec_t **)&p->vVar2Ids );
361 for ( i = 0; i < Vec_PtrSize(&p->vVar2Ids); i++ )
362 Vec_IntFree( (Vec_Int_t *)Vec_PtrEntry(&p->vVar2Ids, i) );
363 ABC_FREE( p->vVar2Ids.pArray );
364 Vec_WecFreeP( &p->vVLits );
365 // CNF manager
366 Cnf_ManStop( p->pCnfMan );
367 Vec_IntFreeP( &p->vAbsFlops );
368 Vec_IntFreeP( &p->vMapFf2Ppi );
369 Vec_IntFreeP( &p->vMapPpi2Ff );
370 // terminary simulation
371 if ( p->pPars->fNewXSim )
372 Txs3_ManStop( p->pTxs3 );
373 // internal use
374 Vec_IntFreeP( &p->vPrio ); // priority flops
375 Vec_IntFree( p->vLits ); // array of literals
376 Vec_IntFree( p->vCiObjs ); // cone leaves
377 Vec_IntFree( p->vCoObjs ); // cone roots
378 Vec_IntFree( p->vCiVals ); // cone leaf values
379 Vec_IntFree( p->vCoVals ); // cone root values
380 Vec_IntFree( p->vNodes ); // cone nodes
381 Vec_IntFree( p->vUndo ); // cone undos
382 Vec_IntFree( p->vVisits ); // intermediate
383 Vec_IntFree( p->vCi2Rem ); // CIs to be removed
384 Vec_IntFree( p->vRes ); // final result
385 Vec_PtrFreeP( &p->vInfCubes );
386 ABC_FREE( p->pTime4Outs );
387 if ( p->vCexes )
388 Vec_PtrFreeFree( p->vCexes );
389 // additional AIG data-members
390 if ( p->pAig->pFanData != NULL )
391 Aig_ManFanoutStop( p->pAig );
392 if ( p->pAig->pTerSimData != NULL )
393 ABC_FREE( p->pAig->pTerSimData );
394 ABC_FREE( p );
395}
#define ABC_PRTP(a, t, T)
Definition abc_global.h:258
void Aig_ManFanoutStop(Aig_Man_t *p)
Definition aigFanout.c:89
void Aig_ManCleanMarkAB(Aig_Man_t *p)
Definition aigUtil.c:186
void Cnf_DataFree(Cnf_Dat_t *p)
Definition cnfMan.c:207
void Cnf_ManStop(Cnf_Man_t *p)
Definition cnfMan.c:82
void Gia_ManStopP(Gia_Man_t **p)
Definition giaMan.c:224
void Pdr_QueueStop(Pdr_Man_t *p)
Definition pdrUtil.c:699
void Pdr_SetDeref(Pdr_Set_t *p)
Definition pdrUtil.c:208
void Txs3_ManStop(Txs3_Man_t *)
Definition pdrTsim3.c:87
void sat_solver_delete(sat_solver *s)
Definition satSolver.c:1341
#define Vec_VecForEachEntry(Type, vGlob, pEntry, i, k)
Definition vecVec.h:87
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pdr_ManTernarySim()

Pdr_Set_t * Pdr_ManTernarySim ( Pdr_Man_t * p,
int k,
Pdr_Set_t * pCube )
extern

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 }
386if ( p->pPars->fVeryVerbose )
387{
388Abc_Print( 1, "Trying to justify cube " );
389if ( pCube )
390 Pdr_SetPrint( stdout, pCube, Aig_ManRegNum(p->pAig), NULL );
391else
392 Abc_Print( 1, "<prop=fail>" );
393Abc_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
402if ( p->pPars->fVeryVerbose )
403Pdr_ManPrintCex( p->pAig, vCiObjs, vCiVals, NULL );
404 RetValue = Pdr_ManSimDataInit( p->pAig, vCiObjs, vCiVals, vNodes, vCoObjs, vCoVals, NULL );
405 assert( RetValue );
406
407 // iteratively remove flops
408 if ( p->pPars->fFlopPrio )
409 {
410 // collect flops and sort them by priority
411 Vec_IntClear( vRes );
412 Aig_ManForEachObjVec( vCiObjs, p->pAig, pObj, i )
413 {
414 if ( !Saig_ObjIsLo( p->pAig, pObj ) )
415 continue;
416 Entry = Aig_ObjCioId(pObj) - Saig_ManPiNum(p->pAig);
417 Vec_IntPush( vRes, Entry );
418 }
419 Vec_IntSelectSortCost( Vec_IntArray(vRes), Vec_IntSize(vRes), vPrio );
420
421 // try removing flops starting from low-priority to high-priority
422 Vec_IntClear( vCi2Rem );
423 Vec_IntForEachEntry( vRes, Entry, i )
424 {
425 pObj = Aig_ManCi( p->pAig, Saig_ManPiNum(p->pAig) + Entry );
426 assert( Saig_ObjIsLo( p->pAig, pObj ) );
427 Vec_IntClear( vUndo );
428 if ( Pdr_ManExtendOne( p->pAig, pObj, vUndo, vVisits ) )
429 Vec_IntPush( vCi2Rem, Aig_ObjId(pObj) );
430 else
431 Pdr_ManExtendUndo( p->pAig, vUndo );
432 }
433 }
434 else
435 {
436 // try removing low-priority flops first
437 Vec_IntClear( vCi2Rem );
438 Aig_ManForEachObjVec( vCiObjs, p->pAig, pObj, i )
439 {
440 if ( !Saig_ObjIsLo( p->pAig, pObj ) )
441 continue;
442 Entry = Aig_ObjCioId(pObj) - Saig_ManPiNum(p->pAig);
443 if ( Vec_IntEntry(vPrio, Entry) )
444 continue;
445 Vec_IntClear( vUndo );
446 if ( Pdr_ManExtendOne( p->pAig, pObj, vUndo, vVisits ) )
447 Vec_IntPush( vCi2Rem, Aig_ObjId(pObj) );
448 else
449 Pdr_ManExtendUndo( p->pAig, vUndo );
450 }
451 // try removing high-priority flops next
452 Aig_ManForEachObjVec( vCiObjs, p->pAig, pObj, i )
453 {
454 if ( !Saig_ObjIsLo( p->pAig, pObj ) )
455 continue;
456 Entry = Aig_ObjCioId(pObj) - Saig_ManPiNum(p->pAig);
457 if ( !Vec_IntEntry(vPrio, Entry) )
458 continue;
459 Vec_IntClear( vUndo );
460 if ( Pdr_ManExtendOne( p->pAig, pObj, vUndo, vVisits ) )
461 Vec_IntPush( vCi2Rem, Aig_ObjId(pObj) );
462 else
463 Pdr_ManExtendUndo( p->pAig, vUndo );
464 }
465 }
466
467if ( p->pPars->fVeryVerbose )
468Pdr_ManPrintCex( p->pAig, vCiObjs, vCiVals, vCi2Rem );
469 RetValue = Pdr_ManSimDataInit( p->pAig, vCiObjs, vCiVals, vNodes, vCoObjs, vCoVals, vCi2Rem );
470 assert( RetValue );
471
472 // derive the set of resulting registers
473 Pdr_ManDeriveResult( p->pAig, vCiObjs, vCiVals, vCi2Rem, vRes, vPiLits );
474 assert( Vec_IntSize(vRes) > 0 );
475 //p->tTsim += Abc_Clock() - clk;
476
477 // move abstracted literals from flops to inputs
478 if ( p->pPars->fUseAbs && p->vAbsFlops )
479 {
480 int i, iLit, k = 0;
481 Vec_IntForEachEntry( vRes, iLit, i )
482 {
483 if ( Vec_IntEntry(p->vAbsFlops, Abc_Lit2Var(iLit)) ) // used flop
484 Vec_IntWriteEntry( vRes, k++, iLit );
485 else
486 Vec_IntPush( vPiLits, 2*Saig_ManPiNum(p->pAig) + iLit );
487 }
488 Vec_IntShrink( vRes, k );
489 }
490 pRes = Pdr_SetCreate( vRes, vPiLits );
491 //ZH: Disabled assertion because this invariant doesn't hold with down
492 //because of the join operation which can bring in initial states
493 //assert( k == 0 || !Pdr_SetIsInit(pRes, -1) );
494 return pRes;
495}
Pdr_Set_t * Pdr_SetCreate(Vec_Int_t *vLits, Vec_Int_t *vPiLits)
Definition pdrUtil.c:65
void Pdr_ManCollectValues(Pdr_Man_t *p, int k, Vec_Int_t *vObjIds, Vec_Int_t *vValues)
Definition pdrSat.c:236
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
void Pdr_ManCollectCone(Aig_Man_t *pAig, Vec_Int_t *vCoObjs, Vec_Int_t *vCiObjs, Vec_Int_t *vNodes)
Definition pdrTsim.c:107
void Pdr_ManPrintCex(Aig_Man_t *pAig, Vec_Int_t *vCiObjs, Vec_Int_t *vCiVals, Vec_Int_t *vCi2Rem)
Definition pdrTsim.c:317
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_ManExtendOne(Aig_Man_t *pAig, Aig_Obj_t *pObj, Vec_Int_t *vUndo, Vec_Int_t *vVis)
Definition pdrTsim.c:199
void Pdr_ManExtendUndo(Aig_Man_t *pAig, Vec_Int_t *vUndo)
Definition pdrTsim.c:251
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pdr_ManVerifyInvariant()

void Pdr_ManVerifyInvariant ( Pdr_Man_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 500 of file pdrInv.c.

501{
502 sat_solver * pSat;
503 Vec_Int_t * vLits;
504 Vec_Ptr_t * vCubes;
505 Pdr_Set_t * pCube;
506 int i, kStart, kThis, RetValue, Counter = 0;
507 abctime clk = Abc_Clock();
508 // collect cubes used in the inductive invariant
509 kStart = Pdr_ManFindInvariantStart( p );
510 vCubes = Pdr_ManCollectCubes( p, kStart );
511 // create solver with the cubes
512 kThis = Vec_PtrSize(p->vSolvers);
513 pSat = Pdr_ManCreateSolver( p, kThis );
514 // add the property output
515// Pdr_ManSetPropertyOutput( p, kThis );
516 // add the clauses
517 Vec_PtrForEachEntry( Pdr_Set_t *, vCubes, pCube, i )
518 {
519 vLits = Pdr_ManCubeToLits( p, kThis, pCube, 1, 0 );
520 RetValue = sat_solver_addclause( pSat, Vec_IntArray(vLits), Vec_IntArray(vLits) + Vec_IntSize(vLits) );
521 assert( RetValue );
522 sat_solver_compress( pSat );
523 }
524 // check each clause
525 Vec_PtrForEachEntry( Pdr_Set_t *, vCubes, pCube, i )
526 {
527 vLits = Pdr_ManCubeToLits( p, kThis, pCube, 0, 1 );
528 RetValue = sat_solver_solve( pSat, Vec_IntArray(vLits), Vec_IntArray(vLits) + Vec_IntSize(vLits), 0, 0, 0, 0 );
529 if ( RetValue != l_False )
530 {
531 Abc_Print( 1, "Verification of clause %d failed.\n", i );
532 Counter++;
533 }
534 }
535 if ( Counter )
536 Abc_Print( 1, "Verification of %d clauses has failed.\n", Counter );
537 else
538 {
539 Abc_Print( 1, "Verification of invariant with %d clauses was successful. ", Vec_PtrSize(vCubes) );
540 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
541 }
542// sat_solver_delete( pSat );
543 Vec_PtrFree( vCubes );
544}
sat_solver * Pdr_ManCreateSolver(Pdr_Man_t *p, int k)
DECLARATIONS ///.
Definition pdrSat.c:45
Vec_Int_t * Pdr_ManCubeToLits(Pdr_Man_t *p, int k, Pdr_Set_t *pCube, int fCompl, int fNext)
Definition pdrSat.c:144
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pdr_ObjRegNum()

int Pdr_ObjRegNum ( Pdr_Man_t * p,
int k,
int iSatVar )
extern

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}
Here is the caller graph for this function:

◆ Pdr_ObjSatVar()

int Pdr_ObjSatVar ( Pdr_Man_t * p,
int k,
int Pol,
Aig_Obj_t * pObj )
extern

FUNCTION DECLARATIONS ///.

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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pdr_OblDeref()

void Pdr_OblDeref ( Pdr_Obl_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 556 of file pdrUtil.c.

557{
558 if ( --p->nRefs == 0 )
559 {
560 if ( p->pNext )
561 Pdr_OblDeref( p->pNext );
562 Pdr_SetDeref( p->pState );
563 ABC_FREE( p );
564 }
565}
void Pdr_OblDeref(Pdr_Obl_t *p)
Definition pdrUtil.c:556
void Pdr_SetDeref(Pdr_Set_t *p)
Definition pdrUtil.c:208
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pdr_OblRef()

Pdr_Obl_t * Pdr_OblRef ( Pdr_Obl_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 539 of file pdrUtil.c.

540{
541 p->nRefs++;
542 return p;
543}
Here is the caller graph for this function:

◆ Pdr_OblStart()

Pdr_Obl_t * Pdr_OblStart ( int k,
int prio,
Pdr_Set_t * pState,
Pdr_Obl_t * pNext )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 515 of file pdrUtil.c.

516{
517 Pdr_Obl_t * p;
518 p = ABC_ALLOC( Pdr_Obl_t, 1 );
519 p->iFrame = k;
520 p->prio = prio;
521 p->nRefs = 1;
522 p->pState = pState;
523 p->pNext = pNext;
524 p->pLink = NULL;
525 return p;
526}
Here is the caller graph for this function:

◆ Pdr_QueueClean()

void Pdr_QueueClean ( Pdr_Man_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 632 of file pdrUtil.c.

633{
634 Pdr_Obl_t * pThis;
635 while ( (pThis = Pdr_QueuePop(p)) )
636 Pdr_OblDeref( pThis );
637 pThis = NULL;
638}
Pdr_Obl_t * Pdr_QueuePop(Pdr_Man_t *p)
Definition pdrUtil.c:610
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pdr_QueueHead()

Pdr_Obl_t * Pdr_QueueHead ( Pdr_Man_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 594 of file pdrUtil.c.

595{
596 return p->pQueue;
597}
Here is the caller graph for this function:

◆ Pdr_QueueIsEmpty()

int Pdr_QueueIsEmpty ( Pdr_Man_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 578 of file pdrUtil.c.

579{
580 return p->pQueue == NULL;
581}
Here is the caller graph for this function:

◆ Pdr_QueuePop()

Pdr_Obl_t * Pdr_QueuePop ( Pdr_Man_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 610 of file pdrUtil.c.

611{
612 Pdr_Obl_t * pRes = p->pQueue;
613 if ( p->pQueue == NULL )
614 return NULL;
615 p->pQueue = p->pQueue->pLink;
616 Pdr_OblDeref( pRes );
617 p->nQueCur--;
618 return pRes;
619}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pdr_QueuePrint()

void Pdr_QueuePrint ( Pdr_Man_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 681 of file pdrUtil.c.

682{
683 Pdr_Obl_t * pObl;
684 for ( pObl = p->pQueue; pObl; pObl = pObl->pLink )
685 Abc_Print( 1, "Frame = %2d. Prio = %8d.\n", pObl->iFrame, pObl->prio );
686}
int prio
Definition pdrInt.h:88
Pdr_Obl_t * pLink
Definition pdrInt.h:92
int iFrame
Definition pdrInt.h:87

◆ Pdr_QueuePush()

void Pdr_QueuePush ( Pdr_Man_t * p,
Pdr_Obl_t * pObl )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 651 of file pdrUtil.c.

652{
653 Pdr_Obl_t * pTemp, ** ppPrev;
654 p->nObligs++;
655 p->nQueCur++;
656 p->nQueMax = Abc_MaxInt( p->nQueMax, p->nQueCur );
657 Pdr_OblRef( pObl );
658 if ( p->pQueue == NULL )
659 {
660 p->pQueue = pObl;
661 return;
662 }
663 for ( ppPrev = &p->pQueue, pTemp = p->pQueue; pTemp; ppPrev = &pTemp->pLink, pTemp = pTemp->pLink )
664 if ( pTemp->iFrame > pObl->iFrame || (pTemp->iFrame == pObl->iFrame && pTemp->prio > pObl->prio) )
665 break;
666 *ppPrev = pObl;
667 pObl->pLink = pTemp;
668}
Pdr_Obl_t * Pdr_OblRef(Pdr_Obl_t *p)
Definition pdrUtil.c:539
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pdr_QueueStop()

void Pdr_QueueStop ( Pdr_Man_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 699 of file pdrUtil.c.

700{
701 Pdr_Obl_t * pObl;
702 while ( !Pdr_QueueIsEmpty(p) )
703 {
704 pObl = Pdr_QueuePop(p);
705 Pdr_OblDeref( pObl );
706 }
707 p->pQueue = NULL;
708 p->nQueCur = 0;
709}
int Pdr_QueueIsEmpty(Pdr_Man_t *p)
Definition pdrUtil.c:578
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pdr_SetAlloc()

Pdr_Set_t * Pdr_SetAlloc ( int nSize)
extern

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}

◆ Pdr_SetCompare()

int Pdr_SetCompare ( Pdr_Set_t ** pp1,
Pdr_Set_t ** pp2 )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 485 of file pdrUtil.c.

486{
487 Pdr_Set_t * p1 = *pp1;
488 Pdr_Set_t * p2 = *pp2;
489 int i;
490 for ( i = 0; i < p1->nLits && i < p2->nLits; i++ )
491 {
492 if ( p1->Lits[i] > p2->Lits[i] )
493 return -1;
494 if ( p1->Lits[i] < p2->Lits[i] )
495 return 1;
496 }
497 if ( i == p1->nLits && i < p2->nLits )
498 return -1;
499 if ( i < p1->nLits && i == p2->nLits )
500 return 1;
501 return 0;
502}
Here is the caller graph for this function:

◆ Pdr_SetContains()

int Pdr_SetContains ( Pdr_Set_t * pOld,
Pdr_Set_t * pNew )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 382 of file pdrUtil.c.

383{
384 int * pOldInt, * pNewInt;
385 assert( pOld->nLits > 0 );
386 assert( pNew->nLits > 0 );
387 if ( pOld->nLits < pNew->nLits )
388 return 0;
389 if ( (pOld->Sign & pNew->Sign) != pNew->Sign )
390 return 0;
391 pOldInt = pOld->Lits + pOld->nLits - 1;
392 pNewInt = pNew->Lits + pNew->nLits - 1;
393 while ( pNew->Lits <= pNewInt )
394 {
395 if ( pOld->Lits > pOldInt )
396 return 0;
397 assert( *pNewInt != -1 );
398 assert( *pOldInt != -1 );
399 if ( *pNewInt == *pOldInt )
400 pNewInt--, pOldInt--;
401 else if ( *pNewInt < *pOldInt )
402 pOldInt--;
403 else
404 return 0;
405 }
406 return 1;
407}
word Sign
Definition pdrInt.h:77
Here is the caller graph for this function:

◆ Pdr_SetContainsSimple()

int Pdr_SetContainsSimple ( Pdr_Set_t * pOld,
Pdr_Set_t * pNew )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 420 of file pdrUtil.c.

421{
422 int * pOldInt, * pNewInt;
423 assert( pOld->nLits > 0 );
424 assert( pNew->nLits > 0 );
425 pOldInt = pOld->Lits + pOld->nLits - 1;
426 pNewInt = pNew->Lits + pNew->nLits - 1;
427 while ( pNew->Lits <= pNewInt )
428 {
429 assert( *pOldInt != -1 );
430 if ( *pNewInt == -1 )
431 {
432 pNewInt--;
433 continue;
434 }
435 if ( pOld->Lits > pOldInt )
436 return 0;
437 assert( *pNewInt != -1 );
438 assert( *pOldInt != -1 );
439 if ( *pNewInt == *pOldInt )
440 pNewInt--, pOldInt--;
441 else if ( *pNewInt < *pOldInt )
442 pOldInt--;
443 else
444 return 0;
445 }
446 return 1;
447}

◆ Pdr_SetCreate()

Pdr_Set_t * Pdr_SetCreate ( Vec_Int_t * vLits,
Vec_Int_t * vPiLits )
extern

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}
int nTotal
DECLARATIONS ///.
Definition cutTruth.c:37
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
Here is the caller graph for this function:

◆ Pdr_SetCreateFrom()

Pdr_Set_t * Pdr_SetCreateFrom ( Pdr_Set_t * pSet,
int iRemove )
extern

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}
int nTotal
Definition pdrInt.h:79
Here is the caller graph for this function:

◆ Pdr_SetCreateSubset()

Pdr_Set_t * Pdr_SetCreateSubset ( Pdr_Set_t * pSet,
int * pLits,
int nLits )
extern

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}
Here is the caller graph for this function:

◆ Pdr_SetDeref()

void Pdr_SetDeref ( Pdr_Set_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 208 of file pdrUtil.c.

209{
210 if ( --p->nRefs == 0 )
211 ABC_FREE( p );
212}
Here is the caller graph for this function:

◆ Pdr_SetDup()

Pdr_Set_t * Pdr_SetDup ( Pdr_Set_t * pSet)
extern

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}
Here is the caller graph for this function:

◆ Pdr_SetIsInit()

int Pdr_SetIsInit ( Pdr_Set_t * pCube,
int iRemove )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 460 of file pdrUtil.c.

461{
462 int i;
463 for ( i = 0; i < pCube->nLits; i++ )
464 {
465 assert( pCube->Lits[i] != -1 );
466 if ( i == iRemove )
467 continue;
468 if ( Abc_LitIsCompl( pCube->Lits[i] ) == 0 )
469 return 0;
470 }
471 return 1;
472}
Here is the caller graph for this function:

◆ Pdr_SetPrint()

void Pdr_SetPrint ( FILE * pFile,
Pdr_Set_t * p,
int nRegs,
Vec_Int_t * vFlopCounts )
extern

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[Abc_Lit2Var(p->Lits[i])] = (Abc_LitIsCompl(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}
Here is the caller graph for this function:

◆ Pdr_SetPrintStr()

void Pdr_SetPrintStr ( Vec_Str_t * vStr,
Pdr_Set_t * p,
int nRegs,
Vec_Int_t * vFlopCounts )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 342 of file pdrUtil.c.

343{
344 char * pBuff;
345 int i, k = 0, Entry;
346 pBuff = ABC_ALLOC( char, nRegs + 1 );
347 for ( i = 0; i < nRegs; i++ )
348 pBuff[i] = '-';
349 pBuff[i] = 0;
350 for ( i = 0; i < p->nLits; i++ )
351 {
352 if ( p->Lits[i] == -1 )
353 continue;
354 pBuff[Abc_Lit2Var(p->Lits[i])] = (Abc_LitIsCompl(p->Lits[i])? '0':'1');
355 }
356 if ( vFlopCounts )
357 {
358 // skip some literals
359 Vec_IntForEachEntry( vFlopCounts, Entry, i )
360 if ( Entry )
361 pBuff[k++] = pBuff[i];
362 pBuff[k] = 0;
363 }
364 Vec_StrPushBuffer( vStr, pBuff, k );
365 Vec_StrPush( vStr, ' ' );
366 Vec_StrPush( vStr, '1' );
367 Vec_StrPush( vStr, '\n' );
368 ABC_FREE( pBuff );
369}
Here is the caller graph for this function:

◆ Pdr_SetRef()

Pdr_Set_t * Pdr_SetRef ( Pdr_Set_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 191 of file pdrUtil.c.

192{
193 p->nRefs++;
194 return p;
195}

◆ Txs3_ManStart()

Txs3_Man_t * Txs3_ManStart ( Pdr_Man_t * pMan,
Aig_Man_t * pAig,
Vec_Int_t * vPrio )
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Start and stop the ternary simulation engine.]

Description []

SideEffects []

SeeAlso []

Definition at line 63 of file pdrTsim3.c.

64{
65 Txs3_Man_t * p;
66// Aig_Obj_t * pObj;
67// int i;
68 assert( Vec_IntSize(vPrio) == Aig_ManRegNum(pAig) );
69 p = ABC_CALLOC( Txs3_Man_t, 1 );
70 p->pGia = Gia_ManFromAigSimple(pAig); // user's AIG
71// Aig_ManForEachObj( pAig, pObj, i )
72// assert( i == 0 || pObj->iData == Abc_Var2Lit(i, 0) );
73 p->vPrio = vPrio; // priority of each flop
74 p->vCiObjs = Vec_IntAlloc( 100 ); // cone leaves (CI obj IDs)
75 p->vFosPre = Vec_IntAlloc( 100 ); // present flop outputs
76 p->vFosAbs = Vec_IntAlloc( 100 ); // absracted flop outputs
77 p->vCoObjs = Vec_IntAlloc( 100 ); // cone roots (CO obj IDs)
78 p->vCiVals = Vec_IntAlloc( 100 ); // cone leaf values (0/1 CI values)
79 p->vCoVals = Vec_IntAlloc( 100 ); // cone root values (0/1 CO values)
80 p->vNodes = Vec_IntAlloc( 100 ); // cone nodes (node obj IDs)
81 p->vTemp = Vec_IntAlloc( 100 ); // cone nodes (node obj IDs)
82 p->vPiLits = Vec_IntAlloc( 100 ); // resulting array of PI literals
83 p->vFfLits = Vec_IntAlloc( 100 ); // resulting array of flop literals
84 p->pMan = pMan; // calling manager
85 return p;
86}
struct Txs3_Man_t_ Txs3_Man_t
Definition pdrInt.h:72
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Txs3_ManStop()

void Txs3_ManStop ( Txs3_Man_t * p)
extern

Definition at line 87 of file pdrTsim3.c.

88{
89 Gia_ManStop( p->pGia );
90 Vec_IntFree( p->vCiObjs );
91 Vec_IntFree( p->vFosPre );
92 Vec_IntFree( p->vFosAbs );
93 Vec_IntFree( p->vCoObjs );
94 Vec_IntFree( p->vCiVals );
95 Vec_IntFree( p->vCoVals );
96 Vec_IntFree( p->vNodes );
97 Vec_IntFree( p->vTemp );
98 Vec_IntFree( p->vPiLits );
99 Vec_IntFree( p->vFfLits );
100 ABC_FREE( p );
101}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Txs3_ManTernarySim()

Pdr_Set_t * Txs3_ManTernarySim ( Txs3_Man_t * p,
int k,
Pdr_Set_t * pCube )
extern

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 188 of file pdrTsim3.c.

189{
190// int fTryNew = 1;
191// int fUseLit = 1;
192 int fVerbose = 0;
193 sat_solver * pSat;
194 Pdr_Set_t * pRes;
195 Gia_Obj_t * pObj;
196 Vec_Int_t * vVar2Ids, * vLits;
197 int i, Lit, LitAux, Var, Value, RetValue, nCoreLits, * pCoreLits;//, nLits;
198// if ( k == 0 )
199// fVerbose = 1;
200 // collect CO objects
201 Vec_IntClear( p->vCoObjs );
202 if ( pCube == NULL ) // the target is the property output
203 {
204 pObj = Gia_ManCo(p->pGia, p->pMan->iOutCur);
205 Vec_IntPush( p->vCoObjs, Gia_ObjId(p->pGia, pObj) );
206 }
207 else // the target is the cube
208 {
209 int i;
210 for ( i = 0; i < pCube->nLits; i++ )
211 {
212 if ( pCube->Lits[i] == -1 )
213 continue;
214 pObj = Gia_ManCo(p->pGia, Gia_ManPoNum(p->pGia) + Abc_Lit2Var(pCube->Lits[i]));
215 Vec_IntPush( p->vCoObjs, Gia_ObjId(p->pGia, pObj) );
216 }
217 }
218if ( 0 )
219{
220Abc_Print( 1, "Trying to justify cube " );
221if ( pCube )
222 Pdr_SetPrint( stdout, pCube, Gia_ManRegNum(p->pGia), NULL );
223else
224 Abc_Print( 1, "<prop=fail>" );
225Abc_Print( 1, " in frame %d.\n", k );
226}
227
228 // collect CI objects
229 Txs3_ManCollectCone( p, fVerbose );
230 // collect values
231 Pdr_ManCollectValues( p->pMan, k, p->vCiObjs, p->vCiVals );
232 Pdr_ManCollectValues( p->pMan, k, p->vCoObjs, p->vCoVals );
233
234 // read solver
235 pSat = Pdr_ManFetchSolver( p->pMan, k );
236 LitAux = Abc_Var2Lit( Pdr_ManFreeVar(p->pMan, k), 0 );
237 // add the clause (complemented cube) in terms of next state variables
238 if ( pCube == NULL ) // the target is the property output
239 {
240 vLits = p->pMan->vLits;
241 Lit = Abc_Var2Lit( Pdr_ObjSatVar(p->pMan, k, 2, Aig_ManCo(p->pMan->pAig, p->pMan->iOutCur)), 1 ); // neg literal (property holds)
242 Vec_IntFill( vLits, 1, Lit );
243 }
244 else
245 vLits = Pdr_ManCubeToLits( p->pMan, k, pCube, 1, 1 );
246 // add activation literal
247 Vec_IntPush( vLits, LitAux );
248 RetValue = sat_solver_addclause( pSat, Vec_IntArray(vLits), Vec_IntArray(vLits) + Vec_IntSize(vLits) );
249 assert( RetValue == 1 );
250 sat_solver_compress( pSat );
251
252 // collect assumptions
253 Vec_IntClear( p->vTemp );
254 Vec_IntPush( p->vTemp, Abc_LitNot(LitAux) );
255 // iterate through the values of the CI variables
256 Vec_IntForEachEntryTwo( p->vCiObjs, p->vCiVals, Var, Value, i )
257 {
258 Aig_Obj_t * pObj = Aig_ManObj( p->pMan->pAig, Var );
259// iVar = Pdr_ObjSatVar( p->pMan, k, fNext ? 2 - lit_sign(pCube->Lits[i]) : 3, pObj ); assert( iVar >= 0 );
260 int iVar = Pdr_ObjSatVar( p->pMan, k, 3, pObj ); assert( iVar >= 0 );
261 assert( Aig_ObjIsCi(pObj) );
262 Vec_IntPush( p->vTemp, Abc_Var2Lit(iVar, !Value) );
263 }
264 if ( fVerbose )
265 {
266 printf( "Clause with %d lits on lev %d\n", pCube ? pCube->nLits : 0, k );
267 Vec_IntPrint( p->vTemp );
268 }
269
270/*
271 // solve with assumptions
272//printf( "%d -> ", Vec_IntSize(p->vTemp) );
273{
274abctime clk = Abc_Clock();
275// assume all except flops
276 Vec_IntForEachEntryStop( p->vTemp, Lit, i, p->nPiLits + 1 )
277 if ( !sat_solver_push(pSat, Lit) )
278 {
279 assert( 0 );
280 }
281 nLits = sat_solver_minimize_assumptions( pSat, Vec_IntArray(p->vTemp) + p->nPiLits + 1, Vec_IntSize(p->vTemp) - p->nPiLits - 1, p->pMan->pPars->nConfLimit );
282 Vec_IntShrink( p->vTemp, p->nPiLits + 1 + nLits );
283
284p->pMan->tAbs += Abc_Clock() - clk;
285 for ( i = 0; i <= p->nPiLits; i++ )
286 sat_solver_pop(pSat);
287}
288//printf( "%d ", nLits );
289*/
290
291
292 //check one last time
293 RetValue = sat_solver_solve( pSat, Vec_IntArray(p->vTemp), Vec_IntLimit(p->vTemp), 0, 0, 0, 0 );
294 assert( RetValue == l_False );
295
296 // use analyze final
297 nCoreLits = sat_solver_final(pSat, &pCoreLits);
298 //assert( Vec_IntSize(p->vTemp) <= nCoreLits );
299
300 Vec_IntClear( p->vTemp );
301 for ( i = 0; i < nCoreLits; i++ )
302 Vec_IntPush( p->vTemp, Abc_LitNot(pCoreLits[i]) );
303 Vec_IntSelectSort( Vec_IntArray(p->vTemp), Vec_IntSize(p->vTemp) );
304
305 if ( fVerbose )
306 Vec_IntPrint( p->vTemp );
307
308 // collect the resulting sets
309 Vec_IntClear( p->vPiLits );
310 Vec_IntClear( p->vFfLits );
311 vVar2Ids = (Vec_Int_t *)Vec_PtrGetEntry( &p->pMan->vVar2Ids, k );
312 Vec_IntForEachEntry( p->vTemp, Lit, i )
313 {
314 if ( Lit != Abc_LitNot(LitAux) )
315 {
316 int Id = Vec_IntEntry( vVar2Ids, Abc_Lit2Var(Lit) );
317 Aig_Obj_t * pObj = Aig_ManObj( p->pMan->pAig, Id );
318 assert( Aig_ObjIsCi(pObj) );
319 if ( Saig_ObjIsPi(p->pMan->pAig, pObj) )
320 Vec_IntPush( p->vPiLits, Abc_Var2Lit(Aig_ObjCioId(pObj), Abc_LitIsCompl(Lit)) );
321 else
322 Vec_IntPush( p->vFfLits, Abc_Var2Lit(Aig_ObjCioId(pObj) - Saig_ManPiNum(p->pMan->pAig), Abc_LitIsCompl(Lit)) );
323 }
324 }
325 assert( Vec_IntSize(p->vTemp) == Vec_IntSize(p->vPiLits) + Vec_IntSize(p->vFfLits) + 1 );
326
327 // move abstracted literals from flops to inputs
328 if ( p->pMan->pPars->fUseAbs && p->pMan->vAbsFlops )
329 {
330 int i, iLit, k = 0;
331 Vec_IntForEachEntry( p->vFfLits, iLit, i )
332 {
333 if ( Vec_IntEntry(p->pMan->vAbsFlops, Abc_Lit2Var(iLit)) ) // used flop
334 Vec_IntWriteEntry( p->vFfLits, k++, iLit );
335 else
336 Vec_IntPush( p->vPiLits, 2*Saig_ManPiNum(p->pMan->pAig) + iLit );
337 }
338 Vec_IntShrink( p->vFfLits, k );
339 }
340
341 if ( fVerbose )
342 Vec_IntPrint( p->vPiLits );
343 if ( fVerbose )
344 Vec_IntPrint( p->vFfLits );
345 if ( fVerbose )
346 printf( "\n" );
347
348 // derive the final set
349 pRes = Pdr_SetCreate( p->vFfLits, p->vPiLits );
350 //ZH: Disabled assertion because this invariant doesn't hold with down
351 //because of the join operation which can bring in initial states
352 assert( k == 0 || !Pdr_SetIsInit(pRes, -1) );
353 return pRes;
354}
int Var
Definition exorList.c:228
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
sat_solver * Pdr_ManFetchSolver(Pdr_Man_t *p, int k)
Definition pdrSat.c:77
int Pdr_SetIsInit(Pdr_Set_t *p, int iRemove)
Definition pdrUtil.c:460
void Txs3_ManCollectCone(Txs3_Man_t *p, int fVerbose)
Definition pdrTsim3.c:140
#define Vec_IntForEachEntryTwo(vVec1, vVec2, Entry1, Entry2, i)
Definition vecInt.h:66
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Txs_ManStart()

Txs_Man_t * Txs_ManStart ( Pdr_Man_t * pMan,
Aig_Man_t * pAig,
Vec_Int_t * vPrio )
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Start and stop the ternary simulation engine.]

Description []

SideEffects []

SeeAlso []

Definition at line 60 of file pdrTsim2.c.

61{
62 Txs_Man_t * p;
63// Aig_Obj_t * pObj;
64// int i;
65 assert( Vec_IntSize(vPrio) == Aig_ManRegNum(pAig) );
66 p = ABC_CALLOC( Txs_Man_t, 1 );
67 p->pGia = Gia_ManFromAigSimple(pAig); // user's AIG
68// Aig_ManForEachObj( pAig, pObj, i )
69// assert( i == 0 || pObj->iData == Abc_Var2Lit(i, 0) );
70 p->vPrio = vPrio; // priority of each flop
71 p->vCiObjs = Vec_IntAlloc( 100 ); // cone leaves (CI obj IDs)
72 p->vCoObjs = Vec_IntAlloc( 100 ); // cone roots (CO obj IDs)
73 p->vCiVals = Vec_IntAlloc( 100 ); // cone leaf values (0/1 CI values)
74 p->vCoVals = Vec_IntAlloc( 100 ); // cone root values (0/1 CO values)
75 p->vNodes = Vec_IntAlloc( 100 ); // cone nodes (node obj IDs)
76 p->vTemp = Vec_IntAlloc( 100 ); // cone nodes (node obj IDs)
77 p->vPiLits = Vec_IntAlloc( 100 ); // resulting array of PI literals
78 p->vFfLits = Vec_IntAlloc( 100 ); // resulting array of flop literals
79 p->pMan = pMan; // calling manager
80 return p;
81}
typedefABC_NAMESPACE_HEADER_START struct Txs_Man_t_ Txs_Man_t
INCLUDES ///.
Definition pdrInt.h:71
Here is the call graph for this function:

◆ Txs_ManStop()

void Txs_ManStop ( Txs_Man_t * p)
extern

Definition at line 82 of file pdrTsim2.c.

83{
84 Gia_ManStop( p->pGia );
85 Vec_IntFree( p->vCiObjs );
86 Vec_IntFree( p->vCoObjs );
87 Vec_IntFree( p->vCiVals );
88 Vec_IntFree( p->vCoVals );
89 Vec_IntFree( p->vNodes );
90 Vec_IntFree( p->vTemp );
91 Vec_IntFree( p->vPiLits );
92 Vec_IntFree( p->vFfLits );
93 ABC_FREE( p );
94}
Here is the call graph for this function:

◆ Txs_ManTernarySim()

Pdr_Set_t * Txs_ManTernarySim ( Txs_Man_t * p,
int k,
Pdr_Set_t * pCube )
extern

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 490 of file pdrTsim2.c.

491{
492 int fTryNew = 1;
493 Pdr_Set_t * pRes;
494 Gia_Obj_t * pObj;
495 // collect CO objects
496 Vec_IntClear( p->vCoObjs );
497 if ( pCube == NULL ) // the target is the property output
498 {
499 pObj = Gia_ManCo(p->pGia, p->pMan->iOutCur);
500 Vec_IntPush( p->vCoObjs, Gia_ObjId(p->pGia, pObj) );
501 }
502 else // the target is the cube
503 {
504 int i;
505 for ( i = 0; i < pCube->nLits; i++ )
506 {
507 if ( pCube->Lits[i] == -1 )
508 continue;
509 pObj = Gia_ManCo(p->pGia, Gia_ManPoNum(p->pGia) + Abc_Lit2Var(pCube->Lits[i]));
510 Vec_IntPush( p->vCoObjs, Gia_ObjId(p->pGia, pObj) );
511 }
512 }
513if ( 0 )
514{
515Abc_Print( 1, "Trying to justify cube " );
516if ( pCube )
517 Pdr_SetPrint( stdout, pCube, Gia_ManRegNum(p->pGia), NULL );
518else
519 Abc_Print( 1, "<prop=fail>" );
520Abc_Print( 1, " in frame %d.\n", k );
521}
522
523 // collect CI objects
524 Txs_ManCollectCone( p->pGia, p->vCoObjs, p->vCiObjs, p->vNodes );
525 // collect values
526 Pdr_ManCollectValues( p->pMan, k, p->vCiObjs, p->vCiVals );
527 Pdr_ManCollectValues( p->pMan, k, p->vCoObjs, p->vCoVals );
528
529 // perform two passes
530 Txs_ManForwardPass( p->pGia, p->vPrio, p->vCiObjs, p->vCiVals, p->vNodes, p->vCoObjs, p->vCoVals );
531 if ( fTryNew )
532 Txs_ManFindCiReduction( p->pGia, p->vPrio, p->vCiObjs, p->vNodes, p->vCoObjs, p->vPiLits, p->vFfLits, p->vTemp );
533 else
534 Txs_ManBackwardPass( p->pGia, p->vCiObjs, p->vNodes, p->vPiLits, p->vFfLits );
535 Txs_ManVerify( p->pGia, p->vCiObjs, p->vNodes, p->vPiLits, p->vFfLits, p->vCoObjs, p->vCoVals );
536
537 // derive the final set
538 pRes = Pdr_SetCreate( p->vFfLits, p->vPiLits );
539 //ZH: Disabled assertion because this invariant doesn't hold with down
540 //because of the join operation which can bring in initial states
541 //assert( k == 0 || !Pdr_SetIsInit(pRes, -1) );
542 return pRes;
543}
void Txs_ManBackwardPass(Gia_Man_t *p, Vec_Int_t *vCiObjs, Vec_Int_t *vNodes, Vec_Int_t *vPiLits, Vec_Int_t *vFfLits)
Definition pdrTsim2.c:217
void Txs_ManVerify(Gia_Man_t *p, Vec_Int_t *vCiObjs, Vec_Int_t *vNodes, Vec_Int_t *vPiLits, Vec_Int_t *vFfLits, Vec_Int_t *vCoObjs, Vec_Int_t *vCoVals)
Definition pdrTsim2.c:436
void Txs_ManForwardPass(Gia_Man_t *p, Vec_Int_t *vPrio, Vec_Int_t *vCiObjs, Vec_Int_t *vCiVals, Vec_Int_t *vNodes, Vec_Int_t *vCoObjs, Vec_Int_t *vCoVals)
Definition pdrTsim2.c:145
void Txs_ManFindCiReduction(Gia_Man_t *p, Vec_Int_t *vPrio, Vec_Int_t *vCiObjs, Vec_Int_t *vNodes, Vec_Int_t *vCoObjs, Vec_Int_t *vPiLits, Vec_Int_t *vFfLits, Vec_Int_t *vTemp)
Definition pdrTsim2.c:391
void Txs_ManCollectCone(Gia_Man_t *p, Vec_Int_t *vCoObjs, Vec_Int_t *vCiObjs, Vec_Int_t *vNodes)
Definition pdrTsim2.c:123
Here is the call graph for this function:

◆ ZPdr_SetIntersection()

Pdr_Set_t * ZPdr_SetIntersection ( Pdr_Set_t * p1,
Pdr_Set_t * p2,
Hash_Int_t * keep )
extern

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

Synopsis [Return the intersection of p1 and p2.]

Description []

SideEffects []

SeeAlso []

Definition at line 283 of file pdrUtil.c.

284{
285 Pdr_Set_t * pIntersection;
286 Vec_Int_t * vCommonLits, * vPiLits;
287 int i, j, nLits;
288 nLits = p1->nLits;
289 if ( p2->nLits < nLits )
290 nLits = p2->nLits;
291 vCommonLits = Vec_IntAlloc( nLits );
292 vPiLits = Vec_IntAlloc( 1 );
293 for ( i = 0, j = 0; i < p1->nLits && j < p2->nLits; )
294 {
295 if ( p1->Lits[i] > p2->Lits[j] )
296 {
297 if ( Hash_IntExists( keep, p2->Lits[j] ) )
298 {
299 //about to drop a literal that should not be dropped
300 Vec_IntFree( vCommonLits );
301 Vec_IntFree( vPiLits );
302 return NULL;
303 }
304 j++;
305 }
306 else if ( p1->Lits[i] < p2->Lits[j] )
307 {
308 if ( Hash_IntExists( keep, p1->Lits[i] ) )
309 {
310 //about to drop a literal that should not be dropped
311 Vec_IntFree( vCommonLits );
312 Vec_IntFree( vPiLits );
313 return NULL;
314 }
315 i++;
316 }
317 else
318 {
319 Vec_IntPush( vCommonLits, p1->Lits[i] );
320 i++;
321 j++;
322 }
323 }
324 pIntersection = Pdr_SetCreate( vCommonLits, vPiLits );
325 Vec_IntFree( vCommonLits );
326 Vec_IntFree( vPiLits );
327 return pIntersection;
328}
Pdr_Set_t * Pdr_SetCreate(Vec_Int_t *vLits, Vec_Int_t *vPiLits)
Definition pdrUtil.c:65
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ZPdr_SetIsInit()

int ZPdr_SetIsInit ( Pdr_Set_t * p)
extern

◆ ZPdr_SetPrint()

void ZPdr_SetPrint ( Pdr_Set_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 263 of file pdrUtil.c.

264{
265 int i;
266 for ( i = 0; i < p->nLits; i++)
267 printf ("%d ", p->Lits[i]);
268 printf ("\n");
269
270}
Here is the caller graph for this function: