152 for ( i = nWords - 1; i >= 0; i-- )
155 p[i] = (Num & 1)? 0xff : 0;
156 p[i] = (p[i] << 8) | ((Num & 2)? 0xff : 0);
157 p[i] = (p[i] << 8) | ((Num & 4)? 0xff : 0);
158 p[i] = (p[i] << 8) | ((Num & 8)? 0xff : 0);
182 if ( i < p->nTruePis )
216 unsigned char * pInfo;
217 int i, k, z, s, nPats;
232 for ( z = 0; z < 2; z++ )
240 pInfo[nPats] = z ? 0xff : 0;
252 pInfo[nPats] = ((i == k) ^ z) ? 0xff : 0;
263 nPatsSource[0] = p->
nPats0;
264 vPatsSource[0] = p->
vPats0;
265 nPatsSource[1] = p->
nPats1;
266 vPatsSource[1] = p->
vPats1;
270 nPatsSource[0] = p->
nPats1;
271 vPatsSource[0] = p->
vPats1;
272 nPatsSource[1] = p->
nPats0;
273 vPatsSource[1] = p->
vPats0;
275 for ( z = 0; z < 2; z++ )
277 for ( s = nPatsSource[z] - 1; s >= 0; s-- )
310 for ( z = nPats; z < p->
nBytesIn; z++ )
347 unsigned * pInfo, * pInfo2;
355 for ( w = 0; w < p->
nWords; w++ )
356 pInfo[w] = pInfo2[w];
373 unsigned * pInfo, * pInfo1, * pInfo2;
374 int k, fComp1, fComp2;
382 if ( fComp1 && fComp2 )
383 for ( k = 0; k < nSimWords; k++ )
384 pInfo[k] = ~pInfo1[k] & ~pInfo2[k];
385 else if ( fComp1 && !fComp2 )
386 for ( k = 0; k < nSimWords; k++ )
387 pInfo[k] = ~pInfo1[k] & pInfo2[k];
388 else if ( !fComp1 && fComp2 )
389 for ( k = 0; k < nSimWords; k++ )
390 pInfo[k] = pInfo1[k] & ~pInfo2[k];
392 for ( k = 0; k < nSimWords; k++ )
393 pInfo[k] = pInfo1[k] & pInfo2[k];
409 unsigned * pInfo, * pInfo1;
417 for ( k = 0; k < nSimWords; k++ )
418 pInfo[k] = ~pInfo1[k];
420 for ( k = 0; k < nSimWords; k++ )
421 pInfo[k] = pInfo1[k];
462 assert( nPats > 0 && nPats < nWords * 8 * (
int)
sizeof(
unsigned) );
464 if ( nPats < 8 *
sizeof(
unsigned) )
468 pInfo[0] |= ((~0) << nPats);
469 nPats = 8 *
sizeof(unsigned);
472 iWords = nPats / (8 *
sizeof(unsigned));
475 for ( w = iWords; w <
nWords; w++ )
493 unsigned * pInfo, * pInfo2;
500 for ( j = 0; j < p->
nPats; j++ )
501 for ( w = 0; w < p->
nWords; w++ )
502 *pInfo2++ = pInfo[w];
519 unsigned * pInfo, * pInfo2;
526 for ( j = 0; j < p->
nPats; j++, pInfo2 += p->
nWords )
528 for ( w = 0; w < p->
nWords; w++ )
529 pInfo2[w] = ~pInfo2[w];
589 unsigned char * pInfoCare, * pInfoNode;
597 else if ( !pInfoNode[i] )
607 printf(
"Dc = %7.2f %% ", 100.0*(*pnDcs) /nTotal );
608 printf(
"On = %7.2f %% ", 100.0*(*pnOnes) /nTotal );
609 printf(
"Off = %7.2f %% ", 100.0*(*pnZeros)/nTotal );
627 unsigned char * pInfoCare, * pInfoNode, * pInfo;
637 assert( pInfoNode[i] == 0 || pInfoNode[i] == 0xff );
647 assert( pInfo[i] == 0 || pInfo[i] == 0xff );
662 assert( pInfo[i] == 0 || pInfo[i] == 0xff );
674 printf(
"On = %3d ", p->
nPats1 );
675 printf(
"Off = %3d ", p->
nPats0 );
694 unsigned * pInfo, * pInfo2;
711 pInfo[0] = value ? ~0 : 0;
716 assert( pInfo[0] == 0 || pInfo[0] == ~0 );
733 int i, nOnes = 0, nZeros = 0, nDcs = 0;
760 for ( i = 0; i < 2; i++ )
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
void Res_SimSetGiven(Res_Sim_t *p, Vec_Ptr_t *vInfo)
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
static int Abc_ObjFaninC1(Abc_Obj_t *pObj)
void Res_SimPrintNodePatterns(Res_Sim_t *p, Abc_Ntk_t *pAig)
static int Abc_InfoHasBit(unsigned *p, int i)
void Res_SimAdjust(Res_Sim_t *p, Abc_Ntk_t *pAig, int nTruePis)
void Res_SimCountResults(Res_Sim_t *p, int *pnDcs, int *pnOnes, int *pnZeros, int fVerbose)
static void Abc_InfoFill(unsigned *p, int nWords)
int Res_SimVerifyValue(Res_Sim_t *p, int fOnSet)
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
#define ABC_ALLOC(type, num)
static int Vec_PtrSize(Vec_Ptr_t *p)
static void Vec_VecFree(Vec_Vec_t *p)
static int Abc_ObjFaninId0(Abc_Obj_t *pObj)
int Res_SimPrepare(Res_Sim_t *p, Abc_Ntk_t *pAig, int nTruePis, int fVerbose)
void Res_SimPerformOne(Abc_Obj_t *pNode, Vec_Ptr_t *vSimInfo, int nSimWords)
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
ABC_NAMESPACE_IMPL_START Res_Sim_t * Res_SimAlloc(int nWords)
DECLARATIONS ///.
#define Abc_AigForEachAnd(pNtk, pNode, i)
void Res_SimSetRandomBytes(Res_Sim_t *p)
void Res_SimCollectPatterns(Res_Sim_t *p, int fVerbose)
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
int Res_SatSimulate(Res_Sim_t *p, int nPats, int fOnSet)
#define ABC_NAMESPACE_IMPL_END
void Abc_InfoRandomBytes(unsigned *p, int nWords)
static Vec_Vec_t * Vec_VecStart(int nSize)
static void Abc_InfoClear(unsigned *p, int nWords)
void Res_SimTransferOne(Abc_Obj_t *pNode, Vec_Ptr_t *vSimInfo, int nSimWords)
#define ABC_NAMESPACE_IMPL_START
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
static void Abc_InfoSetBit(unsigned *p, int i)
void Res_SimFree(Res_Sim_t *p)
void Res_SimSetDerivedBytes(Res_Sim_t *p, int fUseWalk)
void Res_SimPrintOutPatterns(Res_Sim_t *p, Abc_Ntk_t *pAig)
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
void Extra_PrintBinary(FILE *pFile, unsigned Sign[], int nBits)
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
void Res_SimDeriveInfoReplicate(Res_Sim_t *p)
void Res_SimDeriveInfoComplement(Res_Sim_t *p)
void Res_SimPerformRound(Res_Sim_t *p, int nWords)
static void Abc_InfoRandom(unsigned *p, int nWords)
static int Abc_ObjFaninId1(Abc_Obj_t *pObj)
#define Abc_NtkForEachPo(pNtk, pPo, i)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
void Res_SimPadSimInfo(Vec_Ptr_t *vPats, int nPats, int nWords)
int nTotal
DECLARATIONS ///.
static Vec_Ptr_t * Vec_PtrAllocSimInfo(int nEntries, int nWords)
#define Abc_NtkForEachPi(pNtk, pPi, i)
static void Vec_PtrFree(Vec_Ptr_t *p)