ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
wlcGraft.c File Reference
#include "wlc.h"
#include "sat/bsat/satStore.h"
Include dependency graph for wlcGraft.c:

Go to the source code of this file.

Functions

int Wlc_NtkCollectObjs_rec (Wlc_Ntk_t *p, Wlc_Obj_t *pObj, Vec_Int_t *vObjs)
 
Vec_Int_tWlc_NtkCollectObjs (Wlc_Ntk_t *p, int fEven, int *pCount)
 
void Wlc_NtkSaveOneNode (Wlc_Ntk_t *p, Wlc_Obj_t *pWlcObj, Gia_Man_t *pGia, Vec_Mem_t *vTtMem)
 
void Wlc_NtkFindOneNode (Wlc_Ntk_t *p, Wlc_Obj_t *pWlcObj, Gia_Man_t *pGia, Vec_Mem_t *vTtMem)
 
Wlc_Ntk_tWlc_NtkGraftMulti (Wlc_Ntk_t *p, int fVerbose)
 
void Sbc_Mult (word a, word b, word r[2])
 
void Sbc_SimMult (word A[64], word B[64], word R[128], int nIns)
 
Vec_Int_tSbc_ManDetectMult (Gia_Man_t *p, Vec_Int_t *vIns)
 
Vec_Int_tSbc_ManWlcNodes2 (Wlc_Ntk_t *pNtk, Gia_Man_t *p, Vec_Int_t *vGiaLits)
 
int Sbc_ManWlcNodes (Wlc_Ntk_t *pNtk, Gia_Man_t *p, Vec_Int_t *vGia2Out, int nOuts)
 
void Sbc_ManDetectMultTest (Wlc_Ntk_t *pNtk, int fVerbose)
 

Function Documentation

◆ Sbc_ManDetectMult()

Vec_Int_t * Sbc_ManDetectMult ( Gia_Man_t * p,
Vec_Int_t * vIns )

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 349 of file wlcGraft.c.

