46 return Vec_WrdEntryP(
p->vSims,
p->nSimWords * iObj );
48static inline void Wlc_ObjSimPi(
Gia_Man_t *
p,
int iObj )
51 word * pSim = Wlc_ObjSim(
p, iObj );
52 for ( w = 0; w <
p->nSimWords; w++ )
55static inline void Wlc_ObjSimRo(
Gia_Man_t *
p,
int iObj )
58 word * pSimRo = Wlc_ObjSim(
p, iObj );
59 word * pSimRi = Wlc_ObjSim(
p, Gia_ObjRoToRiId(
p, iObj) );
60 for ( w = 0; w <
p->nSimWords; w++ )
61 pSimRo[w] = pSimRi[w];
63static inline void Wlc_ObjSimCo(
Gia_Man_t *
p,
int iObj )
67 word * pSimCo = Wlc_ObjSim(
p, iObj );
68 word * pSimDri = Wlc_ObjSim(
p, Gia_ObjFaninId0(pObj, iObj) );
69 if ( Gia_ObjFaninC0(pObj) )
70 for ( w = 0; w <
p->nSimWords; w++ )
71 pSimCo[w] = ~pSimDri[w];
73 for ( w = 0; w <
p->nSimWords; w++ )
74 pSimCo[w] = pSimDri[w];
76static inline void Wlc_ObjSimAnd(
Gia_Man_t *
p,
int iObj )
80 word * pSim = Wlc_ObjSim(
p, iObj );
81 word * pSim0 = Wlc_ObjSim(
p, Gia_ObjFaninId0(pObj, iObj) );
82 word * pSim1 = Wlc_ObjSim(
p, Gia_ObjFaninId1(pObj, iObj) );
83 if ( Gia_ObjFaninC0(pObj) && Gia_ObjFaninC1(pObj) )
84 for ( w = 0; w <
p->nSimWords; w++ )
85 pSim[w] = ~pSim0[w] & ~pSim1[w];
86 else if ( Gia_ObjFaninC0(pObj) && !Gia_ObjFaninC1(pObj) )
87 for ( w = 0; w <
p->nSimWords; w++ )
88 pSim[w] = ~pSim0[w] & pSim1[w];
89 else if ( !Gia_ObjFaninC0(pObj) && Gia_ObjFaninC1(pObj) )
90 for ( w = 0; w <
p->nSimWords; w++ )
91 pSim[w] = pSim0[w] & ~pSim1[w];
93 for ( w = 0; w <
p->nSimWords; w++ )
94 pSim[w] = pSim0[w] & pSim1[w];
122 word * pInfo;
int i, k;
134 int f, i, k, w, nBits, Counter = 0;
136 Vec_WrdFreeP( &pGia->
vSims );
137 pGia->
vSims = Vec_WrdStart( Gia_ManObjNum(pGia) *
nWords );
140 vRes = Vec_PtrAlloc( Vec_IntSize(vNodes) );
143 nBits = Wlc_ObjRange(pWlcObj);
144 vOne = Vec_PtrAlloc( nBits );
145 for ( k = 0; k < nBits; k++ )
147 Vec_PtrPush( vRes, vOne );
151 for ( f = 0; f < nFrames; f++ )
155 if ( Gia_ObjIsAnd(pObj) )
156 Wlc_ObjSimAnd( pGia, i );
157 else if ( Gia_ObjIsCo(pObj) )
158 Wlc_ObjSimCo( pGia, i );
159 else if ( Gia_ObjIsPi(pGia, pObj) )
160 Wlc_ObjSimPi( pGia, i );
161 else if ( Gia_ObjIsRo(pGia, pObj) )
162 Wlc_ObjSimRo( pGia, i );
167 int nBits = Wlc_ObjRange(pWlcObj);
168 int iFirst = Vec_IntEntry( &
p->vCopies, Wlc_ObjId(
p, pWlcObj) );
169 for ( k = 0; k < nBits; k++ )
171 int iLit = Vec_IntEntry( &
p->vBits, iFirst + k );
176 for ( w = 0; w <
nWords; w++ )
177 pInfo[f *
nWords + w] = 0;
181 word * pInfoObj = Wlc_ObjSim( pGia, Abc_Lit2Var(iLit) );
182 for ( w = 0; w <
nWords; w++ )
183 pInfo[f *
nWords + w] = Abc_LitIsCompl(iLit) ? ~pInfoObj[w] : pInfoObj[w];
187 if ( f == 0 && Counter )
188 printf(
"Replaced %d dangling internal bits with constant 0.\n", Counter );
190 Vec_WrdFreeP( &pGia->
vSims );
213 int f, w, b, i, k, iPat = 0;
214 for ( f = 0; f < nFrames; f++, printf(
"\n") )
215 for ( w = 0; w <
nWords; w++ )
216 for ( b = 0; b < 64; b++, iPat++, printf(
"\n") )
220 int nBits = Wlc_ObjRange(pWlcObj);
221 for ( k = nBits-1; k >= 0; k-- )
224 printf(
"%d", Abc_InfoHasBit((
unsigned *)pInfo, iPat) );
236 Vec_IntPush( vNodes, 1 );
237 Vec_IntPush( vNodes, 2 );
238 Vec_IntPush( vNodes, 3 );
242 Vec_IntFree( vNodes );
#define ABC_CALLOC(type, num)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
void Gia_ManStop(Gia_Man_t *p)
word Gia_ManRandomW(int fReset)
struct Gia_Obj_t_ Gia_Obj_t
struct Gia_Man_t_ Gia_Man_t
#define Gia_ManForEachObj1(p, pObj, i)
unsigned __int64 word
DECLARATIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
#define Vec_VecForEachEntry(Type, vGlob, pEntry, i, k)
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
void Wlc_NtkSimulatePrint(Wlc_Ntk_t *p, Vec_Int_t *vNodes, Vec_Ptr_t *vRes, int nWords, int nFrames)
void Wlc_NtkDeleteSim(Vec_Ptr_t *p)
Vec_Ptr_t * Wlc_NtkSimulate(Wlc_Ntk_t *p, Vec_Int_t *vNodes, int nWords, int nFrames)
void Wlc_NtkSimulateTest(Wlc_Ntk_t *p)
Gia_Man_t * Wlc_NtkBitBlast(Wlc_Ntk_t *p, Wlc_BstPar_t *pPars)
#define Wlc_NtkForEachObjVec(vVec, p, pObj, i)
struct Wlc_Ntk_t_ Wlc_Ntk_t
struct Wlc_Obj_t_ Wlc_Obj_t
BASIC TYPES ///.