abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
pdrInt.h
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [pdrInt.h]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Property driven reachability.]
8 
9  Synopsis [Internal declarations.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - November 20, 2010.]
16 
17  Revision [$Id: pdrInt.h,v 1.00 2010/11/20 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #ifndef ABC__sat__pdr__pdrInt_h
22 #define ABC__sat__pdr__pdrInt_h
23 
24 ////////////////////////////////////////////////////////////////////////
25 /// INCLUDES ///
26 ////////////////////////////////////////////////////////////////////////
27 
28 #include "aig/saig/saig.h"
29 #include "misc/vec/vecWec.h"
30 #include "sat/cnf/cnf.h"
31 #include "sat/bsat/satSolver.h"
32 #include "pdr.h"
33 
35 
36 ////////////////////////////////////////////////////////////////////////
37 /// PARAMETERS ///
38 ////////////////////////////////////////////////////////////////////////
39 
40 ////////////////////////////////////////////////////////////////////////
41 /// BASIC TYPES ///
42 ////////////////////////////////////////////////////////////////////////
43 
44 typedef struct Pdr_Set_t_ Pdr_Set_t;
45 struct Pdr_Set_t_
46 {
47  word Sign; // signature
48  int nRefs; // ref counter
49  int nTotal; // total literals
50  int nLits; // num flop literals
51  int Lits[0];
52 };
53 
54 typedef struct Pdr_Obl_t_ Pdr_Obl_t;
55 struct Pdr_Obl_t_
56 {
57  int iFrame; // time frame
58  int prio; // priority
59  int nRefs; // reference counter
60  Pdr_Set_t * pState; // state cube
61  Pdr_Obl_t * pNext; // next one
62  Pdr_Obl_t * pLink; // queue link
63 };
64 
65 typedef struct Pdr_Man_t_ Pdr_Man_t;
66 struct Pdr_Man_t_
67 {
68  // input problem
69  Pdr_Par_t * pPars; // parameters
70  Aig_Man_t * pAig; // user's AIG
71  // static CNF representation
72  Cnf_Man_t * pCnfMan; // CNF manager
73  Cnf_Dat_t * pCnf1; // CNF for this AIG
74  Vec_Int_t * vVar2Reg; // mapping of SAT var into registers
75  // dynamic CNF representation
76  Cnf_Dat_t * pCnf2; // CNF for this AIG
77  Vec_Int_t * pvId2Vars; // for each used ObjId, maps frame into SAT var
78  Vec_Ptr_t vVar2Ids; // for each used frame, maps SAT var into ObjId
79  Vec_Wec_t * vVLits; // CNF literals
80  // data representation
81  int iOutCur; // current output
82  Vec_Ptr_t * vCexes; // counter-examples for each output
83  Vec_Ptr_t * vSolvers; // SAT solvers
84  Vec_Vec_t * vClauses; // clauses by timeframe
85  Pdr_Obl_t * pQueue; // proof obligations
86  int * pOrder; // ordering of the lits
87  Vec_Int_t * vActVars; // the counter of activation variables
88  int iUseFrame; // the first used frame
89  // internal use
90  Vec_Int_t * vPrio; // priority flops
91  Vec_Int_t * vLits; // array of literals
92  Vec_Int_t * vCiObjs; // cone leaves
93  Vec_Int_t * vCoObjs; // cone roots
94  Vec_Int_t * vCiVals; // cone leaf values
95  Vec_Int_t * vCoVals; // cone root values
96  Vec_Int_t * vNodes; // cone nodes
97  Vec_Int_t * vUndo; // cone undos
98  Vec_Int_t * vVisits; // intermediate
99  Vec_Int_t * vCi2Rem; // CIs to be removed
100  Vec_Int_t * vRes; // final result
101  Vec_Int_t * vSuppLits; // support literals
102  Pdr_Set_t * pCubeJust; // justification
103  abctime * pTime4Outs;// timeout per output
104  // statistics
105  int nBlocks; // the number of times blockState was called
106  int nObligs; // the number of proof obligations derived
107  int nCubes; // the number of cubes derived
108  int nCalls; // the number of SAT calls
109  int nCallsS; // the number of SAT calls (sat)
110  int nCallsU; // the number of SAT calls (unsat)
111  int nStarts; // the number of SAT solver restarts
112  int nFrames; // frames explored
113  int nCasesSS;
114  int nCasesSU;
115  int nCasesUS;
116  int nCasesUU;
117  int nQueCur;
118  int nQueMax;
119  int nQueLim;
120  // runtime
123  // time stats
133 };
134 
135 ////////////////////////////////////////////////////////////////////////
136 /// MACRO DEFINITIONS ///
137 ////////////////////////////////////////////////////////////////////////
138 
139 static inline sat_solver * Pdr_ManSolver( Pdr_Man_t * p, int k ) { return (sat_solver *)Vec_PtrEntry(p->vSolvers, k); }
140 
142 {
143  if ( p->timeToStop == 0 )
144  return p->timeToStopOne;
145  if ( p->timeToStopOne == 0 )
146  return p->timeToStop;
147  if ( p->timeToStop < p->timeToStopOne )
148  return p->timeToStop;
149  return p->timeToStopOne;
150 }
151 
152 ////////////////////////////////////////////////////////////////////////
153 /// FUNCTION DECLARATIONS ///
154 ////////////////////////////////////////////////////////////////////////
155 
156 /*=== pdrCex.c ==========================================================*/
157 extern Abc_Cex_t * Pdr_ManDeriveCex( Pdr_Man_t * p );
158 /*=== pdrCnf.c ==========================================================*/
159 extern int Pdr_ObjSatVar( Pdr_Man_t * p, int k, int Pol, Aig_Obj_t * pObj );
160 extern int Pdr_ObjRegNum( Pdr_Man_t * p, int k, int iSatVar );
161 extern int Pdr_ManFreeVar( Pdr_Man_t * p, int k );
162 extern sat_solver * Pdr_ManNewSolver( sat_solver * pSat, Pdr_Man_t * p, int k, int fInit );
163 /*=== pdrCore.c ==========================================================*/
164 extern int Pdr_ManCheckContainment( Pdr_Man_t * p, int k, Pdr_Set_t * pSet );
165 /*=== pdrInv.c ==========================================================*/
166 extern void Pdr_ManPrintProgress( Pdr_Man_t * p, int fClose, abctime Time );
167 extern void Pdr_ManPrintClauses( Pdr_Man_t * p, int kStart );
168 extern void Pdr_ManDumpClauses( Pdr_Man_t * p, char * pFileName, int fProved );
169 extern void Pdr_ManReportInvariant( Pdr_Man_t * p );
170 extern void Pdr_ManVerifyInvariant( Pdr_Man_t * p );
171 /*=== pdrMan.c ==========================================================*/
172 extern Pdr_Man_t * Pdr_ManStart( Aig_Man_t * pAig, Pdr_Par_t * pPars, Vec_Int_t * vPrioInit );
173 extern void Pdr_ManStop( Pdr_Man_t * p );
174 extern Abc_Cex_t * Pdr_ManDeriveCex( Pdr_Man_t * p );
175 /*=== pdrSat.c ==========================================================*/
176 extern sat_solver * Pdr_ManCreateSolver( Pdr_Man_t * p, int k );
177 extern sat_solver * Pdr_ManFetchSolver( Pdr_Man_t * p, int k );
178 extern void Pdr_ManSetPropertyOutput( Pdr_Man_t * p, int k );
179 extern Vec_Int_t * Pdr_ManCubeToLits( Pdr_Man_t * p, int k, Pdr_Set_t * pCube, int fCompl, int fNext );
180 extern Vec_Int_t * Pdr_ManLitsToCube( Pdr_Man_t * p, int k, int * pArray, int nArray );
181 extern void Pdr_ManSolverAddClause( Pdr_Man_t * p, int k, Pdr_Set_t * pCube );
182 extern void Pdr_ManCollectValues( Pdr_Man_t * p, int k, Vec_Int_t * vObjIds, Vec_Int_t * vValues );
183 extern int Pdr_ManCheckCubeCs( Pdr_Man_t * p, int k, Pdr_Set_t * pCube );
184 extern int Pdr_ManCheckCube( Pdr_Man_t * p, int k, Pdr_Set_t * pCube, Pdr_Set_t ** ppPred, int nConfLimit );
185 /*=== pdrTsim.c ==========================================================*/
186 extern Pdr_Set_t * Pdr_ManTernarySim( Pdr_Man_t * p, int k, Pdr_Set_t * pCube );
187 /*=== pdrUtil.c ==========================================================*/
188 extern Pdr_Set_t * Pdr_SetAlloc( int nSize );
189 extern Pdr_Set_t * Pdr_SetCreate( Vec_Int_t * vLits, Vec_Int_t * vPiLits );
190 extern Pdr_Set_t * Pdr_SetCreateFrom( Pdr_Set_t * pSet, int iRemove );
191 extern Pdr_Set_t * Pdr_SetCreateSubset( Pdr_Set_t * pSet, int * pLits, int nLits );
192 extern Pdr_Set_t * Pdr_SetDup( Pdr_Set_t * pSet );
193 extern Pdr_Set_t * Pdr_SetRef( Pdr_Set_t * p );
194 extern void Pdr_SetDeref( Pdr_Set_t * p );
195 extern int Pdr_SetContains( Pdr_Set_t * pOld, Pdr_Set_t * pNew );
196 extern int Pdr_SetContainsSimple( Pdr_Set_t * pOld, Pdr_Set_t * pNew );
197 extern int Pdr_SetIsInit( Pdr_Set_t * p, int iRemove );
198 extern void Pdr_SetPrint( FILE * pFile, Pdr_Set_t * p, int nRegs, Vec_Int_t * vFlopCounts );
199 extern int Pdr_SetCompare( Pdr_Set_t ** pp1, Pdr_Set_t ** pp2 );
200 extern Pdr_Obl_t * Pdr_OblStart( int k, int prio, Pdr_Set_t * pState, Pdr_Obl_t * pNext );
201 extern Pdr_Obl_t * Pdr_OblRef( Pdr_Obl_t * p );
202 extern void Pdr_OblDeref( Pdr_Obl_t * p );
203 extern int Pdr_QueueIsEmpty( Pdr_Man_t * p );
204 extern Pdr_Obl_t * Pdr_QueueHead( Pdr_Man_t * p );
205 extern Pdr_Obl_t * Pdr_QueuePop( Pdr_Man_t * p );
206 extern void Pdr_QueueClean( Pdr_Man_t * p );
207 extern void Pdr_QueuePush( Pdr_Man_t * p, Pdr_Obl_t * pObl );
208 extern void Pdr_QueuePrint( Pdr_Man_t * p );
209 extern void Pdr_QueueStop( Pdr_Man_t * p );
210 extern int Pdr_ManCubeJust( Pdr_Man_t * p, int k, Pdr_Set_t * pCube );
211 
213 
214 
215 #endif
216 
217 ////////////////////////////////////////////////////////////////////////
218 /// END OF FILE ///
219 ////////////////////////////////////////////////////////////////////////
220 
void Pdr_ManPrintProgress(Pdr_Man_t *p, int fClose, abctime Time)
DECLARATIONS ///.
Definition: pdrInv.c:48
Pdr_Obl_t * pQueue
Definition: pdrInt.h:85
int Pdr_ObjRegNum(Pdr_Man_t *p, int k, int iSatVar)
Definition: pdrCnf.c:312
int Pdr_ManCheckCube(Pdr_Man_t *p, int k, Pdr_Set_t *pCube, Pdr_Set_t **ppPred, int nConfLimit)
Definition: pdrSat.c:286
Aig_Man_t * pAig
Definition: pdrInt.h:70
Vec_Ptr_t * vSolvers
Definition: pdrInt.h:83
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
abctime tGeneral
Definition: pdrInt.h:127
int nObligs
Definition: pdrInt.h:106
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
Definition: vecWec.h:42
Pdr_Set_t * Pdr_SetCreateSubset(Pdr_Set_t *pSet, int *pLits, int nLits)
Definition: pdrUtil.c:132
Pdr_Set_t * Pdr_SetCreate(Vec_Int_t *vLits, Vec_Int_t *vPiLits)
Definition: pdrUtil.c:65
int Pdr_ManCheckContainment(Pdr_Man_t *p, int k, Pdr_Set_t *pSet)
Definition: pdrCore.c:241
Vec_Int_t * vVar2Reg
Definition: pdrInt.h:74
Vec_Int_t * vPrio
Definition: pdrInt.h:90
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
int prio
Definition: pdrInt.h:58
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
abctime tContain
Definition: pdrInt.h:130
int iUseFrame
Definition: pdrInt.h:88
static Llb_Mgr_t * p
Definition: llb3Image.c:950
word Sign
Definition: pdrInt.h:47
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Pdr_Set_t * pState
Definition: pdrInt.h:60
typedefABC_NAMESPACE_HEADER_START struct Pdr_Par_t_ Pdr_Par_t
INCLUDES ///.
Definition: pdr.h:40
int nRefs
Definition: pdrInt.h:59
Vec_Int_t * Pdr_ManLitsToCube(Pdr_Man_t *p, int k, int *pArray, int nArray)
Definition: pdrSat.c:115
int iOutCur
Definition: pdrInt.h:81
int nLits
Definition: pdrInt.h:50
sat_solver * Pdr_ManFetchSolver(Pdr_Man_t *p, int k)
Definition: pdrSat.c:76
void Pdr_ManReportInvariant(Pdr_Man_t *p)
Definition: pdrInv.c:385
abctime tSatSat
Definition: pdrInt.h:125
Vec_Int_t * vRes
Definition: pdrInt.h:100
Pdr_Obl_t * pNext
Definition: pdrInt.h:61
void Pdr_ManSolverAddClause(Pdr_Man_t *p, int k, Pdr_Set_t *pCube)
Definition: pdrSat.c:209
int Pdr_ObjSatVar(Pdr_Man_t *p, int k, int Pol, Aig_Obj_t *pObj)
Definition: pdrCnf.c:241
int Pdr_ManCubeJust(Pdr_Man_t *p, int k, Pdr_Set_t *pCube)
Definition: pdrUtil.c:688
Vec_Int_t * vActVars
Definition: pdrInt.h:87
Pdr_Set_t * pCubeJust
Definition: pdrInt.h:102
Vec_Int_t * pvId2Vars
Definition: pdrInt.h:77
void Pdr_SetDeref(Pdr_Set_t *p)
Definition: pdrUtil.c:208
int Pdr_SetContains(Pdr_Set_t *pOld, Pdr_Set_t *pNew)
Definition: pdrUtil.c:263
Vec_Int_t * vCiVals
Definition: pdrInt.h:94
void Pdr_SetPrint(FILE *pFile, Pdr_Set_t *p, int nRegs, Vec_Int_t *vFlopCounts)
Definition: pdrUtil.c:225
int nCubes
Definition: pdrInt.h:107
int Pdr_SetContainsSimple(Pdr_Set_t *pOld, Pdr_Set_t *pNew)
Definition: pdrUtil.c:301
int nQueMax
Definition: pdrInt.h:118
Pdr_Man_t * Pdr_ManStart(Aig_Man_t *pAig, Pdr_Par_t *pPars, Vec_Int_t *vPrioInit)
DECLARATIONS ///.
Definition: pdrMan.c:45
int nTotal
Definition: pdrInt.h:49
int * pOrder
Definition: pdrInt.h:86
Abc_Cex_t * Pdr_ManDeriveCex(Pdr_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: pdrMan.c:189
void Pdr_ManSetPropertyOutput(Pdr_Man_t *p, int k)
Definition: pdrSat.c:177
abctime * pTime4Outs
Definition: pdrInt.h:103
int Pdr_ManFreeVar(Pdr_Man_t *p, int k)
Definition: pdrCnf.c:332
Pdr_Obl_t * Pdr_OblRef(Pdr_Obl_t *p)
Definition: pdrUtil.c:420
Definition: cnf.h:56
static abctime Pdr_ManTimeLimit(Pdr_Man_t *p)
Definition: pdrInt.h:141
int iFrame
Definition: pdrInt.h:57
void Pdr_QueuePush(Pdr_Man_t *p, Pdr_Obl_t *pObl)
Definition: pdrUtil.c:532
Cnf_Man_t * pCnfMan
Definition: pdrInt.h:72
Vec_Wec_t * vVLits
Definition: pdrInt.h:79
Pdr_Obl_t * pLink
Definition: pdrInt.h:62
Vec_Int_t * vCi2Rem
Definition: pdrInt.h:99
Vec_Int_t * vCoVals
Definition: pdrInt.h:95
Pdr_Obl_t * Pdr_QueuePop(Pdr_Man_t *p)
Definition: pdrUtil.c:491
void Pdr_QueuePrint(Pdr_Man_t *p)
Definition: pdrUtil.c:562
abctime tSatUnsat
Definition: pdrInt.h:126
Vec_Ptr_t vVar2Ids
Definition: pdrInt.h:78
Pdr_Set_t * Pdr_SetDup(Pdr_Set_t *pSet)
Definition: pdrUtil.c:166
int nCalls
Definition: pdrInt.h:108
void Pdr_QueueStop(Pdr_Man_t *p)
Definition: pdrUtil.c:580
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
Pdr_Par_t * pPars
Definition: pdrInt.h:69
int nCallsU
Definition: pdrInt.h:110
Vec_Int_t * vNodes
Definition: pdrInt.h:96
void Pdr_ManVerifyInvariant(Pdr_Man_t *p)
Definition: pdrInv.c:406
int nBlocks
Definition: pdrInt.h:105
int nQueLim
Definition: pdrInt.h:119
void Pdr_QueueClean(Pdr_Man_t *p)
Definition: pdrUtil.c:513
typedefABC_NAMESPACE_HEADER_START struct Pdr_Set_t_ Pdr_Set_t
INCLUDES ///.
Definition: pdrInt.h:44
int nStarts
Definition: pdrInt.h:111
int nCasesUS
Definition: pdrInt.h:115
Definition: aig.h:69
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
Definition: abc_global.h:105
int nRefs
Definition: pdrInt.h:48
Vec_Vec_t * vClauses
Definition: pdrInt.h:84
abctime tTsim
Definition: pdrInt.h:129
void Pdr_ManDumpClauses(Pdr_Man_t *p, char *pFileName, int fProved)
Definition: pdrInv.c:313
void Pdr_OblDeref(Pdr_Obl_t *p)
Definition: pdrUtil.c:437
Vec_Int_t * vVisits
Definition: pdrInt.h:98
abctime tCnf
Definition: pdrInt.h:131
Pdr_Set_t * Pdr_ManTernarySim(Pdr_Man_t *p, int k, Pdr_Set_t *pCube)
Definition: pdrTsim.c:351
#define ABC_NAMESPACE_HEADER_END
Definition: abc_global.h:106
Vec_Int_t * Pdr_ManCubeToLits(Pdr_Man_t *p, int k, Pdr_Set_t *pCube, int fCompl, int fNext)
Definition: pdrSat.c:142
Vec_Int_t * vLits
Definition: pdrInt.h:91
int Pdr_SetCompare(Pdr_Set_t **pp1, Pdr_Set_t **pp2)
Definition: pdrUtil.c:366
abctime timeToStop
Definition: pdrInt.h:121
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static sat_solver * Pdr_ManSolver(Pdr_Man_t *p, int k)
MACRO DEFINITIONS ///.
Definition: pdrInt.h:139
Cnf_Dat_t * pCnf2
Definition: pdrInt.h:76
abctime tTotal
Definition: pdrInt.h:132
abctime tSat
Definition: pdrInt.h:124
sat_solver * Pdr_ManNewSolver(sat_solver *pSat, Pdr_Man_t *p, int k, int fInit)
Definition: pdrCnf.c:435
void Pdr_ManPrintClauses(Pdr_Man_t *p, int kStart)
Definition: pdrInv.c:205
abctime timeToStopOne
Definition: pdrInt.h:122
Cnf_Dat_t * pCnf1
Definition: pdrInt.h:73
int Lits[0]
Definition: pdrInt.h:51
void Pdr_ManStop(Pdr_Man_t *p)
Definition: pdrMan.c:106
int nCasesSU
Definition: pdrInt.h:114
void Pdr_ManCollectValues(Pdr_Man_t *p, int k, Vec_Int_t *vObjIds, Vec_Int_t *vValues)
Definition: pdrSat.c:232
sat_solver * Pdr_ManCreateSolver(Pdr_Man_t *p, int k)
DECLARATIONS ///.
Definition: pdrSat.c:45
int nFrames
Definition: pdrInt.h:112
Vec_Ptr_t * vCexes
Definition: pdrInt.h:82
Pdr_Obl_t * Pdr_QueueHead(Pdr_Man_t *p)
Definition: pdrUtil.c:475
Vec_Int_t * vSuppLits
Definition: pdrInt.h:101
int nCallsS
Definition: pdrInt.h:109
Pdr_Set_t * Pdr_SetAlloc(int nSize)
DECLARATIONS ///.
Definition: pdrUtil.c:46
Pdr_Set_t * Pdr_SetRef(Pdr_Set_t *p)
Definition: pdrUtil.c:191
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition: utilCex.h:39
Pdr_Obl_t * Pdr_OblStart(int k, int prio, Pdr_Set_t *pState, Pdr_Obl_t *pNext)
Definition: pdrUtil.c:396
int nCasesUU
Definition: pdrInt.h:116
int nQueCur
Definition: pdrInt.h:117
Vec_Int_t * vCiObjs
Definition: pdrInt.h:92
abctime tPush
Definition: pdrInt.h:128
typedefABC_NAMESPACE_HEADER_START struct Cnf_Man_t_ Cnf_Man_t
INCLUDES ///.
Definition: cnf.h:51
ABC_INT64_T abctime
Definition: abc_global.h:278
int nCasesSS
Definition: pdrInt.h:113
int Pdr_ManCheckCubeCs(Pdr_Man_t *p, int k, Pdr_Set_t *pCube)
Definition: pdrSat.c:258
int Pdr_SetIsInit(Pdr_Set_t *p, int iRemove)
Definition: pdrUtil.c:341
Vec_Int_t * vUndo
Definition: pdrInt.h:97
Vec_Int_t * vCoObjs
Definition: pdrInt.h:93
int Pdr_QueueIsEmpty(Pdr_Man_t *p)
Definition: pdrUtil.c:459
Pdr_Set_t * Pdr_SetCreateFrom(Pdr_Set_t *pSet, int iRemove)
Definition: pdrUtil.c:98