350{
351 int nWords = 1;
352 Vec_Int_t * vGia2Out = Vec_IntStartFull( Gia_ManObjNum(p) );
353 Gia_Obj_t * pObj; int i, Entry, nIns = Vec_IntSize(vIns)/2;
354 word A[64], B[64], R[128], * pInfoObj; word Temp;
355
356 // create hash table
357 Vec_Mem_t * vTtMem = Vec_MemAlloc( nWords, 10 );
358 Vec_MemHashAlloc( vTtMem, 1000 );
359 Sbc_SimMult( A, B, R, nIns );
360 for ( i = 0; i < 2*nIns; i++ )
361 {
362 Vec_MemHashInsert( vTtMem, R+i );
363 //printf( "Out %2d : ", i );
364 //Extra_PrintHex( stdout, (unsigned *)(R+i), 6 ); printf( "\n" );
365 }
366 assert( Vec_MemEntryNum(vTtMem) == 2*nIns );
367
368 // alloc simulation info
369 Vec_WrdFreeP( &p->vSims );
370 p->vSims = Vec_WrdStart( Gia_ManObjNum(p) * nWords );
371 p->nSimWords = nWords;
372
373 // mark inputs
375 Gia_ObjSetTravIdCurrentId( p, 0 );
376 Gia_ManForEachCi( p, pObj, i )
377 {
378 Gia_ObjSetTravIdCurrent( p, pObj );
379 //Wlc_ObjSimPi( p, Gia_ObjId(p, pObj) );
380 }
381
382 // assign inputs
383 assert( Vec_IntSize(vIns) % 2 == 0 );
384 Gia_ManForEachObjVec( vIns, p, pObj, i )
385 {
386 Gia_ObjSetTravIdCurrent( p, pObj );
387 pInfoObj = Wlc_ObjSim( p, Gia_ObjId(p, pObj) );
388 *pInfoObj = i < nIns ? A[i] : B[i - nIns];
389 }
390
391 // perform simulation
392 Gia_ManForEachObj1( p, pObj, i )
393 {
394 if ( Gia_ObjIsTravIdCurrent(p, pObj) )
395 continue;
396
397 if ( Gia_ObjIsAnd(pObj) )
398 Wlc_ObjSimAnd( p, i );
399 else if ( Gia_ObjIsCo(pObj) )
400 Wlc_ObjSimCo( p, i );
401 else assert( 0 );
402
403 // mark direct polarity
404 pInfoObj = Wlc_ObjSim( p, i );
405 Entry = *Vec_MemHashLookup( vTtMem, pInfoObj );
406 if ( Entry >= 0 )
407 {
408 Vec_IntWriteEntry( vGia2Out, i, Abc_Var2Lit(Entry, 0) );
409 continue;
410 }
411
412 // mark negated polarity
413 Temp = *pInfoObj;
414 Abc_TtNot( pInfoObj, nWords );
415 Entry = *Vec_MemHashLookup( vTtMem, pInfoObj );
416 Abc_TtNot( pInfoObj, nWords );
417 assert( Temp == *pInfoObj );
418 if ( Entry >= 0 )
419 {
420 Vec_IntWriteEntry( vGia2Out, i, Abc_Var2Lit(Entry, 1) );
421 continue;
422 }
423 }
424
425 Gia_ManForEachCo( p, pObj, i )
426 {
427 pInfoObj = Wlc_ObjSim( p, Gia_ObjId(p, pObj) );
428 //printf( "Out %2d : Driver = %5d(%d)", i, Gia_ObjFaninId0p(p, pObj), Gia_ObjFaninC0(pObj) );
429 //Extra_PrintHex( stdout, (unsigned *)pInfoObj, 6 ); printf( "\n" );
430 }
431
432 // cleanup
433 Vec_MemHashFree( vTtMem );
434 Vec_MemFreeP( &vTtMem );
435 //Vec_WrdFreeP( &p->vSims );
436 //p->nSimWords = 0;
437 return vGia2Out;
438}
int nWords
Definition abcNpn.c:127
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Cube * p
Definition exorList.c:222
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
#define Gia_ManForEachObj1(p, pObj, i)
Definition gia.h:1192
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition gia.h:1194
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition giaUtil.c:190
#define Gia_ManForEachCo(p, pObj, i)
Definition gia.h:1236
#define Gia_ManForEachCi(p, pObj, i)
Definition gia.h:1228
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
typedefABC_NAMESPACE_IMPL_START struct Vec_Mem_t_ Vec_Mem_t
DECLARATIONS ///.
Definition utilMem.c:35
#define assert(ex)
Definition util_old.h:213
void Sbc_SimMult(word A[64], word B[64], word R[128], int nIns)
Definition wlcGraft.c:314
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sbc_ManDetectMultTest()

void Sbc_ManDetectMultTest ( Wlc_Ntk_t * pNtk,
int fVerbose )

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 540 of file wlcGraft.c.

541{
543 Gia_Man_t * p = Wlc_NtkBitBlast( pNtk, NULL );//, -1, 0, 0, 0, 0, 1, 0, 0 ); // <= no cleanup
544 Vec_Int_t * vIns, * vGia2Out;
545 int iObjFound = -1;
546// Gia_Obj_t * pObj; int i;
547// Gia_ManForEachCo( p, pObj, i )
548// printf( "Output %2d - driver %5d (%d)\n", i, Gia_ObjFaninId0p(p, pObj), Gia_ObjFaninC0(pObj) );
549
550 vIns = Sdb_StoComputeCutsDetect( p );
551 if ( vIns == NULL || Vec_IntSize(vIns) == 0 || (Vec_IntSize(vIns) % 2) != 0 )
552 {
553 printf( "Input identification did not work out.\n" );
554 return;
555 }
556
557 vGia2Out = Sbc_ManDetectMult( p, vIns );
558
559 iObjFound = Sbc_ManWlcNodes( pNtk, p, vGia2Out, Vec_IntSize(vIns) );
560
561 Vec_IntFree( vGia2Out );
562 Vec_IntFree( vIns );
563
564 Gia_ManStop( p );
565}
Vec_Int_t * Sdb_StoComputeCutsDetect(Gia_Man_t *pGia)
Definition acec2Mult.c:1168
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
Vec_Int_t * Sbc_ManDetectMult(Gia_Man_t *p, Vec_Int_t *vIns)
Definition wlcGraft.c:349
int Sbc_ManWlcNodes(Wlc_Ntk_t *pNtk, Gia_Man_t *p, Vec_Int_t *vGia2Out, int nOuts)
Definition wlcGraft.c:484
Gia_Man_t * Wlc_NtkBitBlast(Wlc_Ntk_t *p, Wlc_BstPar_t *pPars)
Definition wlcBlast.c:1349
Here is the call graph for this function:

