65 static int s_SPrimes[128] = {
66 1009, 1049, 1093, 1151, 1201, 1249, 1297, 1361, 1427, 1459,
67 1499, 1559, 1607, 1657, 1709, 1759, 1823, 1877, 1933, 1997,
68 2039, 2089, 2141, 2213, 2269, 2311, 2371, 2411, 2467, 2543,
69 2609, 2663, 2699, 2741, 2797, 2851, 2909, 2969, 3037, 3089,
70 3169, 3221, 3299, 3331, 3389, 3461, 3517, 3557, 3613, 3671,
71 3719, 3779, 3847, 3907, 3943, 4013, 4073, 4129, 4201, 4243,
72 4289, 4363, 4441, 4493, 4549, 4621, 4663, 4729, 4793, 4871,
73 4933, 4973, 5021, 5087, 5153, 5227, 5281, 5351, 5417, 5471,
74 5519, 5573, 5651, 5693, 5749, 5821, 5861, 5923, 6011, 6073,
75 6131, 6199, 6257, 6301, 6353, 6397, 6481, 6563, 6619, 6689,
76 6737, 6803, 6863, 6917, 6977, 7027, 7109, 7187, 7237, 7309,
77 7393, 7477, 7523, 7561, 7607, 7681, 7727, 7817, 7877, 7933,
78 8011, 8039, 8059, 8081, 8093, 8111, 8123, 8147
86 for ( i = p->
nWordsPref; i < p->nWordsTotal; i++ )
87 uHash ^= pSims[i] * s_SPrimes[i & 0x7F];
107 for ( i = p->
nWordsPref; i < p->nWordsTotal; i++ )
126 unsigned * pSims0, * pSims1;
130 for ( i = p->
nWordsPref; i < p->nWordsTotal; i++ )
131 if ( pSims0[i] != pSims1[i] )
182 unsigned * pSimL, * pSimR;
186 for ( k = p->
nWordsPref; k < p->nWordsTotal; k++ )
204 unsigned * pSimLi, * pSimLo, * pSimCand;
213 for ( k = p->
nWordsPref; k < p->nWordsTotal; k++ )
214 if ( ~pSimCand[k] & (pSimLi[k] ^ pSimLo[k]) )
219 for ( k = p->
nWordsPref; k < p->nWordsTotal; k++ )
220 if ( pSimCand[k] & (pSimLi[k] ^ pSimLo[k]) )
239 unsigned * pSimLi, * pSimLo, * pSimCand;
248 for ( k = p->
nWordsPref; k < p->nWordsTotal; k++ )
253 for ( k = p->
nWordsPref; k < p->nWordsTotal; k++ )
272 unsigned * pSimLi, * pSimLo;
278 for ( k = p->
nWordsPref; k < p->nWordsTotal; k++ )
299 for ( i = p->
nWordsPref; i < p->nWordsTotal; i++ )
319 return pSims[f] == 0;
365 unsigned * pSims, uWord;
400 memset( p->pPatWords, 0,
sizeof(
unsigned) * p->nPatWords );
418 memset( p->pPatWords, 0xff,
sizeof(
unsigned) * p->nPatWords );
444 int i, k, BestPat, * pModel;
451 assert( i < p->nWordsTotal );
453 for ( k = 0; k < 32; k++ )
454 if ( pSims[i] & (1 << k) )
458 BestPat = i * 32 + k;
523 for ( f = 0; f < p->
nFrames; f++ )
542 assert( iFrame < p->nFrames );
564 assert( iFrame < p->nFrames );
568 pSims[i] = fConst1? ~(
unsigned)0 : 0;
585 assert( iFrame < p->nFrames );
586 assert( iWord < p->nWordsFrame );
589 pSims[iWord] = fConst1? ~(unsigned)0 : 0;
606 assert( iFrame < p->nFrames );
626 int f, i, k, Limit, nTruePis;
635 for ( i = 0; i < Limit; i++ )
644 for ( f = 0; f < p->
nFrames; f++ )
657 for ( i = 0; i < Limit; i++ )
686 for ( i = 0; i < Limit; i++ )
690 for ( f = 1; f < p->
nFrames; f++ )
708 unsigned * pSims, * pSims0, * pSims1;
709 int fCompl, fCompl0, fCompl1, i;
710 assert( iFrame < p->nFrames );
723 if ( fCompl0 && fCompl1 )
727 pSims[i] = (pSims0[i] | pSims1[i]);
730 pSims[i] = ~(pSims0[i] | pSims1[i]);
732 else if ( fCompl0 && !fCompl1 )
736 pSims[i] = (pSims0[i] | ~pSims1[i]);
739 pSims[i] = (~pSims0[i] & pSims1[i]);
741 else if ( !fCompl0 && fCompl1 )
745 pSims[i] = (~pSims0[i] | pSims1[i]);
748 pSims[i] = (pSims0[i] & ~pSims1[i]);
754 pSims[i] = ~(pSims0[i] & pSims1[i]);
757 pSims[i] = (pSims0[i] & pSims1[i]);
774 unsigned * pSims0, * pSims1;
776 assert( iFrame0 < p->nFrames );
777 assert( iFrame1 < p->nFrames );
787 if ( pSims0[i] != pSims1[i] )
805 unsigned * pSims, * pSims0;
806 int fCompl, fCompl0, i;
807 assert( iFrame < p->nFrames );
820 pSims[i] = ~pSims0[i];
823 pSims[i] = pSims0[i];
839 unsigned * pSims0, * pSims1;
841 assert( iFrame < p->nFrames );
852 pSims1[i] = pSims0[i];
868 unsigned * pSims0, * pSims1;
880 pSims1[i] = pSims0[i];
1011 for ( f = 0; f < p->
nFrames; f++ )
1052 pSims[i] = ~pSims[i];
1060 pSims[i] = ~pSims[i];
1081 if ( pVisited[p->
nFrames*pObj->
Id+f] == nVisCounter )
1083 pVisited[p->
nFrames*pObj->
Id+f] = nVisCounter;
1152 memset( p, 0,
sizeof(
Ssw_Sml_t) +
sizeof(
unsigned) * (nPref + nFrames) * nWordsFrame );
1343 int iPo, iFrame, iBit, i, k;
1357 for ( i = p->
nWordsPref; i < p->nWordsTotal; i++ )
1367 assert( iFrame < p->nFrames );
1368 assert( iBit < 32 * p->nWordsFrame );
1373 pCex->iFrame = iFrame;
1382 for ( i = 0; i <= iFrame; i++ )
1394 Abc_Print( 1,
"Ssw_SmlGetCounterExample(): Counter-example is invalid.\n" );
void Ssw_SmlReinitialize(Ssw_Sml_t *p)
static Vec_Ptr_t * Vec_PtrStart(int nSize)
void Ssw_SmlNodeTransferFirst(Ssw_Sml_t *p, Aig_Obj_t *pOut, Aig_Obj_t *pIn)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
void Ssw_SmlSimulateOne(Ssw_Sml_t *p)
static int Saig_ManPoNum(Aig_Man_t *p)
static int Saig_ObjIsLo(Aig_Man_t *p, Aig_Obj_t *pObj)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
void Ssw_SmlAssignDist1Plus(Ssw_Sml_t *p, unsigned *pPat)
static Aig_Obj_t * Aig_ObjChild0(Aig_Obj_t *pObj)
void Ssw_SmlClean(Ssw_Sml_t *p)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
static int Abc_InfoHasBit(unsigned *p, int i)
ABC_NAMESPACE_IMPL_START Abc_Cex_t * Abc_CexAlloc(int nRegs, int nRealPis, int nFrames)
DECLARATIONS ///.
void Ssw_SmlSimulateOneDyn_rec(Ssw_Sml_t *p, Aig_Obj_t *pObj, int f, int *pVisited, int nVisCounter)
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
void Ssw_SmlAssignDist1(Ssw_Sml_t *p, unsigned *pPat)
static Aig_Obj_t * Saig_ObjLoToLi(Aig_Man_t *p, Aig_Obj_t *pObj)
int Saig_ManVerifyCex(Aig_Man_t *pAig, Abc_Cex_t *p)
void Ssw_SmlObjAssignConstWord(Ssw_Sml_t *p, Aig_Obj_t *pObj, int fConst1, int iFrame, int iWord)
static Aig_Obj_t * Saig_ManLo(Aig_Man_t *p, int i)
static void Abc_InfoXorBit(unsigned *p, int i)
void Ssw_SmlAssignRandom(Ssw_Sml_t *p, Aig_Obj_t *pObj)
void Ssw_SmlObjSetWord(Ssw_Sml_t *p, Aig_Obj_t *pObj, unsigned Word, int iWord, int iFrame)
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
void Ssw_SmlSavePattern0(Ssw_Man_t *p, int fInit)
static int Aig_IsComplement(Aig_Obj_t *p)
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
static unsigned * Ssw_ObjSim(Ssw_Sml_t *p, int Id)
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
#define Aig_ManForEachCo(p, pObj, i)
int Ssw_SmlObjsAreEqualBit(void *p, Aig_Obj_t *pObj0, Aig_Obj_t *pObj1)
#define ABC_ALLOC(type, num)
Ssw_Sml_t * Ssw_SmlSimulateSeq(Aig_Man_t *pAig, int nPref, int nFrames, int nWords)
void Ssw_SmlNodeTransferNext(Ssw_Sml_t *p, Aig_Obj_t *pOut, Aig_Obj_t *pIn, int iFrame)
int * Ssw_SmlCheckOutput(Ssw_Sml_t *p)
void Ssw_SmlResimulateSeq(Ssw_Sml_t *p)
unsigned Aig_ManRandom(int fReset)
typedefABC_NAMESPACE_HEADER_START struct Ssw_Man_t_ Ssw_Man_t
INCLUDES ///.
static abctime Abc_Clock()
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
static int Vec_PtrSize(Vec_Ptr_t *p)
void Ssw_SmlObjAssignConst(Ssw_Sml_t *p, Aig_Obj_t *pObj, int fConst1, int iFrame)
int Ssw_SmlNodeIsZeroFrame(Ssw_Sml_t *p, Aig_Obj_t *pObj, int f)
static int Saig_ObjIsLi(Aig_Man_t *p, Aig_Obj_t *pObj)
int Ssw_SmlObjIsConstWord(Ssw_Sml_t *p, Aig_Obj_t *pObj)
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
static int Aig_ManCoNum(Aig_Man_t *p)
static int Abc_MinInt(int a, int b)
void Ssw_SmlSimulateOneFrame(Ssw_Sml_t *p)
static int Aig_WordCountOnes(unsigned uWord)
int Ssw_SmlNodeIsZero(Ssw_Sml_t *p, Aig_Obj_t *pObj)
unsigned * Ssw_SmlSimInfo(Ssw_Sml_t *p, Aig_Obj_t *pObj)
#define Aig_ManForEachNode(p, pObj, i)
int Ssw_SmlNodeNotEquWeight(Ssw_Sml_t *p, int Left, int Right)
#define Saig_ManForEachLi(p, pObj, i)
static Aig_Obj_t * Aig_ManCi(Aig_Man_t *p, int i)
static int Aig_WordFindFirstBit(unsigned uWord)
static int Aig_ManCiNum(Aig_Man_t *p)
#define ABC_NAMESPACE_IMPL_END
int Ssw_SmlObjIsConstBit(void *p, Aig_Obj_t *pObj)
static Aig_Obj_t * Aig_ObjChild1(Aig_Obj_t *pObj)
int Ssw_SmlCheckXorImplication(Ssw_Sml_t *p, Aig_Obj_t *pObjLi, Aig_Obj_t *pObjLo, Aig_Obj_t *pCand)
DECLARATIONS ///.
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
static int Aig_ObjPhaseReal(Aig_Obj_t *pObj)
#define Saig_ManForEachLo(p, pObj, i)
int Ssw_SmlCountXorImplication(Ssw_Sml_t *p, Aig_Obj_t *pObjLi, Aig_Obj_t *pObjLo, Aig_Obj_t *pCand)
Vec_Ptr_t * Ssw_SmlSimDataPointers(Ssw_Sml_t *p)
static void Abc_Print(int level, const char *format,...)
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
int Ssw_SmlNumFrames(Ssw_Sml_t *p)
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
static int Aig_ManObjNumMax(Aig_Man_t *p)
Ssw_Sml_t * Ssw_SmlStart(Aig_Man_t *pAig, int nPref, int nFrames, int nWordsFrame)
#define ABC_NAMESPACE_IMPL_START
static void Abc_InfoSetBit(unsigned *p, int i)
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
unsigned Ssw_SmlObjHashWord(Ssw_Sml_t *p, Aig_Obj_t *pObj)
FUNCTION DEFINITIONS ///.
static int Aig_ManRegNum(Aig_Man_t *p)
int Ssw_SmlNumWordsTotal(Ssw_Sml_t *p)
static int Vec_IntSize(Vec_Int_t *p)
#define Aig_ManForEachObj(p, pObj, i)
int Ssw_SmlCheckNonConstOutputs(Ssw_Sml_t *p)
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
void Ssw_SmlNodeSimulate(Ssw_Sml_t *p, Aig_Obj_t *pObj, int iFrame)
int * Ssw_SmlCheckOutputSavePattern(Ssw_Sml_t *p, Aig_Obj_t *pObjPo)
void Ssw_SmlSavePattern1(Ssw_Man_t *p, int fInit)
void Ssw_SmlAssignRandomFrame(Ssw_Sml_t *p, Aig_Obj_t *pObj, int iFrame)
int Ssw_SmlNodesCompareInFrame(Ssw_Sml_t *p, Aig_Obj_t *pObj0, Aig_Obj_t *pObj1, int iFrame0, int iFrame1)
static unsigned Ssw_ObjRandomSim()
#define Saig_ManForEachPo(p, pObj, i)
int Ssw_SmlCountEqual(Ssw_Sml_t *p, Aig_Obj_t *pObjLi, Aig_Obj_t *pObjLo)
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
void Ssw_SmlUnnormalize(Ssw_Sml_t *p)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
int Ssw_SmlNodeCountOnesRealVec(Ssw_Sml_t *p, Vec_Ptr_t *vObjs)
void Abc_CexFree(Abc_Cex_t *p)
Abc_Cex_t * Ssw_SmlGetCounterExample(Ssw_Sml_t *p)
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
void Ssw_SmlStop(Ssw_Sml_t *p)
Ssw_Sml_t * Ssw_SmlSimulateComb(Aig_Man_t *pAig, int nWords)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
void Ssw_SmlNodeCopyFanin(Ssw_Sml_t *p, Aig_Obj_t *pObj, int iFrame)
static int Saig_ObjIsPi(Aig_Man_t *p, Aig_Obj_t *pObj)
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
void Ssw_SmlInitialize(Ssw_Sml_t *p, int fInit)
int Ssw_SmlObjsAreEqualWord(Ssw_Sml_t *p, Aig_Obj_t *pObj0, Aig_Obj_t *pObj1)
void Ssw_SmlInitializeSpecial(Ssw_Sml_t *p, Vec_Int_t *vInit)
int Ssw_SmlNodeCountOnesReal(Ssw_Sml_t *p, Aig_Obj_t *pObj)
#define Saig_ManForEachPi(p, pObj, i)