ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
sswConstr.c
Go to the documentation of this file.
1
20
21#include "sswInt.h"
22#include "sat/cnf/cnf.h"
23#include "misc/bar/bar.h"
24
26
27
31
35
48{
49 Aig_Man_t * pFrames;
50 Aig_Obj_t * pObj, * pObjLi, * pObjLo;
51 int i, f;
52// assert( Saig_ManConstrNum(p) > 0 );
53 assert( Aig_ManRegNum(p) > 0 );
54 assert( Aig_ManRegNum(p) < Aig_ManCiNum(p) );
55 // start the fraig package
56 pFrames = Aig_ManStart( Aig_ManObjNumMax(p) * nFrames );
57 // create latches for the first frame
58 Saig_ManForEachLo( p, pObj, i )
59 Aig_ObjSetCopy( pObj, Aig_ManConst0(pFrames) );
60 // add timeframes
61 for ( f = 0; f < nFrames; f++ )
62 {
63 // map constants and PIs
64 Aig_ObjSetCopy( Aig_ManConst1(p), Aig_ManConst1(pFrames) );
65 Saig_ManForEachPi( p, pObj, i )
66 Aig_ObjSetCopy( pObj, Aig_ObjCreateCi(pFrames) );
67 // add internal nodes of this frame
68 Aig_ManForEachNode( p, pObj, i )
69 Aig_ObjSetCopy( pObj, Aig_And( pFrames, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) ) );
70 // transfer to the primary output
71 Aig_ManForEachCo( p, pObj, i )
72 Aig_ObjSetCopy( pObj, Aig_ObjChild0Copy(pObj) );
73 // create constraint outputs
74 Saig_ManForEachPo( p, pObj, i )
75 {
76 if ( i < Saig_ManPoNum(p) - Saig_ManConstrNum(p) )
77 continue;
78 Aig_ObjCreateCo( pFrames, Aig_Not( Aig_ObjCopy(pObj) ) );
79 }
80 // transfer latch inputs to the latch outputs
81 Saig_ManForEachLiLo( p, pObjLi, pObjLo, i )
82 Aig_ObjSetCopy( pObjLo, Aig_ObjCopy(pObjLi) );
83 }
84 // remove dangling nodes
85 Aig_ManCleanup( pFrames );
86 return pFrames;
87}
88
100int Ssw_ManSetConstrPhases( Aig_Man_t * p, int nFrames, Vec_Int_t ** pvInits )
101{
102 Aig_Man_t * pFrames;
103 sat_solver * pSat;
104 Cnf_Dat_t * pCnf;
105 Aig_Obj_t * pObj;
106 int i, RetValue;
107 if ( pvInits )
108 *pvInits = NULL;
109// assert( p->nConstrs > 0 );
110 // derive the timeframes
111 pFrames = Ssw_FramesWithConstraints( p, nFrames );
112 // create CNF
113 pCnf = Cnf_Derive( pFrames, 0 );
114 // create SAT solver
115 pSat = (sat_solver *)Cnf_DataWriteIntoSolver( pCnf, 1, 0 );
116 if ( pSat == NULL )
117 {
118 Cnf_DataFree( pCnf );
119 Aig_ManStop( pFrames );
120 return 1;
121 }
122 // solve
123 RetValue = sat_solver_solve( pSat, NULL, NULL,
124 (ABC_INT64_T)1000000, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
125 if ( RetValue == l_True && pvInits )
126 {
127 *pvInits = Vec_IntAlloc( 1000 );
128 Aig_ManForEachCi( pFrames, pObj, i )
129 Vec_IntPush( *pvInits, sat_solver_var_value(pSat, pCnf->pVarNums[Aig_ObjId(pObj)]) );
130
131// Aig_ManForEachCi( pFrames, pObj, i )
132// Abc_Print( 1, "%d", Vec_IntEntry(*pvInits, i) );
133// Abc_Print( 1, "\n" );
134 }
135 sat_solver_delete( pSat );
136 Cnf_DataFree( pCnf );
137 Aig_ManStop( pFrames );
138 if ( RetValue == l_False )
139 return 1;
140 if ( RetValue == l_True )
141 return 0;
142 return -1;
143}
144
156int Ssw_ManSetConstrPhases_( Aig_Man_t * p, int nFrames, Vec_Int_t ** pvInits )
157{
158 Vec_Int_t * vLits;
159 sat_solver * pSat;
160 Cnf_Dat_t * pCnf;
161 Aig_Obj_t * pObj;
162 int i, f, iVar, RetValue, nRegs;
163 if ( pvInits )
164 *pvInits = NULL;
165 assert( p->nConstrs > 0 );
166 // create CNF
167 nRegs = p->nRegs; p->nRegs = 0;
168 pCnf = Cnf_Derive( p, Aig_ManCoNum(p) );
169 p->nRegs = nRegs;
170 // create SAT solver
171 pSat = (sat_solver *)Cnf_DataWriteIntoSolver( pCnf, nFrames, 0 );
172 assert( pSat->size == nFrames * pCnf->nVars );
173 // collect constraint literals
174 vLits = Vec_IntAlloc( 100 );
175 Saig_ManForEachLo( p, pObj, i )
176 {
177 assert( pCnf->pVarNums[Aig_ObjId(pObj)] >= 0 );
178 Vec_IntPush( vLits, toLitCond(pCnf->pVarNums[Aig_ObjId(pObj)], 1) );
179 }
180 for ( f = 0; f < nFrames; f++ )
181 {
182 Saig_ManForEachPo( p, pObj, i )
183 {
184 if ( i < Saig_ManPoNum(p) - Saig_ManConstrNum(p) )
185 continue;
186 assert( pCnf->pVarNums[Aig_ObjId(pObj)] >= 0 );
187 iVar = pCnf->pVarNums[Aig_ObjId(pObj)] + pCnf->nVars*f;
188 Vec_IntPush( vLits, toLitCond(iVar, 1) );
189 }
190 }
191 RetValue = sat_solver_solve( pSat, (int *)Vec_IntArray(vLits),
192 (int *)Vec_IntArray(vLits) + Vec_IntSize(vLits),
193 (ABC_INT64_T)1000000, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
194 if ( RetValue == l_True && pvInits )
195 {
196 *pvInits = Vec_IntAlloc( 1000 );
197 for ( f = 0; f < nFrames; f++ )
198 {
199 Saig_ManForEachPi( p, pObj, i )
200 {
201 iVar = pCnf->pVarNums[Aig_ObjId(pObj)] + pCnf->nVars*f;
202 Vec_IntPush( *pvInits, sat_solver_var_value(pSat, iVar) );
203 }
204 }
205 }
206 sat_solver_delete( pSat );
207 Vec_IntFree( vLits );
208 Cnf_DataFree( pCnf );
209 if ( RetValue == l_False )
210 return 1;
211 if ( RetValue == l_True )
212 return 0;
213 return -1;
214}
215
228{
229 Aig_Obj_t * pObj;
230 int i;
231 Aig_ManForEachObj( p, pObj, i )
232 Abc_Print( 1, "%d", pObj->fPhase );
233 Abc_Print( 1, "\n" );
234}
235
248{
249 Aig_Obj_t * pObj, * pObjLi;
250 int f, i, iLits, RetValue1, RetValue2;
251 int nFrames = Vec_IntSize(p->vInits) / Saig_ManPiNum(p->pAig);
252 assert( Vec_IntSize(p->vInits) % Saig_ManPiNum(p->pAig) == 0 );
253 // assign register outputs
254 Saig_ManForEachLi( p->pAig, pObj, i )
255 pObj->fMarkB = 0;
256 // simulate the timeframes
257 iLits = 0;
258 for ( f = 0; f < nFrames; f++ )
259 {
260 // set the PI simulation information
261 Aig_ManConst1(p->pAig)->fMarkB = 1;
262 Saig_ManForEachPi( p->pAig, pObj, i )
263 pObj->fMarkB = Vec_IntEntry( p->vInits, iLits++ );
264 Saig_ManForEachLiLo( p->pAig, pObjLi, pObj, i )
265 pObj->fMarkB = pObjLi->fMarkB;
266 // simulate internal nodes
267 Aig_ManForEachNode( p->pAig, pObj, i )
268 pObj->fMarkB = ( Aig_ObjFanin0(pObj)->fMarkB ^ Aig_ObjFaninC0(pObj) )
269 & ( Aig_ObjFanin1(pObj)->fMarkB ^ Aig_ObjFaninC1(pObj) );
270 // assign the COs
271 Aig_ManForEachCo( p->pAig, pObj, i )
272 pObj->fMarkB = ( Aig_ObjFanin0(pObj)->fMarkB ^ Aig_ObjFaninC0(pObj) );
273 // check the outputs
274 Saig_ManForEachPo( p->pAig, pObj, i )
275 {
276 if ( i < Saig_ManPoNum(p->pAig) - Saig_ManConstrNum(p->pAig) )
277 {
278 if ( pObj->fMarkB && Saig_ManConstrNum(p->pAig) )
279 Abc_Print( 1, "output %d failed in frame %d.\n", i, f );
280 }
281 else
282 {
283 if ( pObj->fMarkB && Saig_ManConstrNum(p->pAig) )
284 Abc_Print( 1, "constraint %d failed in frame %d.\n", i, f );
285 }
286 }
287 // transfer
288 if ( f == 0 )
289 { // copy markB into phase
290 Aig_ManForEachObj( p->pAig, pObj, i )
291 pObj->fPhase = pObj->fMarkB;
292 }
293 else
294 { // refine classes
295 RetValue1 = Ssw_ClassesRefineConst1( p->ppClasses, 0 );
296 RetValue2 = Ssw_ClassesRefine( p->ppClasses, 0 );
297 }
298 }
299 assert( iLits == Vec_IntSize(p->vInits) );
300}
301
302
314int Ssw_ManSweepNodeConstr( Ssw_Man_t * p, Aig_Obj_t * pObj, int f, int fBmc )
315{
316 Aig_Obj_t * pObjRepr, * pObjFraig, * pObjFraig2, * pObjReprFraig;
317 int RetValue;
318 // get representative of this class
319 pObjRepr = Aig_ObjRepr( p->pAig, pObj );
320 if ( pObjRepr == NULL )
321 return 0;
322 // get the fraiged node
323 pObjFraig = Ssw_ObjFrame( p, pObj, f );
324 // get the fraiged representative
325 pObjReprFraig = Ssw_ObjFrame( p, pObjRepr, f );
326 // check if constant 0 pattern distinquishes these nodes
327 assert( pObjFraig != NULL && pObjReprFraig != NULL );
328 assert( (pObj->fPhase == pObjRepr->fPhase) == (Aig_ObjPhaseReal(pObjFraig) == Aig_ObjPhaseReal(pObjReprFraig)) );
329 // if the fraiged nodes are the same, return
330 if ( Aig_Regular(pObjFraig) == Aig_Regular(pObjReprFraig) )
331 return 0;
332 // call equivalence checking
333 if ( Aig_Regular(pObjFraig) != Aig_ManConst1(p->pFrames) )
334 RetValue = Ssw_NodesAreEquiv( p, Aig_Regular(pObjReprFraig), Aig_Regular(pObjFraig) );
335 else
336 RetValue = Ssw_NodesAreEquiv( p, Aig_Regular(pObjFraig), Aig_Regular(pObjReprFraig) );
337 if ( RetValue == 1 ) // proved equivalent
338 {
339 pObjFraig2 = Aig_NotCond( pObjReprFraig, pObj->fPhase ^ pObjRepr->fPhase );
340 Ssw_ObjSetFrame( p, pObj, f, pObjFraig2 );
341 return 0;
342 }
343 if ( RetValue == -1 ) // timed out
344 {
345 Ssw_ClassesRemoveNode( p->ppClasses, pObj );
346 return 1;
347 }
348 // disproved equivalence
350 Ssw_ManResimulateBit( p, pObj, pObjRepr );
351 assert( Aig_ObjRepr( p->pAig, pObj ) != pObjRepr );
352 if ( Aig_ObjRepr( p->pAig, pObj ) == pObjRepr )
353 {
354 Abc_Print( 1, "Ssw_ManSweepNodeConstr(): Failed to refine representative.\n" );
355 }
356 return 1;
357}
358
371{
372 Aig_Obj_t * pObjNew, * pObjLi;
373 pObjNew = Ssw_ObjFrame( p, pObj, f );
374 if ( pObjNew )
375 return pObjNew;
376 assert( !Saig_ObjIsPi(p->pAig, pObj) );
377 if ( Saig_ObjIsLo(p->pAig, pObj) )
378 {
379 assert( f > 0 );
380 pObjLi = Saig_ObjLoToLi( p->pAig, pObj );
381 pObjNew = Ssw_ManSweepBmcConstr_rec( p, Aig_ObjFanin0(pObjLi), f-1 );
382 pObjNew = Aig_NotCond( pObjNew, Aig_ObjFaninC0(pObjLi) );
383 }
384 else
385 {
386 assert( Aig_ObjIsNode(pObj) );
387 Ssw_ManSweepBmcConstr_rec( p, Aig_ObjFanin0(pObj), f );
388 Ssw_ManSweepBmcConstr_rec( p, Aig_ObjFanin1(pObj), f );
389 pObjNew = Aig_And( p->pFrames, Ssw_ObjChild0Fra(p, pObj, f), Ssw_ObjChild1Fra(p, pObj, f) );
390 }
391 Ssw_ObjSetFrame( p, pObj, f, pObjNew );
392 assert( pObjNew != NULL );
393 return pObjNew;
394}
395
408{
409 Bar_Progress_t * pProgress = NULL;
410 Aig_Obj_t * pObj, * pObjNew, * pObjLi, * pObjLo;
411 int i, f, iLits;
412 abctime clk;
413clk = Abc_Clock();
414
415 // start initialized timeframes
416 p->pFrames = Aig_ManStart( Aig_ManObjNumMax(p->pAig) * p->pPars->nFramesK );
417 Saig_ManForEachLo( p->pAig, pObj, i )
418 Ssw_ObjSetFrame( p, pObj, 0, Aig_ManConst0(p->pFrames) );
419
420 // build the constraint outputs
421 iLits = 0;
422 for ( f = 0; f < p->pPars->nFramesK; f++ )
423 {
424 // map constants and PIs
425 Ssw_ObjSetFrame( p, Aig_ManConst1(p->pAig), f, Aig_ManConst1(p->pFrames) );
426 Saig_ManForEachPi( p->pAig, pObj, i )
427 {
428 pObjNew = Aig_ObjCreateCi(p->pFrames);
429 pObjNew->fPhase = Vec_IntEntry( p->vInits, iLits++ );
430 Ssw_ObjSetFrame( p, pObj, f, pObjNew );
431 }
432 // build the constraint cones
433 Saig_ManForEachPo( p->pAig, pObj, i )
434 {
435 if ( i < Saig_ManPoNum(p->pAig) - Saig_ManConstrNum(p->pAig) )
436 continue;
437 pObjNew = Ssw_ManSweepBmcConstr_rec( p, Aig_ObjFanin0(pObj), f );
438 pObjNew = Aig_NotCond( pObjNew, Aig_ObjFaninC0(pObj) );
439 if ( Aig_Regular(pObjNew) == Aig_ManConst1(p->pFrames) )
440 {
441 assert( Aig_IsComplement(pObjNew) );
442 continue;
443 }
444 Ssw_NodesAreConstrained( p, pObjNew, Aig_ManConst0(p->pFrames) );
445 }
446 }
447 assert( Vec_IntSize(p->vInits) == iLits + Saig_ManPiNum(p->pAig) );
448
449 // sweep internal nodes
450 p->fRefined = 0;
451 if ( p->pPars->fVerbose )
452 pProgress = Bar_ProgressStart( stdout, Aig_ManObjNumMax(p->pAig) * p->pPars->nFramesK );
453 for ( f = 0; f < p->pPars->nFramesK; f++ )
454 {
455 // sweep internal nodes
456 Aig_ManForEachNode( p->pAig, pObj, i )
457 {
458 if ( p->pPars->fVerbose )
459 Bar_ProgressUpdate( pProgress, Aig_ManObjNumMax(p->pAig) * f + i, NULL );
460 pObjNew = Aig_And( p->pFrames, Ssw_ObjChild0Fra(p, pObj, f), Ssw_ObjChild1Fra(p, pObj, f) );
461 Ssw_ObjSetFrame( p, pObj, f, pObjNew );
462 p->fRefined |= Ssw_ManSweepNodeConstr( p, pObj, f, 1 );
463 }
464 // quit if this is the last timeframe
465 if ( f == p->pPars->nFramesK - 1 )
466 break;
467 // transfer latch input to the latch outputs
468 Aig_ManForEachCo( p->pAig, pObj, i )
469 Ssw_ObjSetFrame( p, pObj, f, Ssw_ObjChild0Fra(p, pObj, f) );
470 // build logic cones for register outputs
471 Saig_ManForEachLiLo( p->pAig, pObjLi, pObjLo, i )
472 {
473 pObjNew = Ssw_ObjFrame( p, pObjLi, f );
474 Ssw_ObjSetFrame( p, pObjLo, f+1, pObjNew );
475 Ssw_CnfNodeAddToSolver( p->pMSat, Aig_Regular(pObjNew) );//
476 }
477 }
478 if ( p->pPars->fVerbose )
479 Bar_ProgressStop( pProgress );
480
481 // cleanup
482// Ssw_ClassesCheck( p->ppClasses );
483p->timeBmc += Abc_Clock() - clk;
484 return p->fRefined;
485}
486
499{
500 Aig_Obj_t * pObj, * pObjNew, * pObjLi, * pObjLo;
501 int i, f, iLits;
502 abctime clk;
503clk = Abc_Clock();
504
505 // start initialized timeframes
506 p->pFrames = Aig_ManStart( Aig_ManObjNumMax(p->pAig) * p->pPars->nFramesK );
507 Saig_ManForEachLo( p->pAig, pObj, i )
508 Ssw_ObjSetFrame( p, pObj, 0, Aig_ManConst0(p->pFrames) );
509
510 // build the constraint outputs
511 iLits = 0;
512 p->fRefined = 0;
513 for ( f = 0; f < p->pPars->nFramesK; f++ )
514 {
515 // map constants and PIs
516 Ssw_ObjSetFrame( p, Aig_ManConst1(p->pAig), f, Aig_ManConst1(p->pFrames) );
517 Saig_ManForEachPi( p->pAig, pObj, i )
518 {
519 pObjNew = Aig_ObjCreateCi(p->pFrames);
520 pObjNew->fPhase = Vec_IntEntry( p->vInits, iLits++ );
521 Ssw_ObjSetFrame( p, pObj, f, pObjNew );
522 }
523 // build the constraint cones
524 Saig_ManForEachPo( p->pAig, pObj, i )
525 {
526 if ( i < Saig_ManPoNum(p->pAig) - Saig_ManConstrNum(p->pAig) )
527 continue;
528 pObjNew = Ssw_ManSweepBmcConstr_rec( p, Aig_ObjFanin0(pObj), f );
529 pObjNew = Aig_NotCond( pObjNew, Aig_ObjFaninC0(pObj) );
530 if ( Aig_Regular(pObjNew) == Aig_ManConst1(p->pFrames) )
531 {
532 assert( Aig_IsComplement(pObjNew) );
533 continue;
534 }
535 Ssw_NodesAreConstrained( p, pObjNew, Aig_ManConst0(p->pFrames) );
536 }
537 // sweep flops
538 Saig_ManForEachLo( p->pAig, pObj, i )
539 p->fRefined |= Ssw_ManSweepNodeConstr( p, pObj, f, 1 );
540 // sweep internal nodes
541 Aig_ManForEachNode( p->pAig, pObj, i )
542 {
543 pObjNew = Aig_And( p->pFrames, Ssw_ObjChild0Fra(p, pObj, f), Ssw_ObjChild1Fra(p, pObj, f) );
544 Ssw_ObjSetFrame( p, pObj, f, pObjNew );
545 p->fRefined |= Ssw_ManSweepNodeConstr( p, pObj, f, 1 );
546 }
547 // quit if this is the last timeframe
548 if ( f == p->pPars->nFramesK - 1 )
549 break;
550 // transfer latch input to the latch outputs
551 Aig_ManForEachCo( p->pAig, pObj, i )
552 Ssw_ObjSetFrame( p, pObj, f, Ssw_ObjChild0Fra(p, pObj, f) );
553 // build logic cones for register outputs
554 Saig_ManForEachLiLo( p->pAig, pObjLi, pObjLo, i )
555 {
556 pObjNew = Ssw_ObjFrame( p, pObjLi, f );
557 Ssw_ObjSetFrame( p, pObjLo, f+1, pObjNew );
558 Ssw_CnfNodeAddToSolver( p->pMSat, Aig_Regular(pObjNew) );//
559 }
560 }
561 assert( Vec_IntSize(p->vInits) == iLits + Saig_ManPiNum(p->pAig) );
562
563 // cleanup
564// Ssw_ClassesCheck( p->ppClasses );
565p->timeBmc += Abc_Clock() - clk;
566 return p->fRefined;
567}
568
569
570
571
584{
585 Aig_Obj_t * pObjNew, * pObjLi;
586 pObjNew = Ssw_ObjFrame( p, pObj, f );
587 if ( pObjNew )
588 return pObjNew;
589 assert( !Saig_ObjIsPi(p->pAig, pObj) );
590 if ( Saig_ObjIsLo(p->pAig, pObj) )
591 {
592 assert( f > 0 );
593 pObjLi = Saig_ObjLoToLi( p->pAig, pObj );
594 pObjNew = Ssw_FramesWithClasses_rec( p, Aig_ObjFanin0(pObjLi), f-1 );
595 pObjNew = Aig_NotCond( pObjNew, Aig_ObjFaninC0(pObjLi) );
596 }
597 else
598 {
599 assert( Aig_ObjIsNode(pObj) );
600 Ssw_FramesWithClasses_rec( p, Aig_ObjFanin0(pObj), f );
601 Ssw_FramesWithClasses_rec( p, Aig_ObjFanin1(pObj), f );
602 pObjNew = Aig_And( p->pFrames, Ssw_ObjChild0Fra(p, pObj, f), Ssw_ObjChild1Fra(p, pObj, f) );
603 }
604 Ssw_ObjSetFrame( p, pObj, f, pObjNew );
605 assert( pObjNew != NULL );
606 return pObjNew;
607}
608
609
622{
623 Bar_Progress_t * pProgress = NULL;
624 Aig_Obj_t * pObj, * pObj2, * pObjNew;
625 int nConstrPairs, i, f, iLits;
626 abctime clk;
627//Ssw_ManPrintPolarity( p->pAig );
628
629 // perform speculative reduction
630clk = Abc_Clock();
631 // create timeframes
632 p->pFrames = Ssw_FramesWithClasses( p );
633 // add constants
634 nConstrPairs = Aig_ManCoNum(p->pFrames)-Aig_ManRegNum(p->pAig);
635 assert( (nConstrPairs & 1) == 0 );
636 for ( i = 0; i < nConstrPairs; i += 2 )
637 {
638 pObj = Aig_ManCo( p->pFrames, i );
639 pObj2 = Aig_ManCo( p->pFrames, i+1 );
640 Ssw_NodesAreConstrained( p, Aig_ObjChild0(pObj), Aig_ObjChild0(pObj2) );
641 }
642 // build logic cones for register inputs
643 for ( i = 0; i < Aig_ManRegNum(p->pAig); i++ )
644 {
645 pObj = Aig_ManCo( p->pFrames, nConstrPairs + i );
646 Ssw_CnfNodeAddToSolver( p->pMSat, Aig_ObjFanin0(pObj) );//
647 }
648
649 // map constants and PIs of the last frame
650 f = p->pPars->nFramesK;
651// iLits = 0;
652 iLits = f * Saig_ManPiNum(p->pAig);
653 Ssw_ObjSetFrame( p, Aig_ManConst1(p->pAig), f, Aig_ManConst1(p->pFrames) );
654 Saig_ManForEachPi( p->pAig, pObj, i )
655 {
656 pObjNew = Aig_ObjCreateCi(p->pFrames);
657 pObjNew->fPhase = (p->vInits != NULL) && Vec_IntEntry(p->vInits, iLits++);
658 Ssw_ObjSetFrame( p, pObj, f, pObjNew );
659 }
660 assert( Vec_IntSize(p->vInits) == iLits );
661p->timeReduce += Abc_Clock() - clk;
662
663 // add constraints to all timeframes
664 for ( f = 0; f <= p->pPars->nFramesK; f++ )
665 {
666 Saig_ManForEachPo( p->pAig, pObj, i )
667 {
668 if ( i < Saig_ManPoNum(p->pAig) - Saig_ManConstrNum(p->pAig) )
669 continue;
670 Ssw_FramesWithClasses_rec( p, Aig_ObjFanin0(pObj), f );
671// if ( Aig_Regular(Ssw_ObjChild0Fra(p,pObj,f)) == Aig_ManConst1(p->pFrames) )
672 if ( Ssw_ObjChild0Fra(p,pObj,f) == Aig_ManConst0(p->pFrames) )
673 continue;
674 assert( Ssw_ObjChild0Fra(p,pObj,f) != Aig_ManConst1(p->pFrames) );
675 if ( Ssw_ObjChild0Fra(p,pObj,f) == Aig_ManConst1(p->pFrames) )
676 {
677 Abc_Print( 1, "Polarity violation.\n" );
678 continue;
679 }
680 Ssw_NodesAreConstrained( p, Ssw_ObjChild0Fra(p,pObj,f), Aig_ManConst0(p->pFrames) );
681 }
682 }
683 f = p->pPars->nFramesK;
684 // clean the solver
685 sat_solver_simplify( p->pMSat->pSat );
686
687
688 // sweep internal nodes
689 p->fRefined = 0;
690 Ssw_ClassesClearRefined( p->ppClasses );
691 if ( p->pPars->fVerbose )
692 pProgress = Bar_ProgressStart( stdout, Aig_ManObjNumMax(p->pAig) );
693 Aig_ManForEachObj( p->pAig, pObj, i )
694 {
695 if ( p->pPars->fVerbose )
696 Bar_ProgressUpdate( pProgress, i, NULL );
697 if ( Saig_ObjIsLo(p->pAig, pObj) )
698 p->fRefined |= Ssw_ManSweepNodeConstr( p, pObj, f, 0 );
699 else if ( Aig_ObjIsNode(pObj) )
700 {
701 pObjNew = Aig_And( p->pFrames, Ssw_ObjChild0Fra(p, pObj, f), Ssw_ObjChild1Fra(p, pObj, f) );
702 Ssw_ObjSetFrame( p, pObj, f, pObjNew );
703 p->fRefined |= Ssw_ManSweepNodeConstr( p, pObj, f, 0 );
704 }
705 }
706 if ( p->pPars->fVerbose )
707 Bar_ProgressStop( pProgress );
708 // cleanup
709// Ssw_ClassesCheck( p->ppClasses );
710 return p->fRefined;
711}
712
716
717
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
#define Aig_ManForEachObj(p, pObj, i)
Definition aig.h:403
void Aig_ManStop(Aig_Man_t *p)
Definition aigMan.c:187
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition aig.h:393
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition aigOper.c:104
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition aigObj.c:66
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition aigMan.c:47
#define Aig_ManForEachNode(p, pObj, i)
Definition aig.h:413
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition aig.h:50
int Aig_ManCleanup(Aig_Man_t *p)
Definition aigMan.c:265
#define Aig_ManForEachCo(p, pObj, i)
Definition aig.h:398
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition aigObj.c:45
void Bar_ProgressStop(Bar_Progress_t *p)
Definition bar.c:126
Bar_Progress_t * Bar_ProgressStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
Definition bar.c:66
struct Bar_Progress_t_ Bar_Progress_t
BASIC TYPES ///.
Definition bar.h:48
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
#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
struct Cnf_Dat_t_ Cnf_Dat_t
Definition cnf.h:52
void Cnf_DataFree(Cnf_Dat_t *p)
Definition cnfMan.c:207
Cube * p
Definition exorList.c:222
void * Cnf_DataWriteIntoSolver(Cnf_Dat_t *p, int nFrames, int fInit)
Definition cnfMan.c:579
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
Definition saig.h:101
#define Saig_ManForEachLi(p, pObj, i)
Definition saig.h:98
#define Saig_ManForEachPo(p, pObj, i)
Definition saig.h:93
#define Saig_ManForEachLo(p, pObj, i)
Definition saig.h:96
#define Saig_ManForEachPi(p, pObj, i)
Definition saig.h:91
int sat_solver_simplify(sat_solver *s)
Definition satSolver.c:1515
void sat_solver_delete(sat_solver *s)
Definition satSolver.c:1341
Aig_Man_t * Ssw_FramesWithClasses(Ssw_Man_t *p)
Definition sswAig.c:203
void Ssw_ClassesClearRefined(Ssw_Cla_t *p)
Definition sswClass.c:243
int Ssw_ClassesRefineConst1(Ssw_Cla_t *p, int fRecursive)
Definition sswClass.c:1119
void Ssw_ClassesRemoveNode(Ssw_Cla_t *p, Aig_Obj_t *pObj)
Definition sswClass.c:448
int Ssw_ClassesRefine(Ssw_Cla_t *p, int fRecursive)
Definition sswClass.c:1034
void Ssw_CnfNodeAddToSolver(Ssw_Sat_t *p, Aig_Obj_t *pObj)
Definition sswCnf.c:351
int Ssw_ManSweepBmcConstr_old(Ssw_Man_t *p)
Definition sswConstr.c:407
ABC_NAMESPACE_IMPL_START Aig_Man_t * Ssw_FramesWithConstraints(Aig_Man_t *p, int nFrames)
DECLARATIONS ///.
Definition sswConstr.c:47
void Ssw_ManRefineByConstrSim(Ssw_Man_t *p)
Definition sswConstr.c:247
int Ssw_ManSetConstrPhases(Aig_Man_t *p, int nFrames, Vec_Int_t **pvInits)
Definition sswConstr.c:100
int Ssw_ManSweepNodeConstr(Ssw_Man_t *p, Aig_Obj_t *pObj, int f, int fBmc)
Definition sswConstr.c:314
Aig_Obj_t * Ssw_ManSweepBmcConstr_rec(Ssw_Man_t *p, Aig_Obj_t *pObj, int f)
Definition sswConstr.c:370
int Ssw_ManSweepConstr(Ssw_Man_t *p)
Definition sswConstr.c:621
void Ssw_ManPrintPolarity(Aig_Man_t *p)
Definition sswConstr.c:227
Aig_Obj_t * Ssw_FramesWithClasses_rec(Ssw_Man_t *p, Aig_Obj_t *pObj, int f)
Definition sswConstr.c:583
int Ssw_ManSweepBmcConstr(Ssw_Man_t *p)
Definition sswConstr.c:498
int Ssw_ManSetConstrPhases_(Aig_Man_t *p, int nFrames, Vec_Int_t **pvInits)
Definition sswConstr.c:156
typedefABC_NAMESPACE_HEADER_START struct Ssw_Man_t_ Ssw_Man_t
INCLUDES ///.
Definition sswInt.h:47
void Ssw_ManResimulateBit(Ssw_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pRepr)
DECLARATIONS ///.
Definition sswSimSat.c:45
void Ssw_SmlSavePatternAig(Ssw_Man_t *p, int f)
Definition sswSweep.c:136
int Ssw_NodesAreEquiv(Ssw_Man_t *p, Aig_Obj_t *pOld, Aig_Obj_t *pNew)
DECLARATIONS ///.
Definition sswSat.c:45
int Ssw_NodesAreConstrained(Ssw_Man_t *p, Aig_Obj_t *pOld, Aig_Obj_t *pNew)
Definition sswSat.c:196
unsigned int fMarkB
Definition aig.h:80
unsigned int fPhase
Definition aig.h:78
int nVars
Definition cnf.h:59
int * pVarNums
Definition cnf.h:63
#define assert(ex)
Definition util_old.h:213