ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
sswRarity.c File Reference
#include "sswInt.h"
#include "aig/gia/giaAig.h"
#include "base/main/main.h"
#include "sat/bmc/bmc.h"
Include dependency graph for sswRarity.c:

Go to the source code of this file.

Classes

struct  Ssw_RarMan_t_
 

Typedefs

typedef typedefABC_NAMESPACE_IMPL_START struct Ssw_RarMan_t_ Ssw_RarMan_t
 DECLARATIONS ///.
 

Functions

void Ssw_RarSetDefaultParams (Ssw_RarPars_t *p)
 FUNCTION DEFINITIONS ///.
 
void Ssw_RarManPrepareRandom (int nRandSeed)
 
void Ssw_RarManAssingRandomPis (Ssw_RarMan_t *p)
 
Abc_Cex_tSsw_RarDeriveCex (Ssw_RarMan_t *p, int iFrame, int iPo, int iPatFinal, int fVerbose)
 
void transpose32 (unsigned A[32])
 
void transpose64 (word A[64])
 
void transpose64Simple (word A[64], word B[64])
 
void TransposeTest ()
 
void Ssw_RarTranspose (Ssw_RarMan_t *p)
 
void Ssw_RarManInitialize (Ssw_RarMan_t *p, Vec_Int_t *vInit)
 
int Ssw_RarManPoIsConst0 (void *pMan, Aig_Obj_t *pObj)
 
int Ssw_RarManObjIsConst (void *pMan, Aig_Obj_t *pObj)
 
int Ssw_RarManObjsAreEqual (void *pMan, Aig_Obj_t *pObj0, Aig_Obj_t *pObj1)
 
unsigned Ssw_RarManObjHashWord (void *pMan, Aig_Obj_t *pObj)
 
int Ssw_RarManObjWhichOne (Ssw_RarMan_t *p, Aig_Obj_t *pObj)
 
int Ssw_RarManCheckNonConstOutputs (Ssw_RarMan_t *p, int iFrame, abctime Time)
 
void Ssw_RarManSimulate (Ssw_RarMan_t *p, Vec_Int_t *vInit, int fUpdate, int fFirst)
 
int Ssw_RarCheckTrivial (Aig_Man_t *pAig, int fVerbose)
 
int Ssw_RarSimulate (Aig_Man_t *pAig, Ssw_RarPars_t *pPars)
 
Vec_Int_tSsw_RarRandomPermFlop (int nFlops, int nUnused)
 
int Ssw_RarSimulateGia (Gia_Man_t *p, Ssw_RarPars_t *pPars)
 DECLARATIONS ///.
 
int Ssw_RarSignalFilter (Aig_Man_t *pAig, Ssw_RarPars_t *pPars)
 
int Ssw_RarSignalFilterGia (Gia_Man_t *p, Ssw_RarPars_t *pPars)
 

Typedef Documentation

◆ Ssw_RarMan_t

typedef typedefABC_NAMESPACE_IMPL_START struct Ssw_RarMan_t_ Ssw_RarMan_t

DECLARATIONS ///.

CFile****************************************************************

FileName [sswRarity.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Inductive prover with constraints.]

Synopsis [Rarity-driven refinement of equivalence classes.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - September 1, 2008.]

Revision [

Id
sswRarity.c,v 1.00 2008/09/01 00:00:00 alanmi Exp

]

Definition at line 33 of file sswRarity.c.

Function Documentation

◆ Ssw_RarCheckTrivial()

int Ssw_RarCheckTrivial ( Aig_Man_t * pAig,
int fVerbose )

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 941 of file sswRarity.c.

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}
#define ABC_FREE(obj)
Definition abc_global.h:267
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
#define Saig_ManForEachPo(p, pObj, i)
Definition saig.h:93
unsigned int fPhase
Definition aig.h:78
ABC_NAMESPACE_IMPL_START Abc_Cex_t * Abc_CexAlloc(int nRegs, int nRealPis, int nFrames)
DECLARATIONS ///.
Definition utilCex.c:51
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_RarDeriveCex()

Abc_Cex_t * Ssw_RarDeriveCex ( Ssw_RarMan_t * p,
int iFrame,
int iPo,
int iPatFinal,
int fVerbose )

Function*************************************************************

Synopsis [Derives the counter-example.]

Description []

SideEffects []

SeeAlso []

Definition at line 177 of file sswRarity.c.

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}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Cube * p
Definition exorList.c:222
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
#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
void Ssw_RarManAssingRandomPis(Ssw_RarMan_t *p)
Definition sswRarity.c:150
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition utilCex.h:39
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_RarManAssingRandomPis()

void Ssw_RarManAssingRandomPis ( Ssw_RarMan_t * p)

Function*************************************************************

Synopsis [Initializes random primary inputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 150 of file sswRarity.c.

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}
word Aig_ManRandom64(int fReset)
Definition aigUtil.c:1200
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_RarManCheckNonConstOutputs()

int Ssw_RarManCheckNonConstOutputs ( Ssw_RarMan_t * p,
int iFrame,
abctime Time )

