ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
satStore.h
Go to the documentation of this file.
1
20
21#ifndef ABC__sat__bsat__satStore_h
22#define ABC__sat__bsat__satStore_h
23
24
25/*
26 The trace of SAT solving contains the original clauses of the problem
27 along with the learned clauses derived during SAT solving.
28 The first line of the resulting file contains 3 numbers instead of 2:
29 c <num_vars> <num_all_clauses> <num_root_clauses>
30*/
31
35
36#include "satSolver.h"
37
41
43
44#ifdef _WIN32
45#define inline __inline // compatible with MS VS 6.0
46#endif
47
48#define STO_MAX(a,b) ((a) > (b) ? (a) : (b))
49
53
54/*
55typedef unsigned lit;
56// variable/literal conversions (taken from MiniSat)
57static inline lit toLit (int v) { return v + v; }
58static inline lit toLitCond(int v, int c) { return v + v + (c != 0); }
59static inline lit lit_neg (lit l) { return l ^ 1; }
60static inline int lit_var (lit l) { return l >> 1; }
61static inline int lit_sign (lit l) { return l & 1; }
62static inline int lit_print(lit l) { return lit_sign(l)? -lit_var(l)-1 : lit_var(l)+1; }
63static inline lit lit_read (int s) { return s > 0 ? toLit(s-1) : lit_neg(toLit(-s-1)); }
64static inline int lit_check(lit l, int n) { return l >= 0 && lit_var(l) < n; }
65*/
66
67typedef struct Sto_Cls_t_ Sto_Cls_t;
69{
70 Sto_Cls_t * pNext; // the next clause
71 Sto_Cls_t * pNext0; // the next 0-watch
72 Sto_Cls_t * pNext1; // the next 1-watch
73 int Id; // the clause ID
74 unsigned fA : 1; // belongs to A
75 unsigned fRoot : 1; // original clause
76 unsigned fVisit : 1; // visited clause
77 unsigned nLits : 24; // the number of literals
78 lit pLits[0]; // literals of this clause
79};
80
81typedef struct Sto_Man_t_ Sto_Man_t;
83{
84 // general data
85 int nVars; // the number of variables
86 int nRoots; // the number of root clauses
87 int nClauses; // the number of all clauses
88 int nClausesA; // the number of clauses of A
89 Sto_Cls_t * pHead; // the head clause
90 Sto_Cls_t * pTail; // the tail clause
91 Sto_Cls_t * pEmpty; // the empty clause
92 // memory management
93 int nChunkSize; // the number of bytes in a chunk
94 int nChunkUsed; // the number of bytes used in the last chunk
95 char * pChunkLast; // the last memory chunk
96};
97
98// iterators through the clauses
99#define Sto_ManForEachClause( p, pCls ) for( pCls = p->pHead; pCls; pCls = pCls->pNext )
100#define Sto_ManForEachClauseRoot( p, pCls ) for( pCls = p->pHead; pCls && pCls->fRoot; pCls = pCls->pNext )
101
105
109
110/*=== satStore.c ==========================================================*/
111extern Sto_Man_t * Sto_ManAlloc();
112extern void Sto_ManFree( Sto_Man_t * p );
113extern int Sto_ManAddClause( Sto_Man_t * p, lit * pBeg, lit * pEnd );
114extern int Sto_ManMemoryReport( Sto_Man_t * p );
115extern void Sto_ManMarkRoots( Sto_Man_t * p );
116extern void Sto_ManMarkClausesA( Sto_Man_t * p );
117extern void Sto_ManDumpClauses( Sto_Man_t * p, char * pFileName );
118extern int Sto_ManChangeLastClause( Sto_Man_t * p );
119extern Sto_Man_t * Sto_ManLoadClauses( char * pFileName );
120
121
122/*=== satInter.c ==========================================================*/
123typedef struct Int_Man_t_ Int_Man_t;
124extern Int_Man_t * Int_ManAlloc();
125extern int * Int_ManSetGlobalVars( Int_Man_t * p, int nGloVars );
126extern void Int_ManFree( Int_Man_t * p );
127extern int Int_ManInterpolate( Int_Man_t * p, Sto_Man_t * pCnf, int fVerbose, unsigned ** ppResult );
128
129/*=== satInterA.c ==========================================================*/
130typedef struct Inta_Man_t_ Inta_Man_t;
131extern Inta_Man_t * Inta_ManAlloc();
132extern void Inta_ManFree( Inta_Man_t * p );
133extern void * Inta_ManInterpolate( Inta_Man_t * p, Sto_Man_t * pCnf, abctime TimeToStop, void * vVarsAB, int fVerbose );
134
135/*=== satInterB.c ==========================================================*/
136typedef struct Intb_Man_t_ Intb_Man_t;
137extern Intb_Man_t * Intb_ManAlloc();
138extern void Intb_ManFree( Intb_Man_t * p );
139extern void * Intb_ManInterpolate( Intb_Man_t * p, Sto_Man_t * pCnf, void * vVarsAB, int fVerbose );
140
141/*=== satInterP.c ==========================================================*/
142typedef struct Intp_Man_t_ Intp_Man_t;
143extern Intp_Man_t * Intp_ManAlloc();
144extern void Intp_ManFree( Intp_Man_t * p );
145extern void * Intp_ManUnsatCore( Intp_Man_t * p, Sto_Man_t * pCnf, int fLearned, int fVerbose );
146extern void Intp_ManUnsatCorePrintForBmc( FILE * pFile, Sto_Man_t * pCnf, void * vCore, void * vVarMap );
147
148
150
151
152
153#endif
154
158
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_NAMESPACE_HEADER_END
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
Cube * p
Definition exorList.c:222
void Int_ManFree(Int_Man_t *p)
Definition satInter.c:273
void * Intp_ManUnsatCore(Intp_Man_t *p, Sto_Man_t *pCnf, int fLearned, int fVerbose)
Definition satInterP.c:963
void Sto_ManMarkClausesA(Sto_Man_t *p)
Definition satStore.c:257
struct Intb_Man_t_ Intb_Man_t
Definition satStore.h:136
void Intb_ManFree(Intb_Man_t *p)
Definition satInterB.c:255
struct Intp_Man_t_ Intp_Man_t
Definition satStore.h:142
int Sto_ManMemoryReport(Sto_Man_t *p)
Definition satStore.c:97
Int_Man_t * Int_ManAlloc()
FUNCTION DEFINITIONS ///.
Definition satInter.c:107
void * Inta_ManInterpolate(Inta_Man_t *p, Sto_Man_t *pCnf, abctime TimeToStop, void *vVarsAB, int fVerbose)
Definition satInterA.c:944
Inta_Man_t * Inta_ManAlloc()
FUNCTION DEFINITIONS ///.
Definition satInterA.c:106
void Intp_ManFree(Intp_Man_t *p)
Definition satInterP.c:178
void Intp_ManUnsatCorePrintForBmc(FILE *pFile, Sto_Man_t *pCnf, void *vCore, void *vVarMap)
Definition satInterP.c:1059
Intb_Man_t * Intb_ManAlloc()
FUNCTION DEFINITIONS ///.
Definition satInterB.c:110
int * Int_ManSetGlobalVars(Int_Man_t *p, int nGloVars)
Definition satInter.c:133
Sto_Man_t * Sto_ManAlloc()
MACRO DEFINITIONS ///.
Definition satStore.c:121
void Sto_ManDumpClauses(Sto_Man_t *p, char *pFileName)
Definition satStore.c:305
void Inta_ManFree(Inta_Man_t *p)
Definition satInterA.c:250
struct Sto_Man_t_ Sto_Man_t
Definition satStore.h:81
struct Int_Man_t_ Int_Man_t
Definition satStore.h:123
Sto_Man_t * Sto_ManLoadClauses(char *pFileName)
Definition satStore.c:384
void * Intb_ManInterpolate(Intb_Man_t *p, Sto_Man_t *pCnf, void *vVarsAB, int fVerbose)
Definition satInterB.c:987
struct Sto_Cls_t_ Sto_Cls_t
BASIC TYPES ///.
Definition satStore.h:67
int Sto_ManAddClause(Sto_Man_t *p, lit *pBeg, lit *pEnd)
Definition satStore.c:160
int Int_ManInterpolate(Int_Man_t *p, Sto_Man_t *pCnf, int fVerbose, unsigned **ppResult)
Definition satInter.c:1005
Intp_Man_t * Intp_ManAlloc()
FUNCTION DEFINITIONS ///.
Definition satInterP.c:96
int Sto_ManChangeLastClause(Sto_Man_t *p)
Definition satStore.c:279
void Sto_ManFree(Sto_Man_t *p)
Definition satStore.c:143
void Sto_ManMarkRoots(Sto_Man_t *p)
Definition satStore.c:235
struct Inta_Man_t_ Inta_Man_t
Definition satStore.h:130
int lit
Definition satVec.h:130
int nGloVars
Definition satInter.c:44
Sto_Man_t * pCnf
Definition satInter.c:42
int fVerbose
Definition satInter.c:46
Vec_Int_t * vVarsAB
Definition satInterA.c:44
Sto_Man_t * pCnf
Definition satInterA.c:43
Sto_Man_t * pCnf
Definition satInterB.c:43
Vec_Int_t * vVarsAB
Definition satInterB.c:44
Sto_Man_t * pCnf
Definition satInterP.c:43
FILE * pFile
Definition satInterP.c:66
lit pLits[0]
Definition satStore.h:78
unsigned fA
Definition satStore.h:74
unsigned nLits
Definition satStore.h:77
Sto_Cls_t * pNext
Definition satStore.h:70
Sto_Cls_t * pNext1
Definition satStore.h:72
unsigned fRoot
Definition satStore.h:75
Sto_Cls_t * pNext0
Definition satStore.h:71
unsigned fVisit
Definition satStore.h:76
int nVars
Definition satStore.h:85
int nRoots
Definition satStore.h:86
char * pChunkLast
Definition satStore.h:95
Sto_Cls_t * pHead
Definition satStore.h:89
int nChunkSize
Definition satStore.h:93
Sto_Cls_t * pTail
Definition satStore.h:90
int nClausesA
Definition satStore.h:88
int nClauses
Definition satStore.h:87
int nChunkUsed
Definition satStore.h:94
Sto_Cls_t * pEmpty
Definition satStore.h:91