ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
sswRarity.c
Go to the documentation of this file.
1
20
21#include "sswInt.h"
22#include "aig/gia/giaAig.h"
23#include "base/main/main.h"
24#include "sat/bmc/bmc.h"
25
27
28
32
35{
36 // parameters
38 int nGroups; // the number of flop groups
39 int nWordsReg; // the number of words in the registers
40 // internal data
41 Aig_Man_t * pAig; // AIG with equivalence classes
42 Ssw_Cla_t * ppClasses; // equivalence classes
43 Vec_Int_t * vInits; // initial state
44 // simulation data
45 word * pObjData; // simulation info for each obj
46 word * pPatData; // pattern data for each reg
47 // candidates to update
48 Vec_Ptr_t * vUpdConst; // constant 1 candidates
49 Vec_Ptr_t * vUpdClass; // class representatives
50 // rarity data
51 int * pRarity; // occur counts for patterns in groups
52 double * pPatCosts; // pattern costs
53 // best patterns
54 Vec_Int_t * vPatBests; // best patterns
55 int iFailPo; // failed primary output
56 int iFailPat; // failed pattern
57 // counter-examples
59};
60
61
62static inline int Ssw_RarGetBinPat( Ssw_RarMan_t * p, int iBin, int iPat )
63{
64 assert( iBin >= 0 && iBin < Aig_ManRegNum(p->pAig) / p->pPars->nBinSize );
65 assert( iPat >= 0 && iPat < (1 << p->pPars->nBinSize) );
66 return p->pRarity[iBin * (1 << p->pPars->nBinSize) + iPat];
67}
68static inline void Ssw_RarSetBinPat( Ssw_RarMan_t * p, int iBin, int iPat, int Value )
69{
70 assert( iBin >= 0 && iBin < Aig_ManRegNum(p->pAig) / p->pPars->nBinSize );
71 assert( iPat >= 0 && iPat < (1 << p->pPars->nBinSize) );
72 p->pRarity[iBin * (1 << p->pPars->nBinSize) + iPat] = Value;
73}
74static inline void Ssw_RarAddToBinPat( Ssw_RarMan_t * p, int iBin, int iPat )
75{
76 assert( iBin >= 0 && iBin < Aig_ManRegNum(p->pAig) / p->pPars->nBinSize );
77 assert( iPat >= 0 && iPat < (1 << p->pPars->nBinSize) );
78 p->pRarity[iBin * (1 << p->pPars->nBinSize) + iPat]++;
79}
80
81static inline int Ssw_RarBitWordNum( int nBits ) { return (nBits>>6) + ((nBits&63) > 0); }
82
83static inline word * Ssw_RarObjSim( Ssw_RarMan_t * p, int Id ) { assert( Id < Aig_ManObjNumMax(p->pAig) ); return p->pObjData + p->pPars->nWords * Id; }
84static inline word * Ssw_RarPatSim( Ssw_RarMan_t * p, int Id ) { assert( Id < 64 * p->pPars->nWords ); return p->pPatData + p->nWordsReg * Id; }
85
86
90
103{
104 memset( p, 0, sizeof(Ssw_RarPars_t) );
105 p->nFrames = 20;
106 p->nWords = 50;
107 p->nBinSize = 8;
108 p->nRounds = 0;
109 p->nRestart = 0;
110 p->nRandSeed = 0;
111 p->TimeOut = 0;
112 p->TimeOutGap = 0;
113 p->fSolveAll = 0;
114 p->fDropSatOuts = 0;
115 p->fSetLastState = 0;
116 p->fVerbose = 0;
117 p->fNotVerbose = 0;
118}
119
131void Ssw_RarManPrepareRandom( int nRandSeed )
132{
133 int i;
134 Aig_ManRandom( 1 );
135 for ( i = 0; i < nRandSeed; i++ )
136 Aig_ManRandom( 0 );
137}
138
151{
152 word * pSim;
153 Aig_Obj_t * pObj;
154 int w, i;
155 Saig_ManForEachPi( p->pAig, pObj, i )
156 {
157 pSim = Ssw_RarObjSim( p, Aig_ObjId(pObj) );
158 for ( w = 0; w < p->pPars->nWords; w++ )
159 pSim[w] = Aig_ManRandom64(0);
160// pSim[0] <<= 1;
161// pSim[0] = (pSim[0] << 2) | 2;
162 pSim[0] = (pSim[0] << 4) | ((i & 1) ? 0xA : 0xC);
163 }
164}
165
177Abc_Cex_t * Ssw_RarDeriveCex( Ssw_RarMan_t * p, int iFrame, int iPo, int iPatFinal, int fVerbose )
178{
179 Abc_Cex_t * pCex;
180 Aig_Obj_t * pObj;
181 Vec_Int_t * vTrace;
182 word * pSim;
183 int i, r, f, iBit, iPatThis;
184 // compute the pattern sequence
185 iPatThis = iPatFinal;
186 vTrace = Vec_IntStartFull( iFrame / p->pPars->nFrames + 1 );
187 Vec_IntWriteEntry( vTrace, iFrame / p->pPars->nFrames, iPatThis );
188 for ( r = iFrame / p->pPars->nFrames - 1; r >= 0; r-- )
189 {
190 iPatThis = Vec_IntEntry( p->vPatBests, r * p->pPars->nWords + iPatThis / 64 );
191 Vec_IntWriteEntry( vTrace, r, iPatThis );
192 }
193 // create counter-example
194 pCex = Abc_CexAlloc( Aig_ManRegNum(p->pAig), Saig_ManPiNum(p->pAig), iFrame+1 );
195 pCex->iFrame = iFrame;
196 pCex->iPo = iPo;
197 // insert the bits
198 iBit = Aig_ManRegNum(p->pAig);
199 for ( f = 0; f <= iFrame; f++ )
200 {
202 iPatThis = Vec_IntEntry( vTrace, f / p->pPars->nFrames );
203 Saig_ManForEachPi( p->pAig, pObj, i )
204 {
205 pSim = Ssw_RarObjSim( p, Aig_ObjId(pObj) );
206 if ( Abc_InfoHasBit( (unsigned *)pSim, iPatThis ) )
207 Abc_InfoSetBit( pCex->pData, iBit );
208 iBit++;
209 }
210 }
211 Vec_IntFree( vTrace );
212 assert( iBit == pCex->nBits );
213 // verify the counter example
214 if ( !Saig_ManVerifyCex( p->pAig, pCex ) )
215 {
216 Abc_Print( 1, "Ssw_RarDeriveCex(): Counter-example is invalid.\n" );
217// Abc_CexFree( pCex );
218// pCex = NULL;
219 }
220 else
221 {
222// Abc_Print( 1, "Counter-example verification is successful.\n" );
223 }
224 return pCex;
225}
226
227
239void transpose32( unsigned A[32] )
240{
241 int j, k;
242 unsigned t, m = 0x0000FFFF;
243 for ( j = 16; j != 0; j = j >> 1, m = m ^ (m << j) )
244 {
245 for ( k = 0; k < 32; k = (k + j + 1) & ~j )
246 {
247 t = (A[k] ^ (A[k+j] >> j)) & m;
248 A[k] = A[k] ^ t;
249 A[k+j] = A[k+j] ^ (t << j);
250 }
251 }
252}
253
265void transpose64( word A[64] )
266{
267 int j, k;
268 word t, m = 0x00000000FFFFFFFF;
269 for ( j = 32; j != 0; j = j >> 1, m = m ^ (m << j) )
270 {
271 for ( k = 0; k < 64; k = (k + j + 1) & ~j )
272 {
273 t = (A[k] ^ (A[k+j] >> j)) & m;
274 A[k] = A[k] ^ t;
275 A[k+j] = A[k+j] ^ (t << j);
276 }
277 }
278}
279
291void transpose64Simple( word A[64], word B[64] )
292{
293 int i, k;
294 for ( i = 0; i < 64; i++ )
295 B[i] = 0;
296 for ( i = 0; i < 64; i++ )
297 for ( k = 0; k < 64; k++ )
298 if ( (A[i] >> k) & 1 )
299 B[k] |= ((word)1 << (63-i));
300}
301
314{
315 word M[64], N[64];
316 int i;
317 abctime clk;
318 Aig_ManRandom64( 1 );
319// for ( i = 0; i < 64; i++ )
320// M[i] = Aig_ManRandom64( 0 );
321 for ( i = 0; i < 64; i++ )
322 M[i] = i? (word)0 : ~(word)0;
323// for ( i = 0; i < 64; i++ )
324// Extra_PrintBinary( stdout, (unsigned *)&M[i], 64 ), Abc_Print( 1, "\n" );
325
326 clk = Abc_Clock();
327 for ( i = 0; i < 100001; i++ )
328 transpose64Simple( M, N );
329 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
330
331 clk = Abc_Clock();
332 for ( i = 0; i < 100001; i++ )
333 transpose64( M );
334 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
335
336 for ( i = 0; i < 64; i++ )
337 if ( M[i] != N[i] )
338 Abc_Print( 1, "Mismatch\n" );
339/*
340 Abc_Print( 1, "\n" );
341 for ( i = 0; i < 64; i++ )
342 Extra_PrintBinary( stdout, (unsigned *)&M[i], 64 ), Abc_Print( 1, "\n" );
343 Abc_Print( 1, "\n" );
344 for ( i = 0; i < 64; i++ )
345 Extra_PrintBinary( stdout, (unsigned *)&N[i], 64 ), Abc_Print( 1, "\n" );
346*/
347}
348
361{
362 Aig_Obj_t * pObj;
363 word M[64];
364 int w, r, i;
365 for ( w = 0; w < p->pPars->nWords; w++ )
366 for ( r = 0; r < p->nWordsReg; r++ )
367 {
368 // save input
369 for ( i = 0; i < 64; i++ )
370 {
371 if ( r*64 + 63-i < Aig_ManRegNum(p->pAig) )
372 {
373 pObj = Saig_ManLi( p->pAig, r*64 + 63-i );
374 M[i] = Ssw_RarObjSim( p, Aig_ObjId(pObj) )[w];
375 }
376 else
377 M[i] = 0;
378 }
379 // transpose
380 transpose64( M );
381 // save output
382 for ( i = 0; i < 64; i++ )
383 Ssw_RarPatSim( p, w*64 + 63-i )[r] = M[i];
384 }
385/*
386 Saig_ManForEachLi( p->pAig, pObj, i )
387 {
388 word * pBitData = Ssw_RarObjSim( p, Aig_ObjId(pObj) );
389 Extra_PrintBinary( stdout, (unsigned *)pBitData, 64*p->pPars->nWords ); Abc_Print( 1, "\n" );
390 }
391 Abc_Print( 1, "\n" );
392 for ( i = 0; i < p->pPars->nWords*64; i++ )
393 {
394 word * pBitData = Ssw_RarPatSim( p, i );
395 Extra_PrintBinary( stdout, (unsigned *)pBitData, Aig_ManRegNum(p->pAig) ); Abc_Print( 1, "\n" );
396 }
397 Abc_Print( 1, "\n" );
398*/
399}
400
401
402
403
416{
417 Aig_Obj_t * pObj, * pObjLi;
418 word * pSim, * pSimLi;
419 int w, i;
420 // constant
421 pObj = Aig_ManConst1( p->pAig );
422 pSim = Ssw_RarObjSim( p, Aig_ObjId(pObj) );
423 for ( w = 0; w < p->pPars->nWords; w++ )
424 pSim[w] = ~(word)0;
425 // primary inputs
427 // flop outputs
428 if ( vInit )
429 {
430 assert( Vec_IntSize(vInit) == Saig_ManRegNum(p->pAig) * p->pPars->nWords );
431 Saig_ManForEachLo( p->pAig, pObj, i )
432 {
433 pSim = Ssw_RarObjSim( p, Aig_ObjId(pObj) );
434 for ( w = 0; w < p->pPars->nWords; w++ )
435 pSim[w] = Vec_IntEntry(vInit, w * Saig_ManRegNum(p->pAig) + i) ? ~(word)0 : (word)0;
436 }
437 }
438 else
439 {
440 Saig_ManForEachLiLo( p->pAig, pObjLi, pObj, i )
441 {
442 pSimLi = Ssw_RarObjSim( p, Aig_ObjId(pObjLi) );
443 pSim = Ssw_RarObjSim( p, Aig_ObjId(pObj) );
444 for ( w = 0; w < p->pPars->nWords; w++ )
445 pSim[w] = pSimLi[w];
446 }
447 }
448}
449
461int Ssw_RarManPoIsConst0( void * pMan, Aig_Obj_t * pObj )
462{
463 Ssw_RarMan_t * p = (Ssw_RarMan_t *)pMan;
464 word * pSim = Ssw_RarObjSim( p, Aig_ObjId(pObj) );
465 int w;
466 for ( w = 0; w < p->pPars->nWords; w++ )
467 if ( pSim[w] )
468 return 0;
469 return 1;
470}
471
483int Ssw_RarManObjIsConst( void * pMan, Aig_Obj_t * pObj )
484{
485 Ssw_RarMan_t * p = (Ssw_RarMan_t *)pMan;
486 word * pSim = Ssw_RarObjSim( p, Aig_ObjId(pObj) );
487 word Flip = pObj->fPhase ? ~(word)0 : 0;
488 int w;
489 for ( w = 0; w < p->pPars->nWords; w++ )
490 if ( pSim[w] ^ Flip )
491 return 0;
492 return 1;
493}
494
506int Ssw_RarManObjsAreEqual( void * pMan, Aig_Obj_t * pObj0, Aig_Obj_t * pObj1 )
507{
508 Ssw_RarMan_t * p = (Ssw_RarMan_t *)pMan;
509 word * pSim0 = Ssw_RarObjSim( p, pObj0->Id );
510 word * pSim1 = Ssw_RarObjSim( p, pObj1->Id );
511 word Flip = (pObj0->fPhase != pObj1->fPhase) ? ~(word)0 : 0;
512 int w;
513 for ( w = 0; w < p->pPars->nWords; w++ )
514 if ( pSim0[w] ^ pSim1[w] ^ Flip )
515 return 0;
516 return 1;
517}
518
530unsigned Ssw_RarManObjHashWord( void * pMan, Aig_Obj_t * pObj )
531{
532 Ssw_RarMan_t * p = (Ssw_RarMan_t *)pMan;
533 static int s_SPrimes[128] = {
534 1009, 1049, 1093, 1151, 1201, 1249, 1297, 1361, 1427, 1459,
535 1499, 1559, 1607, 1657, 1709, 1759, 1823, 1877, 1933, 1997,
536 2039, 2089, 2141, 2213, 2269, 2311, 2371, 2411, 2467, 2543,
537 2609, 2663, 2699, 2741, 2797, 2851, 2909, 2969, 3037, 3089,
538 3169, 3221, 3299, 3331, 3389, 3461, 3517, 3557, 3613, 3671,
539 3719, 3779, 3847, 3907, 3943, 4013, 4073, 4129, 4201, 4243,
540 4289, 4363, 4441, 4493, 4549, 4621, 4663, 4729, 4793, 4871,
541 4933, 4973, 5021, 5087, 5153, 5227, 5281, 5351, 5417, 5471,
542 5519, 5573, 5651, 5693, 5749, 5821, 5861, 5923, 6011, 6073,
543 6131, 6199, 6257, 6301, 6353, 6397, 6481, 6563, 6619, 6689,
544 6737, 6803, 6863, 6917, 6977, 7027, 7109, 7187, 7237, 7309,
545 7393, 7477, 7523, 7561, 7607, 7681, 7727, 7817, 7877, 7933,
546 8011, 8039, 8059, 8081, 8093, 8111, 8123, 8147
547 };
548 unsigned * pSims;
549 unsigned uHash;
550 int i;
551 uHash = 0;
552 pSims = (unsigned *)Ssw_RarObjSim( p, pObj->Id );
553 for ( i = 0; i < 2 * p->pPars->nWords; i++ )
554 uHash ^= pSims[i] * s_SPrimes[i & 0x7F];
555 return uHash;
556}
557
570{
571 word * pSim = Ssw_RarObjSim( p, Aig_ObjId(pObj) );
572 word Flip = 0;//pObj->fPhase ? ~(word)0 : 0; // bug fix!
573 int w, i;
574 for ( w = 0; w < p->pPars->nWords; w++ )
575 if ( pSim[w] ^ Flip )
576 {
577 for ( i = 0; i < 64; i++ )
578 if ( ((pSim[w] ^ Flip) >> i) & 1 )
579 break;
580 assert( i < 64 );
581 return w * 64 + i;
582 }
583 return -1;
584}
585
598{
599 Aig_Obj_t * pObj;
600 int i;
601 p->iFailPo = -1;
602 p->iFailPat = -1;
603 Saig_ManForEachPo( p->pAig, pObj, i )
604 {
605 if ( p->pAig->nConstrs && i >= Saig_ManPoNum(p->pAig) - p->pAig->nConstrs )
606 break;
607 if ( p->vCexes && Vec_PtrEntry(p->vCexes, i) )
608 continue;
609 if ( Ssw_RarManPoIsConst0(p, pObj) )
610 continue;
611 p->iFailPo = i;
612 p->iFailPat = Ssw_RarManObjWhichOne( p, pObj );
613 if ( !p->pPars->fSolveAll )
614 break;
615 // remember the one solved
616 p->pPars->nSolved++;
617 if ( p->vCexes == NULL )
618 p->vCexes = Vec_PtrStart( Saig_ManPoNum(p->pAig) );
619 assert( Vec_PtrEntry(p->vCexes, i) == NULL );
620 Vec_PtrWriteEntry( p->vCexes, i, (void *)(ABC_PTRINT_T)1 );
621 if ( p->pPars->pFuncOnFail && p->pPars->pFuncOnFail(i, NULL) )
622 return 2; // quitting due to callback
623 // print final report
624 if ( !p->pPars->fNotVerbose )
625 {
626 int nOutDigits = Abc_Base10Log( Saig_ManPoNum(p->pAig) );
627 Abc_Print( 1, "Output %*d was asserted in frame %4d (solved %*d out of %*d outputs). ",
628 nOutDigits, p->iFailPo, iFrame,
629 nOutDigits, p->pPars->nSolved,
630 nOutDigits, Saig_ManPoNum(p->pAig) );
631 Abc_PrintTime( 1, "Time", Time );
632 }
633 }
634 if ( p->iFailPo >= 0 ) // found CEX
635 return 1;
636 else
637 return 0;
638}
639
651void Ssw_RarManSimulate( Ssw_RarMan_t * p, Vec_Int_t * vInit, int fUpdate, int fFirst )
652{
653 Aig_Obj_t * pObj, * pRepr;
654 word * pSim, * pSim0, * pSim1;
655 word Flip, Flip0, Flip1;
656 int w, i;
657 // initialize
658 Ssw_RarManInitialize( p, vInit );
659 Vec_PtrClear( p->vUpdConst );
660 Vec_PtrClear( p->vUpdClass );
661 Aig_ManIncrementTravId( p->pAig );
662 // check comb inputs
663 if ( fUpdate )
664 Aig_ManForEachCi( p->pAig, pObj, i )
665 {
666 pRepr = Aig_ObjRepr(p->pAig, pObj);
667 if ( pRepr == NULL || Aig_ObjIsTravIdCurrent( p->pAig, pRepr ) )
668 continue;
669 if ( Ssw_RarManObjsAreEqual( p, pObj, pRepr ) )
670 continue;
671 // save for update
672 if ( pRepr == Aig_ManConst1(p->pAig) )
673 Vec_PtrPush( p->vUpdConst, pObj );
674 else
675 {
676 Vec_PtrPush( p->vUpdClass, pRepr );
677 Aig_ObjSetTravIdCurrent( p->pAig, pRepr );
678 }
679 }
680 // simulate
681 Aig_ManForEachNode( p->pAig, pObj, i )
682 {
683 pSim = Ssw_RarObjSim( p, Aig_ObjId(pObj) );
684 pSim0 = Ssw_RarObjSim( p, Aig_ObjFaninId0(pObj) );
685 pSim1 = Ssw_RarObjSim( p, Aig_ObjFaninId1(pObj) );
686 Flip0 = Aig_ObjFaninC0(pObj) ? ~(word)0 : 0;
687 Flip1 = Aig_ObjFaninC1(pObj) ? ~(word)0 : 0;
688 for ( w = 0; w < p->pPars->nWords; w++ )
689 pSim[w] = (Flip0 ^ pSim0[w]) & (Flip1 ^ pSim1[w]);
690
691
692 if ( !fUpdate )
693 continue;
694 // check classes
695 pRepr = Aig_ObjRepr(p->pAig, pObj);
696 if ( pRepr == NULL || Aig_ObjIsTravIdCurrent( p->pAig, pRepr ) )
697 continue;
698 if ( Ssw_RarManObjsAreEqual( p, pObj, pRepr ) )
699 continue;
700 // save for update
701 if ( pRepr == Aig_ManConst1(p->pAig) )
702 Vec_PtrPush( p->vUpdConst, pObj );
703 else
704 {
705 Vec_PtrPush( p->vUpdClass, pRepr );
706 Aig_ObjSetTravIdCurrent( p->pAig, pRepr );
707 }
708 }
709 // transfer to POs
710 Aig_ManForEachCo( p->pAig, pObj, i )
711 {
712 pSim = Ssw_RarObjSim( p, Aig_ObjId(pObj) );
713 pSim0 = Ssw_RarObjSim( p, Aig_ObjFaninId0(pObj) );
714 Flip = Aig_ObjFaninC0(pObj) ? ~(word)0 : 0;
715 for ( w = 0; w < p->pPars->nWords; w++ )
716 pSim[w] = Flip ^ pSim0[w];
717 }
718 // refine classes
719 if ( fUpdate )
720 {
721 if ( fFirst )
722 {
723 Vec_Ptr_t * vCands = Vec_PtrAlloc( 1000 );
724 Aig_ManForEachObj( p->pAig, pObj, i )
725 if ( Ssw_ObjIsConst1Cand( p->pAig, pObj ) )
726 Vec_PtrPush( vCands, pObj );
727 assert( Vec_PtrSize(vCands) == Ssw_ClassesCand1Num(p->ppClasses) );
728 Ssw_ClassesPrepareRehash( p->ppClasses, vCands, 0 );
729 Vec_PtrFree( vCands );
730 }
731 else
732 {
733 Ssw_ClassesRefineConst1Group( p->ppClasses, p->vUpdConst, 1 );
734 Ssw_ClassesRefineGroup( p->ppClasses, p->vUpdClass, 1 );
735 }
736 }
737}
738
739
751static Ssw_RarMan_t * Ssw_RarManStart( Aig_Man_t * pAig, Ssw_RarPars_t * pPars )
752{
753 Ssw_RarMan_t * p;
754// if ( Aig_ManRegNum(pAig) < nBinSize || nBinSize <= 0 )
755// return NULL;
756 p = ABC_CALLOC( Ssw_RarMan_t, 1 );
757 p->pAig = pAig;
758 p->pPars = pPars;
759 p->nGroups = Aig_ManRegNum(pAig) / pPars->nBinSize;
760 p->pRarity = ABC_CALLOC( int, (1 << pPars->nBinSize) * p->nGroups );
761 p->pPatCosts = ABC_CALLOC( double, p->pPars->nWords * 64 );
762 p->nWordsReg = Ssw_RarBitWordNum( Aig_ManRegNum(pAig) );
763 p->pObjData = ABC_ALLOC( word, Aig_ManObjNumMax(pAig) * p->pPars->nWords );
764 p->pPatData = ABC_ALLOC( word, 64 * p->pPars->nWords * p->nWordsReg );
765 p->vUpdConst = Vec_PtrAlloc( 100 );
766 p->vUpdClass = Vec_PtrAlloc( 100 );
767 p->vPatBests = Vec_IntAlloc( 100 );
768 return p;
769}
770
782static void Ssw_RarManStop( Ssw_RarMan_t * p )
783{
784// Vec_PtrFreeP( &p->vCexes );
785 if ( p->vCexes )
786 {
787 assert( p->pAig->vSeqModelVec == NULL );
788 p->pAig->vSeqModelVec = p->vCexes;
789 p->vCexes = NULL;
790 }
791 if ( p->ppClasses ) Ssw_ClassesStop( p->ppClasses );
792 Vec_IntFreeP( &p->vInits );
793 Vec_IntFreeP( &p->vPatBests );
794 Vec_PtrFreeP( &p->vUpdConst );
795 Vec_PtrFreeP( &p->vUpdClass );
796 ABC_FREE( p->pObjData );
797 ABC_FREE( p->pPatData );
798 ABC_FREE( p->pPatCosts );
799 ABC_FREE( p->pRarity );
800 ABC_FREE( p );
801}
802
814static void Ssw_RarTransferPatterns( Ssw_RarMan_t * p, Vec_Int_t * vInits )
815{
816// Aig_Obj_t * pObj;
817 unsigned char * pData;
818 unsigned * pPattern;
819 int i, k, Value;
820
821 // more data from regs to pats
823
824 // update counters
825 for ( k = 0; k < p->pPars->nWords * 64; k++ )
826 {
827 pData = (unsigned char *)Ssw_RarPatSim( p, k );
828 for ( i = 0; i < p->nGroups; i++ )
829 Ssw_RarAddToBinPat( p, i, pData[i] );
830 }
831
832 // for each pattern
833 for ( k = 0; k < p->pPars->nWords * 64; k++ )
834 {
835 pData = (unsigned char *)Ssw_RarPatSim( p, k );
836 // find the cost of its values
837 p->pPatCosts[k] = 0.0;
838 for ( i = 0; i < p->nGroups; i++ )
839 {
840 Value = Ssw_RarGetBinPat( p, i, pData[i] );
841 assert( Value > 0 );
842 p->pPatCosts[k] += 1.0/(Value*Value);
843 }
844 // print the result
845//Abc_Print( 1, "%3d : %9.6f\n", k, p->pPatCosts[k] );
846 }
847
848 // choose as many as there are words
849 Vec_IntClear( vInits );
850 for ( i = 0; i < p->pPars->nWords; i++ )
851 {
852 // select the best
853 int iPatBest = -1;
854 double iCostBest = -ABC_INFINITY;
855 for ( k = 0; k < p->pPars->nWords * 64; k++ )
856 if ( iCostBest < p->pPatCosts[k] )
857 {
858 iCostBest = p->pPatCosts[k];
859 iPatBest = k;
860 }
861 // remove from costs
862 assert( iPatBest >= 0 );
863 p->pPatCosts[iPatBest] = -ABC_INFINITY;
864 // set the flops
865 pPattern = (unsigned *)Ssw_RarPatSim( p, iPatBest );
866 for ( k = 0; k < Aig_ManRegNum(p->pAig); k++ )
867 Vec_IntPush( vInits, Abc_InfoHasBit(pPattern, k) );
868//Abc_Print( 1, "Best pattern %5d\n", iPatBest );
869 Vec_IntPush( p->vPatBests, iPatBest );
870 }
871 assert( Vec_IntSize(vInits) == Aig_ManRegNum(p->pAig) * p->pPars->nWords );
872}
873
874
886static Vec_Int_t * Ssw_RarFindStartingState( Aig_Man_t * pAig, Abc_Cex_t * pCex )
887{
888 Vec_Int_t * vInit;
889 Aig_Obj_t * pObj, * pObjLi;
890 int f, i, iBit;
891 // assign register outputs
892 Saig_ManForEachLi( pAig, pObj, i )
893 pObj->fMarkB = Abc_InfoHasBit( pCex->pData, i );
894 // simulate the timeframes
895 iBit = pCex->nRegs;
896 for ( f = 0; f <= pCex->iFrame; f++ )
897 {
898 // set the PI simulation information
899 Aig_ManConst1(pAig)->fMarkB = 1;
900 Saig_ManForEachPi( pAig, pObj, i )
901 pObj->fMarkB = Abc_InfoHasBit( pCex->pData, iBit++ );
902 Saig_ManForEachLiLo( pAig, pObjLi, pObj, i )
903 pObj->fMarkB = pObjLi->fMarkB;
904 // simulate internal nodes
905 Aig_ManForEachNode( pAig, pObj, i )
906 pObj->fMarkB = ( Aig_ObjFanin0(pObj)->fMarkB ^ Aig_ObjFaninC0(pObj) )
907 & ( Aig_ObjFanin1(pObj)->fMarkB ^ Aig_ObjFaninC1(pObj) );
908 // assign the COs
909 Aig_ManForEachCo( pAig, pObj, i )
910 pObj->fMarkB = ( Aig_ObjFanin0(pObj)->fMarkB ^ Aig_ObjFaninC0(pObj) );
911 }
912 assert( iBit == pCex->nBits );
913 // check that the output failed as expected -- cannot check because it is not an SRM!
914// pObj = Aig_ManCo( pAig, pCex->iPo );
915// if ( pObj->fMarkB != 1 )
916// Abc_Print( 1, "The counter-example does not refine the output.\n" );
917 // record the new pattern
918 vInit = Vec_IntAlloc( Saig_ManRegNum(pAig) );
919 Saig_ManForEachLo( pAig, pObj, i )
920 {
921//Abc_Print( 1, "%d", pObj->fMarkB );
922 Vec_IntPush( vInit, pObj->fMarkB );
923 }
924//Abc_Print( 1, "\n" );
925 Aig_ManCleanMarkB( pAig );
926 return vInit;
927}
928
929
941int Ssw_RarCheckTrivial( Aig_Man_t * pAig, int fVerbose )
942{
943 Aig_Obj_t * pObj;
944 int i;
945 Saig_ManForEachPo( pAig, pObj, i )
946 {
947 if ( pAig->nConstrs && i >= Saig_ManPoNum(pAig) - pAig->nConstrs )
948 return 0;
949 if ( pObj->fPhase )
950 {
951 ABC_FREE( pAig->pSeqModel );
952 pAig->pSeqModel = Abc_CexAlloc( Aig_ManRegNum(pAig), Saig_ManPiNum(pAig), 1 );
953 pAig->pSeqModel->iPo = i;
954 if ( fVerbose )
955 Abc_Print( 1, "Output %d is trivally SAT in frame 0. \n", i );
956 return 1;
957 }
958 }
959 return 0;
960}
961
974{
975 int fTryBmc = 0;
976 int fMiter = 1;
977 Ssw_RarMan_t * p;
978 int r, f = -1;
979 abctime clk, clkTotal = Abc_Clock();
980 abctime nTimeToStop = pPars->TimeOut ? pPars->TimeOut * CLOCKS_PER_SEC + Abc_Clock(): 0;
981 abctime timeLastSolved = 0;
982 int nNumRestart = 0;
983 int nSavedSeed = pPars->nRandSeed;
984 int RetValue = -1;
985 int iFrameFail = -1;
986 assert( Aig_ManRegNum(pAig) > 0 );
987 assert( Aig_ManConstrNum(pAig) == 0 );
988 ABC_FREE( pAig->pSeqModel );
989 // consider the case of empty AIG
990// if ( Aig_ManNodeNum(pAig) == 0 )
991// return -1;
992 // check trivially SAT miters
993// if ( fMiter && Ssw_RarCheckTrivial( pAig, fVerbose ) )
994// return 0;
995 if ( pPars->fVerbose )
996 Abc_Print( 1, "Rarity simulation with %d words, %d frames, %d rounds, %d restart, %d seed, and %d sec timeout.\n",
997 pPars->nWords, pPars->nFrames, pPars->nRounds, pPars->nRestart, pPars->nRandSeed, pPars->TimeOut );
998 // reset random numbers
999 Ssw_RarManPrepareRandom( nSavedSeed );
1000
1001 // create manager
1002 p = Ssw_RarManStart( pAig, pPars );
1003 p->vInits = Vec_IntStart( Aig_ManRegNum(pAig) * pPars->nWords );
1004
1005 // perform simulation rounds
1006 pPars->nSolved = 0;
1007 timeLastSolved = Abc_Clock();
1008 for ( r = 0; !pPars->nRounds || (nNumRestart * pPars->nRestart + r < pPars->nRounds); r++ )
1009 {
1010 clk = Abc_Clock();
1011 if ( fTryBmc )
1012 {
1013 Aig_Man_t * pNewAig = Saig_ManDupWithPhase( pAig, p->vInits );
1014 Saig_BmcPerform( pNewAig, 0, 100, 2000, 3, 0, 0, 1 /*fVerbose*/, 0, &iFrameFail, 0, 0 );
1015// if ( pNewAig->pSeqModel != NULL )
1016// Abc_Print( 1, "BMC has found a counter-example in frame %d.\n", iFrameFail );
1017 Aig_ManStop( pNewAig );
1018 }
1019 // simulate
1020 for ( f = 0; f < pPars->nFrames; f++ )
1021 {
1022 Ssw_RarManSimulate( p, f ? NULL : p->vInits, 0, 0 );
1023 if ( fMiter )
1024 {
1025 int Status = Ssw_RarManCheckNonConstOutputs(p, r * p->pPars->nFrames + f, Abc_Clock() - clkTotal);
1026 if ( Status == 2 )
1027 {
1028 Abc_Print( 1, "Quitting due to callback on fail.\n" );
1029 goto finish;
1030 }
1031 if ( Status == 1 ) // found CEX
1032 {
1033 RetValue = 0;
1034 if ( !pPars->fSolveAll )
1035 {
1036 if ( pPars->fVerbose ) Abc_Print( 1, "\n" );
1037 // Abc_Print( 1, "Simulation asserted a PO in frame f: %d <= f < %d.\n", r * nFrames, (r+1) * nFrames );
1038 Ssw_RarManPrepareRandom( nSavedSeed );
1039 if ( pPars->fVerbose )
1040 Abc_Print( 1, "Simulated %d frames for %d rounds with %d restarts.\n", pPars->nFrames, nNumRestart * pPars->nRestart + r, nNumRestart );
1041 pAig->pSeqModel = Ssw_RarDeriveCex( p, r * p->pPars->nFrames + f, p->iFailPo, p->iFailPat, pPars->fVerbose );
1042 // print final report
1043 if ( !pPars->fSilent ) {
1044 Abc_Print( 1, "Output %d of miter \"%s\" was asserted in frame %d. ", pAig->pSeqModel->iPo, pAig->pName, pAig->pSeqModel->iFrame );
1045 Abc_PrintTime( 1, "Time", Abc_Clock() - clkTotal );
1046 }
1047 goto finish;
1048 }
1049 timeLastSolved = Abc_Clock();
1050 }
1051 // else - did not find a counter example
1052 }
1053 // check timeout
1054 if ( pPars->TimeOut && Abc_Clock() > nTimeToStop )
1055 {
1056 if ( !pPars->fSilent )
1057 {
1058 if ( pPars->fVerbose && !pPars->fSolveAll ) Abc_Print( 1, "\n" );
1059 Abc_Print( 1, "Simulated %d frames for %d rounds with %d restarts and solved %d outputs. ", pPars->nFrames, nNumRestart * pPars->nRestart + r, nNumRestart, pPars->nSolved );
1060 Abc_Print( 1, "Reached timeout (%d sec).\n", pPars->TimeOut );
1061 }
1062 goto finish;
1063 }
1064 if ( pPars->TimeOutGap && timeLastSolved && Abc_Clock() > timeLastSolved + pPars->TimeOutGap * CLOCKS_PER_SEC )
1065 {
1066 if ( !pPars->fSilent )
1067 {
1068 if ( pPars->fVerbose && !pPars->fSolveAll ) Abc_Print( 1, "\n" );
1069 Abc_Print( 1, "Simulated %d frames for %d rounds with %d restarts and solved %d outputs. ", pPars->nFrames, nNumRestart * pPars->nRestart + r, nNumRestart, pPars->nSolved );
1070 Abc_Print( 1, "Reached gap timeout (%d sec).\n", pPars->TimeOutGap );
1071 }
1072 goto finish;
1073 }
1074 // check if all outputs are solved by now
1075 if ( pPars->fSolveAll && p->vCexes && Vec_PtrCountZero(p->vCexes) == 0 )
1076 goto finish;
1077 }
1078 // get initialization patterns
1079 if ( pPars->nRestart && r == pPars->nRestart )
1080 {
1081 r = -1;
1082 nSavedSeed = (nSavedSeed + 1) % 1000;
1083 Ssw_RarManPrepareRandom( nSavedSeed );
1084 Vec_IntFill( p->vInits, Aig_ManRegNum(pAig) * pPars->nWords, 0 );
1085 nNumRestart++;
1086 Vec_IntClear( p->vPatBests );
1087 // clean rarity info
1088// memset( p->pRarity, 0, sizeof(int) * (1 << nBinSize) * p->nGroups );
1089 }
1090 else
1091 Ssw_RarTransferPatterns( p, p->vInits );
1092 // printout
1093 if ( pPars->fVerbose )
1094 {
1095 if ( pPars->fSolveAll )
1096 {
1097 Abc_Print( 1, "Starts =%6d ", nNumRestart );
1098 Abc_Print( 1, "Rounds =%6d ", nNumRestart * pPars->nRestart + ((r==-1)?0:r) );
1099 Abc_Print( 1, "Frames =%6d ", (nNumRestart * pPars->nRestart + r) * pPars->nFrames );
1100 Abc_Print( 1, "CEX =%6d (%6.2f %%) ", pPars->nSolved, 100.0*pPars->nSolved/Saig_ManPoNum(p->pAig) );
1101 Abc_PrintTime( 1, "Time", Abc_Clock() - clkTotal );
1102 }
1103 else
1104 Abc_Print( 1, "." );
1105 }
1106
1107 }
1108finish:
1109 if ( pPars->fSetLastState && p->vInits )
1110 {
1111 assert( Vec_IntSize(p->vInits) % Aig_ManRegNum(pAig) == 0 );
1112 Vec_IntShrink( p->vInits, Aig_ManRegNum(pAig) );
1113 pAig->pData = p->vInits; p->vInits = NULL;
1114 }
1115 if ( pPars->nSolved )
1116 {
1117/*
1118 if ( !pPars->fSilent )
1119 {
1120 if ( pPars->fVerbose && !pPars->fSolveAll ) Abc_Print( 1, "\n" );
1121 Abc_Print( 1, "Simulation of %d frames for %d rounds with %d restarts asserted %d (out of %d) POs. ", pPars->nFrames, nNumRestart * pPars->nRestart + r, nNumRestart, pPars->nSolved, Saig_ManPoNum(p->pAig) );
1122 Abc_PrintTime( 1, "Time", Abc_Clock() - clkTotal );
1123 }
1124*/
1125 }
1126 else if ( r == pPars->nRounds && f == pPars->nFrames )
1127 {
1128 if ( !pPars->fSilent )
1129 {
1130 if ( pPars->fVerbose ) Abc_Print( 1, "\n" );
1131 Abc_Print( 1, "Simulation of %d frames for %d rounds with %d restarts did not assert POs. ", pPars->nFrames, nNumRestart * pPars->nRestart + r, nNumRestart );
1132 Abc_PrintTime( 1, "Time", Abc_Clock() - clkTotal );
1133 }
1134 }
1135 // cleanup
1136 Ssw_RarManStop( p );
1137 return RetValue;
1138}
1139
1140
1152Vec_Int_t * Ssw_RarRandomPermFlop( int nFlops, int nUnused )
1153{
1154 Vec_Int_t * vPerm;
1155 int i, k, * pArray;
1156 srand( 1 );
1157 printf( "Generating random permutation of %d flops.\n", nFlops );
1158 vPerm = Vec_IntStartNatural( nFlops );
1159 pArray = Vec_IntArray( vPerm );
1160 for ( i = 0; i < nFlops; i++ )
1161 {
1162 k = rand() % nFlops;
1163 ABC_SWAP( int, pArray[i], pArray[k] );
1164 }
1165 printf( "Randomly adding %d unused flops.\n", nUnused );
1166 for ( i = 0; i < nUnused; i++ )
1167 {
1168 k = rand() % Vec_IntSize(vPerm);
1169 Vec_IntPush( vPerm, -1 );
1170 pArray = Vec_IntArray( vPerm );
1171 ABC_SWAP( int, pArray[Vec_IntSize(vPerm)-1], pArray[k] );
1172 }
1173// Vec_IntPrint(vPerm);
1174 return vPerm;
1175}
1176
1189{
1190 Aig_Man_t * pAig;
1191 int RetValue;
1192 if ( pPars->fUseFfGrouping )
1193 {
1194 Vec_Int_t * vPerm = Ssw_RarRandomPermFlop( Gia_ManRegNum(p), 10 );
1195 Gia_Man_t * pTemp = Gia_ManDupPermFlopGap( p, vPerm );
1196 Vec_IntFree( vPerm );
1197 pAig = Gia_ManToAigSimple( pTemp );
1198 Gia_ManStop( pTemp );
1199 }
1200 else
1201 pAig = Gia_ManToAigSimple( p );
1202 RetValue = Ssw_RarSimulate( pAig, pPars );
1203 // save counter-example
1204 Abc_CexFree( p->pCexSeq );
1205 p->pCexSeq = pAig->pSeqModel; pAig->pSeqModel = NULL;
1206 Aig_ManStop( pAig );
1207 return RetValue;
1208}
1209
1222{
1223 Ssw_RarMan_t * p;
1224 int r, f = -1, i, k;
1225 abctime clkTotal = Abc_Clock();
1226 abctime nTimeToStop = pPars->TimeOut ? pPars->TimeOut * CLOCKS_PER_SEC + Abc_Clock(): 0;
1227 int nNumRestart = 0;
1228 int nSavedSeed = pPars->nRandSeed;
1229 int RetValue = -1;
1230 assert( Aig_ManRegNum(pAig) > 0 );
1231 assert( Aig_ManConstrNum(pAig) == 0 );
1232 // consider the case of empty AIG
1233 if ( Aig_ManNodeNum(pAig) == 0 )
1234 return -1;
1235 // check trivially SAT miters
1236 if ( pPars->fMiter && Ssw_RarCheckTrivial( pAig, 1 ) )
1237 return 0;
1238 if ( pPars->fVerbose )
1239 Abc_Print( 1, "Rarity equiv filtering with %d words, %d frames, %d rounds, %d seed, and %d sec timeout.\n",
1240 pPars->nWords, pPars->nFrames, pPars->nRounds, pPars->nRandSeed, pPars->TimeOut );
1241 // reset random numbers
1242 Ssw_RarManPrepareRandom( nSavedSeed );
1243
1244 // create manager
1245 p = Ssw_RarManStart( pAig, pPars );
1246 // compute starting state if needed
1247 assert( p->vInits == NULL );
1248 if ( pPars->pCex )
1249 {
1250 p->vInits = Ssw_RarFindStartingState( pAig, pPars->pCex );
1251 Abc_Print( 1, "Beginning simulation from the state derived using the counter-example.\n" );
1252 }
1253 else
1254 p->vInits = Vec_IntStart( Aig_ManRegNum(pAig) );
1255 // duplicate the array
1256 for ( i = 1; i < pPars->nWords; i++ )
1257 for ( k = 0; k < Aig_ManRegNum(pAig); k++ )
1258 Vec_IntPush( p->vInits, Vec_IntEntry(p->vInits, k) );
1259 assert( Vec_IntSize(p->vInits) == Aig_ManRegNum(pAig) * pPars->nWords );
1260
1261 // create trivial equivalence classes with all nodes being candidates for constant 1
1262 if ( pAig->pReprs == NULL )
1263 p->ppClasses = Ssw_ClassesPrepareSimple( pAig, pPars->fLatchOnly, 0 );
1264 else
1265 p->ppClasses = Ssw_ClassesPrepareFromReprs( pAig );
1267 // print the stats
1268 if ( pPars->fVerbose )
1269 {
1270 Abc_Print( 1, "Initial : " );
1271 Ssw_ClassesPrint( p->ppClasses, 0 );
1272 }
1273 // refine classes using BMC
1274 for ( r = 0; !pPars->nRounds || (nNumRestart * pPars->nRestart + r < pPars->nRounds); r++ )
1275 {
1276 // start filtering equivalence classes
1277 if ( Ssw_ClassesCand1Num(p->ppClasses) == 0 && Ssw_ClassesClassNum(p->ppClasses) == 0 )
1278 {
1279 Abc_Print( 1, "All equivalences are refined away.\n" );
1280 break;
1281 }
1282 // simulate
1283 for ( f = 0; f < pPars->nFrames; f++ )
1284 {
1285 Ssw_RarManSimulate( p, f ? NULL : p->vInits, 1, !r && !f );
1286 if ( pPars->fMiter && Ssw_RarManCheckNonConstOutputs(p, -1, 0) )
1287 {
1288 if ( !pPars->fVerbose )
1289 Abc_Print( 1, "%s", Abc_FrameIsBatchMode() ? "\n" : "\r" );
1290// Abc_Print( 1, "Simulation asserted a PO in frame f: %d <= f < %d.\n", r * pPars->nFrames, (r+1) * pPars->nFrames );
1291 if ( pPars->fVerbose )
1292 Abc_Print( 1, "Simulated %d frames for %d rounds with %d restarts.\n", pPars->nFrames, nNumRestart * pPars->nRestart + r, nNumRestart );
1293 Ssw_RarManPrepareRandom( nSavedSeed );
1294 Abc_CexFree( pAig->pSeqModel );
1295 pAig->pSeqModel = Ssw_RarDeriveCex( p, r * p->pPars->nFrames + f, p->iFailPo, p->iFailPat, 1 );
1296 // print final report
1297 Abc_Print( 1, "Output %d of miter \"%s\" was asserted in frame %d. ", pAig->pSeqModel->iPo, pAig->pName, pAig->pSeqModel->iFrame );
1298 Abc_PrintTime( 1, "Time", Abc_Clock() - clkTotal );
1299 RetValue = 0;
1300 goto finish;
1301 }
1302 // check timeout
1303 if ( pPars->TimeOut && Abc_Clock() > nTimeToStop )
1304 {
1305 if ( pPars->fVerbose ) Abc_Print( 1, "\n" );
1306 Abc_Print( 1, "Simulated %d frames for %d rounds with %d restarts. ", pPars->nFrames, nNumRestart * pPars->nRestart + r, nNumRestart );
1307 Abc_Print( 1, "Reached timeout (%d sec).\n", pPars->TimeOut );
1308 goto finish;
1309 }
1310 }
1311 // get initialization patterns
1312 if ( pPars->pCex == NULL && pPars->nRestart && r == pPars->nRestart )
1313 {
1314 r = -1;
1315 nSavedSeed = (nSavedSeed + 1) % 1000;
1316 Ssw_RarManPrepareRandom( nSavedSeed );
1317 Vec_IntFill( p->vInits, Aig_ManRegNum(pAig) * pPars->nWords, 0 );
1318 nNumRestart++;
1319 Vec_IntClear( p->vPatBests );
1320 // clean rarity info
1321// memset( p->pRarity, 0, sizeof(int) * (1 << nBinSize) * p->nGroups );
1322 }
1323 else
1324 Ssw_RarTransferPatterns( p, p->vInits );
1325 // printout
1326 if ( pPars->fVerbose )
1327 {
1328 Abc_Print( 1, "Round %3d: ", r );
1329 Ssw_ClassesPrint( p->ppClasses, 0 );
1330 }
1331 else
1332 {
1333 Abc_Print( 1, "." );
1334 }
1335 }
1336finish:
1337 // report
1338 if ( r == pPars->nRounds && f == pPars->nFrames )
1339 {
1340 if ( !pPars->fVerbose )
1341 Abc_Print( 1, "%s", Abc_FrameIsBatchMode() ? "\n" : "\r" );
1342 Abc_Print( 1, "Simulation of %d frames for %d rounds with %d restarts did not assert POs. ", pPars->nFrames, nNumRestart * pPars->nRestart + r, nNumRestart );
1343 Abc_PrintTime( 1, "Time", Abc_Clock() - clkTotal );
1344 }
1345 // cleanup
1346 Ssw_RarManStop( p );
1347 return RetValue;
1348}
1349
1362{
1363 Aig_Man_t * pAig;
1364 int RetValue;
1365 pAig = Gia_ManToAigSimple( p );
1366 if ( p->pReprs != NULL )
1367 {
1368 Gia_ManReprToAigRepr2( pAig, p );
1369 ABC_FREE( p->pReprs );
1370 ABC_FREE( p->pNexts );
1371 }
1372 RetValue = Ssw_RarSignalFilter( pAig, pPars );
1373 Gia_ManReprFromAigRepr( pAig, p );
1374 // save counter-example
1375 Abc_CexFree( p->pCexSeq );
1376 p->pCexSeq = pAig->pSeqModel; pAig->pSeqModel = NULL;
1377 Aig_ManStop( pAig );
1378 return RetValue;
1379}
1380
1381
1385
1386
#define ABC_SWAP(Type, a, b)
Definition abc_global.h:253
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#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
void Aig_ManCleanMarkB(Aig_Man_t *p)
Definition aigUtil.c:167
#define Aig_ManForEachObj(p, pObj, i)
Definition aig.h:403
void Aig_ManStop(Aig_Man_t *p)
Definition aigMan.c:187
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition aigUtil.c:44
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition aig.h:393
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
#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
#define Aig_ManForEachCo(p, pObj, i)
Definition aig.h:398
word Aig_ManRandom64(int fReset)
Definition aigUtil.c:1200
unsigned Aig_ManRandom(int fReset)
Definition aigUtil.c:1170
ABC_DLL int Abc_FrameIsBatchMode()
Definition mainFrame.c:110
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
int Saig_BmcPerform(Aig_Man_t *pAig, int nStart, int nFramesMax, int nNodesMax, int nTimeOut, int nConfMaxOne, int nConfMaxAll, int fVerbose, int fVerbOverwrite, int *piFrames, int fSilent, int fUseSatoko)
Definition bmcBmc2.c:811
Cube * p
Definition exorList.c:222
Aig_Man_t * Gia_ManToAigSimple(Gia_Man_t *p)
Definition giaAig.c:408
void Gia_ManReprFromAigRepr(Aig_Man_t *pAig, Gia_Man_t *pGia)
Definition giaAig.c:528
void Gia_ManReprToAigRepr2(Aig_Man_t *pAig, Gia_Man_t *pGia)
Definition giaAig.c:500
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
Gia_Man_t * Gia_ManDupPermFlopGap(Gia_Man_t *p, Vec_Int_t *vFfPerm)
Definition giaDup.c:1026
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
word M(word f1, word f2, int n)
Definition kitPerm.c:240
Aig_Man_t * Saig_ManDupWithPhase(Aig_Man_t *pAig, Vec_Int_t *vInit)
Definition saigDup.c:482
#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 Saig_ManVerifyCex(Aig_Man_t *pAig, Abc_Cex_t *p)
Definition saigDup.c:281
Ssw_Cla_t * Ssw_ClassesPrepareFromReprs(Aig_Man_t *pAig)
Definition sswClass.c:768
int Ssw_ClassesPrepareRehash(Ssw_Cla_t *p, Vec_Ptr_t *vCands, int fConstCorr)
Definition sswClass.c:500
int Ssw_ClassesRefineConst1Group(Ssw_Cla_t *p, Vec_Ptr_t *vRoots, int fRecursive)
Definition sswClass.c:1074
int Ssw_ClassesCand1Num(Ssw_Cla_t *p)
Definition sswClass.c:259
Ssw_Cla_t * Ssw_ClassesPrepareSimple(Aig_Man_t *pAig, int fLatchCorr, int nMaxLevs)
Definition sswClass.c:724
int Ssw_ClassesRefineGroup(Ssw_Cla_t *p, Vec_Ptr_t *vReprs, int fRecursive)
Definition sswClass.c:1054
int Ssw_ClassesClassNum(Ssw_Cla_t *p)
Definition sswClass.c:275
void Ssw_ClassesPrint(Ssw_Cla_t *p, int fVeryVerbose)
Definition sswClass.c:414
void Ssw_ClassesSetData(Ssw_Cla_t *p, void *pManData, unsigned(*pFuncNodeHash)(void *, Aig_Obj_t *), int(*pFuncNodeIsConst)(void *, Aig_Obj_t *), int(*pFuncNodesAreEqual)(void *, Aig_Obj_t *, Aig_Obj_t *))
Definition sswClass.c:167
void Ssw_ClassesStop(Ssw_Cla_t *p)
Definition sswClass.c:189
struct Ssw_Cla_t_ Ssw_Cla_t
Definition sswInt.h:50
void transpose32(unsigned A[32])
Definition sswRarity.c:239
unsigned Ssw_RarManObjHashWord(void *pMan, Aig_Obj_t *pObj)
Definition sswRarity.c:530
void Ssw_RarManAssingRandomPis(Ssw_RarMan_t *p)
Definition sswRarity.c:150
int Ssw_RarSignalFilter(Aig_Man_t *pAig, Ssw_RarPars_t *pPars)
Definition sswRarity.c:1221
void Ssw_RarSetDefaultParams(Ssw_RarPars_t *p)
FUNCTION DEFINITIONS ///.
Definition sswRarity.c:102
void Ssw_RarManInitialize(Ssw_RarMan_t *p, Vec_Int_t *vInit)
Definition sswRarity.c:415
int Ssw_RarSimulateGia(Gia_Man_t *p, Ssw_RarPars_t *pPars)
DECLARATIONS ///.
Definition sswRarity.c:1188
void transpose64Simple(word A[64], word B[64])
Definition sswRarity.c:291
void TransposeTest()
Definition sswRarity.c:313
int Ssw_RarCheckTrivial(Aig_Man_t *pAig, int fVerbose)
Definition sswRarity.c:941
void transpose64(word A[64])
Definition sswRarity.c:265
void Ssw_RarManSimulate(Ssw_RarMan_t *p, Vec_Int_t *vInit, int fUpdate, int fFirst)
Definition sswRarity.c:651
Abc_Cex_t * Ssw_RarDeriveCex(Ssw_RarMan_t *p, int iFrame, int iPo, int iPatFinal, int fVerbose)
Definition sswRarity.c:177
int Ssw_RarManPoIsConst0(void *pMan, Aig_Obj_t *pObj)
Definition sswRarity.c:461
int Ssw_RarManObjWhichOne(Ssw_RarMan_t *p, Aig_Obj_t *pObj)
Definition sswRarity.c:569
int Ssw_RarSignalFilterGia(Gia_Man_t *p, Ssw_RarPars_t *pPars)
Definition sswRarity.c:1361
int Ssw_RarManObjsAreEqual(void *pMan, Aig_Obj_t *pObj0, Aig_Obj_t *pObj1)
Definition sswRarity.c:506
int Ssw_RarSimulate(Aig_Man_t *pAig, Ssw_RarPars_t *pPars)
Definition sswRarity.c:973
Vec_Int_t * Ssw_RarRandomPermFlop(int nFlops, int nUnused)
Definition sswRarity.c:1152
void Ssw_RarTranspose(Ssw_RarMan_t *p)
Definition sswRarity.c:360
typedefABC_NAMESPACE_IMPL_START struct Ssw_RarMan_t_ Ssw_RarMan_t
DECLARATIONS ///.
Definition sswRarity.c:33
void Ssw_RarManPrepareRandom(int nRandSeed)
Definition sswRarity.c:131
int Ssw_RarManObjIsConst(void *pMan, Aig_Obj_t *pObj)
Definition sswRarity.c:483
int Ssw_RarManCheckNonConstOutputs(Ssw_RarMan_t *p, int iFrame, abctime Time)
Definition sswRarity.c:597
struct Ssw_RarPars_t_ Ssw_RarPars_t
Definition ssw.h:94
int Id
Definition aig.h:85
unsigned int fMarkB
Definition aig.h:80
unsigned int fPhase
Definition aig.h:78
Vec_Int_t * vPatBests
Definition sswRarity.c:54
Ssw_Cla_t * ppClasses
Definition sswRarity.c:42
word * pPatData
Definition sswRarity.c:46
word * pObjData
Definition sswRarity.c:45
Vec_Ptr_t * vUpdConst
Definition sswRarity.c:48
Aig_Man_t * pAig
Definition sswRarity.c:41
int * pRarity
Definition sswRarity.c:51
Ssw_RarPars_t * pPars
Definition sswRarity.c:37
Vec_Int_t * vInits
Definition sswRarity.c:43
Vec_Ptr_t * vCexes
Definition sswRarity.c:58
double * pPatCosts
Definition sswRarity.c:52
Vec_Ptr_t * vUpdClass
Definition sswRarity.c:49
int fUseFfGrouping
Definition ssw.h:114
int TimeOutGap
Definition ssw.h:104
int nRestart
Definition ssw.h:101
int nSolved
Definition ssw.h:115
int nRounds
Definition ssw.h:100
int nRandSeed
Definition ssw.h:102
int fVerbose
Definition ssw.h:107
int fSolveAll
Definition ssw.h:105
int fLatchOnly
Definition ssw.h:113
int TimeOut
Definition ssw.h:103
int nBinSize
Definition ssw.h:99
int fMiter
Definition ssw.h:111
int nFrames
Definition ssw.h:97
Abc_Cex_t * pCex
Definition ssw.h:116
int fSilent
Definition ssw.h:109
int fSetLastState
Definition ssw.h:106
int nWords
Definition ssw.h:98
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
char * memset()
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42