30static inline word * Sbd_ObjSims(
Gia_Man_t *
p,
int i ) {
return Vec_WrdEntryP(
p->vSims,
p->iPatsPi * i ); }
31static inline word * Sbd_ObjCtrl(
Gia_Man_t *
p,
int i ) {
return Vec_WrdEntryP(
p->vSimsPi,
p->iPatsPi * i ); }
55 for ( w = 0; w <
nWords; w++ )
60 word * pSims = Sbd_ObjSims(
p, Gia_ObjId(
p, pObj));
61 Abc_TtCopy( Sbd_ObjSims(
p, Gia_ObjFaninId0p(
p, pObj)), pSims,
nWords, Gia_ObjFaninC0(pObj) );
66 word * pSims = Sbd_ObjSims(
p, i);
67 word * pSims0 = Sbd_ObjSims(
p, Gia_ObjFaninId0(pObj, i));
68 word * pSims1 = Sbd_ObjSims(
p, Gia_ObjFaninId1(pObj, i));
70 for ( w = 0; w <
nWords; w++ )
72 pSims0[w] = pSims[w] | Rand;
73 pSims1[w] = pSims[w] | ~Rand;
75 if ( Gia_ObjFaninC0(pObj) ) Abc_TtNot( pSims0,
nWords );
76 if ( Gia_ObjFaninC1(pObj) ) Abc_TtNot( pSims1,
nWords );
95 if ( Gia_ObjIsTravIdCurrent(
p, pObj) )
96 return (
int)pObj->
fMark0 == Value;
97 Gia_ObjSetTravIdCurrent(
p, pObj);
99 if ( Gia_ObjIsCi(pObj) )
101 word * pSims = Sbd_ObjSims(
p, Gia_ObjId(
p, pObj));
102 if ( Abc_TtGetBit( pSims, iPat ) != Value )
103 Abc_TtXorBit( pSims, iPat );
106 assert( Gia_ObjIsAnd(pObj) );
107 assert( !Gia_ObjIsXor(pObj) );
109 return Sbd_GiaSatOne_rec(
p, Gia_ObjFanin0(pObj), !Gia_ObjFaninC0(pObj), fFirst, iPat ) &&
112 return Sbd_GiaSatOne_rec(
p, Gia_ObjFanin0(pObj), Gia_ObjFaninC0(pObj), fFirst, iPat );
114 return Sbd_GiaSatOne_rec(
p, Gia_ObjFanin1(pObj), Gia_ObjFaninC1(pObj), fFirst, iPat );
118 int k, n,
Var1, Var2, iPat = 0;
127 for ( n = 0; n < 2; n++ )
136 printf(
"%c", n == 2 ?
'.' :
'c' );
140 for ( n = 0; n < 2; n++ )
155 printf(
"%c", n == 2 ?
'.' :
'e' );
157 if ( iPat == 64 *
p->iPatsPi - 1 )
178 Vec_Int_t * vReprs = Vec_IntStart( Gia_ManObjNum(
p) );
179 Vec_Int_t * vPairs = Vec_IntAlloc( 1000 );
181 int i, nConsts = 0, nClasses = 0, nPats;
185 if ( Vec_IntEntry(vMap, i) == 0 )
186 Vec_IntPushTwo( vPairs, 0, i ), nConsts++;
187 else if ( Vec_IntEntry(vReprs, Vec_IntEntry(vMap, i)) == 0 )
188 Vec_IntWriteEntry( vReprs, Vec_IntEntry(vMap, i), i );
189 else if ( Vec_IntEntry(vReprs, Vec_IntEntry(vMap, i)) != -1 )
191 Vec_IntPushTwo( vPairs, Vec_IntEntry(vReprs, Vec_IntEntry(vMap, i)), i );
192 Vec_IntWriteEntry( vReprs, Vec_IntEntry(vMap, i), -1 );
197 Vec_IntFree( vReprs );
198 printf(
"Constants = %d. Classes = %d.\n", nConsts, nClasses );
201 Vec_IntFree( vPairs );
203 printf(
"Generated %d patterns.\n", nPats );
222 Vec_Int_t * vMap = Vec_IntStart( Gia_ManObjNum(
p) );
223 int w, i, Id, fCompl, RetValue;
229 Sbd_ObjSims(
p, Id)[0] <<= 1;
234 for ( w = 0; w <
nWords; w++ )
238 vStore = Vec_MemAlloc(
nWords, 16 );
239 Vec_MemHashAlloc( vStore, 1 << 16 );
240 RetValue = Vec_MemHashInsert( vStore, Sbd_ObjSims(
p, 0) );
244 word * pSims = Sbd_ObjSims(
p, i);
245 if ( Gia_ObjIsXor(pObj) )
247 Sbd_ObjSims(
p, Gia_ObjFaninId0(pObj, i)),
248 Sbd_ObjSims(
p, Gia_ObjFaninId1(pObj, i)),
250 Gia_ObjFaninC0(pObj) ^ Gia_ObjFaninC1(pObj) );
252 Abc_TtAndCompl( pSims,
253 Sbd_ObjSims(
p, Gia_ObjFaninId0(pObj, i)), Gia_ObjFaninC0(pObj),
254 Sbd_ObjSims(
p, Gia_ObjFaninId1(pObj, i)), Gia_ObjFaninC1(pObj),
257 fCompl = (int)(pSims[0] & 1);
258 if ( fCompl ) Abc_TtNot( pSims,
nWords );
259 Vec_IntWriteEntry( vMap, i, Vec_MemHashInsert(vStore, pSims) );
260 if ( fCompl ) Abc_TtNot( pSims,
nWords );
264 word * pSims = Sbd_ObjSims(
p, Gia_ObjId(
p, pObj));
265 Abc_TtCopy( pSims, Sbd_ObjSims(
p, Gia_ObjFaninId0p(
p, pObj)),
nWords, Gia_ObjFaninC0(pObj) );
267 assert( Gia_ObjPhase(pObj) == (
int)(pSims[0] & 1) );
270 Vec_MemHashFree( vStore );
271 Vec_MemFree( vStore );
272 printf(
"Objects = %6d. Unique = %6d.\n", Gia_ManAndNum(
p), Vec_IntCountUnique(vMap) );
284 pGia->
vSims = Vec_WrdStart( Gia_ManObjNum(pGia) * pGia->
iPatsPi );
285 pGia->
vSimsPi = Vec_WrdStart( Gia_ManObjNum(pGia) * pGia->
iPatsPi );
300 Vec_WrdFreeP( &pGia->
vSims );
301 Vec_WrdFreeP( &pGia->
vSimsPi );
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
#define Gia_ManForEachAnd(p, pObj, i)
#define Gia_ManForEachCoId(p, Id, i)
#define Gia_ManForEachAndReverse(p, pObj, i)
word Gia_ManRandomW(int fReset)
struct Gia_Obj_t_ Gia_Obj_t
struct Gia_Man_t_ Gia_Man_t
void Gia_ManIncrementTravId(Gia_Man_t *p)
#define Gia_ManForEachCo(p, pObj, i)
void Gia_ManSetPhase(Gia_Man_t *p)
#define Gia_ManForEachAndId(p, i)
unsigned Gia_ManRandom(int fReset)
FUNCTION DEFINITIONS ///.
#define Gia_ManForEachCiId(p, Id, i)
unsigned __int64 word
DECLARATIONS ///.
void Sbd_GiaSimRoundBack2(Gia_Man_t *p)
FUNCTION DEFINITIONS ///.
void Sbd_GiaSimRound(Gia_Man_t *p, int fTry, Vec_Int_t **pvMap)
int Sbd_GiaSatOne(Gia_Man_t *p, Vec_Int_t *vPairs)
void Sbd_GiaSimRoundBack(Gia_Man_t *p)
void Sbd_GiaSimTest(Gia_Man_t *pGia)
int Sbd_GiaSatOne_rec(Gia_Man_t *p, Gia_Obj_t *pObj, int Value, int fFirst, int iPat)
typedefABC_NAMESPACE_IMPL_START struct Vec_Mem_t_ Vec_Mem_t
DECLARATIONS ///.
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)