51 Vec_IntPush( vFanins, 0 );
54 pFan0 = Amap_LibNod( pLib, Abc_Lit2Var(pNod->
iFan0) );
55 if ( Abc_LitIsCompl(pNod->
iFan0) || pFan0->
Type != pNod->
Type )
56 Vec_IntPush( vFanins, pNod->
iFan0 );
59 pFan1 = Amap_LibNod( pLib, Abc_Lit2Var(pNod->
iFan1) );
60 if ( Abc_LitIsCompl(pNod->
iFan1) || pFan1->
Type != pNod->
Type )
61 Vec_IntPush( vFanins, pNod->
iFan1 );
97 Vec_Int_t * vPerm, * vPermFanin, * vNodFanin, * vDsdLits;
100 int iDsdFanin, iNodFanin, Value, iDsdLit, i, k, j;
102 pDsdObj = Kit_DsdNtkObj( pNtk, Abc_Lit2Var(iLit) );
103 if ( pDsdObj == NULL )
105 vPerm = Vec_IntAlloc( 1 );
106 Vec_IntPush( vPerm, iLit );
111 vPerm = Vec_IntAlloc( 10 );
113 iDsdFanin = pDsdObj->
pFans[0];
114 pNodFanin = Amap_LibNod( pLib, Abc_Lit2Var(pNod->
iFan0) );
116 if ( vPermFanin == NULL )
118 Vec_IntFree( vPerm );
122 Vec_IntPush( vPerm, Value );
123 Vec_IntFree( vPermFanin );
125 iDsdFanin = pDsdObj->
pFans[1];
126 pNodFanin = Amap_LibNod( pLib, Abc_Lit2Var(pNod->
iFan1) );
128 if ( vPermFanin == NULL )
130 Vec_IntFree( vPerm );
134 Vec_IntPush( vPerm, Value );
135 Vec_IntFree( vPermFanin );
137 iDsdFanin = pDsdObj->
pFans[2];
138 pNodFanin = Amap_LibNod( pLib, Abc_Lit2Var(pNod->
iFan2) );
140 if ( vPermFanin == NULL )
142 Vec_IntFree( vPerm );
146 Vec_IntPush( vPerm, Value );
147 Vec_IntFree( vPermFanin );
156 if ( Vec_IntSize(vNodFanin) != (
int)pDsdObj->
nFans )
158 Vec_IntFree( vNodFanin );
163 vPerm = Vec_IntAlloc( 10 );
164 vDsdLits = Vec_IntAlloc( 10 );
167 pDsdFanin = Kit_DsdNtkObj( pNtk, Abc_Lit2Var(iDsdFanin) );
169 pDsdFanin->
fMark = 0;
171 Vec_IntPush( vDsdLits, iDsdFanin );
177 if ( iNodFanin == 0 )
179 if ( iDsdLit >= Vec_IntSize(vDsdLits) )
181 Vec_IntFree( vPerm );
182 Vec_IntFree( vDsdLits );
183 Vec_IntFree( vNodFanin );
186 iDsdFanin = Vec_IntEntry( vDsdLits, iDsdLit++ );
187 Vec_IntPush( vPerm, iDsdFanin );
191 pNodFanin = Amap_LibNod( pLib, Abc_Lit2Var(iNodFanin) );
194 pDsdFanin = Kit_DsdNtkObj( pNtk, Abc_Lit2Var(iDsdFanin) );
195 if ( pDsdFanin == NULL )
197 if ( pDsdFanin->
fMark == 1 )
204 if ( vPermFanin == NULL )
206 Vec_IntFree( vNodFanin );
207 Vec_IntFree( vDsdLits );
208 Vec_IntFree( vPerm );
211 pDsdFanin->
fMark = 1;
213 Vec_IntPush( vPerm, Value );
214 Vec_IntFree( vPermFanin );
219 if ( iDsdLit != Vec_IntSize(vDsdLits) )
220 Vec_IntFreeP( &vPerm );
221 Vec_IntFree( vNodFanin );
222 Vec_IntFree( vDsdLits );
241 unsigned * pTruth0, * pTruth1, * pTruth;
245 return (
unsigned *)Vec_PtrEntry( vTtElems, (*piInput)++ );
246 pFan0 = Amap_LibNod( pLib, Abc_Lit2Var(pNod->
iFan0) );
248 pFan1 = Amap_LibNod( pLib, Abc_Lit2Var(pNod->
iFan1) );
250 pTruth = Vec_IntFetch( vTruth,
nWords );
252 for ( i = 0; i <
nWords; i++ )
253 pTruth[i] = pTruth0[i] ^ pTruth1[i];
254 else if ( !Abc_LitIsCompl(pNod->
iFan0) && !Abc_LitIsCompl(pNod->
iFan1) )
255 for ( i = 0; i <
nWords; i++ )
256 pTruth[i] = pTruth0[i] & pTruth1[i];
257 else if ( !Abc_LitIsCompl(pNod->
iFan0) && Abc_LitIsCompl(pNod->
iFan1) )
258 for ( i = 0; i <
nWords; i++ )
259 pTruth[i] = pTruth0[i] & ~pTruth1[i];
260 else if ( Abc_LitIsCompl(pNod->
iFan0) && !Abc_LitIsCompl(pNod->
iFan1) )
261 for ( i = 0; i <
nWords; i++ )
262 pTruth[i] = ~pTruth0[i] & pTruth1[i];
264 for ( i = 0; i <
nWords; i++ )
265 pTruth[i] = ~pTruth0[i] & ~pTruth1[i];
293 vTtElems = Vec_PtrAllocTruthTables( pGate->
nPins );
294 vTtElemsPol = Vec_PtrAlloc( pGate->
nPins );
295 for ( i = 0; i < (int)pGate->
nPins; i++ )
297 pTruth = (
unsigned *)Vec_PtrEntry( vTtElems, Abc_Lit2Var(pArray[i]) );
298 if ( Abc_LitIsCompl( pArray[i] ) )
299 Kit_TruthNot( pTruth, pTruth, pGate->
nPins );
300 Vec_PtrPush( vTtElemsPol, pTruth );
307 if ( Abc_LitIsCompl(pNtk->
Root) )
308 Kit_TruthNot( pTruth, pTruth, pGate->
nPins );
312 if ( !Kit_TruthIsEqual(pGate->
pFunc, pTruth, pGate->
nPins) )
313 printf(
"Verification failed for gate %d (%s) and node %d.\n",
315 Vec_IntFree( vTruth );
316 Vec_PtrFree( vTtElems );
317 Vec_PtrFree( vTtElemsPol );
335 int Entry, Entry2, i, k;
345 if ( Abc_Lit2Var(Entry) == Abc_Lit2Var(Entry2) )
347 Vec_IntFree( vPerm );
355 pArray[Abc_Lit2Var(Entry)] = Abc_Var2Lit( i, Abc_LitIsCompl(Entry) );
362 Vec_IntFree( vPerm );
366 printf(
"node %4d : ", pNod->
Id );
367 for ( i = 0; i < (int)pNod->
nSuppSize; i++ )
368 printf(
"%d=%d%c ", i, Abc_Lit2Var(pArray[i]), Abc_LitIsCompl(pArray[i])?
'-':
'+' );