34static inline void Ssc_SimAnd(
word * pSim,
word * pSim0,
word * pSim1,
int nWords,
int fComp0,
int fComp1 )
37 if ( fComp0 && fComp1 )
for ( w = 0; w <
nWords; w++ ) pSim[w] = ~(pSim0[w] | pSim1[w]);
38 else if ( fComp0 )
for ( w = 0; w <
nWords; w++ ) pSim[w] = ~pSim0[w] & pSim1[w];
39 else if ( fComp1 )
for ( w = 0; w <
nWords; w++ ) pSim[w] = pSim0[w] &~pSim1[w];
40 else for ( w = 0; w <
nWords; w++ ) pSim[w] = pSim0[w] & pSim1[w];
43static inline void Ssc_SimDup(
word * pSim,
word * pSim0,
int nWords,
int fComp0 )
46 if ( fComp0 )
for ( w = 0; w <
nWords; w++ ) pSim[w] = ~pSim0[w];
47 else for ( w = 0; w <
nWords; w++ ) pSim[w] = pSim0[w];
50static inline void Ssc_SimConst(
word * pSim,
int nWords,
int fComp0 )
53 if ( fComp0 )
for ( w = 0; w <
nWords; w++ ) pSim[w] = ~(
word)0;
54 else for ( w = 0; w <
nWords; w++ ) pSim[w] = 0;
57static inline void Ssc_SimOr(
word * pSim,
word * pSim0,
int nWords,
int fComp0 )
60 if ( fComp0 )
for ( w = 0; w <
nWords; w++ ) pSim[w] |= ~pSim0[w];
61 else for ( w = 0; w <
nWords; w++ ) pSim[w] |= pSim0[w];
64static inline int Ssc_SimFindBitWord(
word t )
67 if ( t == 0 )
return -1;
68 if ( (t & 0x00000000FFFFFFFF) == 0 ) { n += 32; t >>= 32; }
69 if ( (t & 0x000000000000FFFF) == 0 ) { n += 16; t >>= 16; }
70 if ( (t & 0x00000000000000FF) == 0 ) { n += 8; t >>= 8; }
71 if ( (t & 0x000000000000000F) == 0 ) { n += 4; t >>= 4; }
72 if ( (t & 0x0000000000000003) == 0 ) { n += 2; t >>= 2; }
73 if ( (t & 0x0000000000000001) == 0 ) { n++; }
76static inline int Ssc_SimFindBit(
word * pSim,
int nWords )
79 for ( w = 0; w <
nWords; w++ )
81 return 64*w + Ssc_SimFindBitWord(pSim[w]);
85static inline int Ssc_SimCountBitsWord(
word x )
87 x = x - ((x >> 1) &
ABC_CONST(0x5555555555555555));
89 x = (x + (x >> 4)) &
ABC_CONST(0x0F0F0F0F0F0F0F0F);
93 return (
int)(x & 0xFF);
95static inline int Ssc_SimCountBits(
word * pSim,
int nWords )
98 for ( w = 0; w <
nWords; w++ )
99 Counter += Ssc_SimCountBitsWord(pSim[w]);
122 int i,
nWords = Vec_WrdSize(
p) / nObjs;
123 assert( Vec_WrdSize(
p) % nObjs == 0 );
124 for ( i = 0; i < nObjs; i++ )
127 p->nSize =
p->nCap = 2*
nWords*nObjs;
144 if (
p->vSimsPi == NULL )
145 p->vSimsPi = Vec_WrdStart(0);
146 Vec_WrdFill(
p->vSimsPi,
nWords * Gia_ManCiNum(
p), 0 );
153 assert( Vec_IntSize(vPat) == Gia_ManCiNum(
p) );
154 if (
p->iPatsPi == 64 * Gia_ObjSimWords(
p) )
156 assert(
p->iPatsPi < 64 * Gia_ObjSimWords(
p) );
157 pSimPi = Gia_ObjSimPi(
p, 0 );
158 for ( i = 0; i < Gia_ManCiNum(
p); i++, pSimPi += Gia_ObjSimWords(
p) )
159 if ( Vec_IntEntry(vPat, i) )
160 Abc_InfoSetBit( (
unsigned *)pSimPi,
p->iPatsPi );
168 pSimPi = Gia_ObjSimPi(
p, 0 );
169 for ( i = 0; i < Gia_ManPiNum(
p); i++, pSimPi +=
nWords )
171 pSimPi[0] = vPivot ? Ssc_Random1(Vec_IntEntry(vPivot, i)) : Ssc_Random2();
172 for ( w = 1; w <
nWords; w++ )
173 pSimPi[w] = Ssc_Random();
185 pSimAig = Gia_ObjSimObj(
p, pObj );
205 int i, w,
nWords = Gia_ObjSimWords( pCare );
207 int Count = Ssc_SimCountBits( pCareMask,
nWords );
208 word * pSimPiCare, * pSimPiAig;
217 pSimPiAig = Gia_ObjSimPi( pAig, i );
218 pSimPiCare = Gia_ObjSimObj( pCare, pObj );
219 for ( w = 0; w <
nWords; w++ )
220 if ( Vec_IntEntry(vPivot, i) )
221 pSimPiAig[w] = pSimPiCare[w] | ~pCareMask[w];
223 pSimPiAig[w] = pSimPiCare[w] & pCareMask[w];
242 assert( Vec_WrdSize(
p->vSimsPi) % Gia_ManCiNum(
p) == 0 );
243 if (
p->vSims == NULL )
244 p->vSims = Vec_WrdAlloc(0);
245 Vec_WrdFill(
p->vSims, Gia_ObjSimWords(
p) * Gia_ManObjNum(
p), 0 );
250 word * pSim, * pSim0, * pSim1;
251 int i,
nWords = Gia_ObjSimWords(
p);
255 Ssc_SimConst( Gia_ObjSim(
p, 0),
nWords, 0 );
257 pSim = Gia_ObjSim(
p, 1 );
258 pSim0 = Gia_ObjSimPi(
p, 0 );
261 assert( pSim == Gia_ObjSimObj(
p, pObj ) );
262 Ssc_SimDup( pSim, pSim0,
nWords, 0 );
267 pSim = Gia_ObjSim(
p, 1+Gia_ManCiNum(
p) );
270 assert( pSim == Gia_ObjSim(
p, i ) );
273 Ssc_SimAnd( pSim, pSim0, pSim1,
nWords, Gia_ObjFaninC0(pObj), Gia_ObjFaninC1(pObj) );
277 pSim = Gia_ObjSim(
p, Gia_ManObjNum(
p) - Gia_ManPoNum(
p) );
280 assert( pSim == Gia_ObjSimObj(
p, pObj ) );
282 Ssc_SimDup( pSim, pSim0,
nWords, Gia_ObjFaninC0(pObj) );
302 int i,
nWords = Gia_ObjSimWords(
p );
305 Ssc_SimAnd( pRes, pRes, Gia_ObjSimObj(
p, pObj),
nWords, 0, 0 );
312 int i, iBit,
nWords = Gia_ObjSimWords(
p );
314 iBit = Ssc_SimFindBit( pRes,
nWords );
318 vInit = Vec_IntAlloc( 100 );
320 Vec_IntPush( vInit, Abc_InfoHasBit((
unsigned *)Gia_ObjSimObj(
p, pObj), iBit) );
346 int nWords = Gia_ObjSimWords(
p );
347 int Count = Ssc_SimCountBits( pRes,
nWords );
#define ABC_FALLOC(type, num)
#define ABC_CALLOC(type, num)
#define ABC_CONST(number)
PARAMETERS ///.
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
#define Gia_ManForEachPo(p, pObj, i)
#define Gia_ManForEachAnd(p, pObj, i)
struct Gia_Obj_t_ Gia_Obj_t
struct Gia_Man_t_ Gia_Man_t
#define Gia_ManForEachCi(p, pObj, i)
unsigned Gia_ManRandom(int fReset)
FUNCTION DEFINITIONS ///.
unsigned __int64 word
DECLARATIONS ///.
void Vec_WrdDoubleSimInfo(Vec_Wrd_t *p, int nObjs)
FUNCTION DEFINITIONS ///.
Vec_Int_t * Ssc_GiaGetOneSim(Gia_Man_t *p)
int Ssc_GiaTransferPiPattern(Gia_Man_t *pAig, Gia_Man_t *pCare, Vec_Int_t *vPivot)
int Ssc_GiaCountCaresSim(Gia_Man_t *p)
Vec_Int_t * Ssc_GiaFindPivotSim(Gia_Man_t *p)
void Ssc_GiaPrintPiPatterns(Gia_Man_t *p)
word * Ssc_GiaGetCareMask(Gia_Man_t *p)
void Ssc_GiaSimRound(Gia_Man_t *p)
void Ssc_GiaRandomPiPattern(Gia_Man_t *p, int nWords, Vec_Int_t *vPivot)
void Ssc_GiaSavePiPattern(Gia_Man_t *p, Vec_Int_t *vPat)
int Ssc_GiaEstimateCare(Gia_Man_t *p, int nWords)
void Ssc_GiaResetPiPattern(Gia_Man_t *p, int nWords)
void Ssc_GiaResetSimInfo(Gia_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.