abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
pdrMan.c File Reference
#include "pdrInt.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START
Pdr_Man_t
Pdr_ManStart (Aig_Man_t *pAig, Pdr_Par_t *pPars, Vec_Int_t *vPrioInit)
 DECLARATIONS ///. More...
 
void Pdr_ManStop (Pdr_Man_t *p)
 
Abc_Cex_tPdr_ManDeriveCex (Pdr_Man_t *p)
 FUNCTION DECLARATIONS ///. More...
 

Function Documentation

Abc_Cex_t* Pdr_ManDeriveCex ( Pdr_Man_t p)

FUNCTION DECLARATIONS ///.

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

Synopsis [Derives counter-example.]

Description []

SideEffects []

SeeAlso []

Definition at line 189 of file pdrMan.c.

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

DECLARATIONS ///.

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

FileName [pdrMan.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Property driven reachability.]

Synopsis [Manager procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Creates manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file pdrMan.c.

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

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

Synopsis [Frees manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 106 of file pdrMan.c.

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