Function*************************************************************

Synopsis [Check if any of the POs becomes non-constant.]

Description []

SideEffects []

SeeAlso []

Definition at line 597 of file sswRarity.c.

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}
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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_RarManInitialize()

void Ssw_RarManInitialize ( Ssw_RarMan_t * p,
Vec_Int_t * vInit )

Function*************************************************************

Synopsis [Sets random inputs and specialied flop outputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 415 of file sswRarity.c.

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}
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
Definition saig.h:101
#define Saig_ManForEachLo(p, pObj, i)
Definition saig.h:96
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_RarManObjHashWord()

unsigned Ssw_RarManObjHashWord ( void * pMan,
Aig_Obj_t * pObj )

Function*************************************************************

Synopsis [Computes hash value of the node using its simulation info.]

Description []

SideEffects []

SeeAlso []

Definition at line 530 of file sswRarity.c.

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}
typedefABC_NAMESPACE_IMPL_START struct Ssw_RarMan_t_ Ssw_RarMan_t
DECLARATIONS ///.
Definition sswRarity.c:33
int Id
Definition aig.h:85
Here is the caller graph for this function:

◆ Ssw_RarManObjIsConst()

int Ssw_RarManObjIsConst ( void * pMan,
Aig_Obj_t * pObj )

Function*************************************************************

Synopsis [Returns 1 if simulation info is composed of all zeros.]

Description []

SideEffects []

SeeAlso []

Definition at line 483 of file sswRarity.c.

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}
Here is the caller graph for this function:

◆ Ssw_RarManObjsAreEqual()

int Ssw_RarManObjsAreEqual ( void * pMan,
Aig_Obj_t * pObj0,
Aig_Obj_t * pObj1 )

Function*************************************************************

Synopsis [Returns 1 if simulation infos are equal.]

Description []

SideEffects []

SeeAlso []

Definition at line 506 of file sswRarity.c.

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}
Here is the caller graph for this function:

◆ Ssw_RarManObjWhichOne()

int Ssw_RarManObjWhichOne ( Ssw_RarMan_t * p,
Aig_Obj_t * pObj )

Function*************************************************************

Synopsis [Returns 1 if simulation info is composed of all zeros.]

Description []

SideEffects []

SeeAlso []

Definition at line 569 of file sswRarity.c.

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}
Here is the caller graph for this function:

◆ Ssw_RarManPoIsConst0()

int Ssw_RarManPoIsConst0 ( void * pMan,
Aig_Obj_t * pObj )

Function*************************************************************

Synopsis [Returns 1 if simulation info is composed of all zeros.]

Description []

SideEffects []

SeeAlso []

Definition at line 461 of file sswRarity.c.

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}
Here is the caller graph for this function:

◆ Ssw_RarManPrepareRandom()

void Ssw_RarManPrepareRandom ( int nRandSeed)

Function*************************************************************

Synopsis [Prepares random number generator.]

Description []

SideEffects []

SeeAlso []

Definition at line 131 of file sswRarity.c.

132{
133 int i;
134 Aig_ManRandom( 1 );
135 for ( i = 0; i < nRandSeed; i++ )
136 Aig_ManRandom( 0 );
137}
unsigned Aig_ManRandom(int fReset)
Definition aigUtil.c:1170
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_RarManSimulate()

void Ssw_RarManSimulate ( Ssw_RarMan_t * p,
Vec_Int_t * vInit,
int fUpdate,
int fFirst )

Function*************************************************************

Synopsis [Performs one round of simulation.]

Description []

SideEffects []

SeeAlso []

Definition at line 651 of file sswRarity.c.

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}
#define Aig_ManForEachObj(p, pObj, i)
Definition aig.h:403
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition aigUtil.c:44
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition aig.h:393
#define Aig_ManForEachNode(p, pObj, i)
Definition aig.h:413
#define Aig_ManForEachCo(p, pObj, i)
Definition aig.h:398
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
int Ssw_ClassesRefineGroup(Ssw_Cla_t *p, Vec_Ptr_t *vReprs, int fRecursive)
Definition sswClass.c:1054
void Ssw_RarManInitialize(Ssw_RarMan_t *p, Vec_Int_t *vInit)
Definition sswRarity.c:415
int Ssw_RarManObjsAreEqual(void *pMan, Aig_Obj_t *pObj0, Aig_Obj_t *pObj1)
Definition sswRarity.c:506
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_RarRandomPermFlop()

Vec_Int_t * Ssw_RarRandomPermFlop ( int nFlops,
int nUnused )

Function*************************************************************

Synopsis [Derive random flop permutation.]

Description []

SideEffects []

SeeAlso []

Definition at line 1152 of file sswRarity.c.

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}
#define ABC_SWAP(Type, a, b)
Definition abc_global.h:253
Here is the caller graph for this function:

◆ Ssw_RarSetDefaultParams()

void Ssw_RarSetDefaultParams ( Ssw_RarPars_t * p)

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 102 of file sswRarity.c.

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}
struct Ssw_RarPars_t_ Ssw_RarPars_t
Definition ssw.h:94
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_RarSignalFilter()

