107 p->
nWords = pPars->nWords;
151 if ( nProbNum == -1 )
155 for ( w = p->
nWords-1; w >= 0; w-- )
158 else if ( nProbNum > 0 )
161 for ( i = 0; i < nProbNum; i++ )
163 for ( w = p->
nWords-1; w >= 0; w-- )
166 else if ( nProbNum == 0 )
168 for ( w = p->
nWords-1; w >= 0; w-- )
190 if ( nProbNum == -1 )
195 else if ( nProbNum >= 0 )
198 for ( i = 0; i < nProbNum; i++ )
203 for ( w = p->
nWords-1; w >= 0; w-- )
204 pInfo[w] = (pInfo[w] << 16) | ((pInfo[w] ^ Mask) & 0xffff);
221 for ( w = p->
nWords-1; w >= 0; w-- )
239 for ( w = p->
nWords-1; w >= 0; w-- )
257 for ( w = p->
nWords-1; w >= 0; w-- )
258 pInfo[w] = pInfo0[w];
275 for ( w = p->
nWords-1; w >= 0; w-- )
276 pInfo[w] = (pInfo[w] << 16) | (pInfo0[w] & 0xffff);
295 for ( w = p->
nWords-1; w >= 0; w-- )
296 pInfo[w] = pInfo0[w];
316 for ( w = p->
nWords-1; w >= 0; w-- )
317 pInfo[w] = ~pInfo0[w];
319 for ( w = p->
nWords-1; w >= 0; w-- )
320 pInfo[w] = pInfo0[w];
343 for ( w = p->
nWords-1; w >= 0; w-- )
344 pInfo[w] = ~(pInfo0[w] | pInfo1[w]);
346 for ( w = p->
nWords-1; w >= 0; w-- )
347 pInfo[w] = ~pInfo0[w] & pInfo1[w];
352 for ( w = p->
nWords-1; w >= 0; w-- )
353 pInfo[w] = pInfo0[w] & ~pInfo1[w];
355 for ( w = p->
nWords-1; w >= 0; w-- )
356 pInfo[w] = pInfo0[w] & pInfo1[w];
436 for ( w = p->
nWords-1; w >= 0; w-- )
457 for ( w = p->
nWords-1; w >= 0; w-- )
501 if ( p->
pPars->fProbTrans )
524 int nTotal = 32 * nSimWords;
525 return (
float)2.0 * nOnes / nTotal * (nTotal - nOnes) / nTotal;
541 int nTotal = 32 * nSimWords;
542 return (
float)nOnes /
nTotal;
564 if ( pPars->fProbOne && pPars->fProbTrans )
565 printf(
"Conflict of options: Can either compute probability of 1, or probability of switching by observing transitions.\n" );
569 if ( pPars->fVerbose )
571 printf(
"Obj = %8d (%8d). F = %6d. ",
573 printf(
"AIG = %7.2f MB. F-mem = %7.2f MB. Other = %7.2f MB. ",
582 for ( i = 0; i < pPars->nIters; i++ )
585 if ( i == pPars->nIters - 1 )
587 if ( pPars->fProbTrans )
592 if ( pPars->fVerbose )
594 printf(
"Simulated %d frames with %d words. ", pPars->nIters, pPars->nWords );
599 pSwitching = (
float *)vSwitching->pArray;
600 if ( pPars->fProbOne )
612 else if ( pPars->fProbTrans )
664 pPars->nIters = nFrames;
667 pPars->nPref = nPref;
673 pPars->fProbTrans = 0;
679 pPars->fProbTrans = 1;
722 float SwitchTotal = 0.0;
784 float * pSwi = (
float *)
Vec_IntArray(vSwitching), SwiTotal = 0;
791 SwiTotal += pSwi[iFan];
static int * Vec_IntArray(Vec_Int_t *p)
static void Gia_ManSwiSimInfoZero(Gia_ManSwi_t *p, unsigned *pInfo)
void Gia_ManCreateRefs(Gia_Man_t *p)
Gia_Man_t * Gia_ManFromAigSwitch(Aig_Man_t *p)
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
void Gia_ManStop(Gia_Man_t *p)
#define Gia_ManForEachCo(p, pObj, i)
static int Gia_ManPoNum(Gia_Man_t *p)
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
float Gia_ManComputeSwitching(Gia_Man_t *p, int nFrames, int nPref, int fProbOne)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
static int Gia_ObjDiff1(Gia_Obj_t *pObj)
static int Gia_ManSwiSimInfoCountOnes(Gia_ManSwi_t *p, int iPlace)
static int Gia_ObjValue(Gia_Obj_t *pObj)
static int Gia_ObjRefNum(Gia_Man_t *p, Gia_Obj_t *pObj)
static int Gia_WordCountOnes(unsigned uWord)
#define ABC_ALLOC(type, num)
static void Gia_ManSwiSimulateCo(Gia_ManSwi_t *p, int iCo, Gia_Obj_t *pObj)
static abctime Abc_Clock()
static void Gia_ManSwiSimInfoCopyShift(Gia_ManSwi_t *p, unsigned *pInfo, unsigned *pInfo0)
static void Gia_ManSwiSimInfoRandom(Gia_ManSwi_t *p, unsigned *pInfo, int nProbNum)
static void Gia_ManSwiSimInfoRandomShift(Gia_ManSwi_t *p, unsigned *pInfo, int nProbNum)
static void Gia_ManSwiSimulateCi(Gia_ManSwi_t *p, Gia_Obj_t *pObj, int iCi)
#define Gia_ManForEachLut(p, i)
unsigned Gia_ManRandom(int fReset)
FUNCTION DEFINITIONS ///.
Vec_Int_t * Gia_ManComputeSwitchProbs(Gia_Man_t *pGia, int nFrames, int nPref, int fProbOne)
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
static int Gia_ManAndNum(Gia_Man_t *p)
static Vec_Int_t * Vec_IntStart(int nSize)
static void Gia_ManSwiSimInfoCopy(Gia_ManSwi_t *p, unsigned *pInfo, unsigned *pInfo0)
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
static int Gia_ManSwiSimInfoCountTrans(Gia_ManSwi_t *p, int iPlace)
static void Gia_ManSwiSimInfoInit(Gia_ManSwi_t *p)
Vec_Int_t * Gia_ManSwiSimulate(Gia_Man_t *pAig, Gia_ParSwi_t *pPars)
Vec_Int_t * Saig_ManComputeSwitchProbs(Aig_Man_t *pAig, int nFrames, int nPref, int fProbOne)
static void Gia_ManSwiSimInfoTransferShift(Gia_ManSwi_t *p, int nProbNum)
Vec_Flt_t * Gia_ManPrintOutputProb(Gia_Man_t *p)
static void Gia_ManSwiSimulateRound(Gia_ManSwi_t *p, int fCount)
static int Vec_IntEntry(Vec_Int_t *p, int i)
Gia_Man_t * Gia_ManFront(Gia_Man_t *p)
#define ABC_NAMESPACE_IMPL_END
unsigned char * pSwitching
static int Gia_ObjIsAndOrConst0(Gia_Obj_t *pObj)
#define Gia_ManForEachAnd(p, pObj, i)
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
static void Gia_ManSwiSimulateNode(Gia_ManSwi_t *p, Gia_Obj_t *pObj)
float Gia_ManSwiComputeSwitching(int nOnes, int nSimWords)
static int Gia_ObjDiff0(Gia_Obj_t *pObj)
static int Aig_ManObjNumMax(Aig_Man_t *p)
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
#define ABC_NAMESPACE_IMPL_START
static int Gia_ManCiNum(Gia_Man_t *p)
typedefABC_NAMESPACE_IMPL_START struct Gia_ParSwi_t_ Gia_ParSwi_t
DECLARATIONS ///.
static int Gia_ManHasMapping(Gia_Man_t *p)
#define Aig_ManForEachObj(p, pObj, i)
static unsigned * Gia_SwiData(Gia_ManSwi_t *p, int i)
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
#define GIA_NONE
INCLUDES ///.
static int Abc_Lit2Var(int Lit)
#define ABC_CALLOC(type, num)
static unsigned * Gia_SwiDataCo(Gia_ManSwi_t *p, int i)
void Gia_ManSetDefaultParamsSwi(Gia_ParSwi_t *p)
FUNCTION DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Flt_t_ Vec_Flt_t
INCLUDES ///.
ABC_DLL char * Abc_FrameReadFlag(char *pFlag)
#define Gia_ManForEachObj1(p, pObj, i)
static void Gia_ManSwiSimInfoOne(Gia_ManSwi_t *p, unsigned *pInfo)
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
static void Vec_IntFree(Vec_Int_t *p)
Gia_ManSwi_t * Gia_ManSwiCreate(Gia_Man_t *pAig, Gia_ParSwi_t *pPars)
static int Gia_ManPiNum(Gia_Man_t *p)
static void Gia_ManSwiSimInfoTransfer(Gia_ManSwi_t *p, int nProbNum)
static int Gia_ObjFaninId1(Gia_Obj_t *pObj, int ObjId)
void Gia_ManSwiDelete(Gia_ManSwi_t *p)
float Gia_ManSwiComputeProbOne(int nOnes, int nSimWords)
float Gia_ManEvaluateSwitching(Gia_Man_t *p)
#define Gia_LutForEachFanin(p, i, iFan, k)
static int Gia_ObjCioId(Gia_Obj_t *pObj)
static int Gia_ManObjNum(Gia_Man_t *p)
int nTotal
DECLARATIONS ///.
static unsigned * Gia_SwiDataCi(Gia_ManSwi_t *p, int i)
static int Gia_ObjFaninId0(Gia_Obj_t *pObj, int ObjId)
static int Gia_ManCoNum(Gia_Man_t *p)
static int Gia_ManRegNum(Gia_Man_t *p)