◆ Sbc_ManWlcNodes()

int Sbc_ManWlcNodes ( Wlc_Ntk_t * pNtk,
Gia_Man_t * p,
Vec_Int_t * vGia2Out,
int nOuts )

Definition at line 484 of file wlcGraft.c.

485{
486 Wlc_Obj_t * pObj;
487 int i, k, iLitGia, iLitOut, iFirst, nBits, iObjFound = -1;
488 Vec_Int_t * vMatched = Vec_IntAlloc( 100 );
489 Wlc_NtkForEachObj( pNtk, pObj, i )
490 {
491 iFirst = Vec_IntEntry( &pNtk->vCopies, i );
492 nBits = Wlc_ObjRange(pObj);
493 Vec_IntClear( vMatched );
494 for ( k = 0; k < nBits; k++ )
495 {
496 iLitGia = Vec_IntEntry( &pNtk->vBits, iFirst + k );
497 iLitOut = Vec_IntEntry( vGia2Out, Abc_Lit2Var(iLitGia) );
498 if ( iLitOut == -1 )
499 continue;
500 iLitOut = Abc_LitNotCond( iLitOut, Abc_LitIsCompl(iLitGia) );
501 printf( "Matched node %5d (%10s) bit %3d (out of %3d) with output %3d(%d).\n",
502 i, Wlc_ObjName(pNtk, Wlc_ObjId(pNtk, pObj)), k, nBits, Abc_Lit2Var(iLitOut), Abc_LitIsCompl(iLitOut) );
503 Vec_IntPushOrder( vMatched, Abc_Lit2Var(iLitOut) );
504 }
505 if ( Vec_IntSize(vMatched) > 0 )
506 printf( "\n" );
507 if ( Vec_IntSize(vMatched) == nOuts )
508 {
509 if ( iObjFound == -1 )
510 iObjFound = i;
511 printf( "Found object %d with all bits matched.\n", i );
512 /*
513 for ( k = nBits-2; k < nBits; k++ )
514 {
515 iLitGia = Vec_IntEntry( &pNtk->vBits, iFirst + k );
516 {
517 word * pInfoObj = Wlc_ObjSim( p, Abc_Lit2Var(iLitGia) );
518 Extra_PrintHex( stdout, (unsigned *)pInfoObj, 6 ); printf( "\n" );
519 }
520 }
521 */
522 break;
523 }
524 }
525 Vec_IntFree( vMatched );
526 return iObjFound;
527}
Vec_Int_t vBits
Definition wlc.h:172
Vec_Int_t vCopies
Definition wlc.h:171
#define Wlc_NtkForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition wlc.h:356
char * Wlc_ObjName(Wlc_Ntk_t *p, int iObj)
Definition wlcNtk.c:225
struct Wlc_Obj_t_ Wlc_Obj_t
BASIC TYPES ///.
Definition wlc.h:118
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sbc_ManWlcNodes2()

Vec_Int_t * Sbc_ManWlcNodes2 ( Wlc_Ntk_t * pNtk,
Gia_Man_t * p,
Vec_Int_t * vGiaLits )

Definition at line 439 of file wlcGraft.c.

