ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
giaQbf.c
Go to the documentation of this file.
1
20
21#include "gia.h"
22#include "sat/cnf/cnf.h"
23#include "sat/bsat/satStore.h"
24#include "misc/extra/extra.h"
26#include "misc/util/utilTruth.h"
27#include "base/io/ioResub.h"
28
30
31
35
36typedef struct Qbf_Man_t_ Qbf_Man_t;
38{
39 Gia_Man_t * pGia; // original miter
40 int nPars; // parameter variables
41 int nVars; // functional variables
42 int fVerbose; // verbose flag
43 // internal variables
44 int iParVarBeg; // SAT var ID of the first par variable in the ver solver
45 sat_solver * pSatVer; // verification instance
46 sat_solver * pSatSyn; // synthesis instance
47 bmcg_sat_solver*pSatSynG; // synthesis instance
48 Vec_Int_t * vValues; // variable values
49 Vec_Int_t * vParMap; // parameter mapping
50 Vec_Int_t * vLits; // literals for the SAT solver
51 abctime clkStart; // global timeout
52 abctime clkSat; // SAT solver time
53};
54
58
70Vec_Int_t * Gia_GenCollectFlopIndexes( char * pStr, int nLutNum, int nLutSize, int nFlops )
71{
72 int nDups;
73 char * pTemp;
74 Vec_Int_t * vFlops;
75 assert( nLutSize * nLutNum <= nFlops );
76 if ( pStr == NULL )
77 return Vec_IntStartNatural( nLutNum * nLutSize );
78 vFlops = Vec_IntAlloc( nLutNum * nLutSize );
79 pTemp = strtok( pStr, ", " );
80 while ( pTemp )
81 {
82 int iFlop = atoi(pTemp);
83 if ( iFlop >= nFlops )
84 {
85 printf( "Flop index (%d) exceeds the number of flops (%d).\n", iFlop, nFlops );
86 break;
87 }
88 Vec_IntPush( vFlops, iFlop );
89 pTemp = strtok( NULL, ", " );
90 }
91 if ( Vec_IntSize(vFlops) != nLutNum * nLutSize )
92 {
93 printf( "Gia_GenCollectFlopIndexes: Expecting %d flop indexes (instead of %d).\n", nLutNum * nLutSize, Vec_IntSize(vFlops) );
94 Vec_IntFree( vFlops );
95 return NULL;
96 }
97 nDups = Vec_IntCountDuplicates(vFlops);
98 if ( nDups )
99 {
100 printf( "Gia_GenCollectFlopIndexes: There are %d duplicated flops in the list.\n", nDups );
101 Vec_IntFree( vFlops );
102 return NULL;
103 }
104 return vFlops;
105}
106int Gia_GenCreateMux_rec( Gia_Man_t * pNew, int * pCtrl, int nCtrl, Vec_Int_t * vData, int Shift )
107{
108 int iLit0, iLit1;
109 if ( nCtrl == 0 )
110 return Vec_IntEntry( vData, Shift );
111 iLit0 = Gia_GenCreateMux_rec( pNew, pCtrl, nCtrl-1, vData, Shift );
112 iLit1 = Gia_GenCreateMux_rec( pNew, pCtrl, nCtrl-1, vData, Shift + (1<<(nCtrl-1)) );
113 return Gia_ManHashMux( pNew, pCtrl[nCtrl-1], iLit1, iLit0 );
114}
115Vec_Int_t * Gia_GenCreateMuxes( Gia_Man_t * p, Gia_Man_t * pNew, Vec_Int_t * vFlops, int nLutNum, int nLutSize, Vec_Int_t * vParLits, int fUseRi )
116{
117 Vec_Int_t * vLits = Vec_IntAlloc( nLutNum );
118 int i, k, iMux, iFlop, pCtrl[16];
119 // add MUXes for each group of flops
120 assert( Vec_IntSize(vFlops) == nLutNum * nLutSize );
121 for ( i = 0; i < nLutNum; i++ )
122 {
123 for ( k = 0; k < nLutSize; k++ )
124 {
125 iFlop = Vec_IntEntry(vFlops, i * nLutSize + k);
126 assert( iFlop >= 0 && iFlop < Gia_ManRegNum(p) );
127 if ( fUseRi )
128 pCtrl[k] = Gia_ManRi(p, iFlop)->Value;
129 else
130 pCtrl[k] = Gia_ManRo(p, iFlop)->Value;
131 }
132 iMux = Gia_GenCreateMux_rec( pNew, pCtrl, nLutSize, vParLits, i * (1 << nLutSize) );
133 Vec_IntPush( vLits, iMux );
134 }
135 return vLits;
136}
137Gia_Man_t * Gia_GenQbfMiter( Gia_Man_t * p, int nFrames, int nLutNum, int nLutSize, char * pStr, int fUseOut, int fVerbose )
138{
139 Gia_Obj_t * pObj;
140 Gia_Man_t * pTemp, * pNew;
141 int i, iMiter, iLut0, iLut1, nPars = nLutNum * (1 << nLutSize);
142 Vec_Int_t * vLits0, * vLits1, * vParLits;
143 Vec_Int_t * vFlops = Gia_GenCollectFlopIndexes( pStr, nLutNum, nLutSize, Gia_ManRegNum(p) );
144 // collect parameter literals (data vars)
145 vParLits = Vec_IntAlloc( nPars );
146 for ( i = 0; i < nPars; i++ )
147 Vec_IntPush( vParLits, i ? Abc_Var2Lit(i+1, 0) : 1 );
148 // create new manager
149 pNew = Gia_ManStart( Gia_ManObjNum(p) );
150 pNew->pName = Abc_UtilStrsav( p->pName );
151 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
152 Gia_ManHashAlloc( pNew );
153 Gia_ManConst0(p)->Value = 0;
154 for ( i = 0; i < nPars; i++ )
155 Gia_ManAppendCi( pNew );
156 Gia_ManForEachCi( p, pObj, i )
157 pObj->Value = Gia_ManAppendCi( pNew );
158 Gia_ManForEachAnd( p, pObj, i )
159 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
160 Gia_ManForEachCo( p, pObj, i )
161 pObj->Value = Gia_ObjFanin0Copy(pObj);
162 vLits0 = Gia_GenCreateMuxes( p, pNew, vFlops, nLutNum, nLutSize, vParLits, 0 );
163 vLits1 = Gia_GenCreateMuxes( p, pNew, vFlops, nLutNum, nLutSize, vParLits, 1 );
164 // create miter output
165 //iMiter = Gia_ManHashAnd( pNew, Vec_IntEntry(vLits0, 0), Abc_LitNot(Vec_IntEntry(vLits1, 0)) );
167 iLut0 = Vec_IntEntry(vLits0, 0);
168 iLut1 = Vec_IntEntry(vLits1, 0);
169 if ( fUseOut )
170 {
171 Gia_Obj_t * pObjPoLast = Gia_ManPo( p, Gia_ManPoNum(p)-1 );
172 int iOut = Abc_LitNotCond( Gia_ObjFanin0Copy(pObjPoLast), 0 );
173 iLut1 = Gia_ManHashAnd( pNew, iLut1, Abc_LitNot(iOut) );
174 }
175 iMiter = Gia_ManHashAnd( pNew, iLut0, Abc_LitNot(iLut1) );
177 iMiter = Gia_ManHashAnd( pNew, Abc_LitNot(iMiter), Abc_Var2Lit(1, 0) );
178 Gia_ManAppendCo( pNew, iMiter );
179 // cleanup
180 Vec_IntFree( vLits0 );
181 Vec_IntFree( vLits1 );
182 Vec_IntFree( vFlops );
183 Vec_IntFree( vParLits );
184 pNew = Gia_ManCleanup( pTemp = pNew );
185 Gia_ManStop( pTemp );
186 return pNew;
187}
188
189
201int Gia_Gen2CreateMux_rec( Gia_Man_t * pNew, int * pCtrl, int nCtrl, Vec_Int_t * vData, int Shift )
202{
203 int iLit0, iLit1;
204 if ( nCtrl == 0 )
205 return Vec_IntEntry( vData, Shift );
206 iLit0 = Gia_Gen2CreateMux_rec( pNew, pCtrl, nCtrl-1, vData, Shift );
207 iLit1 = Gia_Gen2CreateMux_rec( pNew, pCtrl, nCtrl-1, vData, Shift + (1<<(nCtrl-1)) );
208 return Gia_ManHashMux( pNew, pCtrl[nCtrl-1], iLit1, iLit0 );
209}
210Vec_Int_t * Gia_Gen2CreateMuxes( Gia_Man_t * pNew, int nLutSize, int nLutNum, Vec_Int_t * vPLits, Vec_Int_t * vXLits )
211{
212 Vec_Int_t * vLits = Vec_IntAlloc( nLutNum );
213 int i, iMux;
214 // add MUXes for each group of flops
215 assert( Vec_IntSize(vPLits) == nLutNum * (1 << nLutSize) );
216 assert( Vec_IntSize(vXLits) == nLutSize );
217 for ( i = 0; i < nLutNum; i++ )
218 {
219 iMux = Gia_Gen2CreateMux_rec( pNew, Vec_IntArray(vXLits), nLutSize, vPLits, i * (1 << nLutSize) );
220 Vec_IntPush( vLits, iMux );
221 }
222 return vLits;
223}
224Gia_Man_t * Gia_Gen2CreateMiter( int nLutSize, int nLutNum )
225{
226 // |<-- PVars(0)-->|...|<-- PVars(nLutNum-1)-->|<-- XVars-->|<-- YVars-->|
227 Vec_Int_t * vPLits = Vec_IntAlloc( nLutNum * (1 << nLutSize) );
228 Vec_Int_t * vXLits = Vec_IntAlloc( nLutSize );
229 Vec_Int_t * vYLits = Vec_IntAlloc( nLutSize );
230 Vec_Int_t * vXYLits = Vec_IntAlloc( nLutSize );
231 Vec_Int_t * vXRes, * vYRes, * vXYRes;
232 Vec_Int_t * vXYRes2 = Vec_IntAlloc( 2 * nLutNum );
233 Gia_Man_t * pTemp, * pNew = Gia_ManStart( 1000 ); int i, k, v, Cond, Res;
234 pNew->pName = Abc_UtilStrsav( "homoqbf" );
235 Gia_ManHashAlloc( pNew );
236 for ( i = 0; i < nLutNum * (1 << nLutSize); i++ )
237 Vec_IntPush( vPLits, Gia_ManAppendCi(pNew) );
238 for ( i = 0; i < nLutSize; i++ )
239 Vec_IntPush( vXLits, Gia_ManAppendCi(pNew) );
240 for ( i = 0; i < nLutSize; i++ )
241 Vec_IntPush( vYLits, Gia_ManAppendCi(pNew) );
242 for ( i = 0; i < nLutSize; i++ )
243 Vec_IntPush( vXYLits, Abc_LitNot(Gia_ManHashAnd(pNew, Vec_IntEntry(vXLits, i), Vec_IntEntry(vYLits, i))) );
244 vXRes = Gia_Gen2CreateMuxes( pNew, nLutSize, nLutNum, vPLits, vXLits );
245 vYRes = Gia_Gen2CreateMuxes( pNew, nLutSize, nLutNum, vPLits, vYLits );
246 vXYRes = Gia_Gen2CreateMuxes( pNew, nLutSize, nLutNum, vPLits, vXYLits );
247 for ( i = 0; i < nLutNum; i++ )
248 {
249 Vec_IntPush( vXYRes2, Vec_IntEntry(vXYRes, i) );
250 Vec_IntPush( vXYRes2, Abc_LitNot(Gia_ManHashAnd(pNew, Vec_IntEntry(vXRes, i), Vec_IntEntry(vYRes, i))) );
251 }
252 Res = Gia_ManHashDualMiter( pNew, vXYRes2 );
253 // uniqueness of codes
254 for ( i = 0; i < (1 << nLutSize); i++ )
255 {
256 Vec_Int_t * vCondA = Vec_IntAlloc( nLutNum );
257 Vec_Int_t * vCondB = Vec_IntAlloc( nLutNum );
258 for ( v = 0; v < nLutNum; v++ )
259 Vec_IntPush( vCondA, Vec_IntEntry(vPLits, v*(1 << nLutSize)+i) );
260 for ( k = i+1; k < (1 << nLutSize); k++ )
261 {
262 Vec_IntClear( vCondB );
263 for ( v = 0; v < nLutNum; v++ )
264 {
265 Vec_IntPush( vCondB, Vec_IntEntry(vCondA, v) );
266 Vec_IntPush( vCondB, Vec_IntEntry(vPLits, v*(1 << nLutSize)+k) );
267 }
268 Cond = Gia_ManHashDualMiter( pNew, vCondB );
269 Res = Gia_ManHashOr( pNew, Res, Abc_LitNot(Cond) );
270 }
271 Vec_IntFree( vCondA );
272 Vec_IntFree( vCondB );
273 }
274 Gia_ManAppendCo( pNew, Abc_LitNot(Res) );
275 Gia_ManHashStop( pNew );
276 Vec_IntFree( vPLits );
277 Vec_IntFree( vXLits );
278 Vec_IntFree( vYLits );
279 Vec_IntFree( vXYLits );
280 Vec_IntFree( vXRes );
281 Vec_IntFree( vYRes );
282 Vec_IntFree( vXYRes );
283 Vec_IntFree( vXYRes2 );
284 pNew = Gia_ManCleanup( pTemp = pNew );
285 Gia_ManStop( pTemp );
286 printf( "Generated QBF miter with %d parameters, %d functional variables, and %d AIG nodes.\n",
287 nLutNum * (1 << nLutSize), 2*nLutSize, Gia_ManAndNum(pNew) );
288 return pNew;
289}
290int Gia_Gen2CodeOne( int nLutSize, int nLutNum, Vec_Int_t * vCode, int x )
291{
292 int k, Code = 0;
293 for ( k = 0; k < nLutNum; k++ )
294 if ( Vec_IntEntry(vCode, k*(1 << nLutSize)+x) )
295 Code |= (1 << k);
296 return Code;
297}
298word * Gia_Gen2CodeOneP( int nLutSize, int nLutNum, Vec_Int_t * vCode, int x )
299{
300 word * pRes = ABC_CALLOC( word, Abc_Bit6WordNum(nLutNum) );
301 int k;
302 for ( k = 0; k < nLutNum; k++ )
303 if ( Vec_IntEntry(vCode, k*(1 << nLutSize)+x) )
304 Abc_InfoSetBit( (unsigned *)pRes, k );
305 return pRes;
306}
307void Gia_Gen2CodePrint( int nLutSize, int nLutNum, Vec_Int_t * vCode )
308{
309 // |<-- PVars(0)-->|...|<-- PVars(nLutNum-1)-->|
310 int i, n, nPairs = 16;
311 printf( "%d-input %d-output code table:\n", nLutSize, nLutNum );
312 for ( i = 0; i < (1 << nLutSize); i++ )
313 {
314 word * CodeX = Gia_Gen2CodeOneP( nLutSize, nLutNum, vCode, i );
315 printf( "%3d ", i );
316 Extra_PrintBinary( stdout, (unsigned *)&i, nLutSize );
317 printf( " --> " );
318 if ( nLutNum <= 16 )
319 printf( "%5d ", (int)CodeX[0] );
320 Extra_PrintBinary( stdout, (unsigned *)CodeX, nLutNum );
321 printf( "\n" );
322 ABC_FREE( CodeX );
323 }
324 // create several different pairs
325 srand( time(NULL) );
326 printf( "Simulation of the encoding with %d random pairs:\n", nPairs );
327 for ( n = 0; n < nPairs; n++ )
328 {
329 unsigned MaskIn = Abc_InfoMask( nLutSize );
330 int NumX = 0, NumY = 0, NumXY, nWords = Abc_Bit6WordNum(nLutNum);
331 word * CodeX, * CodeY, * CodeXY;
332 word * CodeXCodeY = ABC_CALLOC( word, nWords );
333 while ( NumX == NumY )
334 {
335 NumX = rand() % (1 << nLutSize);
336 NumY = rand() % (1 << nLutSize);
337 NumXY = MaskIn & ~(NumX & NumY);
338 }
339 CodeX = Gia_Gen2CodeOneP( nLutSize, nLutNum, vCode, NumX );
340 CodeY = Gia_Gen2CodeOneP( nLutSize, nLutNum, vCode, NumY );
341 CodeXY = Gia_Gen2CodeOneP( nLutSize, nLutNum, vCode, NumXY );
342 Abc_TtAnd( CodeXCodeY, CodeX, CodeY, nWords, 1 );
343 if ( nLutNum < 64*nWords )
344 CodeXCodeY[nWords-1] &= Abc_Tt6Mask(nLutNum % 64);
345
346 printf( "%2d :", n );
347 printf( " x =%3d ", NumX );
348 Extra_PrintBinary( stdout,(unsigned *) &NumX, nLutSize );
349 printf( " y =%3d ", NumY );
350 Extra_PrintBinary( stdout, (unsigned *)&NumY, nLutSize );
351 printf( " nand =%3d ", NumXY );
352 Extra_PrintBinary( stdout, (unsigned *)&NumXY, nLutSize );
353 printf( " " );
354
355 printf( " c(x) = " );
356 Extra_PrintBinary( stdout, (unsigned *)CodeX, nLutNum );
357 printf( " c(y) = " );
358 Extra_PrintBinary( stdout, (unsigned *)CodeY, nLutNum );
359 printf( " c(nand) = " );
360 Extra_PrintBinary( stdout, (unsigned *)CodeXY, nLutNum );
361 printf( " nand(c(x),c(y)) = " );
362 Extra_PrintBinary( stdout, (unsigned *)CodeXCodeY, nLutNum );
363 printf( " " );
364
365 printf( "%s", Abc_TtEqual(CodeXCodeY, CodeXY, nWords) ? "yes" : "no" );
366 printf( "\n" );
367
368 ABC_FREE( CodeX );
369 ABC_FREE( CodeY );
370 ABC_FREE( CodeXY );
371 ABC_FREE( CodeXCodeY );
372 }
373}
375{
376 int i, nLutSize = 1, nLutNum = 2;
377 Vec_Int_t * vCode = Vec_IntAlloc( (1 << nLutSize) * nLutNum );
378 srand( time(NULL) );
379 for ( i = 0; i < (1 << nLutSize) * nLutNum; i++ )
380 Vec_IntPush( vCode, rand() & 1 );
381 Gia_Gen2CodePrint( nLutSize, nLutNum, vCode );
382 Vec_IntFree( vCode );
383}
384
396int Gia_ManSatEnum( Gia_Man_t * pGia, int nConfLimit, int nTimeOut, int fVerbose )
397{
398 Cnf_Dat_t * pCnf;
399 sat_solver * pSat;
400 Vec_Int_t * vLits;
401 int i, iLit, iParVarBeg, Iter;
402 int nSolutions = 0, RetValue = 0;
403 abctime clkStart = Abc_Clock();
404 pCnf = (Cnf_Dat_t *)Mf_ManGenerateCnf( pGia, 8, 0, 1, 0, 0 );
405 pSat = (sat_solver *)Cnf_DataWriteIntoSolver( pCnf, 1, 0 );
406 iParVarBeg = pCnf->nVars - Gia_ManPiNum(pGia);// - 1;
407 Cnf_DataFree( pCnf );
408 // iterate through the SAT assignment
409 vLits = Vec_IntAlloc( Gia_ManPiNum(pGia) );
410 for ( Iter = 1 ; ; Iter++ )
411 {
412 int status = sat_solver_solve( pSat, NULL, NULL, (ABC_INT64_T)nConfLimit, 0, 0, 0 );
413 if ( status == l_False ) { RetValue = 1; break; }
414 if ( status == l_Undef ) { RetValue = 0; break; }
415 nSolutions++;
416 // extract SAT assignment
417 Vec_IntClear( vLits );
418 for ( i = 0; i < Gia_ManPiNum(pGia); i++ )
419 Vec_IntPush( vLits, Abc_Var2Lit(iParVarBeg+i, sat_solver_var_value(pSat, iParVarBeg+i)) );
420 if ( fVerbose )
421 {
422 printf( "%5d : ", Iter );
423 Vec_IntForEachEntry( vLits, iLit, i )
424 printf( "%d", !Abc_LitIsCompl(iLit) );
425 printf( "\n" );
426 }
427 // add clause
428 if ( !sat_solver_addclause( pSat, Vec_IntArray(vLits), Vec_IntArray(vLits) + Vec_IntSize(vLits) ) )
429 { RetValue = 1; break; }
430 if ( nTimeOut && (Abc_Clock() - clkStart)/CLOCKS_PER_SEC >= nTimeOut ) { RetValue = 0; break; }
431 }
432 sat_solver_delete( pSat );
433 Vec_IntFree( vLits );
434 if ( nTimeOut && (Abc_Clock() - clkStart)/CLOCKS_PER_SEC >= nTimeOut )
435 printf( "Enumerated %d assignments when timeout (%d sec) was reached. ", nSolutions, nTimeOut );
436 else if ( nConfLimit && !RetValue )
437 printf( "Enumerated %d assignments when conflict limit (%d) was reached. ", nSolutions, nConfLimit );
438 else
439 printf( "Enumerated the complete set of %d assignments. ", nSolutions );
440 Abc_PrintTime( 1, "Time", Abc_Clock() - clkStart );
441 return RetValue;
442}
443
455void Gia_QbfDumpFile( Gia_Man_t * pGia, int nPars )
456{
457 // original problem: \exists p \forall x \exists y. M(p,x,y)
458 // negated problem: \forall p \exists x \exists y. !M(p,x,y)
459 Cnf_Dat_t * pCnf = (Cnf_Dat_t *)Mf_ManGenerateCnf( pGia, 8, 0, 1, 0, 0 );
460 Vec_Int_t * vVarMap, * vForAlls, * vExists;
461 Gia_Obj_t * pObj;
462 char * pFileName;
463 int i, Entry;
464 // create var map
465 vVarMap = Vec_IntStart( pCnf->nVars );
466 Gia_ManForEachCi( pGia, pObj, i )
467 if ( i < nPars )
468 Vec_IntWriteEntry( vVarMap, pCnf->pVarNums[Gia_ManCiIdToId(pGia, i)], 1 );
469 // create various maps
470 vForAlls = Vec_IntAlloc( nPars );
471 vExists = Vec_IntAlloc( Gia_ManCiNum(pGia) - nPars );
472 Vec_IntForEachEntry( vVarMap, Entry, i )
473 if ( Entry )
474 Vec_IntPush( vForAlls, i );
475 else
476 Vec_IntPush( vExists, i );
477 // generate CNF
478 pFileName = Extra_FileNameGenericAppend( pGia->pSpec, ".qdimacs" );
479 Cnf_DataWriteIntoFile( pCnf, pFileName, 0, vForAlls, vExists );
480 Cnf_DataFree( pCnf );
481 Vec_IntFree( vForAlls );
482 Vec_IntFree( vExists );
483 Vec_IntFree( vVarMap );
484 printf( "The 2QBF formula was written into file \"%s\".\n", pFileName );
485}
486void Gia_QbfDumpFileInv( Gia_Man_t * pGia, int nPars )
487{
488 // original problem: \exists p \forall x \exists y. M(p,x,y)
489 // negated problem: \forall p \exists x \exists y. !M(p,x,y)
490 Cnf_Dat_t * pCnf = (Cnf_Dat_t *)Mf_ManGenerateCnf( pGia, 8, 0, 1, 0, 0 );
491 Vec_Int_t * vVarMap, * vForAlls, * vExists1, * vExists2;
492 Gia_Obj_t * pObj;
493 char * pFileName;
494 int i, Entry;
495 // complement the last clause
496 //int * pLit = pCnf->pClauses[pCnf->nClauses] - 1; *pLit ^= 1;
497 // create var map
498 vVarMap = Vec_IntStart( pCnf->nVars );
499 Gia_ManForEachCi( pGia, pObj, i )
500 Vec_IntWriteEntry( vVarMap, pCnf->pVarNums[Gia_ManCiIdToId(pGia, i)], i < nPars ? 1 : 2 );
501 // create various maps
502 vExists1 = Vec_IntAlloc( nPars );
503 vForAlls = Vec_IntAlloc( Gia_ManCiNum(pGia) - nPars );
504 vExists2 = Vec_IntAlloc( pCnf->nVars - Gia_ManCiNum(pGia) );
505 Vec_IntForEachEntry( vVarMap, Entry, i )
506 if ( Entry == 1 )
507 Vec_IntPush( vExists1, i );
508 else if ( Entry == 2 )
509 Vec_IntPush( vForAlls, i );
510 else
511 Vec_IntPush( vExists2, i );
512 // generate CNF
513 pFileName = Extra_FileNameGenericAppend( pGia->pSpec, ".qdimacs" );
514 Cnf_DataWriteIntoFileInv( pCnf, pFileName, 0, vExists1, vForAlls, vExists2 );
515 Cnf_DataFree( pCnf );
516 Vec_IntFree( vExists1 );
517 Vec_IntFree( vForAlls );
518 Vec_IntFree( vExists2 );
519 Vec_IntFree( vVarMap );
520 printf( "The 2QBF formula was written into file \"%s\".\n", pFileName );
521}
522
523
524
525
537Qbf_Man_t * Gia_QbfAlloc( Gia_Man_t * pGia, int nPars, int fGlucose, int fVerbose )
538{
539 Qbf_Man_t * p;
540 Cnf_Dat_t * pCnf;
541 Gia_ObjFlipFaninC0( Gia_ManPo(pGia, 0) );
542 pCnf = (Cnf_Dat_t *)Mf_ManGenerateCnf( pGia, 8, 0, 1, 0, 0 );
543 Gia_ObjFlipFaninC0( Gia_ManPo(pGia, 0) );
544 p = ABC_CALLOC( Qbf_Man_t, 1 );
545 p->clkStart = Abc_Clock();
546 p->pGia = pGia;
547 p->nPars = nPars;
548 p->nVars = Gia_ManPiNum(pGia) - nPars;
549 p->fVerbose = fVerbose;
550 p->iParVarBeg = pCnf->nVars - Gia_ManPiNum(pGia);// - 1;
551 p->pSatVer = (sat_solver *)Cnf_DataWriteIntoSolver( pCnf, 1, 0 );
552 p->pSatSyn = sat_solver_new();
553 p->pSatSynG = fGlucose ? bmcg_sat_solver_start() : NULL;
554 p->vValues = Vec_IntAlloc( Gia_ManPiNum(pGia) );
555 p->vParMap = Vec_IntStartFull( nPars );
556 p->vLits = Vec_IntAlloc( nPars );
557 sat_solver_setnvars( p->pSatSyn, nPars );
558 if ( p->pSatSynG ) bmcg_sat_solver_set_nvars( p->pSatSynG, nPars );
559 Cnf_DataFree( pCnf );
560 return p;
561}
563{
564 sat_solver_delete( p->pSatVer );
565 sat_solver_delete( p->pSatSyn );
566 if ( p->pSatSynG ) bmcg_sat_solver_stop( p->pSatSynG );
567 Vec_IntFree( p->vLits );
568 Vec_IntFree( p->vValues );
569 Vec_IntFree( p->vParMap );
570 ABC_FREE( p );
571}
572
584Gia_Man_t * Gia_QbfQuantifyOne( Gia_Man_t * p, int iVar, int fAndAll, int fOrAll )
585{
586 Gia_Man_t * pNew, * pTemp;
587 Gia_Obj_t * pObj;
588 Vec_Int_t * vCofs;
589 int i, c;
590 pNew = Gia_ManStart( Gia_ManObjNum(p) );
591 pNew->pName = Abc_UtilStrsav( p->pName );
592 Gia_ManHashAlloc( pNew );
594 Gia_ManConst0(p)->Value = 0;
595 Gia_ManForEachPi( p, pObj, i )
596 pObj->Value = Gia_ManAppendCi(pNew);
597 // compute cofactors
598 vCofs = Vec_IntAlloc( 2 * Gia_ManPoNum(p) );
599 for ( c = 0; c < 2; c++ )
600 {
601 Gia_ManPi(p, iVar)->Value = c;
602 Gia_ManForEachAnd( p, pObj, i )
603 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
604 Gia_ManForEachPo( p, pObj, i )
605 Vec_IntPush( vCofs, Gia_ObjFanin0Copy(pObj) );
606 }
607 if ( fAndAll )
608 {
609 for ( i = 0; i < Gia_ManPoNum(p); i++ )
610 Gia_ManAppendCo( pNew, Gia_ManHashAnd(pNew, Vec_IntEntry(vCofs, i), Vec_IntEntry(vCofs, Gia_ManPoNum(p)+i)) );
611 }
612 else if ( fOrAll )
613 {
614 for ( i = 0; i < Gia_ManPoNum(p); i++ )
615 Gia_ManAppendCo( pNew, Gia_ManHashOr(pNew, Vec_IntEntry(vCofs, i), Vec_IntEntry(vCofs, Gia_ManPoNum(p)+i)) );
616 }
617 else
618 {
619 Vec_IntForEachEntry( vCofs, c, i )
620 Gia_ManAppendCo( pNew, c );
621 }
622 Vec_IntFree( vCofs );
623 pNew = Gia_ManCleanup( pTemp = pNew );
624 Gia_ManStop( pTemp );
625 return pNew;
626}
627Gia_Man_t * Gia_QbfQuantifyAll( Gia_Man_t * p, int nPars, int fAndAll, int fOrAll )
628{
629 Gia_Man_t * pNew, * pTemp; int v;
630 pNew = Gia_ManDup( p );
631 for ( v = Gia_ManPiNum(p) - 1; v >= nPars; v-- )
632 {
633 pNew = Gia_QbfQuantifyOne( pTemp = pNew, v, fAndAll, fOrAll );
634 Gia_ManStop( pTemp );
635 }
636 return pNew;
637}
638
650Gia_Man_t * Gia_QbfCofactor( Gia_Man_t * p, int nPars, Vec_Int_t * vValues, Vec_Int_t * vParMap )
651{
652 Gia_Man_t * pNew, * pTemp;
653 Gia_Obj_t * pObj; int i;
654 assert( Gia_ManPiNum(p) == nPars + Vec_IntSize(vValues) );
655 pNew = Gia_ManStart( Gia_ManObjNum(p) );
656 pNew->pName = Abc_UtilStrsav( p->pName );
657 Gia_ManHashAlloc( pNew );
658 Gia_ManConst0(p)->Value = 0;
659 Gia_ManForEachPi( p, pObj, i )
660 if ( i < nPars )
661 {
662 pObj->Value = Gia_ManAppendCi(pNew);
663 if ( Vec_IntEntry(vParMap, i) != -1 )
664 pObj->Value = Vec_IntEntry(vParMap, i);
665 }
666 else
667 pObj->Value = Vec_IntEntry(vValues, i - nPars);
668 Gia_ManForEachAnd( p, pObj, i )
669 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
670 Gia_ManForEachCo( p, pObj, i )
671 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
672 pNew = Gia_ManCleanup( pTemp = pNew );
673 Gia_ManStop( pTemp );
674 assert( Gia_ManPiNum(pNew) == nPars );
675 return pNew;
676}
677/*
678int Gia_QbfAddCofactor( Qbf_Man_t * p, Gia_Man_t * pCof )
679{
680 Cnf_Dat_t * pCnf = (Cnf_Dat_t *)Mf_ManGenerateCnf( pCof, 8, 0, 1, 0, 0 );
681 int i, iFirstVar = sat_solver_nvars(p->pSatSyn) + pCnf->nVars - Gia_ManPiNum(pCof);// - 1;
682 pCnf->pMan = NULL;
683 Cnf_DataLift( pCnf, sat_solver_nvars(p->pSatSyn) );
684 for ( i = 0; i < pCnf->nClauses; i++ )
685 if ( !sat_solver_addclause( p->pSatSyn, pCnf->pClauses[i], pCnf->pClauses[i+1] ) )
686 {
687 Cnf_DataFree( pCnf );
688 return 0;
689 }
690 Cnf_DataFree( pCnf );
691 // add connection clauses
692 for ( i = 0; i < Gia_ManPiNum(p->pGia); i++ )
693 if ( !sat_solver_add_buffer( p->pSatSyn, i, iFirstVar+i, 0 ) )
694 return 0;
695 return 1;
696}
697*/
698void Cnf_SpecialDataLift( Cnf_Dat_t * p, int nVarsPlus, int firstPiVar, int lastPiVar)
699{
700 int v, var;
701 for ( v = 0; v < p->nLiterals; v++ )
702 {
703 var = p->pClauses[0][v] / 2;
704 if (var < firstPiVar || var >= lastPiVar)
705 p->pClauses[0][v] += 2*nVarsPlus;
706 else
707 p->pClauses[0][v] -= 2*firstPiVar;
708 }
709}
710
712{
713 Cnf_Dat_t * pCnf = (Cnf_Dat_t *)Mf_ManGenerateCnf( pCof, 8, 0, 1, 0, 0 );
714 int i, useold = 0;
715 int iFirstVar = useold ? sat_solver_nvars(p->pSatSyn) + pCnf->nVars - Gia_ManPiNum(pCof) : pCnf->nVars - Gia_ManPiNum(pCof); //-1
716 pCnf->pMan = NULL;
717
718 if (useold)
719 Cnf_DataLift( pCnf, sat_solver_nvars(p->pSatSyn) );
720 else
721 Cnf_SpecialDataLift( pCnf, sat_solver_nvars(p->pSatSyn), iFirstVar, iFirstVar + Gia_ManPiNum(p->pGia) );
722
723 for ( i = 0; i < pCnf->nClauses; i++ )
724 if ( !sat_solver_addclause( p->pSatSyn, pCnf->pClauses[i], pCnf->pClauses[i+1] ) )
725 {
726 Cnf_DataFree( pCnf );
727 return 0;
728 }
729 Cnf_DataFree( pCnf );
730 // add connection clauses
731 if (useold)
732 for ( i = 0; i < Gia_ManPiNum(p->pGia); i++ )
733 if ( !sat_solver_add_buffer( p->pSatSyn, i, iFirstVar+i, 0 ) )
734 return 0;
735 return 1;
736}
738{
739 Cnf_Dat_t * pCnf = (Cnf_Dat_t *)Mf_ManGenerateCnf( pCof, 8, 0, 1, 0, 0 );
740 int i, iFirstVar = pCnf->nVars - Gia_ManPiNum(pCof); //-1
741 pCnf->pMan = NULL;
742 Cnf_SpecialDataLift( pCnf, bmcg_sat_solver_varnum(p->pSatSynG), iFirstVar, iFirstVar + Gia_ManPiNum(p->pGia) );
743 for ( i = 0; i < pCnf->nClauses; i++ )
744 if ( !bmcg_sat_solver_addclause( p->pSatSynG, pCnf->pClauses[i], pCnf->pClauses[i+1]-pCnf->pClauses[i] ) )
745 {
746 Cnf_DataFree( pCnf );
747 return 0;
748 }
749 Cnf_DataFree( pCnf );
750 return 1;
751}
752
765{
766 int i;
767 Vec_IntClear( vValues );
768 for ( i = 0; i < p->nPars; i++ )
769 Vec_IntPush( vValues, p->pSatSynG ? bmcg_sat_solver_read_cex_varvalue(p->pSatSynG, i) : sat_solver_var_value(p->pSatSyn, i) );
770}
771void Gia_QbfPrint( Qbf_Man_t * p, Vec_Int_t * vValues, int Iter )
772{
773 printf( "%5d : ", Iter );
774 assert( Vec_IntSize(vValues) == p->nVars );
775 Vec_IntPrintBinary( vValues ); printf( " " );
776 printf( "Var =%7d ", p->pSatSynG ? bmcg_sat_solver_varnum(p->pSatSynG) : sat_solver_nvars(p->pSatSyn) );
777 printf( "Cla =%7d ", p->pSatSynG ? bmcg_sat_solver_clausenum(p->pSatSynG) : sat_solver_nclauses(p->pSatSyn) );
778 printf( "Conf =%9d ", p->pSatSynG ? bmcg_sat_solver_conflictnum(p->pSatSynG) : sat_solver_nconflicts(p->pSatSyn) );
779 Abc_PrintTime( 1, "Time", Abc_Clock() - p->clkStart );
780}
781
794{
795 int i, Entry, RetValue;
796 assert( Vec_IntSize(vValues) == p->nPars );
797 Vec_IntClear( p->vLits );
798 Vec_IntForEachEntry( vValues, Entry, i )
799 Vec_IntPush( p->vLits, Abc_Var2Lit(p->iParVarBeg+i, !Entry) );
800 RetValue = sat_solver_solve( p->pSatVer, Vec_IntArray(p->vLits), Vec_IntLimit(p->vLits), 0, 0, 0, 0 );
801 if ( RetValue == l_True )
802 {
803 Vec_IntClear( vValues );
804 for ( i = 0; i < p->nVars; i++ )
805 Vec_IntPush( vValues, sat_solver_var_value(p->pSatVer, p->iParVarBeg+p->nPars+i) );
806 }
807 return RetValue == l_True ? 1 : 0;
808}
809
822{
823 int i, status, Lits[2];
824 for ( i = 0; i < 4*11; i++ )
825 if ( i % 4 == 0 )
826 {
827 assert( Vec_IntEntry(p->vParMap, i) == -1 );
828 Vec_IntWriteEntry( p->vParMap, i, (i % 4) == 3 );
829 Lits[0] = Abc_Var2Lit( i, (i % 4) != 3 );
830 status = sat_solver_addclause( p->pSatSyn, Lits, Lits+1 );
831 assert( status );
832 }
833}
835{
836 int i, status, Entry, Lits[2];
837 assert( Vec_IntSize(vValues) == p->nPars );
838 printf( " Pattern " );
839 Vec_IntPrintBinary( vValues );
840 printf( "\n" );
841 Vec_IntForEachEntry( vValues, Entry, i )
842 {
843 Lits[0] = Abc_Var2Lit( i, Entry );
844 status = sat_solver_solve( p->pSatSyn, Lits, Lits+1, 0, 0, 0, 0 );
845 printf( " Var =%4d ", i );
846 if ( status != l_True )
847 {
848 printf( "UNSAT\n" );
849 Lits[0] = Abc_LitNot(Lits[0]);
850 status = sat_solver_addclause( p->pSatSyn, Lits, Lits+1 );
851 assert( status );
852 continue;
853 }
854 Gia_QbfOnePattern( p, p->vLits );
855 Vec_IntPrintBinary( p->vLits );
856 printf( "\n" );
857 }
858 assert( Vec_IntSize(vValues) == p->nPars );
859}
860
872int Gia_QbfSolve( Gia_Man_t * pGia, int nPars, int nIterLimit, int nConfLimit, int nTimeOut, int nEncVars, int fGlucose, int fVerbose )
873{
874 Qbf_Man_t * p = Gia_QbfAlloc( pGia, nPars, fGlucose, fVerbose );
875 Gia_Man_t * pCof;
876 int i, status, RetValue = 0;
877 abctime clk;
878// Gia_QbfAddSpecialConstr( p );
879 if ( fVerbose )
880 printf( "Solving QBF for \"%s\" with %d parameters, %d variables and %d AIG nodes.\n",
881 Gia_ManName(pGia), p->nPars, p->nVars, Gia_ManAndNum(pGia) );
882 assert( Gia_ManRegNum(pGia) == 0 );
883 Vec_IntFill( p->vValues, nPars, 0 );
884 for ( i = 0; Gia_QbfVerify(p, p->vValues); i++ )
885 {
886 // generate next constraint
887 assert( Vec_IntSize(p->vValues) == p->nVars );
888 pCof = Gia_QbfCofactor( pGia, nPars, p->vValues, p->vParMap );
889 status = p->pSatSynG ? Gia_QbfAddCofactorG( p, pCof ) : Gia_QbfAddCofactor( p, pCof );
890 Gia_ManStop( pCof );
891 if ( status == 0 ) { RetValue = 1; break; }
892 // synthesize next assignment
893 clk = Abc_Clock();
894 if ( p->pSatSynG )
895 status = bmcg_sat_solver_solve( p->pSatSynG, NULL, 0 );
896 else
897 status = sat_solver_solve( p->pSatSyn, NULL, NULL, (ABC_INT64_T)nConfLimit, 0, 0, 0 );
898 p->clkSat += Abc_Clock() - clk;
899 if ( fVerbose )
900 Gia_QbfPrint( p, p->vValues, i );
901 if ( status == l_False ) { RetValue = 1; break; }
902 if ( status == l_Undef ) { RetValue = -1; break; }
903 // extract SAT assignment
904 Gia_QbfOnePattern( p, p->vValues );
905 assert( Vec_IntSize(p->vValues) == p->nPars );
906 // examine variables
907// Gia_QbfLearnConstraint( p, p->vValues );
908// Vec_IntPrintBinary( p->vValues ); printf( "\n" );
909 if ( nIterLimit && i+1 == nIterLimit ) { RetValue = -1; break; }
910 if ( nTimeOut && (Abc_Clock() - p->clkStart)/CLOCKS_PER_SEC >= nTimeOut ) { RetValue = -1; break; }
911 }
912 if ( RetValue == 0 )
913 {
914 int nZeros = Vec_IntCountZero( p->vValues );
915 printf( "Parameters: " );
916 assert( Vec_IntSize(p->vValues) == nPars );
917 Vec_IntPrintBinary( p->vValues );
918 printf( " Statistics: 0=%d 1=%d\n", nZeros, Vec_IntSize(p->vValues) - nZeros );
919 if ( nEncVars )
920 {
921 int nBits = Vec_IntSize(p->vValues)/(1 << nEncVars);
922 assert( Vec_IntSize(p->vValues) == (1 << nEncVars) * nBits );
923 Gia_Gen2CodePrint( nEncVars, nBits, p->vValues );
924 }
925 }
926 if ( RetValue == -1 && nTimeOut && (Abc_Clock() - p->clkStart)/CLOCKS_PER_SEC >= nTimeOut )
927 printf( "The problem timed out after %d sec. ", nTimeOut );
928 else if ( RetValue == -1 && nConfLimit )
929 printf( "The problem aborted after %d conflicts. ", nConfLimit );
930 else if ( RetValue == -1 && nIterLimit )
931 printf( "The problem aborted after %d iterations. ", nIterLimit );
932 else if ( RetValue == 1 )
933 printf( "The problem is UNSAT after %d iterations. ", i );
934 else
935 printf( "The problem is SAT after %d iterations. ", i );
936 if ( fVerbose )
937 {
938 printf( "\n" );
939 Abc_PrintTime( 1, "SAT ", p->clkSat );
940 Abc_PrintTime( 1, "Other", Abc_Clock() - p->clkStart - p->clkSat );
941 Abc_PrintTime( 1, "TOTAL", Abc_Clock() - p->clkStart );
942 }
943 else
944 Abc_PrintTime( 1, "Time", Abc_Clock() - p->clkStart );
945 Gia_QbfFree( p );
946 return RetValue;
947}
948
960sat_solver * Gia_ManGenSolver( Gia_Man_t * p, Vec_Int_t * vInsOuts, int nIns )
961{
962 Gia_Obj_t * pObj; int i, nObjs = Gia_ManObjNum(p);
963 sat_solver * pSat = sat_solver_new();
964 sat_solver_setnvars( pSat, 2 * nObjs );
966 Gia_ManForEachObjVecStart( vInsOuts, p, pObj, i, nIns )
967 Gia_ObjSetTravIdCurrent(p, pObj);
968 Gia_ManForEachAnd( p, pObj, i )
969 if ( !Gia_ObjIsTravIdCurrent(p, pObj) )
970 sat_solver_add_and( pSat, i, Gia_ObjFaninId0(pObj, i), Gia_ObjFaninId1(pObj, i), Gia_ObjFaninC0(pObj), Gia_ObjFaninC1(pObj), 0 );
971 Gia_ManForEachAnd( p, pObj, i )
972 sat_solver_add_and( pSat, nObjs+i, nObjs+Gia_ObjFaninId0(pObj, i), nObjs+Gia_ObjFaninId1(pObj, i), Gia_ObjFaninC0(pObj), Gia_ObjFaninC1(pObj), 0 );
973 Gia_ManForEachCi( p, pObj, i )
974 if ( !Gia_ObjIsTravIdCurrent(p, pObj) )
975 sat_solver_add_buffer( pSat, nObjs+Gia_ObjId(p, pObj), Gia_ObjId(p, pObj), 0 );
976 Gia_ManForEachCo( p, pObj, i )
977 if ( Gia_ObjFaninId0p(p, pObj) > 0 ) {
978 sat_solver_add_buffer( pSat, Gia_ObjId(p, pObj), Gia_ObjFaninId0p(p, pObj), Gia_ObjFaninC0(pObj) );
979 sat_solver_add_buffer( pSat, nObjs+Gia_ObjId(p, pObj), nObjs+Gia_ObjFaninId0p(p, pObj), Gia_ObjFaninC0(pObj) );
980 sat_solver_add_buffer( pSat, nObjs+Gia_ObjId(p, pObj), Gia_ObjId(p, pObj), 0 );
981 }
982 return pSat;
983}
984Vec_Int_t * Gia_ManGenCombs( Gia_Man_t * p, Vec_Int_t * vInsOuts, int nIns, int fVerbose )
985{
986 int nTimeOut = 600, nConfLimit = 1000000;
987 int i, iSatVar, Iter, Mask, nSolutions = 0, RetValue = 0;
988 abctime clkStart = Abc_Clock();
989 sat_solver * pSat = Gia_ManGenSolver( p, vInsOuts, nIns );
990 Vec_Int_t * vLits = Vec_IntAlloc( 100 );
991 Vec_Int_t * vRes = Vec_IntAlloc( 1000 );
992 for ( Iter = 0; Iter < 1000000; Iter++ )
993 {
994 int status = sat_solver_solve( pSat, NULL, NULL, (ABC_INT64_T)nConfLimit, 0, 0, 0 );
995 if ( status == l_False ) { RetValue = 1; break; }
996 if ( status == l_Undef ) { RetValue = 0; break; }
997 nSolutions++;
998 // extract SAT assignment
999 Mask = 0;
1000 Vec_IntClear( vLits );
1001 Vec_IntForEachEntry( vInsOuts, iSatVar, i ) {
1002 Vec_IntPush( vLits, Abc_Var2Lit(iSatVar, sat_solver_var_value(pSat, iSatVar)) );
1003 if ( sat_solver_var_value(pSat, iSatVar) )
1004 Mask |= 1 << (Vec_IntSize(vInsOuts)-1-i);
1005 }
1006 Vec_IntPush( vRes, Mask );
1007 if ( fVerbose )
1008 {
1009 printf( "%5d : ", Iter );
1010 Vec_IntForEachEntry( vInsOuts, iSatVar, i ) {
1011 if ( i == nIns ) printf( " " );
1012 printf( "%d", (Mask >> (Vec_IntSize(vInsOuts)-1-i)) & 1 );
1013 }
1014 printf( "\n" );
1015 }
1016 // add clause
1017 if ( !sat_solver_addclause( pSat, Vec_IntArray(vLits), Vec_IntArray(vLits) + Vec_IntSize(vLits) ) )
1018 { RetValue = 1; break; }
1019 if ( nTimeOut && (Abc_Clock() - clkStart)/CLOCKS_PER_SEC >= nTimeOut ) { RetValue = 0; break; }
1020 }
1021 Vec_IntSort( vRes, 0 );
1022 Vec_IntFree( vLits );
1023 sat_solver_delete( pSat );
1024 if ( RetValue == 0 )
1025 Vec_IntFreeP( &vRes );
1026 if ( fVerbose )
1027 Abc_PrintTime( 1, "Time", Abc_Clock() - clkStart );
1028 return vRes;
1029}
1030void Gia_ManGenWriteRel( Vec_Int_t * vRes, int nIns, int nOuts, char * pFileName )
1031{
1032 int i, k, Mask, nVars = nIns + nOuts;
1033 Abc_RData_t * p2, * p = Abc_RDataStart( nIns, nOuts, Vec_IntSize(vRes) );
1034 Vec_IntForEachEntry( vRes, Mask, i ) {
1035 for ( k = 0; k < nVars; k++ )
1036 if ( (Mask >> (nVars-1-k)) & 1 ) { // the bit is 1
1037 if ( k < nIns )
1038 Abc_RDataSetIn( p, k, i );
1039 else
1040 Abc_RDataSetOut( p, 2*(k-nIns)+1, i );
1041 }
1042 else { // the bit is zero
1043 if ( k >= nIns )
1044 Abc_RDataSetOut( p, 2*(k-nIns), i );
1045 }
1046 }
1047 Abc_WritePla( p, pFileName, 0 );
1048 p2 = Abc_RData2Rel( p );
1049 Abc_WritePla( p2, Extra_FileNameGenericAppend(pFileName, "_rel.pla"), 1 );
1050 Abc_RDataStop( p2 );
1051 Abc_RDataStop( p );
1052}
1053void Gia_ManGenRel2( Gia_Man_t * pGia, Vec_Int_t * vInsOuts, int nIns, char * pFileName, int fVerbose )
1054{
1055 Vec_Int_t * vRes = Gia_ManGenCombs( pGia, vInsOuts, nIns, fVerbose );
1056 if ( vRes == NULL ) {
1057 printf( "Enumerating solutions did not succeed.\n" );
1058 return;
1059 }
1060 Gia_ManGenWriteRel( vRes, nIns, Vec_IntSize(vInsOuts)-nIns, pFileName );
1061 Vec_IntFree( vRes );
1062}
1063
1075Vec_Int_t * Gia_ManCollectNodeTfos( Gia_Man_t * p, int * pNodes, int nNodes )
1076{
1077 Vec_Int_t * vTfo = Vec_IntAlloc( 100 );
1078 Gia_Obj_t * pObj; int i;
1080 for ( i = 0; i < nNodes; i++ )
1081 Gia_ObjSetTravIdCurrentId( p, pNodes[i] );
1082 Gia_ManForEachAnd( p, pObj, i ) {
1083 if ( Gia_ObjIsTravIdCurrentId(p, i) )
1084 continue;
1085 if ( Gia_ObjIsTravIdCurrentId(p, Gia_ObjFaninId0(pObj, i)) || Gia_ObjIsTravIdCurrentId(p, Gia_ObjFaninId1(pObj, i)) )
1086 Gia_ObjSetTravIdCurrentId( p, i ), Vec_IntPush( vTfo, i );
1087 }
1088 Gia_ManForEachCo( p, pObj, i )
1089 if ( Gia_ObjIsTravIdCurrentId(p, Gia_ObjFaninId0p(p, pObj)) )
1090 Vec_IntPush( vTfo, Gia_ObjId(p, pObj) );
1091 return vTfo;
1092}
1094{
1095 Vec_Int_t * vTfi = Vec_IntAlloc( 100 );
1096 Gia_Obj_t * pObj; int i, Id;
1098 Gia_ManForEachObjVec( vNodes, p, pObj, i )
1099 if ( Gia_ObjIsCo(pObj) )
1100 Gia_ObjSetTravIdCurrentId( p, Gia_ObjFaninId0p(p, pObj) );
1101 Gia_ManForEachAndReverse( p, pObj, i ) {
1102 if ( !Gia_ObjIsTravIdCurrentId(p, i) )
1103 continue;
1104 Gia_ObjSetTravIdCurrentId(p, Gia_ObjFaninId0(pObj, i));
1105 Gia_ObjSetTravIdCurrentId(p, Gia_ObjFaninId1(pObj, i));
1106 }
1107 Gia_ManForEachCiId( p, Id, i )
1108 if ( Gia_ObjIsTravIdCurrentId(p, Id) )
1109 Vec_IntPush( vTfi, Id );
1110 Gia_ManForEachAnd( p, pObj, i )
1111 if ( Gia_ObjIsTravIdCurrentId(p, i) )
1112 Vec_IntPush( vTfi, i );
1113 return vTfi;
1114}
1115Gia_Man_t * Gia_ManGenRelMiter( Gia_Man_t * pGia, Vec_Int_t * vInsOuts, int nIns )
1116{
1117 Vec_Int_t * vTfo = Gia_ManCollectNodeTfos( pGia, Vec_IntEntryP(vInsOuts, nIns), Vec_IntSize(vInsOuts)-nIns );
1118 Vec_Int_t * vTfi = Gia_ManCollectNodeTfis( pGia, vTfo );
1119 Vec_Int_t * vInLits = Vec_IntAlloc( nIns );
1120 Vec_Int_t * vOutLits = Vec_IntAlloc( Vec_IntSize(vInsOuts) - nIns );
1121 Gia_Man_t * pNew, * pTemp; Gia_Obj_t * pObj; int i, iLit = 0;
1122 Gia_ManFillValue( pGia );
1123 pNew = Gia_ManStart( 1000 );
1124 pNew->pName = Abc_UtilStrsav( pGia->pName );
1125 Gia_ManHashAlloc( pNew );
1126 Gia_ManForEachObjVec( vTfi, pGia, pObj, i )
1127 if ( Gia_ObjIsCi(pObj) )
1128 pObj->Value = Gia_ManAppendCi(pNew);
1129 for ( i = 0; i < Vec_IntSize(vInsOuts)-nIns; i++ )
1130 Vec_IntPush( vInLits, Gia_ManAppendCi(pNew) );
1131 Gia_ManForEachObjVec( vTfi, pGia, pObj, i )
1132 if ( Gia_ObjIsAnd(pObj) )
1133 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1134 Gia_ManForEachObjVec( vTfo, pGia, pObj, i )
1135 if ( Gia_ObjIsCo(pObj) )
1136 pObj->Value = Gia_ObjFanin0Copy(pObj);
1137 Gia_ManForEachObjVec( vInsOuts, pGia, pObj, i )
1138 if ( i < nIns )
1139 Vec_IntPush( vOutLits, pObj->Value );
1140 else
1141 pObj->Value = Vec_IntEntry( vInLits, i-nIns );
1142 Gia_ManForEachObjVec( vTfo, pGia, pObj, i )
1143 if ( Gia_ObjIsAnd(pObj) )
1144 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1145 Gia_ManForEachObjVec( vTfo, pGia, pObj, i )
1146 if ( Gia_ObjIsCo(pObj) )
1147 iLit = Gia_ManHashOr( pNew, iLit, Gia_ManHashXor(pNew, Gia_ObjFanin0Copy(pObj), pObj->Value) );
1148 Gia_ManAppendCo( pNew, iLit );
1149 Vec_IntForEachEntry( vOutLits, iLit, i )
1150 Gia_ManAppendCo( pNew, iLit );
1151 Vec_IntFree( vTfo );
1152 Vec_IntFree( vTfi );
1153 Vec_IntFree( vInLits );
1154 Vec_IntFree( vOutLits );
1155 pNew = Gia_ManCleanup( pTemp = pNew );
1156 Gia_ManStop( pTemp );
1157 Gia_ManSetRegNum( pNew, Gia_ManRegNum(pGia) );
1158 return pNew;
1159}
1160void Gia_ManPrintRelMinterm( int Mint, int nIns, int nVars )
1161{
1162 for ( int i = 0; i < nVars; i++ )
1163 printf( "%s%d", i == nIns ? " ":"", (Mint >> (nVars-1-i)) & 1 );
1164 printf( "\n" );
1165}
1166Vec_Int_t * Gia_ManGenIoCombs( Gia_Man_t * pGia, Vec_Int_t * vInsOuts, int nIns, int fVerbose )
1167{
1168 abctime clkStart = Abc_Clock();
1169 int nTimeOut = 600, nConfLimit = 1000000;
1170 int i, iNode, iSatVar, Iter, Mask, nSolutions = 0, RetValue = 0;
1171 Gia_Man_t * pMiter = Gia_ManGenRelMiter( pGia, vInsOuts, nIns );
1172 Cnf_Dat_t * pCnf = (Cnf_Dat_t*)Mf_ManGenerateCnf( pMiter, 8, 0, 0, 0, 0 );
1173 sat_solver * pSat = (sat_solver*)Cnf_DataWriteIntoSolver( pCnf, 1, 0 );
1174 int iLit = Abc_Var2Lit( 1, 0 ); // enumerating the care set (the miter output is 1)
1175 int status = sat_solver_addclause( pSat, &iLit, &iLit + 1 ); assert( status );
1176 Vec_Int_t * vSatVars = Vec_IntAlloc( Vec_IntSize(vInsOuts) );
1177 Vec_IntForEachEntry( vInsOuts, iNode, i )
1178 Vec_IntPush( vSatVars, i < nIns ? 2+i : pCnf->nVars-Vec_IntSize(vInsOuts)+i );
1179 Vec_Int_t * vLits = Vec_IntAlloc( 100 );
1180 Vec_Int_t * vRes = Vec_IntAlloc( 1000 );
1181 for ( Iter = 0; Iter < 1000000; Iter++ )
1182 {
1183 int status = sat_solver_solve( pSat, NULL, NULL, (ABC_INT64_T)nConfLimit, 0, 0, 0 );
1184 if ( status == l_False ) { RetValue = 1; break; }
1185 if ( status == l_Undef ) { RetValue = 0; break; }
1186 nSolutions++;
1187 // extract SAT assignment
1188 Mask = 0;
1189 Vec_IntClear( vLits );
1190 Vec_IntForEachEntry( vSatVars, iSatVar, i ) {
1191 Vec_IntPush( vLits, Abc_Var2Lit(iSatVar, sat_solver_var_value(pSat, iSatVar)) );
1192 if ( sat_solver_var_value(pSat, iSatVar) )
1193 Mask |= 1 << (Vec_IntSize(vInsOuts)-1-i);
1194 }
1195 Vec_IntPush( vRes, Mask );
1196 if ( 0 ) {
1197 printf( "%5d : ", Iter );
1198 Gia_ManPrintRelMinterm( Mask, nIns, Vec_IntSize(vSatVars) );
1199 }
1200 // add clause
1201 if ( !sat_solver_addclause( pSat, Vec_IntArray(vLits), Vec_IntArray(vLits) + Vec_IntSize(vLits) ) )
1202 { RetValue = 1; break; }
1203 if ( nTimeOut && (Abc_Clock() - clkStart)/CLOCKS_PER_SEC >= nTimeOut ) { RetValue = 0; break; }
1204 }
1205 // complement the set of input/output minterms
1206 Vec_Int_t * vBits = Vec_IntStart( 1 << Vec_IntSize(vInsOuts) );
1207 Vec_IntForEachEntry( vRes, Mask, i )
1208 Vec_IntWriteEntry( vBits, Mask, 1 );
1209 Vec_IntClear( vRes );
1210 Vec_IntForEachEntry( vBits, Mask, i )
1211 if ( !Mask )
1212 Vec_IntPush( vRes, i );
1213 Vec_IntFree( vBits );
1214 // cleanup
1215 Vec_IntFree( vLits );
1216 sat_solver_delete( pSat );
1217 Gia_ManStop( pMiter );
1218 Cnf_DataFree( pCnf );
1219 if ( RetValue == 0 )
1220 Vec_IntFreeP( &vRes );
1221 return vRes;
1222}
1223void Gia_ManGenRel( Gia_Man_t * pGia, Vec_Int_t * vInsOuts, int nIns, char * pFileName, int fVerbose )
1224{
1225 abctime clkStart = Abc_Clock();
1226 Vec_Int_t * vRes = Gia_ManGenIoCombs( pGia, vInsOuts, nIns, fVerbose );
1227 if ( vRes == NULL ) {
1228 printf( "Enumerating solutions did not succeed.\n" );
1229 return;
1230 }
1231 Gia_ManGenWriteRel( vRes, nIns, Vec_IntSize(vInsOuts)-nIns, pFileName );
1232 if ( fVerbose ) {
1233 printf( "The resulting relation with %d input/output minterms is written into file \"%s\". ", Vec_IntSize(vRes), pFileName );
1234 Abc_PrintTime( 1, "Time", Abc_Clock() - clkStart );
1235 if ( 0 ) {
1236 int i, Mint;
1237 Vec_IntForEachEntry( vRes, Mint, i )
1238 Gia_ManPrintRelMinterm( Mint, nIns, Vec_IntSize(vInsOuts) );
1239 }
1240 }
1241 Vec_IntFree( vRes );
1242}
1243
1247
1248
1250
int bmcg_sat_solver_conflictnum(bmcg_sat_solver *s)
int bmcg_sat_solver_varnum(bmcg_sat_solver *s)
bmcg_sat_solver * bmcg_sat_solver_start()
MACRO DEFINITIONS ///.
int bmcg_sat_solver_solve(bmcg_sat_solver *s, int *plits, int nlits)
int bmcg_sat_solver_addclause(bmcg_sat_solver *s, int *plits, int nlits)
int bmcg_sat_solver_read_cex_varvalue(bmcg_sat_solver *s, int ivar)
void bmcg_sat_solver_set_nvars(bmcg_sat_solver *s, int nvars)
int bmcg_sat_solver_clausenum(bmcg_sat_solver *s)
void bmcg_sat_solver_stop(bmcg_sat_solver *s)
void bmcg_sat_solver
Definition AbcGlucose.h:63
int nWords
Definition abcNpn.c:127
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
#define ABC_FREE(obj)
Definition abc_global.h:267
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
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_add_and
Definition cecSatG2.c:38
#define sat_solver
Definition cecSatG2.c:34
#define sat_solver_solve
Definition cecSatG2.c:45
void Cnf_DataWriteIntoFileInv(Cnf_Dat_t *p, char *pFileName, int fReadable, Vec_Int_t *vExists1, Vec_Int_t *vForAlls, Vec_Int_t *vExists2)
Definition cnfMan.c:427
struct Cnf_Dat_t_ Cnf_Dat_t
Definition cnf.h:52
void Cnf_DataFree(Cnf_Dat_t *p)
Definition cnfMan.c:207
void Cnf_DataWriteIntoFile(Cnf_Dat_t *p, char *pFileName, int fReadable, Vec_Int_t *vForAlls, Vec_Int_t *vExists)
Definition cnfMan.c:387
void Cnf_DataLift(Cnf_Dat_t *p, int nVarsPlus)
Definition cnfMan.c:232
#define Code
Definition deflate.h:76
Cube * p
Definition exorList.c:222
char * Extra_FileNameGenericAppend(char *pBase, char *pSuffix)
Gia_Man_t * Gia_QbfQuantifyAll(Gia_Man_t *p, int nPars, int fAndAll, int fOrAll)
Definition giaQbf.c:627
Gia_Man_t * Gia_QbfQuantifyOne(Gia_Man_t *p, int iVar, int fAndAll, int fOrAll)
Definition giaQbf.c:584
int Gia_QbfSolve(Gia_Man_t *pGia, int nPars, int nIterLimit, int nConfLimit, int nTimeOut, int nEncVars, int fGlucose, int fVerbose)
Definition giaQbf.c:872
typedefABC_NAMESPACE_IMPL_START struct Qbf_Man_t_ Qbf_Man_t
DECLARATIONS ///.
Definition giaQbf.c:36
void Gia_ManPrintRelMinterm(int Mint, int nIns, int nVars)
Definition giaQbf.c:1160
Vec_Int_t * Gia_GenCreateMuxes(Gia_Man_t *p, Gia_Man_t *pNew, Vec_Int_t *vFlops, int nLutNum, int nLutSize, Vec_Int_t *vParLits, int fUseRi)
Definition giaQbf.c:115
void Gia_ManGenRel2(Gia_Man_t *pGia, Vec_Int_t *vInsOuts, int nIns, char *pFileName, int fVerbose)
Definition giaQbf.c:1053
word * Gia_Gen2CodeOneP(int nLutSize, int nLutNum, Vec_Int_t *vCode, int x)
Definition giaQbf.c:298
int Gia_QbfAddCofactorG(Qbf_Man_t *p, Gia_Man_t *pCof)
Definition giaQbf.c:737
int Gia_QbfAddCofactor(Qbf_Man_t *p, Gia_Man_t *pCof)
Definition giaQbf.c:711
Vec_Int_t * Gia_ManCollectNodeTfos(Gia_Man_t *p, int *pNodes, int nNodes)
Definition giaQbf.c:1075
int Gia_Gen2CodeOne(int nLutSize, int nLutNum, Vec_Int_t *vCode, int x)
Definition giaQbf.c:290
void Gia_ManGenRel(Gia_Man_t *pGia, Vec_Int_t *vInsOuts, int nIns, char *pFileName, int fVerbose)
Definition giaQbf.c:1223
Gia_Man_t * Gia_Gen2CreateMiter(int nLutSize, int nLutNum)
Definition giaQbf.c:224
int Gia_Gen2CreateMux_rec(Gia_Man_t *pNew, int *pCtrl, int nCtrl, Vec_Int_t *vData, int Shift)
Definition giaQbf.c:201
void Gia_QbfPrint(Qbf_Man_t *p, Vec_Int_t *vValues, int Iter)
Definition giaQbf.c:771
int Gia_ManSatEnum(Gia_Man_t *pGia, int nConfLimit, int nTimeOut, int fVerbose)
Definition giaQbf.c:396
int Gia_QbfVerify(Qbf_Man_t *p, Vec_Int_t *vValues)
Definition giaQbf.c:793
void Gia_Gen2CodePrint(int nLutSize, int nLutNum, Vec_Int_t *vCode)
Definition giaQbf.c:307
sat_solver * Gia_ManGenSolver(Gia_Man_t *p, Vec_Int_t *vInsOuts, int nIns)
Definition giaQbf.c:960
void Gia_QbfLearnConstraint(Qbf_Man_t *p, Vec_Int_t *vValues)
Definition giaQbf.c:834
Vec_Int_t * Gia_Gen2CreateMuxes(Gia_Man_t *pNew, int nLutSize, int nLutNum, Vec_Int_t *vPLits, Vec_Int_t *vXLits)
Definition giaQbf.c:210
Gia_Man_t * Gia_GenQbfMiter(Gia_Man_t *p, int nFrames, int nLutNum, int nLutSize, char *pStr, int fUseOut, int fVerbose)
Definition giaQbf.c:137
void Gia_Gen2CodeTest()
Definition giaQbf.c:374
Vec_Int_t * Gia_ManGenIoCombs(Gia_Man_t *pGia, Vec_Int_t *vInsOuts, int nIns, int fVerbose)
Definition giaQbf.c:1166
void Gia_QbfOnePattern(Qbf_Man_t *p, Vec_Int_t *vValues)
Definition giaQbf.c:764
void Gia_ManGenWriteRel(Vec_Int_t *vRes, int nIns, int nOuts, char *pFileName)
Definition giaQbf.c:1030
Gia_Man_t * Gia_ManGenRelMiter(Gia_Man_t *pGia, Vec_Int_t *vInsOuts, int nIns)
Definition giaQbf.c:1115
Vec_Int_t * Gia_GenCollectFlopIndexes(char *pStr, int nLutNum, int nLutSize, int nFlops)
FUNCTION DEFINITIONS ///.
Definition giaQbf.c:70
void Gia_QbfAddSpecialConstr(Qbf_Man_t *p)
Definition giaQbf.c:821
Vec_Int_t * Gia_ManCollectNodeTfis(Gia_Man_t *p, Vec_Int_t *vNodes)
Definition giaQbf.c:1093
Gia_Man_t * Gia_QbfCofactor(Gia_Man_t *p, int nPars, Vec_Int_t *vValues, Vec_Int_t *vParMap)
Definition giaQbf.c:650
int Gia_GenCreateMux_rec(Gia_Man_t *pNew, int *pCtrl, int nCtrl, Vec_Int_t *vData, int Shift)
Definition giaQbf.c:106
void Gia_QbfFree(Qbf_Man_t *p)
Definition giaQbf.c:562
void Gia_QbfDumpFile(Gia_Man_t *pGia, int nPars)
Definition giaQbf.c:455
void Cnf_SpecialDataLift(Cnf_Dat_t *p, int nVarsPlus, int firstPiVar, int lastPiVar)
Definition giaQbf.c:698
void Gia_QbfDumpFileInv(Gia_Man_t *pGia, int nPars)
Definition giaQbf.c:486
Vec_Int_t * Gia_ManGenCombs(Gia_Man_t *p, Vec_Int_t *vInsOuts, int nIns, int fVerbose)
Definition giaQbf.c:984
Qbf_Man_t * Gia_QbfAlloc(Gia_Man_t *pGia, int nPars, int fGlucose, int fVerbose)
Definition giaQbf.c:537
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition giaDup.c:720
#define Gia_ManForEachPo(p, pObj, i)
Definition gia.h:1250
#define Gia_ManForEachAnd(p, pObj, i)
Definition gia.h:1214
#define Gia_ManForEachAndReverse(p, pObj, i)
Definition gia.h:1222
int Gia_ManHashDualMiter(Gia_Man_t *p, Vec_Int_t *vOuts)
Definition giaHash.c:809
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition giaMan.c:764
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition giaHash.c:105
#define Gia_ManForEachPi(p, pObj, i)
Definition gia.h:1248
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
Definition giaMan.c:57
#define Gia_ManForEachObjVecStart(vVec, p, pObj, i, Start)
Definition gia.h:1196
int Gia_ManHashOr(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:621
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
int Gia_ManHashXor(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:668
void Gia_ManFillValue(Gia_Man_t *p)
Definition giaUtil.c:369
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition gia.h:1194
int Gia_ManHashMux(Gia_Man_t *p, int iCtrl, int iData1, int iData0)
Definition giaHash.c:692
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition giaScl.c:84
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:576
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition giaUtil.c:190
#define Gia_ManForEachCo(p, pObj, i)
Definition gia.h:1236
#define Gia_ManForEachCi(p, pObj, i)
Definition gia.h:1228
void Gia_ManHashStop(Gia_Man_t *p)
Definition giaHash.c:149
void * Mf_ManGenerateCnf(Gia_Man_t *pGia, int nLutSize, int fCnfObjIds, int fAddOrCla, int fMapping, int fVerbose)
Definition giaMf.c:1877
#define Gia_ManForEachCiId(p, Id, i)
Definition gia.h:1230
void Extra_PrintBinary(FILE *pFile, unsigned Sign[], int nBits)
typedefABC_NAMESPACE_HEADER_START struct Abc_RData_t_ Abc_RData_t
INCLUDES ///.
Definition ioResub.h:40
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
void * Cnf_DataWriteIntoSolver(Cnf_Dat_t *p, int nFrames, int fInit)
Definition cnfMan.c:579
sat_solver * sat_solver_new(void)
Definition satSolver.c:1137
int sat_solver_nconflicts(sat_solver *s)
Definition satSolver.c:2381
int sat_solver_nclauses(sat_solver *s)
Definition satSolver.c:2375
void sat_solver_setnvars(sat_solver *s, int n)
Definition satSolver.c:1272
int sat_solver_nvars(sat_solver *s)
Definition satSolver.c:2369
void sat_solver_delete(sat_solver *s)
Definition satSolver.c:1341
int nVars
Definition cnf.h:59
int * pVarNums
Definition cnf.h:63
int ** pClauses
Definition cnf.h:62
int nClauses
Definition cnf.h:61
Aig_Man_t * pMan
Definition cnf.h:58
char * pSpec
Definition gia.h:100
char * pName
Definition gia.h:99
unsigned Value
Definition gia.h:89
Vec_Int_t * vValues
Definition giaQbf.c:48
int fVerbose
Definition giaQbf.c:42
Vec_Int_t * vParMap
Definition giaQbf.c:49
Vec_Int_t * vLits
Definition giaQbf.c:50
abctime clkSat
Definition giaQbf.c:52
sat_solver * pSatSyn
Definition giaQbf.c:46
bmcg_sat_solver * pSatSynG
Definition giaQbf.c:47
int nPars
Definition giaQbf.c:40
abctime clkStart
Definition giaQbf.c:51
int iParVarBeg
Definition giaQbf.c:44
int nVars
Definition giaQbf.c:41
Gia_Man_t * pGia
Definition giaQbf.c:39
sat_solver * pSatVer
Definition giaQbf.c:45
#define assert(ex)
Definition util_old.h:213
char * strtok()
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54