ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
wlcAbs.c
Go to the documentation of this file.
1
20
21#include "wlc.h"
22#include "proof/pdr/pdr.h"
23#include "proof/pdr/pdrInt.h"
24#include "proof/ssw/ssw.h"
25#include "aig/gia/giaAig.h"
26#include "sat/bmc/bmc.h"
27
29
33
34extern Vec_Vec_t * IPdr_ManSaveClauses( Pdr_Man_t * p, int fDropLast );
35extern int IPdr_ManRestoreClauses( Pdr_Man_t * p, Vec_Vec_t * vClauses, Vec_Int_t * vMap );
36extern int IPdr_ManRebuildClauses( Pdr_Man_t * p, Vec_Vec_t * vClauses );
37extern int IPdr_ManSolveInt( Pdr_Man_t * p, int fCheckClauses, int fPushClauses );
38extern int IPdr_ManCheckCombUnsat( Pdr_Man_t * p );
39extern int IPdr_ManReduceClauses( Pdr_Man_t * p, Vec_Vec_t * vClauses );
40extern void IPdr_ManPrintClauses( Vec_Vec_t * vClauses, int kStart, int nRegs );
41extern void Wla_ManJoinThread( Wla_Man_t * pWla, int RunId );
42extern void Wla_ManConcurrentBmc3( Wla_Man_t * pWla, Aig_Man_t * pAig, Abc_Cex_t ** ppCex );
43extern int Wla_CallBackToStop( int RunId );
44extern int Wla_GetGlobalRunId();
45
46typedef struct Int_Pair_t_ Int_Pair_t;
48{
49 int first;
50 int second;
51};
52
54{
55 return (*a)->second < (*b)->second;
56}
57
61
63{
64 int i;
65 Wlc_Obj_t * pObj;
66
67 Abc_Print( 1, "PIs:");
68 Wlc_NtkForEachPi( p, pObj, i )
69 Abc_Print( 1, " %s", Wlc_ObjName(p, Wlc_ObjId(p, pObj)) );
70 Abc_Print( 1, "\n\n");
71
72 Abc_Print( 1, "POs:");
73 Wlc_NtkForEachPo( p, pObj, i )
74 Abc_Print( 1, " %s", Wlc_ObjName(p, Wlc_ObjId(p, pObj)) );
75 Abc_Print( 1, "\n\n");
76
77 Abc_Print( 1, "FO(Fi)s:");
78 Wlc_NtkForEachCi( p, pObj, i )
79 if ( !Wlc_ObjIsPi( pObj ) )
80 Abc_Print( 1, " %s(%s)", Wlc_ObjName(p, Wlc_ObjId(p, pObj)), Wlc_ObjName(p, Wlc_ObjId(p, Wlc_ObjFo2Fi(p, pObj))) );
81 Abc_Print( 1, "\n\n");
82
83 Abc_Print( 1, "Objs:\n");
84 Wlc_NtkForEachObj( p, pObj, i )
85 {
86 if ( !Wlc_ObjIsCi(pObj) )
87 Wlc_NtkPrintNode( p, pObj ) ;
88 }
89}
90
91void Wlc_NtkAbsGetSupp_rec( Wlc_Ntk_t * p, Wlc_Obj_t * pObj, Vec_Bit_t * vCiMarks, Vec_Int_t * vSuppRefs, Vec_Int_t * vSuppList )
92{
93 int i, iFanin, iObj;
94 if ( pObj->Mark ) // visited
95 return;
96 pObj->Mark = 1;
97 iObj = Wlc_ObjId( p, pObj );
98 if ( Vec_BitEntry( vCiMarks, iObj ) )
99 {
100 if ( vSuppRefs )
101 Vec_IntAddToEntry( vSuppRefs, iObj, 1 );
102 if ( vSuppList )
103 Vec_IntPush( vSuppList, iObj );
104 return;
105 }
106 Wlc_ObjForEachFanin( pObj, iFanin, i )
107 Wlc_NtkAbsGetSupp_rec( p, Wlc_NtkObj(p, iFanin), vCiMarks, vSuppRefs, vSuppList );
108}
109
110void Wlc_NtkAbsGetSupp( Wlc_Ntk_t * p, Wlc_Obj_t * pObj, Vec_Bit_t * vCiMarks, Vec_Int_t * vSuppRefs, Vec_Int_t * vSuppList)
111{
112 assert( vSuppRefs || vSuppList );
114
115 Wlc_NtkAbsGetSupp_rec( p, pObj, vCiMarks, vSuppRefs, vSuppList );
116}
117
119{
120 int num = 0;
121 int i;
122 Wlc_Obj_t * pObj;
123 Wlc_NtkForEachPi(pNtk, pObj, i) {
124 num += Wlc_ObjRange(pObj);
125 }
126 return num;
127}
128
129void Wlc_NtkAbsAnalyzeRefine( Wlc_Ntk_t * p, Vec_Int_t * vBlacks, Vec_Bit_t * vUnmark, int * nDisj, int * nNDisj )
130{
131 Vec_Bit_t * vCurCis, * vCandCis;
132 Vec_Int_t * vSuppList;
133 Vec_Int_t * vDeltaB;
134 Vec_Int_t * vSuppRefs;
135 int i, Entry;
136 Wlc_Obj_t * pObj;
137
138 vCurCis = Vec_BitStart( Wlc_NtkObjNumMax( p ) );
139 vCandCis = Vec_BitStart( Wlc_NtkObjNumMax( p ) );
140 vDeltaB = Vec_IntAlloc( Vec_IntSize(vBlacks) );
141 vSuppList = Vec_IntAlloc( Wlc_NtkCiNum(p) + Vec_IntSize(vBlacks) );
142 vSuppRefs = Vec_IntAlloc( Wlc_NtkObjNumMax( p ) );
143
144
145 Vec_IntFill( vSuppRefs, Wlc_NtkObjNumMax( p ), 0 );
146
147 Wlc_NtkForEachCi( p, pObj, i )
148 {
149 Vec_BitWriteEntry( vCurCis, Wlc_ObjId(p, pObj), 1 ) ;
150 Vec_BitWriteEntry( vCandCis, Wlc_ObjId(p, pObj), 1 ) ;
151 }
152
153 Vec_IntForEachEntry( vBlacks, Entry, i )
154 {
155 Vec_BitWriteEntry( vCurCis, Entry, 1 );
156 if ( !Vec_BitEntry( vUnmark, Entry ) )
157 Vec_BitWriteEntry( vCandCis, Entry, 1 );
158 else
159 Vec_IntPush( vDeltaB, Entry );
160 }
161 assert( Vec_IntSize( vDeltaB ) );
162
163 Wlc_NtkForEachCo( p, pObj, i )
164 Wlc_NtkAbsGetSupp( p, pObj, vCurCis, vSuppRefs, NULL );
165
166 /*
167 Abc_Print( 1, "SuppCurrentAbs =" );
168 Wlc_NtkForEachObj( p, pObj, i )
169 if ( Vec_IntEntry(vSuppRefs, i) > 0 )
170 Abc_Print( 1, " %d", i );
171 Abc_Print( 1, "\n" );
172 */
173
174 Vec_IntForEachEntry( vDeltaB, Entry, i )
175 Wlc_NtkAbsGetSupp( p, Wlc_NtkObj(p, Entry), vCandCis, vSuppRefs, NULL );
176
177 Vec_IntForEachEntry( vDeltaB, Entry, i )
178 {
179 int iSupp, ii;
180 int fDisjoint = 1;
181
182 Vec_IntClear( vSuppList );
183 Wlc_NtkAbsGetSupp( p, Wlc_NtkObj(p, Entry), vCandCis, NULL, vSuppList );
184
185 //Abc_Print( 1, "SuppCandAbs =" );
186 Vec_IntForEachEntry( vSuppList, iSupp, ii )
187 {
188 //Abc_Print( 1, " %d(%d)", iSupp, Vec_IntEntry( vSuppRefs, iSupp ) );
189 if ( Vec_IntEntry( vSuppRefs, iSupp ) >= 2 )
190 {
191 fDisjoint = 0;
192 break;
193 }
194 }
195 //Abc_Print( 1, "\n" );
196
197 if ( fDisjoint )
198 {
199 //Abc_Print( 1, "PPI[%d] is disjoint.\n", Entry );
200 ++(*nDisj);
201 }
202 else
203 {
204 //Abc_Print( 1, "PPI[%d] is non-disjoint.\n", Entry );
205 ++(*nNDisj);
206 }
207 }
208
209 Vec_BitFree( vCurCis );
210 Vec_BitFree( vCandCis );
211 Vec_IntFree( vDeltaB );
212 Vec_IntFree( vSuppList );
213 Vec_IntFree( vSuppRefs );
214}
215
216static Vec_Int_t * Wlc_NtkGetCoreSels( Gia_Man_t * pFrames, int nFrames, int first_sel_pi, int num_sel_pis, Vec_Bit_t * vMark, int nConfLimit, Wlc_Par_t * pPars, int fSetPO, int RunId )
217{
218 Vec_Int_t * vCores = NULL;
219 Aig_Man_t * pAigFrames = Gia_ManToAigSimple( pFrames );
220 Cnf_Dat_t * pCnf = Cnf_Derive(pAigFrames, Aig_ManCoNum(pAigFrames));
221 sat_solver * pSat = sat_solver_new();
222 int i;
223
224 sat_solver_setnvars(pSat, pCnf->nVars);
225 if ( RunId >= 0 )
226 {
227 sat_solver_set_runid( pSat, RunId );
228 sat_solver_set_stop_func( pSat, Wla_CallBackToStop );
229 }
230
231 for (i = 0; i < pCnf->nClauses; i++)
232 {
233 if (!sat_solver_addclause(pSat, pCnf->pClauses[i], pCnf->pClauses[i + 1]))
234 assert(false);
235 }
236 // add PO clauses
237 {
238 Vec_Int_t* vLits = Vec_IntAlloc(100);
239 Aig_Obj_t* pObj;
240 int i, ret;
241 Aig_ManForEachCo( pAigFrames, pObj, i )
242 {
243 assert(pCnf->pVarNums[pObj->Id] >= 0);
244 Vec_IntPush(vLits, toLitCond(pCnf->pVarNums[pObj->Id], 0));
245 }
246 if ( !fSetPO )
247 {
248 ret = sat_solver_addclause(pSat, Vec_IntArray(vLits), Vec_IntArray(vLits) + Vec_IntSize(vLits));
249 if (!ret)
250 Abc_Print( 1, "UNSAT after adding PO clauses.\n" );
251 }
252 else
253 {
254 int Lit;
255 for ( i = 0; i < Vec_IntSize(vLits); ++i )
256 {
257 if ( i == Vec_IntSize(vLits) - 1 )
258 Lit = Vec_IntEntry( vLits, i );
259 else
260 Lit = lit_neg(Vec_IntEntry( vLits, i ));
261 ret = sat_solver_addclause(pSat, &Lit, &Lit + 1);
262 if (!ret)
263 Abc_Print( 1, "UNSAT after adding PO clauses.\n" );
264 }
265 }
266
267 Vec_IntFree(vLits);
268 }
269
270 // main procedure
271 {
272 int status;
273 Vec_Int_t* vLits = Vec_IntAlloc(100);
274 Vec_Int_t* vMapVar2Sel = Vec_IntStart( pCnf->nVars );
275 for ( i = 0; i < num_sel_pis; ++i )
276 {
277 int cur_pi = first_sel_pi + i;
278 int var = pCnf->pVarNums[Aig_ManCi(pAigFrames, cur_pi)->Id];
279 int Lit;
280 assert(var >= 0);
281 Vec_IntWriteEntry( vMapVar2Sel, var, i );
282 Lit = toLitCond( var, 0 );
283 if ( Vec_BitEntry( vMark, i ) )
284 Vec_IntPush(vLits, Lit);
285 else
286 sat_solver_addclause( pSat, &Lit, &Lit+1 );
287 }
288 /*
289 int i, Entry;
290 Abc_Print( 1, "#vLits = %d; vLits = ", Vec_IntSize(vLits) );
291 Vec_IntForEachEntry(vLits, Entry, i)
292 Abc_Print( 1, "%d ", Entry);
293 Abc_Print( 1, "\n");
294 */
295 status = sat_solver_solve(pSat, Vec_IntArray(vLits), Vec_IntArray(vLits) + Vec_IntSize(vLits), (ABC_INT64_T)(nConfLimit), (ABC_INT64_T)(0), (ABC_INT64_T)(0), (ABC_INT64_T)(0));
296 if (status == l_False) {
297 int nCoreLits, *pCoreLits;
298 Abc_Print( 1, "UNSAT.\n" );
299 nCoreLits = sat_solver_final(pSat, &pCoreLits);
300 vCores = Vec_IntAlloc( nCoreLits );
301 for (i = 0; i < nCoreLits; i++)
302 {
303 Vec_IntPush( vCores, Vec_IntEntry( vMapVar2Sel, lit_var( pCoreLits[i] ) ) );
304 }
305 } else if (status == l_True) {
306 Abc_Print( 1, "SAT.\n" );
307 } else {
308 Abc_Print( 1, "UNKNOWN.\n" );
309 }
310
311 Vec_IntFree(vLits);
312 Vec_IntFree(vMapVar2Sel);
313 }
314 Cnf_ManFree();
315 sat_solver_delete(pSat);
316 Aig_ManStop(pAigFrames);
317
318 return vCores;
319}
320
321static Gia_Man_t * Wlc_NtkUnrollWoCex(Wlc_Ntk_t * pChoice, int nFrames, int first_sel_pi, int num_sel_pis)
322{
323 Gia_Man_t * pGiaChoice = Wlc_NtkBitBlast( pChoice, NULL );
324 Gia_Man_t * pFrames = NULL, * pGia;
325 Gia_Obj_t * pObj, * pObjRi;
326 int f, i;
327
328 pFrames = Gia_ManStart( 10000 );
329 pFrames->pName = Abc_UtilStrsav( pGiaChoice->pName );
330 Gia_ManHashAlloc( pFrames );
331 Gia_ManConst0(pGiaChoice)->Value = 0;
332 Gia_ManForEachRi( pGiaChoice, pObj, i )
333 pObj->Value = 0;
334
335 for ( f = 0; f < nFrames; f++ )
336 {
337 for( i = 0; i < Gia_ManPiNum(pGiaChoice); i++ )
338 {
339 if ( i >= first_sel_pi && i < first_sel_pi + num_sel_pis )
340 {
341 if( f == 0 )
342 Gia_ManPi(pGiaChoice, i)->Value = Gia_ManAppendCi(pFrames);
343 }
344 else
345 {
346 Gia_ManPi(pGiaChoice, i)->Value = Gia_ManAppendCi(pFrames);
347 }
348 }
349 Gia_ManForEachRiRo( pGiaChoice, pObjRi, pObj, i )
350 pObj->Value = pObjRi->Value;
351 Gia_ManForEachAnd( pGiaChoice, pObj, i )
352 pObj->Value = Gia_ManHashAnd(pFrames, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj));
353 Gia_ManForEachCo( pGiaChoice, pObj, i )
354 pObj->Value = Gia_ObjFanin0Copy(pObj);
355 Gia_ManForEachPo( pGiaChoice, pObj, i )
356 Gia_ManAppendCo(pFrames, pObj->Value);
357 }
358 Gia_ManHashStop (pFrames);
359 Gia_ManSetRegNum(pFrames, 0);
360 pFrames = Gia_ManCleanup(pGia = pFrames);
361 Gia_ManStop(pGia);
362 Gia_ManStop(pGiaChoice);
363
364 return pFrames;
365}
366
367static Gia_Man_t * Wlc_NtkUnrollWithCex(Wlc_Ntk_t * pChoice, Abc_Cex_t * pCex, int nbits_old_pis, int num_sel_pis, int * p_num_ppis, int sel_pi_first, int fUsePPI)
368{
369 Gia_Man_t * pGiaChoice = Wlc_NtkBitBlast( pChoice, NULL );
370 int nbits_new_pis = Wlc_NtkNumPiBits( pChoice );
371 int num_ppis = nbits_new_pis - nbits_old_pis - num_sel_pis;
372 int num_undc_pis = Gia_ManPiNum(pGiaChoice) - nbits_new_pis;
373 Gia_Man_t * pFrames = NULL;
374 Gia_Obj_t * pObj, * pObjRi;
375 int f, i;
376 int is_sel_pi;
377 Gia_Man_t * pGia;
378 *p_num_ppis = num_ppis;
379
380 Abc_Print( 1, "#orig_pis = %d, #ppis = %d, #sel_pis = %d, #undc_pis = %d\n", nbits_old_pis, num_ppis, num_sel_pis, num_undc_pis );
381 assert(Gia_ManPiNum(pGiaChoice)==nbits_old_pis+num_ppis+num_sel_pis+num_undc_pis);
382 assert(Gia_ManPiNum(pGiaChoice)==pCex->nPis+num_sel_pis);
383
384 pFrames = Gia_ManStart( 10000 );
385 pFrames->pName = Abc_UtilStrsav( pGiaChoice->pName );
386 Gia_ManHashAlloc( pFrames );
387 Gia_ManConst0(pGiaChoice)->Value = 0;
388 Gia_ManForEachRi( pGiaChoice, pObj, i )
389 pObj->Value = 0;
390
391 for ( f = 0; f <= pCex->iFrame; f++ )
392 {
393 for( i = 0; i < Gia_ManPiNum(pGiaChoice); i++ )
394 {
395 if ( i >= nbits_old_pis && i < nbits_old_pis + num_ppis + num_sel_pis )
396 {
397 is_sel_pi = sel_pi_first ? (i < nbits_old_pis + num_sel_pis) : (i >= nbits_old_pis + num_ppis);
398 if( f == 0 && is_sel_pi )
399 Gia_ManPi(pGiaChoice, i)->Value = Gia_ManAppendCi(pFrames);
400 if( !is_sel_pi )
401 {
402 if ( !fUsePPI )
403 Gia_ManPi(pGiaChoice, i)->Value = Gia_ManAppendCi(pFrames);
404 else
405 Gia_ManPi(pGiaChoice, i)->Value = Abc_InfoHasBit(pCex->pData, pCex->nRegs+pCex->nPis*f + i + num_undc_pis);
406 }
407 }
408 else if (i < nbits_old_pis)
409 {
410 Gia_ManPi(pGiaChoice, i)->Value = Abc_InfoHasBit(pCex->pData, pCex->nRegs+pCex->nPis*f + i);
411 }
412 else if (i >= nbits_old_pis + num_ppis + num_sel_pis)
413 {
414 Gia_ManPi(pGiaChoice, i)->Value = Abc_InfoHasBit(pCex->pData, pCex->nRegs+pCex->nPis*f + i - num_sel_pis - num_ppis);
415 }
416 }
417 Gia_ManForEachRiRo( pGiaChoice, pObjRi, pObj, i )
418 pObj->Value = pObjRi->Value;
419 Gia_ManForEachAnd( pGiaChoice, pObj, i )
420 pObj->Value = Gia_ManHashAnd(pFrames, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj));
421 Gia_ManForEachCo( pGiaChoice, pObj, i )
422 pObj->Value = Gia_ObjFanin0Copy(pObj);
423 Gia_ManForEachPo( pGiaChoice, pObj, i )
424 Gia_ManAppendCo(pFrames, pObj->Value);
425 }
426 Gia_ManHashStop (pFrames);
427 Gia_ManSetRegNum(pFrames, 0);
428 pFrames = Gia_ManCleanup(pGia = pFrames);
429 Gia_ManStop(pGia);
430 Gia_ManStop(pGiaChoice);
431
432 return pFrames;
433}
434
436{
437 //if ( vBlacks== NULL ) return NULL;
438 Vec_Int_t * vNodes = Vec_IntDup( vBlacks );
439 Wlc_Ntk_t * pNew;
440 Wlc_Obj_t * pObj;
441 int i, k, iObj, iFanin;
442 Vec_Int_t * vFanins = Vec_IntAlloc( 3 );
443 Vec_Int_t * vMapNode2Pi = Vec_IntStart( Wlc_NtkObjNumMax(pNtk) );
444 Vec_Int_t * vMapNode2Sel = Vec_IntStart( Wlc_NtkObjNumMax(pNtk) );
445 int nOrigObjNum = Wlc_NtkObjNumMax( pNtk );
446 Wlc_Ntk_t * p = Wlc_NtkDupDfsSimple( pNtk );
447 Vec_Bit_t * vPPIMark = NULL;
448
449 Wlc_NtkForEachObjVec( vNodes, pNtk, pObj, i )
450 {
451 // TODO : fix FOs here
452 Vec_IntWriteEntry(vNodes, i, Wlc_ObjCopy(pNtk, Wlc_ObjId(pNtk, pObj)));
453 }
454
455 if ( vPPIs )
456 {
457 vPPIMark = Vec_BitStart( Wlc_NtkObjNumMax(pNtk) );
458 Wlc_NtkForEachObjVec( vPPIs, pNtk, pObj, i )
459 {
460 Vec_IntWriteEntry(vPPIs, i, Wlc_ObjCopy(pNtk, Wlc_ObjId(pNtk, pObj)));
461 Vec_BitWriteEntry( vPPIMark, Vec_IntEntry(vPPIs, i), 1 );
462 }
463 }
464
465 // Vec_IntPrint(vNodes);
466 Wlc_NtkCleanCopy( p );
467
468 // mark nodes
469 Wlc_NtkForEachObjVec( vNodes, p, pObj, i )
470 {
471 iObj = Wlc_ObjId(p, pObj);
472 pObj->Mark = 1;
473 // add fresh PI with the same number of bits
474 Vec_IntWriteEntry( vMapNode2Pi, iObj, Wlc_ObjAlloc( p, WLC_OBJ_PI, Wlc_ObjIsSigned(pObj), Wlc_ObjRange(pObj) - 1, 0 ) );
475 }
476
477 if ( vPPIs )
478 {
479 Wlc_NtkForEachObjVec( vPPIs, p, pObj, i )
480 {
481 iObj = Wlc_ObjId(p, pObj);
482 pObj->Mark = 1;
483 // add fresh PI with the same number of bits
484 Vec_IntWriteEntry( vMapNode2Pi, iObj, Wlc_ObjAlloc( p, WLC_OBJ_PI, Wlc_ObjIsSigned(pObj), Wlc_ObjRange(pObj) - 1, 0 ) );
485 }
486 }
487
488 // add sel PI
489 Wlc_NtkForEachObjVec( vNodes, p, pObj, i )
490 {
491 iObj = Wlc_ObjId( p, pObj );
492 Vec_IntWriteEntry( vMapNode2Sel, iObj, Wlc_ObjAlloc( p, WLC_OBJ_PI, 0, 0, 0 ) );
493 }
494
495 // iterate through the nodes in the DFS order
496 Wlc_NtkForEachObj( p, pObj, i )
497 {
498 int isSigned, range;
499 if ( i == nOrigObjNum )
500 {
501 // cout << "break at " << i << endl;
502 break;
503 }
504
505 // update fanins
506 Wlc_ObjForEachFanin( pObj, iFanin, k )
507 Wlc_ObjFanins(pObj)[k] = Wlc_ObjCopy(p, iFanin);
508 // node to remain
509 iObj = i;
510
511 if ( pObj->Mark )
512 {
513 // clean
514 pObj->Mark = 0;
515
516 if ( vPPIMark && Vec_BitEntry(vPPIMark, i) )
517 iObj = Vec_IntEntry( vMapNode2Pi, i );
518 else
519 {
520 isSigned = Wlc_ObjIsSigned(pObj);
521 range = Wlc_ObjRange(pObj);
522 Vec_IntClear(vFanins);
523 Vec_IntPush(vFanins, Vec_IntEntry( vMapNode2Sel, i) );
524 Vec_IntPush(vFanins, Vec_IntEntry( vMapNode2Pi, i ) );
525 Vec_IntPush(vFanins, i);
526 iObj = Wlc_ObjCreate(p, WLC_OBJ_MUX, isSigned, range - 1, 0, vFanins);
527 }
528 }
529
530 Wlc_ObjSetCopy( p, i, iObj );
531 }
532
533 Wlc_NtkForEachCo( p, pObj, i )
534 {
535 iObj = Wlc_ObjId(p, pObj);
536 if (iObj != Wlc_ObjCopy(p, iObj))
537 {
538 if (pObj->fIsFi)
539 Wlc_NtkObj(p, Wlc_ObjCopy(p, iObj))->fIsFi = 1;
540 else
541 Wlc_NtkObj(p, Wlc_ObjCopy(p, iObj))->fIsPo = 1;
542
543 Vec_IntWriteEntry(&p->vCos, i, Wlc_ObjCopy(p, iObj));
544 }
545 }
546
547 // DumpWlcNtk(p);
548 pNew = Wlc_NtkDupDfsSimple( p );
549
550 if ( vPPIMark )
551 Vec_BitFree( vPPIMark );
552 Vec_IntFree( vFanins );
553 Vec_IntFree( vMapNode2Pi );
554 Vec_IntFree( vMapNode2Sel );
555 Vec_IntFree( vNodes );
556 Wlc_NtkFree( p );
557
558 return pNew;
559}
560
561static Abc_Cex_t * Wlc_NtkCexIsReal( Wlc_Ntk_t * pOrig, Abc_Cex_t * pCex )
562{
563 Gia_Man_t * pGiaOrig = Wlc_NtkBitBlast( pOrig, NULL );
564 int f, i;
565 Gia_Obj_t * pObj, * pObjRi;
566 Abc_Cex_t * pCexReal = Abc_CexAlloc( Gia_ManRegNum(pGiaOrig), Gia_ManPiNum(pGiaOrig), pCex->iFrame + 1 );
567
568 Gia_ManConst0(pGiaOrig)->Value = 0;
569 Gia_ManForEachRi( pGiaOrig, pObj, i )
570 pObj->Value = 0;
571 for ( f = 0; f <= pCex->iFrame; f++ )
572 {
573 for( i = 0; i < Gia_ManPiNum( pGiaOrig ); i++ )
574 {
575 Gia_ManPi(pGiaOrig, i)->Value = Abc_InfoHasBit(pCex->pData, pCex->nRegs+pCex->nPis*f + i);
576 if ( Gia_ManPi(pGiaOrig, i)->Value )
577 Abc_InfoSetBit(pCexReal->pData, pCexReal->nRegs + pCexReal->nPis*f + i);
578 }
579 Gia_ManForEachRiRo( pGiaOrig, pObjRi, pObj, i )
580 pObj->Value = pObjRi->Value;
581 Gia_ManForEachAnd( pGiaOrig, pObj, i )
582 pObj->Value = Gia_ObjFanin0Copy(pObj) & Gia_ObjFanin1Copy(pObj);
583 Gia_ManForEachCo( pGiaOrig, pObj, i )
584 pObj->Value = Gia_ObjFanin0Copy(pObj);
585 Gia_ManForEachPo( pGiaOrig, pObj, i )
586 {
587 if (pObj->Value==1) {
588 Abc_Print( 1, "CEX is real on the original model.\n" );
589 Gia_ManStop(pGiaOrig);
590 pCexReal->iFrame = f;
591 pCexReal->iPo = i;
592 return pCexReal;
593 }
594 }
595 }
596
597 // Abc_Print( 1, "CEX is spurious.\n" );
598 Gia_ManStop(pGiaOrig);
599 Abc_CexFree(pCexReal);
600 return NULL;
601}
602
603static Wlc_Ntk_t * Wlc_NtkAbs2( Wlc_Ntk_t * pNtk, Vec_Int_t * vBlacks, Vec_Int_t ** pvFlops )
604{
605 Vec_Int_t * vFlops = Vec_IntAlloc( 100 );
606 Vec_Int_t * vNodes = Vec_IntDup( vBlacks );
607 Wlc_Ntk_t * pNew;
608 Wlc_Obj_t * pObj;
609 int i, k, iObj, iFanin;
610 Vec_Int_t * vMapNode2Pi = Vec_IntStart( Wlc_NtkObjNumMax(pNtk) );
611 int nOrigObjNum = Wlc_NtkObjNumMax( pNtk );
612 Wlc_Ntk_t * p = Wlc_NtkDupDfsSimple( pNtk );
613
614 Wlc_NtkForEachCi( pNtk, pObj, i )
615 {
616 if ( !Wlc_ObjIsPi( pObj ) )
617 Vec_IntPush( vFlops, Wlc_ObjId( pNtk, pObj ) );
618 }
619
620 Wlc_NtkForEachObjVec( vNodes, pNtk, pObj, i )
621 Vec_IntWriteEntry(vNodes, i, Wlc_ObjCopy(pNtk, Wlc_ObjId(pNtk, pObj)));
622
623 // mark nodes
624 Wlc_NtkForEachObjVec( vNodes, p, pObj, i )
625 {
626 iObj = Wlc_ObjId(p, pObj);
627 pObj->Mark = 1;
628 // add fresh PI with the same number of bits
629 Vec_IntWriteEntry( vMapNode2Pi, iObj, Wlc_ObjAlloc( p, WLC_OBJ_PI, Wlc_ObjIsSigned(pObj), Wlc_ObjRange(pObj) - 1, 0 ) );
630 }
631
632 Wlc_NtkCleanCopy( p );
633
634 Wlc_NtkForEachObj( p, pObj, i )
635 {
636 if ( i == nOrigObjNum )
637 break;
638
639 if ( pObj->Mark ) {
640 // clean
641 pObj->Mark = 0;
642 iObj = Vec_IntEntry( vMapNode2Pi, i );
643 }
644 else {
645 // update fanins
646 Wlc_ObjForEachFanin( pObj, iFanin, k )
647 Wlc_ObjFanins(pObj)[k] = Wlc_ObjCopy(p, iFanin);
648 // node to remain
649 iObj = i;
650 }
651 Wlc_ObjSetCopy( p, i, iObj );
652 }
653
654 Wlc_NtkForEachCo( p, pObj, i )
655 {
656 iObj = Wlc_ObjId(p, pObj);
657 if (iObj != Wlc_ObjCopy(p, iObj))
658 {
659 if (pObj->fIsFi)
660 Wlc_NtkObj(p, Wlc_ObjCopy(p, iObj))->fIsFi = 1;
661 else
662 Wlc_NtkObj(p, Wlc_ObjCopy(p, iObj))->fIsPo = 1;
663
664
665 Vec_IntWriteEntry(&p->vCos, i, Wlc_ObjCopy(p, iObj));
666 }
667 }
668
669 pNew = Wlc_NtkDupDfsSimple( p );
670 Vec_IntFree( vMapNode2Pi );
671 Vec_IntFree( vNodes );
672 Wlc_NtkFree( p );
673
674 if ( pvFlops )
675 *pvFlops = vFlops;
676 else
677 Vec_IntFree( vFlops );
678
679 return pNew;
680}
681
682static Vec_Bit_t * Wlc_NtkProofReduce( Wlc_Ntk_t * p, Wlc_Par_t * pPars, int nFrames, Vec_Int_t * vWhites, Vec_Int_t * vBlacks, int RunId )
683{
684 Gia_Man_t * pGiaFrames;
685 Wlc_Ntk_t * pNtkWithChoices = NULL;
686 Vec_Int_t * vCoreSels;
687 Vec_Bit_t * vChoiceMark;
688 int first_sel_pi;
689 int i, Entry;
690 abctime clk = Abc_Clock();
691
692 assert( vWhites && Vec_IntSize(vWhites) );
693 pNtkWithChoices = Wlc_NtkIntroduceChoices( p, vWhites, vBlacks );
694
695 first_sel_pi = Wlc_NtkNumPiBits( pNtkWithChoices ) - Vec_IntSize( vWhites );
696 pGiaFrames = Wlc_NtkUnrollWoCex( pNtkWithChoices, nFrames, first_sel_pi, Vec_IntSize( vWhites ) );
697
698 vChoiceMark = Vec_BitStartFull( Vec_IntSize( vWhites ) );
699 vCoreSels = Wlc_NtkGetCoreSels( pGiaFrames, nFrames, first_sel_pi, Vec_IntSize( vWhites ), vChoiceMark, 0, pPars, 0, RunId );
700
701 Wlc_NtkFree( pNtkWithChoices );
702 Gia_ManStop( pGiaFrames );
703
704 if ( vCoreSels == NULL )
705 return NULL;
706
707 Vec_BitReset( vChoiceMark );
708 Vec_IntForEachEntry( vCoreSels, Entry, i )
709 Vec_BitWriteEntry( vChoiceMark, Entry, 1 );
710
711 Abc_Print( 1, "ProofReduce: remove %d out of %d white boxes.", Vec_IntSize(vWhites) - Vec_BitCount(vChoiceMark), Vec_IntSize(vWhites) );
712 Abc_PrintTime( 1, " Time", Abc_Clock() - clk );
713
714 Vec_IntFree( vCoreSels );
715 return vChoiceMark;
716}
717
718static int Wlc_NtkProofRefine( Wlc_Ntk_t * p, Wlc_Par_t * pPars, Abc_Cex_t * pCex, Vec_Int_t * vBlacks, Vec_Int_t ** pvRefine )
719{
720 Gia_Man_t * pGiaFrames;
721 Vec_Int_t * vRefine = NULL;
722 Vec_Bit_t * vUnmark;
723 Vec_Bit_t * vChoiceMark;
724 Wlc_Ntk_t * pNtkWithChoices = NULL;
725 Vec_Int_t * vCoreSels;
726 int num_ppis = -1;
727 int Entry, i;
728
729 if ( *pvRefine == NULL )
730 return 0;
731
732 vUnmark = Vec_BitStart( Wlc_NtkObjNumMax( p ) );
733 vChoiceMark = Vec_BitStart( Vec_IntSize( vBlacks ) );
734
735 Vec_IntForEachEntry( *pvRefine, Entry, i )
736 Vec_BitWriteEntry( vUnmark, Entry, 1 );
737
738 Vec_IntForEachEntry( vBlacks, Entry, i )
739 {
740 if ( Vec_BitEntry( vUnmark, Entry ) )
741 Vec_BitWriteEntry( vChoiceMark, i, 1 );
742 }
743
744 pNtkWithChoices = vBlacks ? Wlc_NtkIntroduceChoices( p, vBlacks, NULL ) : NULL;
745 pGiaFrames = Wlc_NtkUnrollWithCex( pNtkWithChoices, pCex, Wlc_NtkNumPiBits( p ), Vec_IntSize( vBlacks ), &num_ppis, 0, pPars->fProofUsePPI );
746
747 if ( !pPars->fProofUsePPI )
748 vCoreSels = Wlc_NtkGetCoreSels( pGiaFrames, pCex->iFrame+1, num_ppis, Vec_IntSize( vBlacks ), vChoiceMark, 0, pPars, 0, -1 );
749 else
750 vCoreSels = Wlc_NtkGetCoreSels( pGiaFrames, pCex->iFrame+1, 0, Vec_IntSize( vBlacks ), vChoiceMark, 0, pPars, 0, -1 );
751
752 Wlc_NtkFree( pNtkWithChoices );
753 Gia_ManStop( pGiaFrames );
754 Vec_BitFree( vUnmark );
755 Vec_BitFree( vChoiceMark );
756
757 assert( Vec_IntSize( vCoreSels ) );
758
759 vRefine = Vec_IntAlloc( 100 );
760 Vec_IntForEachEntry( vCoreSels, Entry, i )
761 Vec_IntPush( vRefine, Vec_IntEntry( vBlacks, Entry ) );
762
763 Vec_IntFree( vCoreSels );
764
765 if ( pPars->fVerbose )
766 Abc_Print( 1, "Proof-based refinement reduces %d (out of %d) white boxes\n", Vec_IntSize( *pvRefine ) - Vec_IntSize( vRefine ), Vec_IntSize( *pvRefine ) );
767
768 Vec_IntFree( *pvRefine );
769 *pvRefine = vRefine;
770
771 return 0;
772}
773
774static int Wlc_NtkUpdateBlacks( Wlc_Ntk_t * p, Wlc_Par_t * pPars, Vec_Int_t ** pvBlacks, Vec_Bit_t * vUnmark, Vec_Int_t * vSignals )
775{
776 int Entry, i;
777 Wlc_Obj_t * pObj; int Count[4] = {0};
778 Vec_Int_t * vBlacks = Vec_IntAlloc( 100 );
779 Vec_Int_t * vVec;
780
781 assert( *pvBlacks );
782
783 vVec = vSignals ? vSignals : *pvBlacks;
784
785 Vec_IntForEachEntry( vVec, Entry, i )
786 {
787 if ( Vec_BitEntry( vUnmark, Entry) )
788 continue;
789 Vec_IntPush( vBlacks, Entry );
790
791 pObj = Wlc_NtkObj( p, Entry );
792 if ( pObj->Type == WLC_OBJ_ARI_ADD || pObj->Type == WLC_OBJ_ARI_SUB || pObj->Type == WLC_OBJ_ARI_MINUS )
793 Count[0]++;
794 else if ( pObj->Type == WLC_OBJ_ARI_MULTI || pObj->Type == WLC_OBJ_ARI_DIVIDE || pObj->Type == WLC_OBJ_ARI_REM || pObj->Type == WLC_OBJ_ARI_MODULUS )
795 Count[1]++;
796 else if ( pObj->Type == WLC_OBJ_MUX )
797 Count[2]++;
798 else if ( Wlc_ObjIsCi(pObj) && !Wlc_ObjIsPi(pObj) )
799 Count[3]++;
800 }
801
802 Vec_IntFree( *pvBlacks );
803 *pvBlacks = vBlacks;
804
805 if ( pPars->fVerbose )
806 printf( "Abstraction engine marked %d adds/subs, %d muls/divs, %d muxes, and %d flops to be abstracted away.\n", Count[0], Count[1], Count[2], Vec_IntSize( vBlacks ) - Count[0] - Count[1] - Count[2] );
807
808 return 0;
809}
810
811static Vec_Bit_t * Wlc_NtkMarkLimit( Wlc_Ntk_t * p, Wlc_Par_t * pPars )
812{
813 Vec_Bit_t * vMarks = NULL;
814 Vec_Ptr_t * vAdds = Vec_PtrAlloc( 1000 );
815 Vec_Ptr_t * vMuxes = Vec_PtrAlloc( 1000 );
816 Vec_Ptr_t * vMults = Vec_PtrAlloc( 1000 );
817 Vec_Ptr_t * vFlops = Vec_PtrAlloc( 1000 );
818 Wlc_Obj_t * pObj; int i;
819 Int_Pair_t * pPair = NULL;
820
821 if ( pPars->nLimit == ABC_INFINITY )
822 return NULL;
823
824 vMarks = Vec_BitStart( Wlc_NtkObjNumMax( p ) );
825
826 Wlc_NtkForEachObj( p, pObj, i )
827 {
828 if ( pObj->Type == WLC_OBJ_ARI_ADD || pObj->Type == WLC_OBJ_ARI_SUB || pObj->Type == WLC_OBJ_ARI_MINUS )
829 {
830 if ( Wlc_ObjRange(pObj) >= pPars->nBitsAdd )
831 {
832 pPair = ABC_ALLOC( Int_Pair_t, 1 );
833 pPair->first = i;
834 pPair->second = Wlc_ObjRange( pObj );
835 Vec_PtrPush( vAdds, pPair );
836 }
837 }
838 else if ( pObj->Type == WLC_OBJ_ARI_MULTI || pObj->Type == WLC_OBJ_ARI_DIVIDE || pObj->Type == WLC_OBJ_ARI_REM || pObj->Type == WLC_OBJ_ARI_MODULUS )
839 {
840 if ( Wlc_ObjRange(pObj) >= pPars->nBitsMul )
841 {
842 pPair = ABC_ALLOC( Int_Pair_t, 1 );
843 pPair->first = i;
844 pPair->second = Wlc_ObjRange( pObj );
845 Vec_PtrPush( vMults, pPair );
846 }
847 }
848 else if ( pObj->Type == WLC_OBJ_MUX )
849 {
850 if ( Wlc_ObjRange(pObj) >= pPars->nBitsMux )
851 {
852 pPair = ABC_ALLOC( Int_Pair_t, 1 );
853 pPair->first = i;
854 pPair->second = Wlc_ObjRange( pObj );
855 Vec_PtrPush( vMuxes, pPair );
856 }
857 }
858 else if ( Wlc_ObjIsCi(pObj) && !Wlc_ObjIsPi(pObj) )
859 {
860 if ( Wlc_ObjRange(pObj) >= pPars->nBitsFlop )
861 {
862 pPair = ABC_ALLOC( Int_Pair_t, 1 );
863 pPair->first = i;
864 pPair->second = Wlc_ObjRange( pObj );
865 Vec_PtrPush( vFlops, pPair );
866 }
867 }
868 }
869
870 Vec_PtrSort( vAdds, (int (*)(const void *, const void *))IntPairPtrCompare ) ;
871 Vec_PtrSort( vMults, (int (*)(const void *, const void *))IntPairPtrCompare ) ;
872 Vec_PtrSort( vMuxes, (int (*)(const void *, const void *))IntPairPtrCompare ) ;
873 Vec_PtrSort( vFlops, (int (*)(const void *, const void *))IntPairPtrCompare ) ;
874
875 Vec_PtrForEachEntry( Int_Pair_t *, vAdds, pPair, i )
876 {
877 if ( i >= pPars->nLimit ) break;
878 Vec_BitWriteEntry( vMarks, pPair->first, 1 );
879 }
880 if ( i && pPars->fVerbose ) Abc_Print( 1, "%%PDRA: %d-th ADD has width = %d\n", i, pPair->second );
881
882 Vec_PtrForEachEntry( Int_Pair_t *, vMults, pPair, i )
883 {
884 if ( i >= pPars->nLimit ) break;
885 Vec_BitWriteEntry( vMarks, pPair->first, 1 );
886 }
887 if ( i && pPars->fVerbose ) Abc_Print( 1, "%%PDRA: %d-th MUL has width = %d\n", i, pPair->second );
888
889 Vec_PtrForEachEntry( Int_Pair_t *, vMuxes, pPair, i )
890 {
891 if ( i >= pPars->nLimit ) break;
892 Vec_BitWriteEntry( vMarks, pPair->first, 1 );
893 }
894 if ( i && pPars->fVerbose ) Abc_Print( 1, "%%PDRA: %d-th MUX has width = %d\n", i, pPair->second );
895
896 Vec_PtrForEachEntry( Int_Pair_t *, vFlops, pPair, i )
897 {
898 if ( i >= pPars->nLimit ) break;
899 Vec_BitWriteEntry( vMarks, pPair->first, 1 );
900 }
901 if ( i && pPars->fVerbose ) Abc_Print( 1, "%%PDRA: %d-th FF has width = %d\n", i, pPair->second );
902
903
904 Vec_PtrForEachEntry( Int_Pair_t *, vAdds, pPair, i ) ABC_FREE( pPair );
905 Vec_PtrForEachEntry( Int_Pair_t *, vMults, pPair, i ) ABC_FREE( pPair );
906 Vec_PtrForEachEntry( Int_Pair_t *, vMuxes, pPair, i ) ABC_FREE( pPair );
907 Vec_PtrForEachEntry( Int_Pair_t *, vFlops, pPair, i ) ABC_FREE( pPair );
908 Vec_PtrFree( vAdds );
909 Vec_PtrFree( vMults );
910 Vec_PtrFree( vMuxes );
911 Vec_PtrFree( vFlops );
912
913 return vMarks;
914}
915
916static void Wlc_NtkSetUnmark( Wlc_Ntk_t * p, Wlc_Par_t * pPars, Vec_Bit_t * vUnmark )
917{
918 int Entry, i;
919 Vec_Bit_t * vMarks = Wlc_NtkMarkLimit( p, pPars );
920
921 Vec_BitForEachEntry( vMarks, Entry, i )
922 Vec_BitWriteEntry( vUnmark, i, Entry^1 );
923
924 Vec_BitFree( vMarks );
925}
926
927static Vec_Int_t * Wlc_NtkGetBlacks( Wlc_Ntk_t * p, Wlc_Par_t * pPars )
928{
929 Vec_Int_t * vBlacks = Vec_IntAlloc( 100 ) ;
930 Wlc_Obj_t * pObj; int i, Count[4] = {0};
931 Vec_Bit_t * vMarks = NULL;
932 int nTotal = 0;
933
934 vMarks = Wlc_NtkMarkLimit( p, pPars ) ;
935
936 Wlc_NtkForEachObj( p, pObj, i )
937 {
938 if ( pObj->Type == WLC_OBJ_ARI_ADD || pObj->Type == WLC_OBJ_ARI_SUB || pObj->Type == WLC_OBJ_ARI_MINUS )
939 {
940 if ( Wlc_ObjRange(pObj) >= pPars->nBitsAdd )
941 {
942 ++nTotal;
943 if ( vMarks == NULL )
944 Vec_IntPushUniqueOrder( vBlacks, Wlc_ObjId(p, pObj) ), Count[0]++;
945 else if ( Vec_BitEntry( vMarks, i ) )
946 Vec_IntPushUniqueOrder( vBlacks, Wlc_ObjId(p, pObj) ), Count[0]++;
947 }
948 continue;
949 }
950 if ( pObj->Type == WLC_OBJ_ARI_MULTI || pObj->Type == WLC_OBJ_ARI_DIVIDE || pObj->Type == WLC_OBJ_ARI_REM || pObj->Type == WLC_OBJ_ARI_MODULUS )
951 {
952 if ( Wlc_ObjRange(pObj) >= pPars->nBitsMul )
953 {
954 ++nTotal;
955 if ( vMarks == NULL )
956 Vec_IntPushUniqueOrder( vBlacks, Wlc_ObjId(p, pObj) ), Count[1]++;
957 else if ( Vec_BitEntry( vMarks, i ) )
958 Vec_IntPushUniqueOrder( vBlacks, Wlc_ObjId(p, pObj) ), Count[1]++;
959 }
960 continue;
961 }
962 if ( pObj->Type == WLC_OBJ_MUX )
963 {
964 if ( Wlc_ObjRange(pObj) >= pPars->nBitsMux )
965 {
966 ++nTotal;
967 if ( vMarks == NULL )
968 Vec_IntPushUniqueOrder( vBlacks, Wlc_ObjId(p, pObj) ), Count[2]++;
969 else if ( Vec_BitEntry( vMarks, i ) )
970 Vec_IntPushUniqueOrder( vBlacks, Wlc_ObjId(p, pObj) ), Count[2]++;
971 }
972 continue;
973 }
974 if ( Wlc_ObjIsCi(pObj) && !Wlc_ObjIsPi(pObj) )
975 {
976 if ( Wlc_ObjRange(pObj) >= pPars->nBitsFlop )
977 {
978 ++nTotal;
979 if ( vMarks == NULL )
980 Vec_IntPushUniqueOrder( vBlacks, Wlc_ObjId( p, Wlc_ObjFo2Fi( p, pObj ) ) ), Count[3]++;
981 else if ( Vec_BitEntry( vMarks, i ) )
982 Vec_IntPushUniqueOrder( vBlacks, Wlc_ObjId( p, Wlc_ObjFo2Fi( p, pObj ) ) ), Count[3]++;
983 }
984 continue;
985 }
986 }
987 if ( vMarks )
988 Vec_BitFree( vMarks );
989 if ( pPars->fVerbose )
990 printf( "Abstraction engine marked %d adds/subs, %d muls/divs, %d muxes, and %d flops to be abstracted away (out of %d signals).\n", Count[0], Count[1], Count[2], Count[3], nTotal );
991 return vBlacks;
992}
993
1007
1008static Vec_Bit_t * Wlc_NtkAbsMarkOpers( Wlc_Ntk_t * p, Wlc_Par_t * pPars, Vec_Bit_t * vUnmark, int fVerbose )
1009{
1010 Vec_Bit_t * vLeaves = Vec_BitStart( Wlc_NtkObjNumMax(p) );
1011 Wlc_Obj_t * pObj; int i, Count[4] = {0};
1012 Wlc_NtkForEachObj( p, pObj, i )
1013 {
1014 if ( vUnmark && Vec_BitEntry(vUnmark, i) ) // not allow this object to be abstracted away
1015 continue;
1016 if ( pObj->Type == WLC_OBJ_ARI_ADD || pObj->Type == WLC_OBJ_ARI_SUB || pObj->Type == WLC_OBJ_ARI_MINUS )
1017 {
1018 if ( Wlc_ObjRange(pObj) >= pPars->nBitsAdd )
1019 Vec_BitWriteEntry( vLeaves, Wlc_ObjId(p, pObj), 1 ), Count[0]++;
1020 continue;
1021 }
1022 if ( pObj->Type == WLC_OBJ_ARI_MULTI || pObj->Type == WLC_OBJ_ARI_DIVIDE || pObj->Type == WLC_OBJ_ARI_REM || pObj->Type == WLC_OBJ_ARI_MODULUS )
1023 {
1024 if ( Wlc_ObjRange(pObj) >= pPars->nBitsMul )
1025 Vec_BitWriteEntry( vLeaves, Wlc_ObjId(p, pObj), 1 ), Count[1]++;
1026 continue;
1027 }
1028 if ( pObj->Type == WLC_OBJ_MUX )
1029 {
1030 if ( Wlc_ObjRange(pObj) >= pPars->nBitsMux )
1031 Vec_BitWriteEntry( vLeaves, Wlc_ObjId(p, pObj), 1 ), Count[2]++;
1032 continue;
1033 }
1034 if ( Wlc_ObjIsCi(pObj) && !Wlc_ObjIsPi(pObj) )
1035 {
1036 if ( Wlc_ObjRange(pObj) >= pPars->nBitsFlop )
1037 Vec_BitWriteEntry( vLeaves, Wlc_ObjId(p, pObj), 1 ), Count[3]++;
1038 continue;
1039 }
1040 }
1041 if ( fVerbose )
1042 printf( "Abstraction engine marked %d adds/subs, %d muls/divs, %d muxes, and %d flops to be abstracted away.\n", Count[0], Count[1], Count[2], Count[3] );
1043 return vLeaves;
1044}
1045
1060static void Wlc_NtkAbsMarkNodes_rec( Wlc_Ntk_t * p, Wlc_Obj_t * pObj, Vec_Bit_t * vLeaves, Vec_Int_t * vPisOld, Vec_Int_t * vPisNew, Vec_Int_t * vFlops )
1061{
1062 int i, iFanin;
1063 if ( pObj->Mark )
1064 return;
1065 pObj->Mark = 1;
1066 if ( Vec_BitEntry(vLeaves, Wlc_ObjId(p, pObj)) )
1067 {
1068 assert( !Wlc_ObjIsPi(pObj) );
1069 Vec_IntPush( vPisNew, Wlc_ObjId(p, pObj) );
1070 return;
1071 }
1072 if ( Wlc_ObjIsCi(pObj) )
1073 {
1074 if ( Wlc_ObjIsPi(pObj) )
1075 Vec_IntPush( vPisOld, Wlc_ObjId(p, pObj) );
1076 else
1077 Vec_IntPush( vFlops, Wlc_ObjId(p, pObj) );
1078 return;
1079 }
1080 Wlc_ObjForEachFanin( pObj, iFanin, i )
1081 Wlc_NtkAbsMarkNodes_rec( p, Wlc_NtkObj(p, iFanin), vLeaves, vPisOld, vPisNew, vFlops );
1082}
1083static void Wlc_NtkAbsMarkNodes( Wlc_Ntk_t * p, Vec_Bit_t * vLeaves, Vec_Int_t * vPisOld, Vec_Int_t * vPisNew, Vec_Int_t * vFlops )
1084{
1085 Wlc_Obj_t * pObj;
1086 int i, Count = 0;
1088 Wlc_NtkForEachCo( p, pObj, i )
1089 Wlc_NtkAbsMarkNodes_rec( p, pObj, vLeaves, vPisOld, vPisNew, vFlops );
1090
1091/*
1092 Vec_IntClear(vFlops);
1093 Wlc_NtkForEachCi( p, pObj, i ) {
1094 if ( !Wlc_ObjIsPi(pObj) ) {
1095 Vec_IntPush( vFlops, Wlc_ObjId(p, pObj) );
1096 pObj->Mark = 1;
1097 }
1098 }
1099*/
1100
1101 Wlc_NtkForEachObjVec( vFlops, p, pObj, i )
1102 Wlc_NtkAbsMarkNodes_rec( p, Wlc_ObjFo2Fi(p, pObj), vLeaves, vPisOld, vPisNew, vFlops );
1103 Wlc_NtkForEachObj( p, pObj, i )
1104 Count += pObj->Mark;
1105// printf( "Collected %d old PIs, %d new PIs, %d flops, and %d other objects.\n",
1106// Vec_IntSize(vPisOld), Vec_IntSize(vPisNew), Vec_IntSize(vFlops),
1107// Count - Vec_IntSize(vPisOld) - Vec_IntSize(vPisNew) - Vec_IntSize(vFlops) );
1108 Vec_IntSort( vPisOld, 0 );
1109 Vec_IntSort( vPisNew, 0 );
1110 Vec_IntSort( vFlops, 0 );
1112}
1113
1129static Wlc_Ntk_t * Wlc_NtkAbs( Wlc_Ntk_t * p, Wlc_Par_t * pPars, Vec_Bit_t * vUnmark, Vec_Int_t ** pvPisNew, Vec_Int_t ** pvFlops, int fVerbose )
1130{
1131 Wlc_Ntk_t * pNtkNew = NULL;
1132 Vec_Int_t * vPisOld = Vec_IntAlloc( 100 );
1133 Vec_Int_t * vPisNew = Vec_IntAlloc( 100 );
1134 Vec_Int_t * vFlops = Vec_IntAlloc( 100 );
1135 Vec_Bit_t * vLeaves = Wlc_NtkAbsMarkOpers( p, pPars, vUnmark, fVerbose );
1136 Wlc_NtkAbsMarkNodes( p, vLeaves, vPisOld, vPisNew, vFlops );
1137 Vec_BitFree( vLeaves );
1138 pNtkNew = Wlc_NtkDupDfsAbs( p, vPisOld, vPisNew, vFlops );
1139 Vec_IntFree( vPisOld );
1140 if ( pvFlops )
1141 *pvFlops = vFlops;
1142 else
1143 Vec_IntFree( vFlops );
1144 if ( pvPisNew )
1145 *pvPisNew = vPisNew;
1146 else
1147 Vec_IntFree( vPisNew );
1148 return pNtkNew;
1149}
1150
1165static Vec_Int_t * Wlc_NtkAbsRefinement( Wlc_Ntk_t * p, Gia_Man_t * pGia, Abc_Cex_t * pCex, Vec_Int_t * vPisNew )
1166{
1167 Vec_Int_t * vRefine = Vec_IntAlloc( 100 );
1168 Abc_Cex_t * pCexCare;
1169 Wlc_Obj_t * pObj;
1170 // count the number of bit-level PPIs and map them into word-level objects they were derived from
1171 int f, i, b, nRealPis, nPpiBits = 0;
1172 Vec_Int_t * vMap = Vec_IntStartFull( pCex->nPis );
1173 Wlc_NtkForEachObjVec( vPisNew, p, pObj, i )
1174 for ( b = 0; b < Wlc_ObjRange(pObj); b++ )
1175 Vec_IntWriteEntry( vMap, nPpiBits++, Wlc_ObjId(p, pObj) );
1176 // since PPIs are ordered last, the previous bits are real PIs
1177 nRealPis = pCex->nPis - nPpiBits;
1178 // find the care-set
1179 pCexCare = Bmc_CexCareMinimizeAig( pGia, nRealPis, pCex, 1, 0, 0 );
1180 assert( pCexCare->nPis == pCex->nPis );
1181 // detect care PPIs
1182 for ( f = 0; f <= pCexCare->iFrame; f++ )
1183 for ( i = nRealPis; i < pCexCare->nPis; i++ )
1184 if ( Abc_InfoHasBit(pCexCare->pData, pCexCare->nRegs + pCexCare->nPis * f + i) )
1185 Vec_IntPushUniqueOrder( vRefine, Vec_IntEntry(vMap, i-nRealPis) );
1186 Abc_CexFree( pCexCare );
1187 Vec_IntFree( vMap );
1188 if ( Vec_IntSize(vRefine) == 0 )// real CEX
1189 Vec_IntFreeP( &vRefine );
1190 return vRefine;
1191}
1192
1205static int Wlc_NtkNodeDeref_rec( Wlc_Ntk_t * p, Wlc_Obj_t * pNode, Vec_Bit_t * vUnmark )
1206{
1207 int i, Fanin, Counter = 1;
1208 if ( Wlc_ObjIsCi(pNode) )
1209 return 0;
1210 Vec_BitWriteEntry( vUnmark, Wlc_ObjId(p, pNode), 1 );
1211 Wlc_ObjForEachFanin( pNode, Fanin, i )
1212 {
1213 Vec_IntAddToEntry( &p->vRefs, Fanin, -1 );
1214 if ( Vec_IntEntry(&p->vRefs, Fanin) == 0 )
1215 Counter += Wlc_NtkNodeDeref_rec( p, Wlc_NtkObj(p, Fanin), vUnmark );
1216 }
1217 return Counter;
1218}
1219static int Wlc_NtkNodeRef_rec( Wlc_Ntk_t * p, Wlc_Obj_t * pNode )
1220{
1221 int i, Fanin, Counter = 1;
1222 if ( Wlc_ObjIsCi(pNode) )
1223 return 0;
1224 Wlc_ObjForEachFanin( pNode, Fanin, i )
1225 {
1226 if ( Vec_IntEntry(&p->vRefs, Fanin) == 0 )
1227 Counter += Wlc_NtkNodeRef_rec( p, Wlc_NtkObj(p, Fanin) );
1228 Vec_IntAddToEntry( &p->vRefs, Fanin, 1 );
1229 }
1230 return Counter;
1231}
1232static int Wlc_NtkMarkMffc( Wlc_Ntk_t * p, Wlc_Obj_t * pNode, Vec_Bit_t * vUnmark )
1233{
1234 int Count1, Count2;
1235 // if this is a flop output, compute MFFC of the corresponding flop input
1236 while ( Wlc_ObjIsCi(pNode) )
1237 {
1238 Vec_BitWriteEntry( vUnmark, Wlc_ObjId(p, pNode), 1 );
1239 pNode = Wlc_ObjFo2Fi(p, pNode);
1240 }
1241 assert( !Wlc_ObjIsCi(pNode) );
1242 // dereference the node (and set the bits in vUnmark)
1243 Count1 = Wlc_NtkNodeDeref_rec( p, pNode, vUnmark );
1244 // reference it back
1245 Count2 = Wlc_NtkNodeRef_rec( p, pNode );
1246 assert( Count1 == Count2 );
1247 return Count1;
1248}
1249static int Wlc_NtkRemoveFromAbstraction( Wlc_Ntk_t * p, Vec_Int_t * vRefine, Vec_Bit_t * vUnmark )
1250{
1251 Wlc_Obj_t * pObj; int i, nNodes = 0;
1252 if ( Vec_IntSize(&p->vRefs) == 0 )
1253 Wlc_NtkSetRefs( p );
1254 Wlc_NtkForEachObjVec( vRefine, p, pObj, i )
1255 nNodes += Wlc_NtkMarkMffc( p, pObj, vUnmark );
1256 return nNodes;
1257}
1258
1259static int Wlc_NtkUnmarkRefinement( Wlc_Ntk_t * p, Vec_Int_t * vRefine, Vec_Bit_t * vUnmark )
1260{
1261 Wlc_Obj_t * pObj; int i, nNodes = 0;
1262 Wlc_NtkForEachObjVec( vRefine, p, pObj, i )
1263 {
1264 Vec_BitWriteEntry( vUnmark, Wlc_ObjId(p, pObj), 1 );
1265 ++nNodes;
1266 }
1267 return nNodes;
1268}
1269
1285{
1286 Vec_Int_t * vMap = Vec_IntAlloc( 1000 ); // the resulting map
1287 Vec_Int_t * vMapFfNew2Bit1 = Vec_IntAlloc( 1000 ); // first binary bit of each new word-level flop
1288 int i, b, iFfOld, iFfNew, iBit1New, nBits = 0;
1289 // map object IDs of old flops into their flop indexes
1290 Vec_Int_t * vMapFfObj2FfId = Vec_IntStartFull( Wlc_NtkObjNumMax(p) );
1291 Vec_IntForEachEntry( vFfNew, iFfNew, i )
1292 Vec_IntWriteEntry( vMapFfObj2FfId, iFfNew, i );
1293 // map each new flop index into its first bit
1294 Vec_IntForEachEntry( vFfNew, iFfNew, i )
1295 {
1296 Wlc_Obj_t * pObj = Wlc_NtkObj( p, iFfNew );
1297 int nRange = Wlc_ObjRange( pObj );
1298 Vec_IntPush( vMapFfNew2Bit1, nBits );
1299 nBits += nRange;
1300 }
1301 assert( Vec_IntSize(vMapFfNew2Bit1) == Vec_IntSize(vFfNew) );
1302 // remap old binary flops into new binary flops
1303 Vec_IntForEachEntry( vFfOld, iFfOld, i )
1304 {
1305 Wlc_Obj_t * pObj = Wlc_NtkObj( p, iFfOld );
1306 int nRange = Wlc_ObjRange( pObj );
1307 iFfNew = Vec_IntEntry( vMapFfObj2FfId, iFfOld );
1308 assert( iFfNew >= 0 ); // every old flop should be present in the new abstraction
1309 // find the first bit of this new flop
1310 iBit1New = Vec_IntEntry( vMapFfNew2Bit1, iFfNew );
1311 for ( b = 0; b < nRange; b++ )
1312 Vec_IntPush( vMap, iBit1New + b );
1313 }
1314 Vec_IntFree( vMapFfNew2Bit1 );
1315 Vec_IntFree( vMapFfObj2FfId );
1316 return vMap;
1317}
1318
1331{
1332 Vec_Int_t * vNodes = NULL;
1333 int i, Entry;
1334
1335 assert( pWla->vSignals );
1336
1337 vNodes = Vec_IntAlloc( 100 );
1338 Vec_IntForEachEntry( pWla->vSignals, Entry, i )
1339 {
1340 if ( !fBlack && Vec_BitEntry(pWla->vUnmark, Entry) )
1341 Vec_IntPush( vNodes, Entry );
1342
1343 if ( fBlack && !Vec_BitEntry(pWla->vUnmark, Entry) )
1344 Vec_IntPush( vNodes, Entry );
1345 }
1346
1347 return vNodes;
1348}
1349
1350int Wla_ManShrinkAbs( Wla_Man_t * pWla, int nFrames, int RunId )
1351{
1352 int i, Entry;
1353 int RetValue = 0;
1354
1355 Vec_Int_t * vWhites = Wla_ManCollectNodes( pWla, 0 );
1356 Vec_Int_t * vBlacks = Wla_ManCollectNodes( pWla, 1 );
1357 Vec_Bit_t * vCoreMarks = Wlc_NtkProofReduce( pWla->p, pWla->pPars, nFrames, vWhites, vBlacks, RunId );
1358
1359 if ( vCoreMarks == NULL )
1360 {
1361 Vec_IntFree( vWhites );
1362 Vec_IntFree( vBlacks );
1363 return -1;
1364 }
1365
1366 RetValue = Vec_IntSize( vWhites ) != Vec_BitCount( vCoreMarks );
1367
1368 Vec_IntForEachEntry( vWhites, Entry, i )
1369 if ( !Vec_BitEntry( vCoreMarks, i ) )
1370 Vec_BitWriteEntry( pWla->vUnmark, Entry, 0 );
1371
1372 Vec_IntFree( vWhites );
1373 Vec_IntFree( vBlacks );
1374 Vec_BitFree( vCoreMarks );
1375
1376 return RetValue;
1377}
1378
1380{
1381 Wlc_Ntk_t * pAbs;
1382
1383 // get abstracted GIA and the set of pseudo-PIs (vBlacks)
1384 if ( pWla->vBlacks == NULL )
1385 {
1386 pWla->vBlacks = Wlc_NtkGetBlacks( pWla->p, pWla->pPars );
1387 pWla->vSignals = Vec_IntDup( pWla->vBlacks );
1388 }
1389 else
1390 {
1391 Wlc_NtkUpdateBlacks( pWla->p, pWla->pPars, &pWla->vBlacks, pWla->vUnmark, pWla->vSignals );
1392 }
1393 pAbs = Wlc_NtkAbs2( pWla->p, pWla->vBlacks, NULL );
1394
1395 return pAbs;
1396}
1397
1399{
1400 int nDcFlops;
1401 Gia_Man_t * pTemp;
1402 Aig_Man_t * pAig;
1403
1404 pWla->pGia = Wlc_NtkBitBlast( pAbs, NULL );
1405
1406 // if the abstraction has flops with DC-init state,
1407 // new PIs were introduced by bit-blasting at the end of the PI list
1408 // here we move these variables to be *before* PPIs, because
1409 // PPIs are supposed to be at the end of the PI list for refinement
1410 nDcFlops = Wlc_NtkDcFlopNum(pAbs);
1411 if ( nDcFlops > 0 ) // DC-init flops are present
1412 {
1413 pWla->pGia = Gia_ManPermuteInputs( pTemp = pWla->pGia, Wlc_NtkCountObjBits(pWla->p, pWla->vBlacks), nDcFlops );
1414 Gia_ManStop( pTemp );
1415 }
1416 // if the word-level outputs have to be XORs, this is a place to do it
1417 if ( pWla->pPars->fXorOutput )
1418 {
1419 pWla->pGia = Gia_ManTransformMiter2( pTemp = pWla->pGia );
1420 Gia_ManStop( pTemp );
1421 }
1422 if ( pWla->pPars->fVerbose )
1423 {
1424 printf( "Derived abstraction with %d objects and %d PPIs. Bit-blasted AIG stats are:\n", Wlc_NtkObjNum(pAbs), Vec_IntSize(pWla->vBlacks) );
1425 Gia_ManPrintStats( pWla->pGia, NULL );
1426 }
1427
1428 // try to prove abstracted GIA by converting it to AIG and calling PDR
1429 pAig = Gia_ManToAigSimple( pWla->pGia );
1430
1431 return pAig;
1432}
1433
1435{
1436 Pdr_Man_t * pPdr;
1437 Pdr_Par_t * pPdrPars = (Pdr_Par_t *)pWla->pPdrPars;
1438 abctime clk;
1439 int RetValue = -1;
1440
1441 if ( Aig_ManAndNum( pAig ) <= 20000 )
1442 {
1443 Aig_Man_t * pAigScorr;
1444 Ssw_Pars_t ScorrPars, * pScorrPars = &ScorrPars;
1445 int nAnds;
1446
1447 clk = Abc_Clock();
1448
1449 Ssw_ManSetDefaultParams( pScorrPars );
1450 pScorrPars->fStopWhenGone = 1;
1451 pScorrPars->nFramesK = 1;
1452 pAigScorr = Ssw_SignalCorrespondence( pAig, pScorrPars );
1453 assert ( pAigScorr );
1454 nAnds = Aig_ManAndNum( pAigScorr);
1455 Aig_ManStop( pAigScorr );
1456
1457 if ( nAnds == 0 )
1458 {
1459 if ( pWla->pPars->fVerbose )
1460 Abc_PrintTime( 1, "SCORR proved UNSAT. Time", Abc_Clock() - clk );
1461 return 1;
1462 }
1463 else if ( pWla->pPars->fVerbose )
1464 {
1465 Abc_Print( 1, "SCORR failed with %d ANDs. ", nAnds);
1466 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
1467 }
1468 }
1469
1470 clk = Abc_Clock();
1471
1472 pPdrPars->fVerbose = 0;
1473 pPdr = Pdr_ManStart( pAig, pPdrPars, NULL );
1474 RetValue = IPdr_ManCheckCombUnsat( pPdr );
1475 Pdr_ManStop( pPdr );
1476 pPdrPars->fVerbose = pWla->pPars->fPdrVerbose;
1477
1478 pWla->tPdr += Abc_Clock() - clk;
1479
1480 return RetValue;
1481}
1482
1484{
1485 abctime clk;
1486 Pdr_Man_t * pPdr;
1487 Pdr_Par_t * pPdrPars = (Pdr_Par_t *)pWla->pPdrPars;
1488 Abc_Cex_t * pBmcCex = NULL;
1489 Abc_Cex_t * pCexReal = NULL;
1490 int RetValue = -1;
1491 int RunId = Wla_GetGlobalRunId();
1492
1493 if ( pWla->vClauses && pWla->pPars->fCheckCombUnsat )
1494 {
1495 clk = Abc_Clock();
1496
1497 RetValue = Wla_ManCheckCombUnsat( pWla, pAig );
1498 if ( RetValue == 1 )
1499 {
1500 if ( pWla->pPars->fVerbose )
1501 Abc_PrintTime( 1, "ABS becomes combinationally UNSAT. Time", Abc_Clock() - clk );
1502 return 1;
1503 }
1504
1505 if ( pWla->pPars->fVerbose )
1506 Abc_PrintTime( 1, "Check comb. unsat failed. Time", Abc_Clock() - clk );
1507 }
1508
1509 if ( pWla->pPars->fUseBmc3 )
1510 {
1511 pPdrPars->RunId = RunId;
1512 pPdrPars->pFuncStop = Wla_CallBackToStop;
1513
1514 Wla_ManConcurrentBmc3( pWla, Aig_ManDupSimple(pAig), &pBmcCex );
1515 }
1516
1517 clk = Abc_Clock();
1518 pPdr = Pdr_ManStart( pAig, pPdrPars, NULL );
1519 if ( pWla->vClauses ) {
1520 assert( Vec_VecSize( pWla->vClauses) >= 2 );
1521
1522 if ( pWla->fNewAbs )
1523 IPdr_ManRebuildClauses( pPdr, pWla->pPars->fShrinkScratch ? NULL : pWla->vClauses );
1524 else
1525 IPdr_ManRestoreClauses( pPdr, pWla->vClauses, NULL );
1526
1527 pWla->fNewAbs = 0;
1528 }
1529
1530 RetValue = IPdr_ManSolveInt( pPdr, pWla->pPars->fCheckClauses, pWla->pPars->fPushClauses );
1531 pPdr->tTotal += Abc_Clock() - clk;
1532 pWla->tPdr += pPdr->tTotal;
1533 if ( pWla->pPars->fLoadTrace)
1534 pWla->vClauses = IPdr_ManSaveClauses( pPdr, 0 );
1535 Pdr_ManStop( pPdr );
1536
1537
1538 if ( pWla->pPars->fUseBmc3 )
1539 Wla_ManJoinThread( pWla, RunId );
1540
1541 if ( pBmcCex )
1542 {
1543 pWla->pCex = pBmcCex ;
1544 }
1545 else
1546 {
1547 pWla->pCex = pAig->pSeqModel;
1548 pAig->pSeqModel = NULL;
1549 }
1550
1551 // consider outcomes
1552 if ( pWla->pCex == NULL )
1553 {
1554 assert( RetValue ); // proved or undecided
1555 return RetValue;
1556 }
1557
1558 // verify CEX
1559 pCexReal = Wlc_NtkCexIsReal( pWla->p, pWla->pCex );
1560 if ( pCexReal )
1561 {
1562 Abc_CexFree( pWla->pCex );
1563 pWla->pCex = pCexReal;
1564 return 0;
1565 }
1566
1567 return -1;
1568}
1569
1571{
1572 abctime clk;
1573 int nNodes;
1574 Vec_Int_t * vRefine = NULL;
1575
1576 if ( pWla->fNewAbs )
1577 {
1578 if ( pWla->pCex )
1579 Abc_CexFree( pWla->pCex );
1580 pWla->pCex = NULL;
1581 Gia_ManStop( pWla->pGia ); pWla->pGia = NULL;
1582 return;
1583 }
1584
1585 // perform refinement
1586 if ( pWla->pPars->fHybrid || !pWla->pPars->fProofRefine )
1587 {
1588 clk = Abc_Clock();
1589 vRefine = Wlc_NtkAbsRefinement( pWla->p, pWla->pGia, pWla->pCex, pWla->vBlacks );
1590 pWla->tCbr += Abc_Clock() - clk;
1591 }
1592 else // proof-based only
1593 {
1594 vRefine = Vec_IntDup( pWla->vBlacks );
1595 }
1596 if ( pWla->pPars->fProofRefine )
1597 {
1598 clk = Abc_Clock();
1599 Wlc_NtkProofRefine( pWla->p, pWla->pPars, pWla->pCex, pWla->vBlacks, &vRefine );
1600 pWla->tPbr += Abc_Clock() - clk;
1601 }
1602
1603 if ( pWla->vClauses && pWla->pPars->fVerbose )
1604 {
1605 int i;
1606 Vec_Ptr_t * vVec;
1607 Vec_VecForEachLevel( pWla->vClauses, vVec, i )
1608 pWla->nTotalCla += Vec_PtrSize( vVec );
1609 }
1610
1611 // update the set of objects to be un-abstracted
1612 clk = Abc_Clock();
1613 if ( pWla->pPars->fMFFC )
1614 {
1615 nNodes = Wlc_NtkRemoveFromAbstraction( pWla->p, vRefine, pWla->vUnmark );
1616 if ( pWla->pPars->fVerbose )
1617 printf( "Refinement of CEX in frame %d came up with %d un-abstacted PPIs, whose MFFCs include %d objects.\n", pWla->pCex->iFrame, Vec_IntSize(vRefine), nNodes );
1618 }
1619 else
1620 {
1621 nNodes = Wlc_NtkUnmarkRefinement( pWla->p, vRefine, pWla->vUnmark );
1622 if ( pWla->pPars->fVerbose )
1623 printf( "Refinement of CEX in frame %d came up with %d un-abstacted PPIs.\n", pWla->pCex->iFrame, Vec_IntSize(vRefine) );
1624
1625 }
1626 /*
1627 if ( pWla->pPars->fVerbose )
1628 {
1629 Wlc_NtkAbsAnalyzeRefine( pWla->p, pWla->vBlacks, pWla->vUnmark, &pWla->nDisj, &pWla->nNDisj );
1630 Abc_Print( 1, "Refine analysis (total): %d disjoint PPIs and %d non-disjoint PPIs\n", pWla->nDisj, pWla->nNDisj );
1631 }
1632 */
1633 pWla->tCbr += Abc_Clock() - clk;
1634
1635 // Experimental
1636 /*
1637 if ( pWla->pCex->iFrame > 0 )
1638 {
1639 Vec_Int_t * vWhites = Wla_ManCollectWhites( pWla );
1640 Vec_Bit_t * vCore = Wlc_NtkProofReduce( pWla->p, pWla->pPars, pWla->pCex->iFrame, vWhites );
1641 Vec_IntFree( vWhites );
1642 Vec_BitFree( vCore );
1643 }
1644 */
1645
1646 pWla->iCexFrame = pWla->pCex->iFrame;
1647
1648 Vec_IntFree( vRefine );
1649 Gia_ManStop( pWla->pGia ); pWla->pGia = NULL;
1650 Abc_CexFree( pWla->pCex ); pWla->pCex = NULL;
1651}
1652
1654{
1655 Wla_Man_t * p = ABC_CALLOC( Wla_Man_t, 1 );
1656 Pdr_Par_t * pPdrPars;
1657 p->p = pNtk;
1658 p->pPars = pPars;
1659 p->vUnmark = Vec_BitStart( Wlc_NtkObjNumMax(pNtk) );
1660
1661 pPdrPars = ABC_CALLOC( Pdr_Par_t, 1 );
1662 Pdr_ManSetDefaultParams( pPdrPars );
1663 pPdrPars->fVerbose = pPars->fPdrVerbose;
1664 pPdrPars->fVeryVerbose = 0;
1665 pPdrPars->pFuncStop = pPars->pFuncStop;
1666 pPdrPars->RunId = pPars->RunId;
1667 if ( pPars->fPdra )
1668 {
1669 pPdrPars->fUseAbs = 1; // use 'pdr -t' (on-the-fly abstraction)
1670 pPdrPars->fCtgs = 1; // use 'pdr -nc' (improved generalization)
1671 pPdrPars->fSkipDown = 0; // use 'pdr -nc' (improved generalization)
1672 pPdrPars->nRestLimit = 500; // reset queue or proof-obligations when it gets larger than this
1673 }
1674 p->pPdrPars = (void *)pPdrPars;
1675
1676 p->iCexFrame = 0;
1677 p->fNewAbs = 0;
1678
1679 p->nIters = 1;
1680 p->nTotalCla = 0;
1681 p->nDisj = 0;
1682 p->nNDisj = 0;
1683
1684 return p;
1685}
1686
1688{
1689 if ( p->vBlacks ) Vec_IntFree( p->vBlacks );
1690 if ( p->vSignals ) Vec_IntFree( p->vSignals );
1691 if ( p->pGia ) Gia_ManStop( p->pGia );
1692 if ( p->pCex ) Abc_CexFree( p->pCex );
1693 Vec_BitFree( p->vUnmark );
1694 ABC_FREE( p->pPdrPars );
1695 ABC_FREE( p );
1696}
1697
1698int Wla_ManSolve( Wla_Man_t * pWla, Wlc_Par_t * pPars )
1699{
1700 abctime clk = Abc_Clock();
1701 abctime tTotal;
1702 Wlc_Ntk_t * pAbs = NULL;
1703 Aig_Man_t * pAig = NULL;
1704
1705 int RetValue = -1;
1706
1707 // perform refinement iterations
1708 for ( pWla->nIters = 1; pWla->nIters < pPars->nIterMax; ++pWla->nIters )
1709 {
1710 if ( pPars->fVerbose )
1711 printf( "\nIteration %d:\n", pWla->nIters );
1712
1713 pAbs = Wla_ManCreateAbs( pWla );
1714
1715 pAig = Wla_ManBitBlast( pWla, pAbs );
1716 Wlc_NtkFree( pAbs );
1717
1718 RetValue = Wla_ManSolveInt( pWla, pAig );
1719 Aig_ManStop( pAig );
1720
1721 if ( RetValue != -1 || (pPars->pFuncStop && pPars->pFuncStop( pPars->RunId)) )
1722 break;
1723
1724 Wla_ManRefine( pWla );
1725 }
1726
1727 // report the result
1728 if ( pPars->fVerbose )
1729 printf( "\n" );
1730 printf( "Abstraction " );
1731 if ( RetValue == 0 )
1732 printf( "resulted in a real CEX" );
1733 else if ( RetValue == 1 )
1734 printf( "is successfully proved" );
1735 else
1736 printf( "timed out" );
1737 printf( " after %d iterations. ", pWla->nIters );
1738 tTotal = Abc_Clock() - clk;
1739 Abc_PrintTime( 1, "Time", tTotal );
1740
1741 if ( pPars->fVerbose )
1742 Abc_Print( 1, "PDRA reused %d clauses.\n", pWla->nTotalCla );
1743 if ( pPars->fVerbose )
1744 {
1745 ABC_PRTP( "PDR ", pWla->tPdr, tTotal );
1746 ABC_PRTP( "CEX Refine ", pWla->tCbr, tTotal );
1747 ABC_PRTP( "Proof Refine ", pWla->tPbr, tTotal );
1748 ABC_PRTP( "Misc. ", tTotal - pWla->tPdr - pWla->tCbr - pWla->tPbr, tTotal );
1749 ABC_PRTP( "Total ", tTotal, tTotal );
1750 }
1751
1752 return RetValue;
1753}
1754
1756{
1757 Wla_Man_t * pWla = NULL;
1758
1759 int RetValue = -1;
1760
1761 pWla = Wla_ManStart( p, pPars );
1762
1763 RetValue = Wla_ManSolve( pWla, pPars );
1764
1765 Wla_ManStop( pWla );
1766
1767 return RetValue;
1768}
1769
1787{
1788 abctime clk = Abc_Clock();
1789 Vec_Int_t * vBlacks = NULL;
1790 int nIters, nNodes, nDcFlops, RetValue = -1;
1791 // start the bitmap to mark objects that cannot be abstracted because of refinement
1792 // currently, this bitmap is empty because abstraction begins without refinement
1793 Vec_Bit_t * vUnmark = Vec_BitStart( Wlc_NtkObjNumMax(p) );
1794 // set up parameters to run PDR
1795 Pdr_Par_t PdrPars, * pPdrPars = &PdrPars;
1796 Pdr_ManSetDefaultParams( pPdrPars );
1797 //pPdrPars->fUseAbs = 1; // use 'pdr -t' (on-the-fly abstraction)
1798 //pPdrPars->fCtgs = 1; // use 'pdr -nc' (improved generalization)
1799 //pPdrPars->fSkipDown = 0; // use 'pdr -nc' (improved generalization)
1800 //pPdrPars->nRestLimit = 500; // reset queue or proof-obligations when it gets larger than this
1801 pPdrPars->fVerbose = pPars->fPdrVerbose;
1802 pPdrPars->fVeryVerbose = 0;
1803 // perform refinement iterations
1804 for ( nIters = 1; nIters < pPars->nIterMax; nIters++ )
1805 {
1806 Aig_Man_t * pAig;
1807 Abc_Cex_t * pCex;
1808 Vec_Int_t * vPisNew, * vRefine;
1809 Gia_Man_t * pGia, * pTemp;
1810 Wlc_Ntk_t * pAbs;
1811
1812 if ( pPars->fVerbose )
1813 printf( "\nIteration %d:\n", nIters );
1814
1815 // get abstracted GIA and the set of pseudo-PIs (vPisNew)
1816 if ( pPars->fAbs2 )
1817 {
1818 if ( vBlacks == NULL )
1819 vBlacks = Wlc_NtkGetBlacks( p, pPars );
1820 else
1821 Wlc_NtkUpdateBlacks( p, pPars, &vBlacks, vUnmark, NULL );
1822 pAbs = Wlc_NtkAbs2( p, vBlacks, NULL );
1823 vPisNew = Vec_IntDup( vBlacks );
1824 }
1825 else
1826 {
1827 if ( nIters == 1 && pPars->nLimit < ABC_INFINITY )
1828 Wlc_NtkSetUnmark( p, pPars, vUnmark );
1829
1830 pAbs = Wlc_NtkAbs( p, pPars, vUnmark, &vPisNew, NULL, pPars->fVerbose );
1831 }
1832 pGia = Wlc_NtkBitBlast( pAbs, NULL );
1833
1834 // if the abstraction has flops with DC-init state,
1835 // new PIs were introduced by bit-blasting at the end of the PI list
1836 // here we move these variables to be *before* PPIs, because
1837 // PPIs are supposed to be at the end of the PI list for refinement
1838 nDcFlops = Wlc_NtkDcFlopNum(pAbs);
1839 if ( nDcFlops > 0 ) // DC-init flops are present
1840 {
1841 pGia = Gia_ManPermuteInputs( pTemp = pGia, Wlc_NtkCountObjBits(p, vPisNew), nDcFlops );
1842 Gia_ManStop( pTemp );
1843 }
1844 // if the word-level outputs have to be XORs, this is a place to do it
1845 if ( pPars->fXorOutput )
1846 {
1847 pGia = Gia_ManTransformMiter2( pTemp = pGia );
1848 Gia_ManStop( pTemp );
1849 }
1850 if ( pPars->fVerbose )
1851 {
1852 printf( "Derived abstraction with %d objects and %d PPIs. Bit-blasted AIG stats are:\n", Wlc_NtkObjNum(pAbs), Vec_IntSize(vPisNew) );
1853 Gia_ManPrintStats( pGia, NULL );
1854 }
1855 Wlc_NtkFree( pAbs );
1856
1857 // try to prove abstracted GIA by converting it to AIG and calling PDR
1858 pAig = Gia_ManToAigSimple( pGia );
1859 RetValue = Pdr_ManSolve( pAig, pPdrPars );
1860 pCex = pAig->pSeqModel; pAig->pSeqModel = NULL;
1861 Aig_ManStop( pAig );
1862
1863 // consider outcomes
1864 if ( pCex == NULL )
1865 {
1866 assert( RetValue ); // proved or undecided
1867 Gia_ManStop( pGia );
1868 Vec_IntFree( vPisNew );
1869 break;
1870 }
1871
1872 // perform refinement
1873 vRefine = Wlc_NtkAbsRefinement( p, pGia, pCex, vPisNew );
1874 Gia_ManStop( pGia );
1875 Vec_IntFree( vPisNew );
1876 if ( vRefine == NULL ) // real CEX
1877 {
1878 Abc_CexFree( pCex ); // return CEX in the future
1879 break;
1880 }
1881
1882 // update the set of objects to be un-abstracted
1883 nNodes = Wlc_NtkRemoveFromAbstraction( p, vRefine, vUnmark );
1884 if ( pPars->fVerbose )
1885 printf( "Refinement of CEX in frame %d came up with %d un-abstacted PPIs, whose MFFCs include %d objects.\n", pCex->iFrame, Vec_IntSize(vRefine), nNodes );
1886 Vec_IntFree( vRefine );
1887 Abc_CexFree( pCex );
1888 }
1889 Vec_IntFreeP( &vBlacks );
1890 Vec_BitFreeP( &vUnmark );
1891 // report the result
1892 if ( pPars->fVerbose )
1893 printf( "\n" );
1894 printf( "Abstraction " );
1895 if ( RetValue == 0 )
1896 printf( "resulted in a real CEX" );
1897 else if ( RetValue == 1 )
1898 printf( "is successfully proved" );
1899 else
1900 printf( "timed out" );
1901 printf( " after %d iterations. ", nIters );
1902 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
1903 return RetValue;
1904}
1905
1909
1910
1912
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_PRTP(a, t, T)
Definition abc_global.h:258
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition abc_global.h:250
#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
Aig_Man_t * Aig_ManDupSimple(Aig_Man_t *p)
DECLARATIONS ///.
Definition aigDup.c:46
void Aig_ManStop(Aig_Man_t *p)
Definition aigMan.c:187
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition aig.h:50
#define Aig_ManForEachCo(p, pObj, i)
Definition aig.h:398
int nTotal
DECLARATIONS ///.
Definition cutTruth.c:37
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_False
Definition bmcBmcS.c:36
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
#define sat_solver_addclause
Definition cecSatG2.c:37
#define sat_solver
Definition cecSatG2.c:34
#define sat_solver_solve
Definition cecSatG2.c:45
Cnf_Dat_t * Cnf_Derive(Aig_Man_t *pAig, int nOutputs)
Definition cnfCore.c:165
void Cnf_ManFree()
Definition cnfCore.c:58
struct Cnf_Dat_t_ Cnf_Dat_t
Definition cnf.h:52
Cube * p
Definition exorList.c:222
Aig_Man_t * Gia_ManToAigSimple(Gia_Man_t *p)
Definition giaAig.c:408
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
Gia_Man_t * Gia_ManPermuteInputs(Gia_Man_t *p, int nPpis, int nExtra)
Definition giaDup.c:2758
#define Gia_ManForEachPo(p, pObj, i)
Definition gia.h:1250
#define Gia_ManForEachAnd(p, pObj, i)
Definition gia.h:1214
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition giaMan.c:764
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition giaHash.c:105
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
Definition giaMan.c:57
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition giaScl.c:84
Gia_Man_t * Gia_ManTransformMiter2(Gia_Man_t *p)
Definition giaDup.c:3409
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:576
#define Gia_ManForEachCo(p, pObj, i)
Definition gia.h:1236
#define Gia_ManForEachRiRo(p, pObjRi, pObjRo, i)
Definition gia.h:1256
void Gia_ManHashStop(Gia_Man_t *p)
Definition giaHash.c:149
void Gia_ManPrintStats(Gia_Man_t *p, Gps_Par_t *pPars)
Definition giaMan.c:495
#define Gia_ManForEachRi(p, pObj, i)
Definition gia.h:1254
unsigned short var
Definition giaNewBdd.h:35
Pdr_Man_t * Pdr_ManStart(Aig_Man_t *pAig, Pdr_Par_t *pPars, Vec_Int_t *vPrioInit)
Definition pdrMan.c:248
void Pdr_ManStop(Pdr_Man_t *p)
Definition pdrMan.c:318
struct Pdr_Man_t_ Pdr_Man_t
Definition pdrInt.h:95
void Pdr_ManSetDefaultParams(Pdr_Par_t *pPars)
MACRO DEFINITIONS ///.
Definition pdrCore.c:50
typedefABC_NAMESPACE_HEADER_START struct Pdr_Par_t_ Pdr_Par_t
INCLUDES ///.
Definition pdr.h:40
int Pdr_ManSolve(Aig_Man_t *p, Pdr_Par_t *pPars)
Definition pdrCore.c:1765
sat_solver * sat_solver_new(void)
Definition satSolver.c:1137
void sat_solver_setnvars(sat_solver *s, int n)
Definition satSolver.c:1272
void sat_solver_delete(sat_solver *s)
Definition satSolver.c:1341
void Ssw_ManSetDefaultParams(Ssw_Pars_t *p)
DECLARATIONS ///.
Definition sswCore.c:45
typedefABC_NAMESPACE_HEADER_START struct Ssw_Pars_t_ Ssw_Pars_t
INCLUDES ///.
Definition ssw.h:40
Aig_Man_t * Ssw_SignalCorrespondence(Aig_Man_t *pAig, Ssw_Pars_t *pPars)
Definition sswCore.c:436
int Id
Definition aig.h:85
int nVars
Definition cnf.h:59
int * pVarNums
Definition cnf.h:63
int ** pClauses
Definition cnf.h:62
int nClauses
Definition cnf.h:61
char * pName
Definition gia.h:99
unsigned Value
Definition gia.h:89
int second
Definition wlcAbs.c:50
int first
Definition wlcAbs.c:49
abctime tTotal
Definition pdrInt.h:174
Vec_Int_t * vBlacks
Definition wlc.h:256
abctime tCbr
Definition wlc.h:273
Vec_Int_t * vSignals
Definition wlc.h:257
int iCexFrame
Definition wlc.h:264
abctime tPbr
Definition wlc.h:274
Vec_Vec_t * vClauses
Definition wlc.h:255
int nIters
Definition wlc.h:267
Wlc_Par_t * pPars
Definition wlc.h:254
abctime tPdr
Definition wlc.h:272
int fNewAbs
Definition wlc.h:265
Abc_Cex_t * pCex
Definition wlc.h:258
Vec_Bit_t * vUnmark
Definition wlc.h:260
Gia_Man_t * pGia
Definition wlc.h:259
Wlc_Ntk_t * p
Definition wlc.h:253
int nTotalCla
Definition wlc.h:268
void * pPdrPars
Definition wlc.h:261
unsigned Type
Definition wlc.h:121
unsigned fIsFi
Definition wlc.h:126
unsigned Mark
Definition wlc.h:123
int nBitsAdd
Definition wlc.h:181
int fCheckCombUnsat
Definition wlc.h:195
int fXorOutput
Definition wlc.h:187
int fHybrid
Definition wlc.h:194
int fPdra
Definition wlc.h:191
int fAbs2
Definition wlc.h:196
int fShrinkScratch
Definition wlc.h:200
int nBitsMul
Definition wlc.h:182
int fProofUsePPI
Definition wlc.h:197
int(* pFuncStop)(int)
Definition wlc.h:204
int nIterMax
Definition wlc.h:185
int fPdrVerbose
Definition wlc.h:202
int fVerbose
Definition wlc.h:201
int fUseBmc3
Definition wlc.h:198
int nBitsMux
Definition wlc.h:183
int nBitsFlop
Definition wlc.h:184
int fPushClauses
Definition wlc.h:189
int nLimit
Definition wlc.h:186
int fCheckClauses
Definition wlc.h:188
int RunId
Definition wlc.h:203
int fLoadTrace
Definition wlc.h:192
int fProofRefine
Definition wlc.h:193
int fMFFC
Definition wlc.h:190
void Abc_CexFree(Abc_Cex_t *p)
Definition utilCex.c:382
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
#define assert(ex)
Definition util_old.h:213
#define Vec_BitForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecBit.h:54
typedefABC_NAMESPACE_HEADER_START struct Vec_Bit_t_ Vec_Bit_t
INCLUDES ///.
Definition vecBit.h:42
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
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_VecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
Definition vecVec.h:55
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition vecVec.h:42
void Wla_ManStop(Wla_Man_t *p)
Definition wlcAbs.c:1687
void Wla_ManJoinThread(Wla_Man_t *pWla, int RunId)
Definition wlcPth.c:51
Aig_Man_t * Wla_ManBitBlast(Wla_Man_t *pWla, Wlc_Ntk_t *pAbs)
Definition wlcAbs.c:1398
int IPdr_ManSolveInt(Pdr_Man_t *p, int fCheckClauses, int fPushClauses)
Definition pdrIncr.c:373
int Wlc_NtkNumPiBits(Wlc_Ntk_t *pNtk)
Definition wlcAbs.c:118
int IPdr_ManReduceClauses(Pdr_Man_t *p, Vec_Vec_t *vClauses)
Definition pdrIncr.c:971
int IPdr_ManCheckCombUnsat(Pdr_Man_t *p)
Definition pdrIncr.c:871
int IPdr_ManRebuildClauses(Pdr_Man_t *p, Vec_Vec_t *vClauses)
Definition pdrIncr.c:256
int Wla_CallBackToStop(int RunId)
Definition wlcPth.c:46
int Wla_GetGlobalRunId()
Definition wlcPth.c:47
void Wla_ManRefine(Wla_Man_t *pWla)
Definition wlcAbs.c:1570
int IPdr_ManRestoreClauses(Pdr_Man_t *p, Vec_Vec_t *vClauses, Vec_Int_t *vMap)
Definition pdrIncr.c:338
int Wlc_NtkPdrAbs(Wlc_Ntk_t *p, Wlc_Par_t *pPars)
Definition wlcAbs.c:1755
int IntPairPtrCompare(Int_Pair_t **a, Int_Pair_t **b)
Definition wlcAbs.c:53
int Wlc_NtkAbsCore(Wlc_Ntk_t *p, Wlc_Par_t *pPars)
FUNCTION DECLARATIONS ///.
Definition wlcAbs.c:1786
void Wlc_NtkPrintNtk(Wlc_Ntk_t *p)
FUNCTION DEFINITIONS ///.
Definition wlcAbs.c:62
Vec_Int_t * Wlc_NtkFlopsRemap(Wlc_Ntk_t *p, Vec_Int_t *vFfOld, Vec_Int_t *vFfNew)
Definition wlcAbs.c:1284
Wla_Man_t * Wla_ManStart(Wlc_Ntk_t *pNtk, Wlc_Par_t *pPars)
Definition wlcAbs.c:1653
int Wla_ManSolveInt(Wla_Man_t *pWla, Aig_Man_t *pAig)
Definition wlcAbs.c:1483
int Wla_ManSolve(Wla_Man_t *pWla, Wlc_Par_t *pPars)
Definition wlcAbs.c:1698
void Wlc_NtkAbsGetSupp(Wlc_Ntk_t *p, Wlc_Obj_t *pObj, Vec_Bit_t *vCiMarks, Vec_Int_t *vSuppRefs, Vec_Int_t *vSuppList)
Definition wlcAbs.c:110
struct Int_Pair_t_ Int_Pair_t
Definition wlcAbs.c:46
Wlc_Ntk_t * Wlc_NtkIntroduceChoices(Wlc_Ntk_t *pNtk, Vec_Int_t *vBlacks, Vec_Int_t *vPPIs)
Definition wlcAbs.c:435
void IPdr_ManPrintClauses(Vec_Vec_t *vClauses, int kStart, int nRegs)
Definition pdrIncr.c:113
void Wla_ManConcurrentBmc3(Wla_Man_t *pWla, Aig_Man_t *pAig, Abc_Cex_t **ppCex)
Definition wlcPth.c:52
int Wla_ManShrinkAbs(Wla_Man_t *pWla, int nFrames, int RunId)
Definition wlcAbs.c:1350
int Wla_ManCheckCombUnsat(Wla_Man_t *pWla, Aig_Man_t *pAig)
Definition wlcAbs.c:1434
void Wlc_NtkAbsGetSupp_rec(Wlc_Ntk_t *p, Wlc_Obj_t *pObj, Vec_Bit_t *vCiMarks, Vec_Int_t *vSuppRefs, Vec_Int_t *vSuppList)
Definition wlcAbs.c:91
Wlc_Ntk_t * Wla_ManCreateAbs(Wla_Man_t *pWla)
Definition wlcAbs.c:1379
Vec_Int_t * Wla_ManCollectNodes(Wla_Man_t *pWla, int fBlack)
Definition wlcAbs.c:1330
void Wlc_NtkAbsAnalyzeRefine(Wlc_Ntk_t *p, Vec_Int_t *vBlacks, Vec_Bit_t *vUnmark, int *nDisj, int *nNDisj)
Definition wlcAbs.c:129
ABC_NAMESPACE_IMPL_START Vec_Vec_t * IPdr_ManSaveClauses(Pdr_Man_t *p, int fDropLast)
DECLARATIONS ///.
Definition pdrIncr.c:182
struct Wlc_Par_t_ Wlc_Par_t
Definition wlc.h:178
Wlc_Ntk_t * Wlc_NtkDupDfsAbs(Wlc_Ntk_t *p, Vec_Int_t *vPisOld, Vec_Int_t *vPisNew, Vec_Int_t *vFlops)
Definition wlcNtk.c:1055
#define Wlc_NtkForEachPo(p, pPo, i)
Definition wlc.h:364
#define Wlc_NtkForEachCi(p, pCi, i)
Definition wlc.h:366
Gia_Man_t * Wlc_NtkBitBlast(Wlc_Ntk_t *p, Wlc_BstPar_t *pPars)
Definition wlcBlast.c:1349
void Wlc_NtkPrintNode(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
Definition wlcNtk.c:703
int Wlc_ObjAlloc(Wlc_Ntk_t *p, int Type, int Signed, int End, int Beg)
Definition wlcNtk.c:199
void Wlc_NtkCleanMarks(Wlc_Ntk_t *p)
Definition wlcNtk.c:1135
#define Wlc_NtkForEachObjVec(vVec, p, pObj, i)
Definition wlc.h:360
void Wlc_NtkFree(Wlc_Ntk_t *p)
Definition wlcNtk.c:253
void Wlc_NtkSetRefs(Wlc_Ntk_t *p)
Definition wlcNtk.c:1373
#define Wlc_NtkForEachPi(p, pPi, i)
Definition wlc.h:362
struct Wlc_Ntk_t_ Wlc_Ntk_t
Definition wlc.h:135
#define Wlc_NtkForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition wlc.h:356
#define Wlc_ObjForEachFanin(pObj, iFanin, i)
Definition wlc.h:375
int Wlc_ObjCreate(Wlc_Ntk_t *p, int Type, int Signed, int End, int Beg, Vec_Int_t *vFanins)
Definition wlcNtk.c:219
char * Wlc_ObjName(Wlc_Ntk_t *p, int iObj)
Definition wlcNtk.c:225
@ WLC_OBJ_ARI_MULTI
Definition wlc.h:90
@ WLC_OBJ_ARI_REM
Definition wlc.h:92
@ WLC_OBJ_ARI_SUB
Definition wlc.h:89
@ WLC_OBJ_ARI_DIVIDE
Definition wlc.h:91
@ WLC_OBJ_MUX
Definition wlc.h:53
@ WLC_OBJ_PI
Definition wlc.h:46
@ WLC_OBJ_ARI_MINUS
Definition wlc.h:95
@ WLC_OBJ_ARI_MODULUS
Definition wlc.h:93
@ WLC_OBJ_ARI_ADD
Definition wlc.h:88
Wlc_Ntk_t * Wlc_NtkDupDfsSimple(Wlc_Ntk_t *p)
Definition wlcNtk.c:957
int Wlc_NtkCountObjBits(Wlc_Ntk_t *p, Vec_Int_t *vPisNew)
Definition wlcNtk.c:1395
struct Wlc_Obj_t_ Wlc_Obj_t
BASIC TYPES ///.
Definition wlc.h:118
#define Wlc_NtkForEachCo(p, pCo, i)
Definition wlc.h:368
int Wlc_NtkDcFlopNum(Wlc_Ntk_t *p)
Definition wlcNtk.c:1351
struct Wla_Man_t_ Wla_Man_t
Definition wlc.h:250