440{
441 Wlc_Obj_t * pObj; int i, k, iGiaLit, iFirst, nBits;
442 Vec_Int_t * vRes = Vec_IntAlloc( 100 );
443 Vec_Int_t * vMap = Vec_IntStartFull( Gia_ManObjNum(p) );
444 Vec_IntForEachEntry( vGiaLits, iGiaLit, i )
445 if ( iGiaLit != -1 )
446 Vec_IntWriteEntry( vMap, Abc_Lit2Var(iGiaLit), Abc_Var2Lit(i, Abc_LitIsCompl(iGiaLit)) );
447 Wlc_NtkForEachObj( pNtk, pObj, i )
448 {
449 iFirst = Vec_IntEntry( &pNtk->vCopies, i );
450 nBits = Wlc_ObjRange(pObj);
451 for ( k = 0; k < nBits; k++ )
452 {
453 int iLitGia = Vec_IntEntry( &pNtk->vBits, iFirst + k );
454 int iLitOut = Vec_IntEntry( vMap, Abc_Lit2Var(iLitGia) );
455 if ( iLitOut == -1 )
456 continue;
457 Vec_IntWriteEntry( vMap, Abc_Lit2Var(iLitGia), -1 );
458 iLitOut = Abc_LitNotCond( iLitOut, Abc_LitIsCompl(iLitGia) );
459 printf( "Matched out %d in phase %d with object %d (%s) bit %d (out of %d).\n", Abc_Lit2Var(iLitOut), Abc_LitIsCompl(iLitOut), i, Wlc_ObjName(pNtk, Wlc_ObjId(pNtk, pObj)), k, nBits );
460 Vec_IntPushUnique( vRes, i );
461 }
462 }
463 Vec_IntFree( vMap );
464 Vec_IntSort( vRes, 0 );
465 // consider the last one
466 pObj = Wlc_NtkObj( pNtk, Vec_IntEntryLast(vRes) );
467 iFirst = Vec_IntEntry( &pNtk->vCopies, Wlc_ObjId(pNtk, pObj) );
468 nBits = Wlc_ObjRange(pObj);
469 printf( "Considering object %d (%s):\n", Wlc_ObjId(pNtk, pObj), Wlc_ObjName(pNtk, Wlc_ObjId(pNtk, pObj)) );
470 for ( k = 0; k < nBits; k++ )
471 {
472 int iLitGia = Vec_IntEntry( &pNtk->vBits, iFirst + k );
473 int iLitOutP = Vec_IntFind( vGiaLits, iLitGia );
474 int iLitOutN = Vec_IntFind( vGiaLits, Abc_LitNot(iLitGia) );
475 printf( "Matching bit %d with output %d / %d.\n", k, iLitOutP, iLitOutN );
476 // print simulation signature
477 {
478 word * pInfoObj = Wlc_ObjSim( p, Abc_Lit2Var(iLitGia) );
479 Extra_PrintHex( stdout, (unsigned *)pInfoObj, 6 ); printf( "\n" );
480 }
481 }
482 return vRes;
483}
void Extra_PrintHex(FILE *pFile, unsigned *pTruth, int nVars)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
Here is the call graph for this function:

◆ Sbc_Mult()

void Sbc_Mult ( word a,
word b,
word r[2] )

Function*************************************************************

Synopsis [Generate simulation vectors.]

Description []

SideEffects []

SeeAlso []

Definition at line 303 of file wlcGraft.c.

304{
305 word Msk = 0xFFFFFFFF;
306 word pL = (a & Msk) * (b & Msk);
307 word pM1 = (a & Msk) * (b >> 32);
308 word pM2 = (a >> 32) * (b & Msk);
309 word pH = (a >> 32) * (b >> 32);
310 word Car = (pM1 & Msk) + (pM2 & Msk) + (pL >> 32);
311 r[0] = a * b;
312 r[1] = pH + (pM1 >> 32) + (pM2 >> 32) + (Car >> 32);
313}
Here is the caller graph for this function:

◆ Sbc_SimMult()

void Sbc_SimMult ( word A[64],
word B[64],
word R[128],
int nIns )