int Ssw_RarSignalFilter ( Aig_Man_t * pAig,
Ssw_RarPars_t * pPars )

Function*************************************************************

Synopsis [Filter equivalence classes of nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1221 of file sswRarity.c.

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}
ABC_INT64_T abctime
Definition abc_global.h:332
ABC_DLL int Abc_FrameIsBatchMode()
Definition mainFrame.c:110
Ssw_Cla_t * Ssw_ClassesPrepareFromReprs(Aig_Man_t *pAig)
Definition sswClass.c:768
Ssw_Cla_t * Ssw_ClassesPrepareSimple(Aig_Man_t *pAig, int fLatchCorr, int nMaxLevs)
Definition sswClass.c:724
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
unsigned Ssw_RarManObjHashWord(void *pMan, Aig_Obj_t *pObj)
Definition sswRarity.c:530
int Ssw_RarCheckTrivial(Aig_Man_t *pAig, int fVerbose)
Definition sswRarity.c:941
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
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
int nRestart
Definition ssw.h:101
int nRounds
Definition ssw.h:100
int nRandSeed
Definition ssw.h:102
int fVerbose
Definition ssw.h:107
int fLatchOnly
Definition ssw.h:113
int TimeOut
Definition ssw.h:103
int fMiter
Definition ssw.h:111
int nFrames
Definition ssw.h:97
Abc_Cex_t * pCex
Definition ssw.h:116
int nWords
Definition ssw.h:98
void Abc_CexFree(Abc_Cex_t *p)
Definition utilCex.c:382
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_RarSignalFilterGia()

int Ssw_RarSignalFilterGia ( Gia_Man_t * p,
Ssw_RarPars_t * pPars )

Function*************************************************************

Synopsis [Filter equivalence classes of nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1361 of file sswRarity.c.

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}
void Aig_ManStop(Aig_Man_t *p)
Definition aigMan.c:187
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition aig.h:50
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
int Ssw_RarSignalFilter(Aig_Man_t *pAig, Ssw_RarPars_t *pPars)
Definition sswRarity.c:1221
Here is the call graph for this function:

◆ Ssw_RarSimulate()

int Ssw_RarSimulate ( Aig_Man_t * pAig,
Ssw_RarPars_t * pPars )

Function*************************************************************

Synopsis [Perform sequential simulation.]

Description []

SideEffects []

SeeAlso []

Definition at line 973 of file sswRarity.c.

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}
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
Aig_Man_t * Saig_ManDupWithPhase(Aig_Man_t *pAig, Vec_Int_t *vInit)
Definition saigDup.c:482
int TimeOutGap
Definition ssw.h:104
int nSolved
Definition ssw.h:115
int fSolveAll
Definition ssw.h:105
int fSilent
Definition ssw.h:109
int fSetLastState
Definition ssw.h:106
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_RarSimulateGia()

int Ssw_RarSimulateGia ( Gia_Man_t * p,
Ssw_RarPars_t * pPars )

DECLARATIONS ///.

Function*************************************************************

Synopsis [Perform sequential simulation.]

Description []

SideEffects []

SeeAlso []

Definition at line 1188 of file sswRarity.c.

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}
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
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
int fUseFfGrouping
Definition ssw.h:114
Here is the call graph for this function:

◆ Ssw_RarTranspose()

void Ssw_RarTranspose ( Ssw_RarMan_t * p)

Function*************************************************************

Synopsis [Transposing pObjData[ nRegs x nWords ] -> pPatData[ nWords x nRegs ].]

Description []

SideEffects []

SeeAlso []

Definition at line 360 of file sswRarity.c.

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}
word M(word f1, word f2, int n)
Definition kitPerm.c:240
void transpose64(word A[64])
Definition sswRarity.c:265
Here is the call graph for this function:

◆ transpose32()

void transpose32 ( unsigned A[32])

Function*************************************************************

Synopsis [Transposing 32-bit matrix.]

Description [Borrowed from "Hacker's Delight", by Henry Warren.]

SideEffects []

SeeAlso []

Definition at line 239 of file sswRarity.c.

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}

◆ transpose64()

void transpose64 ( word A[64])

Function*************************************************************

Synopsis [Transposing 64-bit matrix.]

Description []

SideEffects []

SeeAlso []

Definition at line 265 of file sswRarity.c.

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}
Here is the caller graph for this function:

◆ transpose64Simple()

void transpose64Simple ( word A[64],
word B[64] )

Function*************************************************************

Synopsis [Transposing 64-bit matrix.]

Description []

SideEffects []

SeeAlso []

Definition at line 291 of file sswRarity.c.

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}
Here is the caller graph for this function:

◆ TransposeTest()

void TransposeTest ( )

Function*************************************************************

Synopsis [Testing the transposing code.]

Description []

SideEffects []

SeeAlso []

Definition at line 313 of file sswRarity.c.

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}
void transpose64Simple(word A[64], word B[64])
Definition sswRarity.c:291
Here is the call graph for this function: