101 #define Gli_ManForEachObj( p, pObj, i ) \
102 for ( i = 0; (i < p->nObjData) && (pObj = Gli_ManObj(p,i)); i += Gli_ObjSize(pObj) )
103 #define Gli_ManForEachNode( p, pObj, i ) \
104 for ( i = 0; (i < p->nObjData) && (pObj = Gli_ManObj(p,i)); i += Gli_ObjSize(pObj) ) if ( Gli_ObjIsTerm(pObj) ) {} else
106 #define Gli_ManForEachEntry( vVec, p, pObj, i ) \
107 for ( i = 0; (i < Vec_IntSize(vVec)) && (pObj = Gli_ManObj(p,Vec_IntEntry(vVec,i))); i++ )
108 #define Gli_ManForEachCi( p, pObj, i ) \
109 for ( i = 0; (i < Vec_IntSize(p->vCis)) && (pObj = Gli_ManObj(p,Vec_IntEntry(p->vCis,i))); i++ )
110 #define Gli_ManForEachCo( p, pObj, i ) \
111 for ( i = 0; (i < Vec_IntSize(p->vCos)) && (pObj = Gli_ManObj(p,Vec_IntEntry(p->vCos,i))); i++ )
113 #define Gli_ManForEachPi( p, pObj, i ) \
114 for ( i = 0; (i < Gli_ManPiNum(p)) && ((pObj) = Gli_ManCi(p, i)); i++ )
115 #define Gli_ManForEachPo( p, pObj, i ) \
116 for ( i = 0; (i < Gli_ManPoNum(p)) && ((pObj) = Gli_ManCo(p, i)); i++ )
117 #define Gli_ManForEachRo( p, pObj, i ) \
118 for ( i = 0; (i < Gli_ManRegNum(p)) && ((pObj) = Gli_ManCi(p, Gli_ManPiNum(p)+i)); i++ )
119 #define Gli_ManForEachRi( p, pObj, i ) \
120 for ( i = 0; (i < Gli_ManRegNum(p)) && ((pObj) = Gli_ManCo(p, Gli_ManPoNum(p)+i)); i++ )
121 #define Gli_ManForEachRiRo( p, pObjRi, pObjRo, i ) \
122 for ( i = 0; (i < Gli_ManRegNum(p)) && ((pObjRi) = Gli_ManCo(p, Gli_ManPoNum(p)+i)) && ((pObjRo) = Gli_ManCi(p, Gli_ManPiNum(p)+i)); i++ )
124 #define Gli_ObjForEachFanin( pObj, pNext, i ) \
125 for ( i = 0; (i < (int)pObj->nFanins) && (pNext = Gli_ObjFanin(pObj,i)); i++ )
126 #define Gli_ObjForEachFanout( pObj, pNext, i ) \
127 for ( i = 0; (i < (int)pObj->nFanouts) && (pNext = Gli_ObjFanout(pObj,i)); i++ )
198 printf(
"Node %d \n", pObj->Handle );
199 printf(
"Fanins: " );
201 printf(
"%d ", pNext->Handle );
203 printf(
"Fanouts: " );
205 printf(
"%d ", pNext->Handle );
228 assert( pObj->iFanin == (
int)pObj->nFanins );
229 assert( pObj->iFanout == (
int)pObj->nFanouts );
248 assert( pObj->iFanin < (
int)pObj->nFanins );
249 assert( pFanin->iFanout < (
int)pFanin->nFanouts );
250 pFanin->Fanios[pFanin->nFanins + pFanin->iFanout++] =
251 pObj->Fanios[pObj->iFanin++] = pObj->Handle - pFanin->Handle;
270 pObj->nFanins = nFanins;
271 pObj->nFanouts = nFanouts;
315 pObj->fPhase = pObj->fPhase2 = pFanin->fPhase;
334 for ( i = 0; i < (int)pNode->nFanins; i++ )
353 for ( i = 0; i < (int)pNode->nFanins; i++ )
377 pObj->uTruth[0] = puTruth[0];
378 pObj->uTruth[1] = puTruth[
Vec_IntSize(vFanins) == 6];
430 float Multi = 1.0 / (1 << 16);
432 assert( 0.0 < PiTransProb && PiTransProb < 1.0 );
462 if ( (p->
pSimInfoPrev[i] ^ pObj->uSimInfo) & (1 << iBit) )
528 if ( pFanout->fMark )
565 assert( pObj->fPhase == pObj->fPhase2 );
566 assert( pObj->nGlitches >= pObj->nSwitches );
583 unsigned pSimInfos[6], Result = 0;
589 pSimInfos[i] = pFanin->uSimInfo;
590 for ( i = 0; i < 32; i++ )
593 for ( k = 0; k < nFanins; k++ )
594 if ( (pSimInfos[k] >> i) & 1 )
615 float Multi = 1.0 / (1 << 16);
617 if ( PiTransProb == 0.5 )
619 for ( i = 0; i < 32; i++ )
645 for ( f = 0; f < nPref; f++ )
656 pObjRo->uSimInfo = pObjRi->uSimInfo;
681 pObj->fPhase = pObj->fPhase2 = ((p->
pSimInfoPrev[i] >> iBit) & 1);
700 float Multi = 1.0 / (1 << 16);
702 assert( 0.0 < PiTransProb && PiTransProb < 1.0 );
705 pObj->fPhase = pObj->fPhase2 =
Gli_ObjFanin(pObj, 0)->fPhase;
719 if ( pObjRi->fPhase != pObj->fPhase )
749 for ( i = 0; i < nPatterns; i++ )
761 for ( i = 0; i < 32; i++ )
764 for ( k = 0; k < nIters; k++ )
775 printf(
"\nSimulated %d patterns. ", nPatterns );
static int Gli_ObjIsTerm(Gli_Obj_t *pObj)
void Gli_ManPrintObjects(Gli_Man_t *p)
unsigned Gli_ManSimulateSeqNode(Gli_Man_t *p, Gli_Obj_t *pNode)
int Gli_ManCreateCi(Gli_Man_t *p, int nFanouts)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
static int Abc_InfoHasBit(unsigned *p, int i)
void Gli_ManGlitching(Gli_Man_t *p)
static Gli_Obj_t * Gli_ManCi(Gli_Man_t *p, int v)
int Gli_ObjNumGlitches(Gli_Man_t *p, int iNode)
static Gli_Obj_t * Gli_ObjFanin(Gli_Obj_t *pObj, int i)
void Gli_ManSwitching(Gli_Man_t *p)
static Gli_Obj_t * Gli_ManCo(Gli_Man_t *p, int v)
static Gli_Obj_t * Gli_ManPo(Gli_Man_t *p, int v)
#define ABC_ALLOC(type, num)
static int Gli_ManCoNum(Gli_Man_t *p)
static abctime Abc_Clock()
#define Gli_ObjForEachFanin(pObj, pNext, i)
static Gli_Obj_t * Gli_ManObj(Gli_Man_t *p, int v)
static int Gli_NodeComputeValue(Gli_Obj_t *pNode)
void Gli_ManFinalize(Gli_Man_t *p)
static int Gli_ObjSize(Gli_Obj_t *pObj)
#define Gli_ManForEachCo(p, pObj, i)
typedefABC_NAMESPACE_IMPL_START struct Gli_Obj_t_ Gli_Obj_t
DECLARATIONS ///.
unsigned Gia_ManRandom(int fReset)
FUNCTION DEFINITIONS ///.
void Gli_ManSimulateSeqPref(Gli_Man_t *p, int nPref)
void Gli_ObjAddFanin(Gli_Obj_t *pObj, Gli_Obj_t *pFanin)
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
void Gli_ManSetPiRandomSeq(Gli_Man_t *p, float PiTransProb)
static int Gli_ManNodeNum(Gli_Man_t *p)
#define Gli_ObjForEachFanout(pObj, pNext, i)
static int Vec_IntEntry(Vec_Int_t *p, int i)
Gli_Obj_t * Gli_ObjAlloc(Gli_Man_t *p, int nFanins, int nFanouts)
static Gli_Obj_t * Gli_ManRo(Gli_Man_t *p, int v)
#define ABC_NAMESPACE_IMPL_END
static int Gli_ManCiNum(Gli_Man_t *p)
static Gli_Obj_t * Gli_ObjFanout(Gli_Obj_t *pObj, int i)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
#define Gli_ManForEachObj(p, pObj, i)
#define Gli_ManForEachCi(p, pObj, i)
static unsigned Gli_ManUpdateRandomInput(unsigned uInfo, float PiTransProb)
int Gli_ManCreateNode(Gli_Man_t *p, Vec_Int_t *vFanins, int nFanouts, unsigned *puTruth)
static int Gli_ManRegNum(Gli_Man_t *p)
void Gli_ManSwitchesAndGlitches(Gli_Man_t *p, int nPatterns, float PiTransProb, int fVerbose)
void Gli_ManSetDataSaved(Gli_Man_t *p, int iBit)
#define ABC_NAMESPACE_IMPL_START
static int Gli_ManPoNum(Gli_Man_t *p)
static int Gli_ManObjNum(Gli_Man_t *p)
static int Gli_NodeComputeValue2(Gli_Obj_t *pNode)
#define Gli_ManForEachEntry(vVec, p, pObj, i)
#define Gli_ManForEachRi(p, pObj, i)
int Gli_ManCreateCo(Gli_Man_t *p, int iFanin)
static int Vec_IntSize(Vec_Int_t *p)
static int Gli_ObjIsNode(Gli_Obj_t *pObj)
static int Gli_ObjIsCo(Gli_Obj_t *pObj)
static int Gli_ObjIsCi(Gli_Obj_t *pObj)
static Gli_Obj_t * Gli_ManPi(Gli_Man_t *p, int v)
void Gli_ManStop(Gli_Man_t *p)
static int Gli_ObjFaninNum(Gli_Obj_t *pObj)
#define ABC_CALLOC(type, num)
void Gli_ManVerify(Gli_Man_t *p)
void Gli_ManSetPiRandom(Gli_Man_t *p, float PiTransProb)
static Gli_Obj_t * Gli_ManRi(Gli_Man_t *p, int v)
static int Abc_BitWordNum(int nBits)
static int Gli_ManPiNum(Gli_Man_t *p)
#define Gli_ManForEachPi(p, pObj, i)
static void Vec_IntFree(Vec_Int_t *p)
int Gli_ObjNumSwitches(Gli_Man_t *p, int iNode)
static void Vec_IntClear(Vec_Int_t *p)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
#define Gli_ManForEachRiRo(p, pObjRi, pObjRo, i)
void Gli_ManSetPiFromSaved(Gli_Man_t *p, int iBit)
Gli_Man_t * Gli_ManAlloc(int nObjs, int nRegs, int nFanioPairs)
FUNCTION DEFINITIONS ///.
#define Gli_ManForEachRo(p, pObj, i)
static int Gli_ObjFanoutNum(Gli_Obj_t *pObj)
#define Gli_ManForEachNode(p, pObj, i)