Definition at line 314 of file wlcGraft.c.

315{
316 word a, b, r[2], Mask = Abc_Tt6Mask(nIns); int i, k;
317 for ( i = 0; i < 64; i++ )
318 A[i] = B[i] = R[i] = R[i+64] = 0;
319 Gia_ManRandom(1);
320 for ( i = 0; i < 64; i++ )
321 {
322 a = i ? (Mask & Gia_ManRandomW(0)) : 0;
323 b = i ? (Mask & Gia_ManRandomW(0)) : 0;
324 Sbc_Mult( a, b, r );
325 for ( k = 0; k < 64; k++ )
326 {
327 if ( (a >> k) & 1 ) A[k] |= ((word)1 << i);
328 if ( (b >> k) & 1 ) B[k] |= ((word)1 << i);
329 if ( (r[0] >> k) & 1 ) R[k] |= ((word)1 << i);
330 if ( (r[1] >> k) & 1 ) R[k+64] |= ((word)1 << i);
331 }
332 }
333// for ( i = 0; i < 128; i++ )
334// for ( k = 0; k < 64; k++, printf( "\n" ) )
335// printf( "%d", (R[i] >> k) & 1 );
336}
word Gia_ManRandomW(int fReset)
Definition giaUtil.c:67
unsigned Gia_ManRandom(int fReset)
FUNCTION DEFINITIONS ///.
Definition giaUtil.c:49
void Sbc_Mult(word a, word b, word r[2])
Definition wlcGraft.c:303
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkCollectObjs()

Vec_Int_t * Wlc_NtkCollectObjs ( Wlc_Ntk_t * p,
int fEven,
int * pCount )

Definition at line 123 of file wlcGraft.c.

124{
125 Vec_Int_t * vObjs = Vec_IntAlloc( 100 );
126 Wlc_Obj_t * pObj;
127 int i, Count = 0;
129 Wlc_NtkForEachCo( p, pObj, i )
130 if ( (i & 1) == fEven )
131 Count += Wlc_NtkCollectObjs_rec( p, pObj, vObjs );
133 if ( pCount )
134 *pCount = Count;
135 return vObjs;
136}
int Wlc_NtkCollectObjs_rec(Wlc_Ntk_t *p, Wlc_Obj_t *pObj, Vec_Int_t *vObjs)
Definition wlcGraft.c:110
void Wlc_NtkCleanMarks(Wlc_Ntk_t *p)
Definition wlcNtk.c:1135
#define Wlc_NtkForEachCo(p, pCo, i)
Definition wlc.h:368
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkCollectObjs_rec()

int Wlc_NtkCollectObjs_rec ( Wlc_Ntk_t * p,
Wlc_Obj_t * pObj,
Vec_Int_t * vObjs )

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 110 of file wlcGraft.c.

111{
112 int i, iFanin, Count = 0;
113 if ( Wlc_ObjIsCi(pObj) )
114 return 0;
115 if ( pObj->Mark )
116 return 0;
117 pObj->Mark = 1;
118 Wlc_ObjForEachFanin( pObj, iFanin, i )
119 Count += Wlc_NtkCollectObjs_rec( p, Wlc_NtkObj(p, iFanin), vObjs );
120 Vec_IntPush( vObjs, Wlc_ObjId(p, pObj) );
121 return Count + (int)(pObj->Type == WLC_OBJ_ARI_MULTI);
122}
unsigned Type
Definition wlc.h:121
unsigned Mark
Definition wlc.h:123
#define Wlc_ObjForEachFanin(pObj, iFanin, i)
Definition wlc.h:375
@ WLC_OBJ_ARI_MULTI
Definition wlc.h:90
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkFindOneNode()

void Wlc_NtkFindOneNode ( Wlc_Ntk_t * p,
Wlc_Obj_t * pWlcObj,
Gia_Man_t * pGia,
Vec_Mem_t * vTtMem )

Definition at line 169 of file wlcGraft.c.

