32 0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
33 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
34 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
35 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
36 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
37 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
38 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
39 3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8
61 assert( nSize > 0 && nWords > 0 );
63 vInfo->pArray[0] =
ABC_ALLOC(
unsigned, nSize * nWords );
65 memset( vInfo->pArray[0], 0,
sizeof(
unsigned) * nSize * nWords );
66 for ( i = 1; i < nSize; i++ )
67 vInfo->pArray[i] = ((
unsigned *)vInfo->pArray[i-1]) +
nWords;
103 for ( w = 0; w <
nWords; w++ )
104 pInfo1[w] |= pInfo2[w];
123 for ( w = 0; w <
nWords; w++ )
124 if ( (uMask = (pInfo2[w] ^ pInfo1[w])) )
125 for ( b = 0; b < 32; b++ )
126 if ( uMask & (1 << b) )
146 for ( w = 0; w <
nWords; w++ )
147 if ( (uMask = (pInfo2[w] & ~pInfo1[w])) )
148 for ( b = 0; b < 32; b++ )
149 if ( uMask & (1 << b) )
166 unsigned * pSimInfo1, * pSimInfo2;
168 pSimInfo1 = (
unsigned *)p->
vSim0->pArray[pNode->
Id];
169 pSimInfo2 = (
unsigned *)p->
vSim1->pArray[pNode->
Id];
171 pSimInfo2[k] = ~pSimInfo1[k];
187 unsigned * pSimInfo1, * pSimInfo2;
189 pSimInfo1 = (
unsigned *)p->
vSim0->pArray[pNode->
Id];
190 pSimInfo2 = (
unsigned *)p->
vSim1->pArray[pNode->
Id];
192 if ( pSimInfo2[k] != pSimInfo1[k] )
233 unsigned * pSimmNode, * pSimmNode1, * pSimmNode2;
234 int k, fComp1, fComp2;
239 pSimmNode = (
unsigned *)p->
vSim1->pArray[ pNode->
Id ];
241 pSimmNode = (
unsigned *)p->
vSim0->pArray[ pNode->
Id ];
255 if ( fComp1 && fComp2 )
257 pSimmNode[k] = ~pSimmNode1[k] & ~pSimmNode2[k];
258 else if ( fComp1 && !fComp2 )
260 pSimmNode[k] = ~pSimmNode1[k] & pSimmNode2[k];
261 else if ( !fComp1 && fComp2 )
263 pSimmNode[k] = pSimmNode1[k] & ~pSimmNode2[k];
266 pSimmNode[k] = pSimmNode1[k] & pSimmNode2[k];
272 pSimmNode = (
unsigned *)p->
vSim1->pArray[ pNode->
Id ];
274 pSimmNode = (
unsigned *)p->
vSim0->pArray[ pNode->
Id ];
284 pSimmNode[k] = ~pSimmNode1[k];
287 pSimmNode[k] = pSimmNode1[k];
304 unsigned * pSimmNode, * pSimmNode1, * pSimmNode2;
305 int k, fComp1, fComp2;
311 pSimmNode += nOffset;
312 pSimmNode1 += nOffset;
313 pSimmNode2 += nOffset;
316 if ( fComp1 && fComp2 )
317 for ( k = 0; k < nSimWords; k++ )
318 pSimmNode[k] = ~pSimmNode1[k] & ~pSimmNode2[k];
319 else if ( fComp1 && !fComp2 )
320 for ( k = 0; k < nSimWords; k++ )
321 pSimmNode[k] = ~pSimmNode1[k] & pSimmNode2[k];
322 else if ( !fComp1 && fComp2 )
323 for ( k = 0; k < nSimWords; k++ )
324 pSimmNode[k] = pSimmNode1[k] & ~pSimmNode2[k];
326 for ( k = 0; k < nSimWords; k++ )
327 pSimmNode[k] = pSimmNode1[k] & pSimmNode2[k];
343 unsigned * pSimmNode, * pSimmNode1;
349 pSimmNode += nOffset + (fShift > 0)*nSimWords;
350 pSimmNode1 += nOffset;
353 for ( k = 0; k < nSimWords; k++ )
354 pSimmNode[k] = ~pSimmNode1[k];
356 for ( k = 0; k < nSimWords; k++ )
357 pSimmNode[k] = pSimmNode1[k];
404 unsigned char * pBytes;
405 int nOnes, nBytes, i;
406 pBytes = (
unsigned char *)pSimInfo;
407 nBytes = 4 * nSimWords;
409 for ( i = 0; i < nBytes; i++ )
450 for ( k = 0; k < nSimWords; k++ )
468 for ( k = 0; k < nSimWords; k++ )
469 pPatRand[k] = ~pPatRand[k];
486 for ( k = 0; k < nSimWords; k++ )
506 for ( k = 0; k < nSimWords; k++ )
507 if ( pPats1[k] != pPats2[k] )
526 for ( k = 0; k < nSimWords; k++ )
527 if ( pPats1[k] & ~pPats2[k] )
546 for ( k = 0; k < nSimWords; k++ )
547 if ( ~pPats1[k] & ~pPats2[k] )
571 nPairs = nOnes * (nOnes - 1) / 2;
591 int i, k, Index1, Index2;
615 int i, k, Index1, Index2;
619 printf(
"(%d,%d) ", i, k );
639 for ( i = 0; i < p->nOutputs; i++ )
641 printf(
"Output %2d :", i );
661 int nPairsTotal, nPairsSym, nPairsNonSym, i;
665 p->nPairsNonSymm = 0;
666 for ( i = 0; i < p->nOutputs; i++ )
671 assert( nPairsTotal >= nPairsSym + nPairsNonSym );
672 if ( nPairsTotal == nPairsSym + nPairsNonSym )
674 p->nPairsSymm += nPairsSym;
675 p->nPairsNonSymm += nPairsNonSym;
680 assert( nPairsTotal >= nPairsSym + nPairsNonSym );
683 p->nPairsSymm += nPairsSym;
684 p->nPairsNonSymm += nPairsNonSym;
688 p->nPairsRem = p->nPairsTotal-p->nPairsSymm-p->nPairsNonSymm;
706 for ( i = 0; i < p->nOutputs; i++ )
void Sim_UtilInfoDetectNews(unsigned *pInfo1, unsigned *pInfo2, int nWords, Vec_Int_t *vDiffs)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
void Sim_UtilInfoFree(Vec_Ptr_t *p)
int Sim_UtilInfoCompare(Sim_Man_t *p, Abc_Obj_t *pNode)
void Sim_UtilInfoDetectDiffs(unsigned *pInfo1, unsigned *pInfo2, int nWords, Vec_Int_t *vDiffs)
static int Abc_ObjFaninC1(Abc_Obj_t *pObj)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
void Sim_UtilInfoAdd(unsigned *pInfo1, unsigned *pInfo2, int nWords)
int Sim_UtilCountOnes(unsigned *pSimInfo, int nSimWords)
#define SIM_RANDOM_UNSIGNED
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Vec_Int_t * Sim_UtilCountOnesArray(Vec_Ptr_t *vInfo, int nSimWords)
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
int Sim_UtilInfoIsEqual(unsigned *pPats1, unsigned *pPats2, int nSimWords)
#define ABC_ALLOC(type, num)
#define Abc_NtkForEachCo(pNtk, pCo, i)
typedefABC_NAMESPACE_HEADER_START struct Sym_Man_t_ Sym_Man_t
INCLUDES ///.
static abctime Abc_Clock()
int Sim_UtilInfoIsClause(unsigned *pPats1, unsigned *pPats2, int nSimWords)
static int Vec_PtrSize(Vec_Ptr_t *p)
static int Abc_ObjFaninId0(Abc_Obj_t *pObj)
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
static Vec_Int_t * Vec_IntStart(int nSize)
void Sim_UtilSetRandom(unsigned *pPatRand, int nSimWords)
static int Vec_IntEntry(Vec_Int_t *p, int i)
#define ABC_NAMESPACE_IMPL_END
void Sim_UtilSimulate(Sim_Man_t *p, int fType)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
void Sim_UtilCountPairsAllPrint(Sym_Man_t *p)
#define Sim_SuppStrHasVar(vSupps, pNode, v)
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
void Sim_UtilSimulateNode(Sim_Man_t *p, Abc_Obj_t *pNode, int fType, int fType1, int fType2)
static ABC_NAMESPACE_IMPL_START int bit_count[256]
DECLARATIONS ///.
int Sim_UtilMatrsAreDisjoint(Sym_Man_t *p)
#define Abc_NtkForEachNode(pNtk, pNode, i)
void Sim_UtilSetCompl(unsigned *pPatRand, int nSimWords)
static Vec_Int_t * Vec_VecEntryInt(Vec_Vec_t *p, int i)
#define ABC_NAMESPACE_IMPL_START
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
#define Abc_NtkForEachCi(pNtk, pCi, i)
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
int Sim_UtilCountAllPairs(Vec_Ptr_t *vSuppFun, int nSimWords, Vec_Int_t *vCounters)
Vec_Ptr_t * Sim_UtilInfoAlloc(int nSize, int nWords, int fClean)
FUNCTION DEFINITIONS ///.
void Sim_UtilCountPairsAll(Sym_Man_t *p)
void Sim_UtilSetConst(unsigned *pPatRand, int nSimWords, int fConst1)
int Sim_UtilCountSuppSizes(Sim_Man_t *p, int fStruct)
int Sim_UtilInfoIsImp(unsigned *pPats1, unsigned *pPats2, int nSimWords)
static int Abc_ObjFaninId1(Abc_Obj_t *pObj)
void Sim_UtilSimulateNodeOne(Abc_Obj_t *pNode, Vec_Ptr_t *vSimInfo, int nSimWords, int nOffset)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
int Sim_UtilCountPairsOne(Extra_BitMat_t *pMat, Vec_Int_t *vSupport)
void Sim_UtilInfoFlip(Sim_Man_t *p, Abc_Obj_t *pNode)
int Sim_UtilCountPairsOnePrint(Extra_BitMat_t *pMat, Vec_Int_t *vSupport)
#define Sim_SuppFunHasVar(vSupps, Output, v)
void Sim_UtilTransferNodeOne(Abc_Obj_t *pNode, Vec_Ptr_t *vSimInfo, int nSimWords, int nOffset, int fShift)
static void Vec_PtrFree(Vec_Ptr_t *p)