170{
171 int k, Entry;
172 int nWords = Vec_MemEntrySize(vTtMem);
173 int nBits = Wlc_ObjRange(pWlcObj);
174 int iFirst = Vec_IntEntry( &p->vCopies, Wlc_ObjId(p, pWlcObj) );
175 for ( k = 0; k < nBits; k++ )
176 {
177 int iLit = Vec_IntEntry( &p->vBits, iFirst + k );
178 word * pInfoObj = Wlc_ObjSim( pGia, Abc_Lit2Var(iLit) );
179 int fCompl = pInfoObj[0] & 1;
180 if ( fCompl ) Abc_TtNot( pInfoObj, nWords );
181 Entry = *Vec_MemHashLookup( vTtMem, pInfoObj );
182 if ( Entry > 0 )
183 printf( "Obj %4d. Range = %2d. Bit %2d. Entry %d(%d). %s\n", Wlc_ObjId(p, pWlcObj), Wlc_ObjRange(pWlcObj), k, Entry, fCompl ^ Abc_LitIsCompl(iLit), Wlc_ObjName(p, Wlc_ObjId(p, pWlcObj)) );
184 if ( fCompl ) Abc_TtNot( pInfoObj, nWords );
185 //printf( "%2d ", Entry );
186 //Extra_PrintHex( stdout, (unsigned*)pInfoObj, 8 );
187 //printf( "\n" );
188 }
189 //printf( "\n" );
190}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkGraftMulti()

Wlc_Ntk_t * Wlc_NtkGraftMulti ( Wlc_Ntk_t * p,
int fVerbose )

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 203 of file wlcGraft.c.

204{
205 int nWords = 4;
206 int i, nMultiLHS, nMultiRHS;
207 word * pInfoObj;
208 Wlc_Ntk_t * pNew = NULL;
209 Wlc_Obj_t * pWlcObj;
210 Gia_Obj_t * pObj;
211 Vec_Int_t * vObjsLHS = Wlc_NtkCollectObjs( p, 0, &nMultiLHS );
212 Vec_Int_t * vObjsRHS = Wlc_NtkCollectObjs( p, 1, &nMultiRHS );
213 Gia_Man_t * pGia = Wlc_NtkBitBlast( p, NULL ); //, -1, 0, 0, 0, 0, 1, 0, 0 ); // <= no cleanup
214 Vec_Mem_t * vTtMem = Vec_MemAlloc( nWords, 10 );
215 Vec_MemHashAlloc( vTtMem, 10000 );
216
217 // check if there are multipliers
218 if ( nMultiLHS == 0 && nMultiRHS == 0 )
219 {
220 printf( "No multipliers are present.\n" );
221 return NULL;
222 }
223 // compare multipliers
224 if ( nMultiLHS > 0 && nMultiRHS > 0 )
225 {
226 printf( "Multipliers are present in both sides of the miter.\n" );
227 return NULL;
228 }
229 // swap if wrong side
230 if ( nMultiRHS > 0 )
231 {
232 ABC_SWAP( Vec_Int_t *, vObjsLHS, vObjsRHS );
233 ABC_SWAP( int, nMultiLHS, nMultiRHS );
234 }
235 assert( nMultiLHS > 0 );
236 assert( nMultiRHS == 0 );
237
238 // allocate simulation info for one timeframe
239 Vec_WrdFreeP( &pGia->vSims );
240 pGia->vSims = Vec_WrdStart( Gia_ManObjNum(pGia) * nWords );
241 pGia->nSimWords = nWords;
242 // perform simulation
243 Gia_ManRandomW( 1 );
244 Gia_ManForEachObj1( pGia, pObj, i )
245 {
246 if ( Gia_ObjIsAnd(pObj) )
247 Wlc_ObjSimAnd( pGia, i );
248 else if ( Gia_ObjIsCo(pObj) )
249 Wlc_ObjSimCo( pGia, i );
250 else if ( Gia_ObjIsCi(pObj) )
251 Wlc_ObjSimPi( pGia, i );
252 else assert( 0 );
253 }
254
255 // hash constant 0
256 pInfoObj = Wlc_ObjSim( pGia, 0 );
257 Vec_MemHashInsert( vTtMem, pInfoObj );
258
259 // hash sim info on the multiplier boundary
260 Wlc_NtkForEachObjVec( vObjsLHS, p, pWlcObj, i )
261 if ( Wlc_ObjType(pWlcObj) == WLC_OBJ_ARI_MULTI )
262 {
263 Wlc_NtkSaveOneNode( p, Wlc_ObjFanin0(p, pWlcObj), pGia, vTtMem );
264 Wlc_NtkSaveOneNode( p, Wlc_ObjFanin1(p, pWlcObj), pGia, vTtMem );
265 Wlc_NtkSaveOneNode( p, pWlcObj, pGia, vTtMem );
266 }
267
268 // check if there are similar signals in LHS
269 Wlc_NtkForEachObjVec( vObjsRHS, p, pWlcObj, i )
270 Wlc_NtkFindOneNode( p, pWlcObj, pGia, vTtMem );
271
272 // perform grafting
273
274
275 Vec_MemHashFree( vTtMem );
276 Vec_MemFreeP( &vTtMem );
277
278 // cleanup
279 Vec_WrdFreeP( &pGia->vSims );
280 pGia->nSimWords = 0;
281
282 Vec_IntFree( vObjsLHS );
283 Vec_IntFree( vObjsRHS );
284 Gia_ManStop( pGia );
285 return pNew;
286}
#define ABC_SWAP(Type, a, b)
Definition abc_global.h:253
Vec_Wrd_t * vSims
Definition gia.h:213
int nSimWords
Definition gia.h:209
void Wlc_NtkFindOneNode(Wlc_Ntk_t *p, Wlc_Obj_t *pWlcObj, Gia_Man_t *pGia, Vec_Mem_t *vTtMem)
Definition wlcGraft.c:169
Vec_Int_t * Wlc_NtkCollectObjs(Wlc_Ntk_t *p, int fEven, int *pCount)
Definition wlcGraft.c:123
void Wlc_NtkSaveOneNode(Wlc_Ntk_t *p, Wlc_Obj_t *pWlcObj, Gia_Man_t *pGia, Vec_Mem_t *vTtMem)
Definition wlcGraft.c:149
#define Wlc_NtkForEachObjVec(vVec, p, pObj, i)
Definition wlc.h:360
struct Wlc_Ntk_t_ Wlc_Ntk_t
Definition wlc.h:135
Here is the call graph for this function:

◆ Wlc_NtkSaveOneNode()

void Wlc_NtkSaveOneNode ( Wlc_Ntk_t * p,
Wlc_Obj_t * pWlcObj,
Gia_Man_t * pGia,
Vec_Mem_t * vTtMem )

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 149 of file wlcGraft.c.

150{
151 int k, Entry;
152 int nWords = Vec_MemEntrySize(vTtMem);
153 int nBits = Wlc_ObjRange(pWlcObj);
154 int iFirst = Vec_IntEntry( &p->vCopies, Wlc_ObjId(p, pWlcObj) );
155 for ( k = 0; k < nBits; k++ )
156 {
157 int iLit = Vec_IntEntry( &p->vBits, iFirst + k );
158 word * pInfoObj = Wlc_ObjSim( pGia, Abc_Lit2Var(iLit) );
159 int fCompl = pInfoObj[0] & 1;
160 if ( fCompl ) Abc_TtNot( pInfoObj, nWords );
161 Entry = Vec_MemHashInsert( vTtMem, pInfoObj );
162 if ( fCompl ) Abc_TtNot( pInfoObj, nWords );
163 printf( "%2d(%d) ", Entry, fCompl ^ Abc_LitIsCompl(iLit) );
164 Extra_PrintHex( stdout, (unsigned*)pInfoObj, 8 );
165 printf( "\n" );
166 }
167 printf( "\n" );
168}
Here is the call graph for this function:
Here is the caller graph for this function: