ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
giaResub2.c File Reference
#include "gia.h"
#include "misc/util/utilTruth.h"
#include "misc/vec/vecHsh.h"
#include "opt/dau/dau.h"
Include dependency graph for giaResub2.c:

Go to the source code of this file.

Classes

struct  Gia_Rsb2Man_t_
 

Typedefs

typedef typedefABC_NAMESPACE_IMPL_START struct Gia_Rsb2Man_t_ Gia_Rsb2Man_t
 DECLARATIONS ///.
 

Functions

void Abc_ResubPrepareManager (int nWords)
 
int Abc_ResubComputeFunction (void **ppDivs, int nDivs, int nWords, int nLimit, int nDivsMax, int iChoice, int fUseXor, int fDebug, int fVerbose, int **ppArray)
 
Gia_Rsb2Man_tGia_Rsb2ManAlloc ()
 FUNCTION DEFINITIONS ///.
 
void Gia_Rsb2ManFree (Gia_Rsb2Man_t *p)
 
void Gia_Rsb2ManStart (Gia_Rsb2Man_t *p, int *pObjs, int nObjs, int nDivsMax, int nLevelIncrease, int fUseXor, int fUseZeroCost, int fDebug, int fVerbose)
 
void Gia_Rsb2ManPrint (Gia_Rsb2Man_t *p)
 
int Gia_Rsb2ManLevel (Gia_Rsb2Man_t *p)
 
word Gia_Rsb2ManOdcs (Gia_Rsb2Man_t *p, int iNode)
 
int Gia_Rsb2ManDeref_rec (Gia_Rsb2Man_t *p, int *pObjs, int *pRefs, int iNode)
 
int Gia_Rsb2ManMffc (Gia_Rsb2Man_t *p, int iNode)
 
int Gia_Rsb2ManDivs (Gia_Rsb2Man_t *p, int iNode)
 
int Gia_Rsb2AddNode (Vec_Int_t *vRes, int iLit0, int iLit1, int iRes0, int iRes1)
 
int Gia_Rsb2ManInsert_rec (Vec_Int_t *vRes, int nPis, Vec_Int_t *vObjs, int iNode, Vec_Int_t *vResub, Vec_Int_t *vDivs, Vec_Int_t *vCopies, int iObj)
 
Vec_Int_tGia_Rsb2ManInsert (int nPis, int nPos, Vec_Int_t *vObjs, int iNode, Vec_Int_t *vResub, Vec_Int_t *vDivs, Vec_Int_t *vCopies)
 
void Abc_ResubPrintDivs (void **ppDivs, int nDivs)
 
int Abc_ResubNodeToTry (Vec_Int_t *vTried, int iFirst, int iLast)
 
int Abc_ResubComputeWindow (int *pObjs, int nObjs, int nDivsMax, int nLevelIncrease, int fUseXor, int fUseZeroCost, int fDebug, int fVerbose, int **ppArray, int *pnResubs)
 
int Abc_ResubComputeWindow2 (int *pObjs, int nObjs, int nDivsMax, int nLevelIncrease, int fUseXor, int fUseZeroCost, int fDebug, int fVerbose, int **ppArray, int *pnResubs)
 
int * Gia_ManToResub (Gia_Man_t *p)
 
Gia_Man_tGia_ManFromResub (int *pObjs, int nObjs, int nIns)
 
Gia_Man_tGia_ManResub2Test (Gia_Man_t *p)
 
int Gia_WinTryAddingNode (Gia_Man_t *p, int iPivot, int iPivot2, Vec_Wec_t *vLevels, Vec_Int_t *vNodes)
 
int Gia_WinAddCiWithMaxFanouts (Gia_Man_t *p)
 
int Gia_WinAddCiWithMaxDivisors (Gia_Man_t *p, Vec_Wec_t *vLevels)
 
int Gia_WinNodeHasUnmarkedFanouts (Gia_Man_t *p, int iPivot)
 
Vec_Int_tGia_RsbCiTranslate (Gia_Man_t *p, Vec_Int_t *vObjs, Vec_Int_t *vMap)
 
Vec_Int_tGia_RsbCiWindow (Gia_Man_t *p, int nPis)
 
void Gia_RsbCiWindowTest (Gia_Man_t *p)
 
void Gia_RsbWindowGather (Gia_Man_t *p, Vec_Int_t *vPaths, int iNode, Vec_Int_t *vVisited)
 
int Gia_RsbWindowExplore (Gia_Man_t *p, Vec_Int_t *vVisited, int iStart, Vec_Int_t *vPaths, int *piMeet, int *piNode)
 
Vec_Int_tGia_RsbWindowInit (Gia_Man_t *p, Vec_Int_t *vPaths, int iPivot, int nIter)
 
Vec_Int_tGia_RsbCreateWindowInputs (Gia_Man_t *p, Vec_Int_t *vWin)
 
void Gia_RsbAddSideInputs (Gia_Man_t *p, Vec_Wec_t *vLevels, Vec_Int_t *vWin)
 
void Gia_RsbExpandInputs (Gia_Man_t *p, Vec_Wec_t *vLevels, Vec_Int_t *vWin, Vec_Int_t *vInputs)
 
int Gia_RsbSelectOneInput (Gia_Man_t *p, Vec_Wec_t *vLevels, Vec_Int_t *vIns)
 
void Gia_RsbWindowGrow (Gia_Man_t *p, Vec_Wec_t *vLevels, Vec_Int_t *vWin, Vec_Int_t *vIns, int nInputsMax)
 
void Gia_WinCreateFromCut_rec (Gia_Man_t *p, int iObj, Vec_Int_t *vWin)
 
void Gia_WinCreateFromCut (Gia_Man_t *p, int iPivot, Vec_Int_t *vIn, Vec_Wec_t *vLevels, Vec_Int_t *vWin)
 
int Gia_RsbExpandCut (Gia_Man_t *p, Vec_Int_t *vIns)
 
int Gia_RsbFindFaninAdd (int iFan, int pFanins[32], int pFaninCounts[32], int nFanins)
 
int Gia_RsbFindFaninToAddToCut (Gia_Man_t *p, Vec_Int_t *vIns)
 
void Gia_RsbWindowGrow2 (Gia_Man_t *p, int iObj, Vec_Wec_t *vLevels, Vec_Int_t *vWin, Vec_Int_t *vIns, int nInputsMax)
 
int Gia_RsbWindowCompute (Gia_Man_t *p, int iObj, int nInputsMax, int nLevelsMax, Vec_Wec_t *vLevels, Vec_Int_t *vPaths, Vec_Int_t **pvWin, Vec_Int_t **pvIns)
 
Vec_Int_tGia_RsbFindOutputs (Gia_Man_t *p, Vec_Int_t *vWin, Vec_Int_t *vIns, Vec_Int_t *vRefs)
 
Gia_Man_tGia_RsbDeriveGiaFromWindows (Gia_Man_t *p, Vec_Int_t *vWin, Vec_Int_t *vIns, Vec_Int_t *vOuts)
 
word Gia_LutComputeTruth66_rec (Gia_Man_t *p, Gia_Obj_t *pObj)
 
int Gia_ManVerifyTwoTruths (Gia_Man_t *p1, Gia_Man_t *p2)
 
void Gia_RsbEnumerateWindows (Gia_Man_t *p, int nInputsMax, int nLevelsMax)
 
Gia_Man_tGia_RsbTryOneWindow (Gia_Man_t *p)
 
void Gia_RsbTestArray ()
 
Vec_Wec_tGia_ManExtractCuts2 (Gia_Man_t *p, int nCutSize, int nCuts, int fVerbose)
 

Typedef Documentation

◆ Gia_Rsb2Man_t

typedef typedefABC_NAMESPACE_IMPL_START struct Gia_Rsb2Man_t_ Gia_Rsb2Man_t

DECLARATIONS ///.

CFile****************************************************************

FileName [giaResub2.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis []

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id
giaResub2.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

]

Definition at line 33 of file giaResub2.c.

Function Documentation

◆ Abc_ResubComputeFunction()

int Abc_ResubComputeFunction ( void ** ppDivs,
int nDivs,
int nWords,
int nLimit,
int nDivsMax,
int iChoice,
int fUseXor,
int fDebug,
int fVerbose,
int ** ppArray )
extern

Definition at line 1548 of file giaResub.c.

1549{
1550 Vec_Ptr_t Divs = { nDivs, nDivs, ppDivs };
1551 assert( s_pResbMan != NULL ); // first call Abc_ResubPrepareManager()
1552 Gia_ManResubPerform( s_pResbMan, &Divs, nWords, nLimit, nDivsMax, iChoice, fUseXor, fDebug, fVerbose==2, 0 );
1553 if ( fVerbose )
1554 {
1555 int nGates = Vec_IntSize(s_pResbMan->vGates)/2;
1556 if ( nGates )
1557 {
1558 printf( " Gain = %2d Gates = %2d __________ F = ", nLimit+1-nGates, nGates );
1559 Gia_ManResubPrint( s_pResbMan->vGates, nDivs );
1560 printf( "\n" );
1561 }
1562 }
1563 if ( fDebug )
1564 {
1565 if ( !Gia_ManResubVerify(s_pResbMan, NULL) )
1566 {
1567 Gia_ManResubPrint( s_pResbMan->vGates, nDivs );
1568 printf( "Verification FAILED.\n" );
1569 }
1570 //else
1571 // printf( "Verification succeeded.\n" );
1572 }
1573 *ppArray = Vec_IntArray(s_pResbMan->vGates);
1574 assert( Vec_IntSize(s_pResbMan->vGates)/2 <= nLimit );
1575 return Vec_IntSize(s_pResbMan->vGates);
1576}
int nWords
Definition abcNpn.c:127
int Gia_ManResubVerify(Gia_ResbMan_t *p, word *pFunc)
Definition giaResub.c:456
void Gia_ManResubPerform(Gia_ResbMan_t *p, Vec_Ptr_t *vDivs, int nWords, int nLimit, int nDivsMax, int iChoice, int fUseXor, int fDebug, int fVerbose, int Depth)
Definition giaResub.c:1491
int Gia_ManResubPrint(Vec_Int_t *vRes, int nVars)
Definition giaResub.c:430
#define assert(ex)
Definition util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_ResubComputeWindow()

int Abc_ResubComputeWindow ( int * pObjs,
int nObjs,
int nDivsMax,
int nLevelIncrease,
int fUseXor,
int fUseZeroCost,
int fDebug,
int fVerbose,
int ** ppArray,
int * pnResubs )

Definition at line 434 of file giaResub2.c.

435{
436 int iNode, nChanges = 0, RetValue = 0;
438 Gia_Rsb2ManStart( p, pObjs, nObjs, nDivsMax, nLevelIncrease, fUseXor, fUseZeroCost, fDebug, fVerbose );
439 *ppArray = NULL;
440 while ( (iNode = Abc_ResubNodeToTry(&p->vTried, p->nPis+1, p->iFirstPo)) > 0 )
441 {
442 int nDivs = Gia_Rsb2ManDivs( p, iNode );
443 int * pResub, nResub = Abc_ResubComputeFunction( Vec_PtrArray(&p->vpDivs), nDivs, 1, p->nMffc-1, nDivsMax, 0, fUseXor, fDebug, fVerbose, &pResub );
444 if ( nResub == 0 )
445 Vec_IntPush( &p->vTried, iNode );
446 else
447 {
448 int i, k = 0, iTried;
449 Vec_Int_t vResub = { nResub, nResub, pResub };
450 Vec_Int_t * vRes = Gia_Rsb2ManInsert( p->nPis, p->nPos, &p->vObjs, iNode, &vResub, &p->vDivs, &p->vCopies );
451 //printf( "\nResubing node %d:\n", iNode );
452 //Gia_Rsb2ManPrint( p );
453 p->nObjs = Vec_IntSize(vRes)/2;
454 p->iFirstPo = p->nObjs - p->nPos;
455 Vec_IntClear( &p->vObjs );
456 Vec_IntAppend( &p->vObjs, vRes );
457 Vec_IntFree( vRes );
458 Vec_IntForEachEntry( &p->vTried, iTried, i )
459 if ( Vec_IntEntry(&p->vCopies, iTried) > Abc_Var2Lit(p->nPis, 0) ) // internal node
460 Vec_IntWriteEntry( &p->vTried, k++, Abc_Lit2Var(Vec_IntEntry(&p->vCopies, iTried)) );
461 Vec_IntShrink( &p->vTried, k );
462 nChanges++;
463 //Gia_Rsb2ManPrint( p );
464 }
465 }
466 if ( nChanges )
467 {
468 RetValue = p->nObjs;
469 *ppArray = p->vObjs.pArray;
470 Vec_IntZero( &p->vObjs );
471 }
473 if ( pnResubs )
474 *pnResubs = nChanges;
475 return RetValue;
476}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Cube * p
Definition exorList.c:222
void Gia_Rsb2ManFree(Gia_Rsb2Man_t *p)
Definition giaResub2.c:88
void Gia_Rsb2ManStart(Gia_Rsb2Man_t *p, int *pObjs, int nObjs, int nDivsMax, int nLevelIncrease, int fUseXor, int fUseZeroCost, int fDebug, int fVerbose)
Definition giaResub2.c:100
int Abc_ResubNodeToTry(Vec_Int_t *vTried, int iFirst, int iLast)
Definition giaResub2.c:425
int Gia_Rsb2ManDivs(Gia_Rsb2Man_t *p, int iNode)
Definition giaResub2.c:256
Gia_Rsb2Man_t * Gia_Rsb2ManAlloc()
FUNCTION DEFINITIONS ///.
Definition giaResub2.c:83
Vec_Int_t * Gia_Rsb2ManInsert(int nPis, int nPos, Vec_Int_t *vObjs, int iNode, Vec_Int_t *vResub, Vec_Int_t *vDivs, Vec_Int_t *vCopies)
Definition giaResub2.c:383
typedefABC_NAMESPACE_IMPL_START struct Gia_Rsb2Man_t_ Gia_Rsb2Man_t
DECLARATIONS ///.
Definition giaResub2.c:33
int Abc_ResubComputeFunction(void **ppDivs, int nDivs, int nWords, int nLimit, int nDivsMax, int iChoice, int fUseXor, int fDebug, int fVerbose, int **ppArray)
Definition giaResub.c:1548
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_ResubComputeWindow2()

int Abc_ResubComputeWindow2 ( int * pObjs,
int nObjs,
int nDivsMax,
int nLevelIncrease,
int fUseXor,
int fUseZeroCost,
int fDebug,
int fVerbose,
int ** ppArray,
int * pnResubs )

Definition at line 477 of file giaResub2.c.

478{
479 *ppArray = ABC_ALLOC( int, 2*nObjs );
480 memmove( *ppArray, pObjs, 2*nObjs * sizeof(int) );
481 if ( pnResubs )
482 *pnResubs = 0;
483 return nObjs;
484}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
char * memmove()
Here is the call graph for this function:

◆ Abc_ResubNodeToTry()

int Abc_ResubNodeToTry ( Vec_Int_t * vTried,
int iFirst,
int iLast )

Definition at line 425 of file giaResub2.c.

426{
427 int iNode;
428 //for ( iNode = iFirst; iNode < iLast; iNode++ )
429 for ( iNode = iLast - 1; iNode >= iFirst; iNode-- )
430 if ( Vec_IntFind(vTried, iNode) == -1 )
431 return iNode;
432 return -1;
433}
Here is the caller graph for this function:

◆ Abc_ResubPrepareManager()

void Abc_ResubPrepareManager ( int nWords)
extern

Definition at line 1539 of file giaResub.c.

1540{
1541 if ( s_pResbMan != NULL )
1542 Gia_ResbFree( s_pResbMan );
1543 s_pResbMan = NULL;
1544 if ( nWords > 0 )
1545 s_pResbMan = Gia_ResbAlloc( nWords );
1546}
Gia_ResbMan_t * Gia_ResbAlloc(int nWords)
Definition giaResub.c:314
void Gia_ResbFree(Gia_ResbMan_t *p)
Definition giaResub.c:366
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_ResubPrintDivs()

void Abc_ResubPrintDivs ( void ** ppDivs,
int nDivs )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 415 of file giaResub2.c.

416{
417 word ** pDivs = (word **)ppDivs;
418 int i;
419 for ( i = 0; i < nDivs; i++ )
420 {
421 printf( "Div %2d : ", i );
422 Dau_DsdPrintFromTruth( pDivs[i], 6 );
423 }
424}
void Dau_DsdPrintFromTruth(word *pTruth, int nVarsInit)
Definition dauDsd.c:1968
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
Here is the call graph for this function:

◆ Gia_LutComputeTruth66_rec()

word Gia_LutComputeTruth66_rec ( Gia_Man_t * p,
Gia_Obj_t * pObj )

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

Synopsis [Naive truth-table-based verification.]

Description []

SideEffects []

SeeAlso []

Definition at line 1297 of file giaResub2.c.

1298{
1299 word Truth0, Truth1;
1300 if ( Gia_ObjIsCi(pObj) )
1301 return s_Truths6[Gia_ObjCioId(pObj)];
1302 if ( Gia_ObjIsConst0(pObj) )
1303 return 0;
1304 assert( Gia_ObjIsAnd(pObj) );
1305 Truth0 = Gia_LutComputeTruth66_rec( p, Gia_ObjFanin0(pObj) );
1306 Truth1 = Gia_LutComputeTruth66_rec( p, Gia_ObjFanin1(pObj) );
1307 if ( Gia_ObjFaninC0(pObj) )
1308 Truth0 = ~Truth0;
1309 if ( Gia_ObjFaninC1(pObj) )
1310 Truth1 = ~Truth1;
1311 return Truth0 & Truth1;
1312}
word Gia_LutComputeTruth66_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaResub2.c:1297
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManExtractCuts2()

Vec_Wec_t * Gia_ManExtractCuts2 ( Gia_Man_t * p,
int nCutSize,
int nCuts,
int fVerbose )

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

Synopsis [Computing cuts of the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1523 of file giaResub2.c.

1524{
1525 int c, nLevelMax = 8;
1526 abctime clk = Abc_Clock();
1527 Vec_Wec_t * vCuts = Vec_WecStart( nCuts );
1528 Vec_Int_t * vPaths = Vec_IntStart( Gia_ManObjNum(p) );
1529 srand( time(NULL) );
1530 for ( c = 0; c < nCuts; )
1531 {
1532 Vec_Int_t * vCut, * vWin = NULL;
1533 while ( vWin == NULL )
1534 {
1535 int iPivot = 1 + Gia_ManCiNum(p) + rand() % Gia_ManAndNum(p);
1536 assert( Gia_ObjIsAnd(Gia_ManObj(p, iPivot)) );
1537 vWin = Gia_RsbWindowInit( p, vPaths, iPivot, nLevelMax );
1538 }
1539 vCut = Gia_RsbCreateWindowInputs( p, vWin );
1540 if ( Vec_IntSize(vCut) >= nCutSize - 2 && Vec_IntSize(vCut) <= nCutSize )
1541 {
1542 Vec_IntPush( Vec_WecEntry(vCuts, c), Vec_IntSize(vCut) );
1543 Vec_IntAppend( Vec_WecEntry(vCuts, c++), vCut );
1544 }
1545 Vec_IntFree( vCut );
1546 Vec_IntFree( vWin );
1547 }
1548 Vec_IntFree( vPaths );
1549 Abc_PrintTime( 0, "Computing cuts ", Abc_Clock() - clk );
1550 return vCuts;
1551}
ABC_INT64_T abctime
Definition abc_global.h:332
Vec_Int_t * Gia_RsbCreateWindowInputs(Gia_Man_t *p, Vec_Int_t *vWin)
Definition giaResub2.c:830
Vec_Int_t * Gia_RsbWindowInit(Gia_Man_t *p, Vec_Int_t *vPaths, int iPivot, int nIter)
Definition giaResub2.c:789
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
Definition vecWec.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManFromResub()

Gia_Man_t * Gia_ManFromResub ( int * pObjs,
int nObjs,
int nIns )

Definition at line 515 of file giaResub2.c.

516{
517 Gia_Man_t * pNew = Gia_ManStart( nObjs );
518 int i;
519 for ( i = 1; i < nObjs; i++ )
520 {
521 if ( pObjs[2*i] == 0 && i <= nIns ) // pi
522 Gia_ManAppendCi( pNew );
523 else if ( pObjs[2*i] == pObjs[2*i+1] ) // po
524 Gia_ManAppendCo( pNew, pObjs[2*i] );
525 else if ( pObjs[2*i] < pObjs[2*i+1] )
526 Gia_ManAppendAnd( pNew, pObjs[2*i], pObjs[2*i+1] );
527 else if ( pObjs[2*i] > pObjs[2*i+1] )
528 Gia_ManAppendXor( pNew, pObjs[2*i], pObjs[2*i+1] );
529 else assert( 0 );
530 }
531 return pNew;
532}
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
Definition giaMan.c:57
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManResub2Test()

Gia_Man_t * Gia_ManResub2Test ( Gia_Man_t * p)

Definition at line 533 of file giaResub2.c.

534{
535 Gia_Man_t * pNew;
536 int nResubs, nObjsNew, * pObjsNew, * pObjs = Gia_ManToResub( p );
537//Gia_ManPrint( p );
539 nObjsNew = Abc_ResubComputeWindow( pObjs, Gia_ManObjNum(p), 1000, -1, 0, 0, 0, 0, &pObjsNew, &nResubs );
540 //printf( "Performed resub %d times. Reduced %d nodes.\n", nResubs, nObjsNew ? Gia_ManObjNum(p) - nObjsNew : 0 );
542 if ( nObjsNew )
543 {
544 pNew = Gia_ManFromResub( pObjsNew, nObjsNew, Gia_ManCiNum(p) );
545 pNew->pName = Abc_UtilStrsav( p->pName );
546 }
547 else
548 pNew = Gia_ManDup( p );
549 ABC_FREE( pObjs );
550 ABC_FREE( pObjsNew );
551 return pNew;
552}
#define ABC_FREE(obj)
Definition abc_global.h:267
void Abc_ResubPrepareManager(int nWords)
Definition giaResub.c:1539
int Abc_ResubComputeWindow(int *pObjs, int nObjs, int nDivsMax, int nLevelIncrease, int fUseXor, int fUseZeroCost, int fDebug, int fVerbose, int **ppArray, int *pnResubs)
Definition giaResub2.c:434
int * Gia_ManToResub(Gia_Man_t *p)
Definition giaResub2.c:497
Gia_Man_t * Gia_ManFromResub(int *pObjs, int nObjs, int nIns)
Definition giaResub2.c:515
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition giaDup.c:720
char * pName
Definition gia.h:99
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManToResub()

int * Gia_ManToResub ( Gia_Man_t * p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 497 of file giaResub2.c.

498{
499 Gia_Obj_t * pObj;
500 int i, * pObjs = ABC_CALLOC( int, 2*Gia_ManObjNum(p) );
502 Gia_ManForEachObj1( p, pObj, i )
503 {
504 if ( Gia_ObjIsCi(pObj) )
505 continue;
506 pObjs[2*i+0] = Gia_ObjFaninLit0(Gia_ManObj(p, i), i);
507 if ( Gia_ObjIsCo(pObj) )
508 pObjs[2*i+1] = pObjs[2*i+0];
509 else if ( Gia_ObjIsAnd(pObj) )
510 pObjs[2*i+1] = Gia_ObjFaninLit1(Gia_ManObj(p, i), i);
511 else assert( 0 );
512 }
513 return pObjs;
514}
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
int Gia_ManIsNormalized(Gia_Man_t *p)
Definition giaTim.c:114
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
#define Gia_ManForEachObj1(p, pObj, i)
Definition gia.h:1192
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManVerifyTwoTruths()

int Gia_ManVerifyTwoTruths ( Gia_Man_t * p1,
Gia_Man_t * p2 )

Definition at line 1313 of file giaResub2.c.

1314{
1315 int i, fFailed = 0;
1316 assert( Gia_ManCoNum(p1) == Gia_ManCoNum(p2) );
1317 for ( i = 0; i < Gia_ManCoNum(p1); i++ )
1318 {
1319 Gia_Obj_t * pPo1 = Gia_ManCo(p1, i);
1320 Gia_Obj_t * pPo2 = Gia_ManCo(p2, i);
1321 word word1 = Gia_LutComputeTruth66_rec( p1, Gia_ObjFanin0(pPo1) );
1322 word word2 = Gia_LutComputeTruth66_rec( p2, Gia_ObjFanin0(pPo2) );
1323 if ( Gia_ObjFaninC0(pPo1) )
1324 word1 = ~word1;
1325 if ( Gia_ObjFaninC0(pPo2) )
1326 word2 = ~word2;
1327 if ( word1 != word2 )
1328 {
1329 //Dau_DsdPrintFromTruth( &word1, 6 );
1330 //Dau_DsdPrintFromTruth( &word2, 6 );
1331 printf( "Verification failed for output %d (out of %d).\n", i, Gia_ManCoNum(p1) );
1332 fFailed = 1;
1333 }
1334 }
1335// if ( !fFailed )
1336// printf( "Verification succeeded for %d outputs.\n", Gia_ManCoNum(p1) );
1337 return !fFailed;
1338}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_Rsb2AddNode()

int Gia_Rsb2AddNode ( Vec_Int_t * vRes,
int iLit0,
int iLit1,
int iRes0,
int iRes1 )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 301 of file giaResub2.c.

302{
303 int iLitMin = iRes0 < iRes1 ? Abc_LitNotCond(iRes0, Abc_LitIsCompl(iLit0)) : Abc_LitNotCond(iRes1, Abc_LitIsCompl(iLit1));
304 int iLitMax = iRes0 < iRes1 ? Abc_LitNotCond(iRes1, Abc_LitIsCompl(iLit1)) : Abc_LitNotCond(iRes0, Abc_LitIsCompl(iLit0));
305 int iLitRes = Vec_IntSize(vRes);
306 if ( iLit0 < iLit1 ) // and
307 {
308 if ( iLitMin == 0 )
309 return 0;
310 if ( iLitMin == 1 )
311 return iLitMax;
312 if ( iLitMin == Abc_LitNot(iLitMax) )
313 return 0;
314 }
315 else if ( iLit0 > iLit1 ) // xor
316 {
317 if ( iLitMin == 0 )
318 return iLitMax;
319 if ( iLitMin == 1 )
320 return Abc_LitNot(iLitMax);
321 if ( iLitMin == Abc_LitNot(iLitMax) )
322 return 1;
323 }
324 else assert( 0 );
325 assert( iLitMin >= 2 && iLitMax >= 2 );
326 if ( iLit0 < iLit1 ) // and
327 Vec_IntPushTwo( vRes, iLitMin, iLitMax );
328 else if ( iLit0 > iLit1 ) // xor
329 {
330 assert( !Abc_LitIsCompl(iLit0) );
331 assert( !Abc_LitIsCompl(iLit1) );
332 Vec_IntPushTwo( vRes, iLitMax, iLitMin );
333 }
334 else assert( 0 );
335 return iLitRes;
336}
Here is the caller graph for this function:

◆ Gia_Rsb2ManAlloc()

Gia_Rsb2Man_t * Gia_Rsb2ManAlloc ( )

FUNCTION DEFINITIONS ///.

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 83 of file giaResub2.c.

84{
86 return p;
87}
Here is the caller graph for this function:

◆ Gia_Rsb2ManDeref_rec()

int Gia_Rsb2ManDeref_rec ( Gia_Rsb2Man_t * p,
int * pObjs,
int * pRefs,
int iNode )

Definition at line 223 of file giaResub2.c.

224{
225 int Counter = 1;
226 if ( iNode <= p->nPis )
227 return 0;
228 if ( --pRefs[Abc_Lit2Var(pObjs[2*iNode+0])] == 0 )
229 Counter += Gia_Rsb2ManDeref_rec( p, pObjs, pRefs, Abc_Lit2Var(pObjs[2*iNode+0]) );
230 if ( --pRefs[Abc_Lit2Var(pObjs[2*iNode+1])] == 0 )
231 Counter += Gia_Rsb2ManDeref_rec( p, pObjs, pRefs, Abc_Lit2Var(pObjs[2*iNode+1]) );
232 return Counter;
233}
int Gia_Rsb2ManDeref_rec(Gia_Rsb2Man_t *p, int *pObjs, int *pRefs, int iNode)
Definition giaResub2.c:223
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_Rsb2ManDivs()

int Gia_Rsb2ManDivs ( Gia_Rsb2Man_t * p,
int iNode )

Definition at line 256 of file giaResub2.c.

257{
258 int i, iNodeLevel = 0;
259 int * pRefs = Vec_IntArray( &p->vRefs );
260 p->CareSet = Gia_Rsb2ManOdcs( p, iNode );
261 p->Truth1 = p->CareSet & Vec_WrdEntry(&p->vSims, 2*iNode);
262 p->Truth0 = p->CareSet & ~p->Truth1;
263 Vec_PtrClear( &p->vpDivs );
264 Vec_PtrPush( &p->vpDivs, &p->Truth0 );
265 Vec_PtrPush( &p->vpDivs, &p->Truth1 );
266 Vec_IntClear( &p->vDivs );
267 Vec_IntPushTwo( &p->vDivs, -1, -1 );
268 for ( i = 1; i <= p->nPis; i++ )
269 {
270 Vec_PtrPush( &p->vpDivs, Vec_WrdEntryP(&p->vSims, 2*i) );
271 Vec_IntPush( &p->vDivs, i );
272 }
273 p->nMffc = Gia_Rsb2ManMffc( p, iNode );
274 if ( p->nLevelIncrease >= 0 )
275 {
276 p->Level = Gia_Rsb2ManLevel(p);
277 iNodeLevel = Vec_IntEntry(&p->vLevels, iNode);
278 }
279 for ( i = p->nPis + 1; i < p->iFirstPo; i++ )
280 {
281 if ( !pRefs[i] || (p->nLevelIncrease >= 0 && Vec_IntEntry(&p->vLevels, i) > iNodeLevel + p->nLevelIncrease) )
282 continue;
283 Vec_PtrPush( &p->vpDivs, Vec_WrdEntryP(&p->vSims, 2*i) );
284 Vec_IntPush( &p->vDivs, i );
285 }
286 assert( Vec_IntSize(&p->vDivs) == Vec_PtrSize(&p->vpDivs) );
287 return Vec_IntSize(&p->vDivs);
288}
int Gia_Rsb2ManLevel(Gia_Rsb2Man_t *p)
Definition giaResub2.c:179
int Gia_Rsb2ManMffc(Gia_Rsb2Man_t *p, int iNode)
Definition giaResub2.c:234
word Gia_Rsb2ManOdcs(Gia_Rsb2Man_t *p, int iNode)
Definition giaResub2.c:191
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_Rsb2ManFree()

void Gia_Rsb2ManFree ( Gia_Rsb2Man_t * p)

Definition at line 88 of file giaResub2.c.

89{
90 Vec_IntErase( &p->vObjs );
91 Vec_WrdErase( &p->vSims );
92 Vec_PtrErase( &p->vpDivs );
93 Vec_IntErase( &p->vDivs );
94 Vec_IntErase( &p->vLevels );
95 Vec_IntErase( &p->vRefs );
96 Vec_IntErase( &p->vCopies );
97 Vec_IntErase( &p->vTried );
98 ABC_FREE( p );
99}
Here is the caller graph for this function:

◆ Gia_Rsb2ManInsert()

Vec_Int_t * Gia_Rsb2ManInsert ( int nPis,
int nPos,
Vec_Int_t * vObjs,
int iNode,
Vec_Int_t * vResub,
Vec_Int_t * vDivs,
Vec_Int_t * vCopies )

Definition at line 383 of file giaResub2.c.

384{
385 int i, nObjs = Vec_IntSize(vObjs)/2, iFirstPo = nObjs - nPos;
386 Vec_Int_t * vRes = Vec_IntAlloc( Vec_IntSize(vObjs) );
387//Vec_IntPrint( vDivs );
388//Vec_IntPrint( vResub );
389 Vec_IntFill( vCopies, Vec_IntSize(vObjs), -1 );
390 Vec_IntFill( vRes, 2*(nPis + 1), 0 );
391 for ( i = 0; i <= nPis; i++ )
392 Vec_IntWriteEntry( vCopies, i, 2*i );
393 for ( i = iFirstPo; i < nObjs; i++ )
394 Gia_Rsb2ManInsert_rec( vRes, nPis, vObjs, iNode, vResub, vDivs, vCopies, Abc_Lit2Var( Vec_IntEntry(vObjs, 2*i) ) );
395 for ( i = iFirstPo; i < nObjs; i++ )
396 {
397 int iLitNew = Abc_Lit2LitL( Vec_IntArray(vCopies), Vec_IntEntry(vObjs, 2*i) );
398 Vec_IntPushTwo( vRes, iLitNew, iLitNew );
399 }
400 return vRes;
401}
int Gia_Rsb2ManInsert_rec(Vec_Int_t *vRes, int nPis, Vec_Int_t *vObjs, int iNode, Vec_Int_t *vResub, Vec_Int_t *vDivs, Vec_Int_t *vCopies, int iObj)
Definition giaResub2.c:337
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_Rsb2ManInsert_rec()

int Gia_Rsb2ManInsert_rec ( Vec_Int_t * vRes,
int nPis,
Vec_Int_t * vObjs,
int iNode,
Vec_Int_t * vResub,
Vec_Int_t * vDivs,
Vec_Int_t * vCopies,
int iObj )

Definition at line 337 of file giaResub2.c.

338{
339 if ( Vec_IntEntry(vCopies, iObj) >= 0 )
340 return Vec_IntEntry(vCopies, iObj);
341 assert( iObj > nPis );
342 if ( iObj == iNode )
343 {
344 int nVars = Vec_IntSize(vDivs);
345 int iLitRes = -1, iTopLit = Vec_IntEntryLast( vResub );
346 if ( Abc_Lit2Var(iTopLit) == 0 )
347 iLitRes = 0;
348 else if ( Abc_Lit2Var(iTopLit) < nVars )
349 iLitRes = Gia_Rsb2ManInsert_rec( vRes, nPis, vObjs, -1, vResub, vDivs, vCopies, Vec_IntEntry(vDivs, Abc_Lit2Var(iTopLit)) );
350 else
351 {
352 Vec_Int_t * vCopy = Vec_IntAlloc( 10 );
353 int k, iLit, iLit0, iLit1;
354 Vec_IntForEachEntryStop( vResub, iLit, k, Vec_IntSize(vResub)-1 )
355 if ( Abc_Lit2Var(iLit) < nVars )
356 Gia_Rsb2ManInsert_rec( vRes, nPis, vObjs, -1, vResub, vDivs, vCopies, Vec_IntEntry(vDivs, Abc_Lit2Var(iLit)) );
357 Vec_IntForEachEntryDouble( vResub, iLit0, iLit1, k )
358 {
359 int iVar0 = Abc_Lit2Var(iLit0);
360 int iVar1 = Abc_Lit2Var(iLit1);
361 int iRes0 = iVar0 < nVars ? Vec_IntEntry(vCopies, Vec_IntEntry(vDivs, iVar0)) : Vec_IntEntry(vCopy, iVar0 - nVars);
362 int iRes1 = iVar1 < nVars ? Vec_IntEntry(vCopies, Vec_IntEntry(vDivs, iVar1)) : Vec_IntEntry(vCopy, iVar1 - nVars);
363 iLitRes = Gia_Rsb2AddNode( vRes, iLit0, iLit1, iRes0, iRes1 );
364 Vec_IntPush( vCopy, iLitRes );
365 }
366 Vec_IntFree( vCopy );
367 }
368 iLitRes = Abc_LitNotCond( iLitRes, Abc_LitIsCompl(iTopLit) );
369 Vec_IntWriteEntry( vCopies, iObj, iLitRes );
370 return iLitRes;
371 }
372 else
373 {
374 int iLit0 = Vec_IntEntry( vObjs, 2*iObj+0 );
375 int iLit1 = Vec_IntEntry( vObjs, 2*iObj+1 );
376 int iRes0 = Gia_Rsb2ManInsert_rec( vRes, nPis, vObjs, iNode, vResub, vDivs, vCopies, Abc_Lit2Var(iLit0) );
377 int iRes1 = Gia_Rsb2ManInsert_rec( vRes, nPis, vObjs, iNode, vResub, vDivs, vCopies, Abc_Lit2Var(iLit1) );
378 int iLitRes = Gia_Rsb2AddNode( vRes, iLit0, iLit1, iRes0, iRes1 );
379 Vec_IntWriteEntry( vCopies, iObj, iLitRes );
380 return iLitRes;
381 }
382}
int Gia_Rsb2AddNode(Vec_Int_t *vRes, int iLit0, int iLit1, int iRes0, int iRes1)
Definition giaResub2.c:301
if(last==0)
Definition sparse_int.h:34
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)
Definition vecInt.h:72
#define Vec_IntForEachEntryStop(vVec, Entry, i, Stop)
Definition vecInt.h:58
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_Rsb2ManLevel()

int Gia_Rsb2ManLevel ( Gia_Rsb2Man_t * p)

Definition at line 179 of file giaResub2.c.

180{
181 int i, * pLevs, Level = 0;
182 Vec_IntClear( &p->vLevels );
183 Vec_IntGrow( &p->vLevels, p->nObjs );
184 pLevs = Vec_IntArray( &p->vLevels );
185 for ( i = p->nPis + 1; i < p->iFirstPo; i++ )
186 pLevs[i] = 1 + Abc_MaxInt( pLevs[2*i+0]/2, pLevs[2*i+1]/2 );
187 for ( i = p->iFirstPo; i < p->nObjs; i++ )
188 Level = Abc_MaxInt( Level, pLevs[i] = pLevs[2*i+0]/2 );
189 return Level;
190}
Here is the caller graph for this function:

◆ Gia_Rsb2ManMffc()

int Gia_Rsb2ManMffc ( Gia_Rsb2Man_t * p,
int iNode )

Definition at line 234 of file giaResub2.c.

235{
236 int i, * pRefs, * pObjs;
237 Vec_IntFill( &p->vRefs, p->nObjs, 0 );
238 pRefs = Vec_IntArray( &p->vRefs );
239 pObjs = Vec_IntArray( &p->vObjs );
240 assert( pObjs[2*iNode+0] != pObjs[2*iNode+1] );
241 for ( i = p->nPis + 1; i < p->iFirstPo; i++ )
242 pRefs[Abc_Lit2Var(pObjs[2*i+0])]++,
243 pRefs[Abc_Lit2Var(pObjs[2*i+1])]++;
244 for ( i = p->iFirstPo; i < p->nObjs; i++ )
245 pRefs[Abc_Lit2Var(pObjs[2*i+0])]++;
246 for ( i = p->nPis + 1; i < p->iFirstPo; i++ )
247 assert( pRefs[i] );
248 pRefs[iNode] = 0;
249 for ( i = iNode + 1; i < p->iFirstPo; i++ )
250 if ( !pRefs[Abc_Lit2Var(pObjs[2*i+0])] || !pRefs[Abc_Lit2Var(pObjs[2*i+1])] )
251 pRefs[i] = 0;
252 return Gia_Rsb2ManDeref_rec( p, pObjs, pRefs, iNode );
253}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_Rsb2ManOdcs()

word Gia_Rsb2ManOdcs ( Gia_Rsb2Man_t * p,
int iNode )

Definition at line 191 of file giaResub2.c.

192{
193 int i; word Res = 0;
194 int * pObjs = Vec_IntArray( &p->vObjs );
195 word * pSims = Vec_WrdArray( &p->vSims );
196 for ( i = p->nPis + 1; i < p->iFirstPo; i++ )
197 {
198 if ( pObjs[2*i+0] < pObjs[2*i+1] )
199 pSims[2*i+0] = pSims[pObjs[2*i+0]] & pSims[pObjs[2*i+1]];
200 else if ( pObjs[2*i+0] > pObjs[2*i+1] )
201 pSims[2*i+0] = pSims[pObjs[2*i+0]] ^ pSims[pObjs[2*i+1]];
202 else assert( 0 );
203 pSims[2*i+1] = ~pSims[2*i+0];
204 }
205 for ( i = p->iFirstPo; i < p->nObjs; i++ )
206 pSims[2*i+0] = pSims[pObjs[2*i+0]];
207 ABC_SWAP( word, pSims[2*iNode+0], pSims[2*iNode+1] );
208 for ( i = iNode + 1; i < p->iFirstPo; i++ )
209 {
210 if ( pObjs[2*i+0] < pObjs[2*i+1] )
211 pSims[2*i+0] = pSims[pObjs[2*i+0]] & pSims[pObjs[2*i+1]];
212 else if ( pObjs[2*i+0] < pObjs[2*i+1] )
213 pSims[2*i+0] = pSims[pObjs[2*i+0]] ^ pSims[pObjs[2*i+1]];
214 else assert( 0 );
215 pSims[2*i+1] = ~pSims[2*i+0];
216 }
217 for ( i = p->iFirstPo; i < p->nObjs; i++ )
218 Res |= pSims[2*i+0] ^ pSims[pObjs[2*i+0]];
219 ABC_SWAP( word, pSims[2*iNode+0], pSims[2*iNode+1] );
220 return Res;
221}
#define ABC_SWAP(Type, a, b)
Definition abc_global.h:253
Here is the caller graph for this function:

◆ Gia_Rsb2ManPrint()

void Gia_Rsb2ManPrint ( Gia_Rsb2Man_t * p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 166 of file giaResub2.c.

167{
168 int i, * pObjs = Vec_IntArray( &p->vObjs );
169 printf( "PI = %d. PO = %d. Obj = %d.\n", p->nPis, p->nPos, p->nObjs );
170 for ( i = p->nPis + 1; i < p->iFirstPo; i++ )
171 printf( "%2d = %c%2d & %c%2d;\n", i,
172 Abc_LitIsCompl(pObjs[2*i+0]) ? '!' : ' ', Abc_Lit2Var(pObjs[2*i+0]),
173 Abc_LitIsCompl(pObjs[2*i+1]) ? '!' : ' ', Abc_Lit2Var(pObjs[2*i+1]) );
174 for ( i = p->iFirstPo; i < p->nObjs; i++ )
175 printf( "%2d = %c%2d;\n", i,
176 Abc_LitIsCompl(pObjs[2*i+0]) ? '!' : ' ', Abc_Lit2Var(pObjs[2*i+0]) );
177}

◆ Gia_Rsb2ManStart()

void Gia_Rsb2ManStart ( Gia_Rsb2Man_t * p,
int * pObjs,
int nObjs,
int nDivsMax,
int nLevelIncrease,
int fUseXor,
int fUseZeroCost,
int fDebug,
int fVerbose )

Definition at line 100 of file giaResub2.c.

101{
102 int i;
103 // hyper-parameters
104 p->nDivsMax = nDivsMax;
105 p->nLevelIncrease = nLevelIncrease;
106 p->fUseXor = fUseXor;
107 p->fUseZeroCost = fUseZeroCost;
108 p->fDebug = fDebug;
109 p->fVerbose = fVerbose;
110 // user data
111 Vec_IntClear( &p->vObjs );
112 Vec_IntPushArray( &p->vObjs, pObjs, 2*nObjs );
113 assert( pObjs[0] == 0 );
114 assert( pObjs[1] == 0 );
115 p->nObjs = nObjs;
116 p->nPis = 0;
117 p->nNodes = 0;
118 p->nPos = 0;
119 p->iFirstPo = 0;
120 for ( i = 1; i < nObjs; i++ )
121 {
122 if ( pObjs[2*i+0] == 0 && pObjs[2*i+1] == 0 )
123 p->nPis++;
124 else if ( pObjs[2*i+0] == pObjs[2*i+1] )
125 p->nPos++;
126 else
127 p->nNodes++;
128 }
129 assert( nObjs == 1 + p->nPis + p->nNodes + p->nPos );
130 p->iFirstPo = nObjs - p->nPos;
131 Vec_WrdClear( &p->vSims );
132 Vec_WrdGrow( &p->vSims, 2*nObjs );
133 Vec_WrdPush( &p->vSims, 0 );
134 Vec_WrdPush( &p->vSims, 0 );
135 for ( i = 0; i < p->nPis; i++ )
136 {
137 Vec_WrdPush( &p->vSims, s_Truths6[i] );
138 Vec_WrdPush( &p->vSims, ~s_Truths6[i] );
139 }
140 p->vSims.nSize = 2*p->nObjs;
141 Vec_IntClear( &p->vDivs );
142 Vec_IntClear( &p->vLevels );
143 Vec_IntClear( &p->vRefs );
144 Vec_IntClear( &p->vCopies );
145 Vec_IntClear( &p->vTried );
146 Vec_PtrClear( &p->vpDivs );
147 Vec_IntGrow( &p->vDivs, nObjs );
148 Vec_IntGrow( &p->vLevels, nObjs );
149 Vec_IntGrow( &p->vRefs, nObjs );
150 Vec_IntGrow( &p->vCopies, nObjs );
151 Vec_IntGrow( &p->vTried, nObjs );
152 Vec_PtrGrow( &p->vpDivs, nObjs );
153}
Here is the caller graph for this function:

◆ Gia_RsbAddSideInputs()

void Gia_RsbAddSideInputs ( Gia_Man_t * p,
Vec_Wec_t * vLevels,
Vec_Int_t * vWin )

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

Synopsis [Grow window for the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 866 of file giaResub2.c.

867{
868 Vec_Int_t * vLevel;
869 Gia_Obj_t * pObj, * pFanout;
870 int k, i, f, iObj;
871 // precondition: the levelized structure is empty
872 assert( Vec_WecSizeSize(vLevels) == 0 );
873 // precondition: window nodes are labeled with the current ID
874 Vec_IntForEachEntry( vWin, iObj, i )
875 {
876 assert( Gia_ObjIsTravIdCurrentId(p, iObj) );
877 Vec_WecPush( vLevels, Gia_ObjLevelId(p, iObj), iObj );
878 }
879 // iterate through all objects and explore their fanouts
880 Vec_WecForEachLevel( vLevels, vLevel, k )
881 Gia_ManForEachObjVec( vLevel, p, pObj, i )
882 Gia_ObjForEachFanoutStatic( p, pObj, pFanout, f )
883 {
884 if ( f == 5 ) // explore first 5 fanouts of the node
885 break;
886 if ( Gia_ObjIsAnd(pFanout) && // internal node
887 !Gia_ObjIsTravIdCurrent(p, pFanout) && // not in the window
888 Gia_ObjIsTravIdCurrent(p, Gia_ObjFanin0(pFanout)) && // but fanins are
889 Gia_ObjIsTravIdCurrent(p, Gia_ObjFanin1(pFanout)) ) // in the window
890 {
891 // add fanout to the window and to the levelized structure
892 Gia_ObjSetTravIdCurrent( p, pFanout );
893 Vec_WecPush( vLevels, Gia_ObjLevel(p, pFanout), Gia_ObjId(p, pFanout) );
894 Vec_IntPush( vWin, Gia_ObjId(p, pFanout) );
895 }
896 }
897 // iterate through the nodes in the levelized structure
898 Vec_WecForEachLevel( vLevels, vLevel, k )
899 Vec_IntClear( vLevel );
900}
#define Gia_ObjForEachFanoutStatic(p, pObj, pFanout, i)
Definition gia.h:1125
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition gia.h:1194
#define Vec_WecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
Definition vecWec.h:55
Here is the caller graph for this function:

◆ Gia_RsbCiTranslate()

Vec_Int_t * Gia_RsbCiTranslate ( Gia_Man_t * p,
Vec_Int_t * vObjs,
Vec_Int_t * vMap )

Definition at line 665 of file giaResub2.c.

666{
667 int i, iObj, Lit0, Lit1, Fan0, Fan1;
668 Vec_Int_t * vNodes = Vec_IntAlloc( 100 );
669 assert( Vec_IntSize(vMap) == Gia_ManObjNum(p) );
670 Vec_IntPushTwo( vNodes, 0, 0 ); // const0 node
671 Vec_IntForEachEntry( vObjs, iObj, i )
672 {
673 Gia_Obj_t * pObj = Gia_ManObj(p, iObj);
674 assert( Gia_ObjIsTravIdCurrentId(p, iObj) );
675 Fan0 = Gia_ObjIsCi(pObj) ? 0 : Vec_IntEntry(vMap, Gia_ObjFaninId0(pObj, iObj));
676 Fan1 = Gia_ObjIsCi(pObj) ? 0 : Vec_IntEntry(vMap, Gia_ObjFaninId1(pObj, iObj));
677 Lit0 = Gia_ObjIsCi(pObj) ? 0 : Abc_LitNotCond( Fan0, Gia_ObjFaninC0(pObj) );
678 Lit1 = Gia_ObjIsCi(pObj) ? 0 : Abc_LitNotCond( Fan1, Gia_ObjFaninC1(pObj) );
679 Vec_IntWriteEntry( vMap, iObj, Vec_IntSize(vNodes) );
680 Vec_IntPushTwo( vNodes, Lit0, Lit1 );
681 }
682 Vec_IntForEachEntry( vObjs, iObj, i )
683 if ( Gia_WinNodeHasUnmarkedFanouts( p, iObj ) )
684 Vec_IntPushTwo( vNodes, Vec_IntEntry(vMap, iObj), Vec_IntEntry(vMap, iObj) );
685 return vNodes;
686}
int Gia_WinNodeHasUnmarkedFanouts(Gia_Man_t *p, int iPivot)
Definition giaResub2.c:654
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_RsbCiWindow()

Vec_Int_t * Gia_RsbCiWindow ( Gia_Man_t * p,
int nPis )

Definition at line 688 of file giaResub2.c.

689{
690 Vec_Int_t * vRes; int i, iMaxFan;
691 Vec_Int_t * vNodes = Vec_IntAlloc( 100 );
692 Vec_Int_t * vMap = Vec_IntStartFull( Gia_ManObjNum(p) );
693 Vec_Wec_t * vLevels = Vec_WecStart( Gia_ManLevelNum(p)+1 );
696 // add the first one
697 iMaxFan = Gia_WinAddCiWithMaxFanouts( p );
698 Gia_ObjSetTravIdCurrentId( p, iMaxFan );
699 Vec_IntPush( vNodes, iMaxFan );
700 // add remaining ones
701 for ( i = 1; i < nPis; i++ )
702 {
703 iMaxFan = Gia_WinAddCiWithMaxDivisors( p, vLevels );
704 Gia_WinTryAddingNode( p, iMaxFan, -1, vLevels, vNodes );
705 }
706 Vec_IntSort( vNodes, 0 );
707 vRes = Gia_RsbCiTranslate( p, vNodes, vMap );
709 Vec_WecFree( vLevels );
710 Vec_IntFree( vMap );
711//Vec_IntPrint( vNodes );
712 Vec_IntFree( vNodes );
713 return vRes;
714}
Vec_Int_t * Gia_RsbCiTranslate(Gia_Man_t *p, Vec_Int_t *vObjs, Vec_Int_t *vMap)
Definition giaResub2.c:665
int Gia_WinAddCiWithMaxFanouts(Gia_Man_t *p)
Definition giaResub2.c:623
int Gia_WinTryAddingNode(Gia_Man_t *p, int iPivot, int iPivot2, Vec_Wec_t *vLevels, Vec_Int_t *vNodes)
Definition giaResub2.c:568
int Gia_WinAddCiWithMaxDivisors(Gia_Man_t *p, Vec_Wec_t *vLevels)
Definition giaResub2.c:636
void Gia_ManStaticFanoutStart(Gia_Man_t *p)
Definition giaFanout.c:238
void Gia_ManStaticFanoutStop(Gia_Man_t *p)
Definition giaFanout.c:393
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition giaUtil.c:190
int Gia_ManLevelNum(Gia_Man_t *p)
Definition giaUtil.c:546
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_RsbCiWindowTest()

void Gia_RsbCiWindowTest ( Gia_Man_t * p)

Definition at line 715 of file giaResub2.c.

716{
717 Vec_Int_t * vWin = Gia_RsbCiWindow( p, 6 );
718 //Vec_IntPrint( vWin );
719 Vec_IntFree( vWin );
720}
Vec_Int_t * Gia_RsbCiWindow(Gia_Man_t *p, int nPis)
Definition giaResub2.c:688
Here is the call graph for this function:

◆ Gia_RsbCreateWindowInputs()

Vec_Int_t * Gia_RsbCreateWindowInputs ( Gia_Man_t * p,
Vec_Int_t * vWin )

Definition at line 830 of file giaResub2.c.

831{
832 Vec_Int_t * vInputs = Vec_IntAlloc(10);
833 Gia_Obj_t * pObj; int i, n, iObj;
835 Gia_ManForEachObjVec( vWin, p, pObj, i )
836 Gia_ObjSetTravIdCurrent(p, pObj);
837 Gia_ManForEachObjVec( vWin, p, pObj, i )
838 {
839 assert( Gia_ObjIsAnd(pObj) );
840 for ( n = 0; n < 2; n++ )
841 {
842 int iFan = n ? Gia_ObjFaninId1p(p, pObj) : Gia_ObjFaninId0p(p, pObj);
843 if ( !Gia_ObjIsTravIdCurrentId(p, iFan) )
844 Vec_IntPushUnique( vInputs, iFan );
845 }
846 }
847 Vec_IntForEachEntry( vInputs, iObj, i )
848 {
849 Gia_ObjSetTravIdCurrentId( p, iObj );
850 Vec_IntPush( vWin, iObj );
851 }
852 return vInputs;
853}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_RsbDeriveGiaFromWindows()

Gia_Man_t * Gia_RsbDeriveGiaFromWindows ( Gia_Man_t * p,
Vec_Int_t * vWin,
Vec_Int_t * vIns,
Vec_Int_t * vOuts )

Definition at line 1264 of file giaResub2.c.

1265{
1266 Gia_Man_t * pNew;
1267 Gia_Obj_t * pObj;
1268 int i;
1269 pNew = Gia_ManStart( Gia_ManObjNum(p) );
1270 pNew->pName = Abc_UtilStrsav( p->pName );
1271 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1272 Gia_ManHashAlloc( pNew );
1274 Gia_ManConst0(p)->Value = 0;
1275 Gia_ManForEachObjVec( vIns, p, pObj, i )
1276 pObj->Value = Gia_ManAppendCi( pNew );
1277 Gia_ManForEachObjVec( vWin, p, pObj, i )
1278 if ( !~pObj->Value )
1279 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1280 Gia_ManForEachObjVec( vOuts, p, pObj, i )
1281 Gia_ManAppendCo( pNew, pObj->Value );
1282 Gia_ManHashStop( pNew );
1283 return pNew;
1284}
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition giaHash.c:105
void Gia_ManFillValue(Gia_Man_t *p)
Definition giaUtil.c:369
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:576
void Gia_ManHashStop(Gia_Man_t *p)
Definition giaHash.c:149
char * pSpec
Definition gia.h:100
unsigned Value
Definition gia.h:89
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_RsbEnumerateWindows()

void Gia_RsbEnumerateWindows ( Gia_Man_t * p,
int nInputsMax,
int nLevelsMax )

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

Synopsis [Enumerate windows of the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1353 of file giaResub2.c.

1354{
1355 int fVerbose = 0;
1356 int fUseHash = 0;
1357 int i, nWins = 0, nWinSize = 0, nInsSize = 0, nOutSize = 0, nNodeGain = 0;
1358 Vec_Wec_t * vLevels = Vec_WecStart( Gia_ManLevelNum(p)+1 );
1359 Vec_Int_t * vPaths = Vec_IntStart( Gia_ManObjNum(p) );
1360 Vec_Int_t * vRefs = Vec_IntStart( Gia_ManObjNum(p) );
1361 Hsh_VecMan_t * pHash = Hsh_VecManStart( 1000 );
1362 Gia_Obj_t * pObj;
1363 Gia_Man_t * pIn, * pOut;
1364 abctime clk = Abc_Clock();
1366 Gia_ManForEachAnd( p, pObj, i )
1367 {
1368 Vec_Int_t * vWin, * vIns, * vOuts;
1369 if ( !Gia_RsbWindowCompute( p, i, nInputsMax, nLevelsMax, vLevels, vPaths, &vWin, &vIns ) )
1370 continue;
1371 vOuts = Gia_RsbFindOutputs( p, vWin, vIns, vRefs );
1372 nWins++;
1373 nWinSize += Vec_IntSize(vWin);
1374 nInsSize += Vec_IntSize(vIns);
1375 nOutSize += Vec_IntSize(vOuts);
1376
1377
1378 if ( fVerbose )
1379 {
1380 printf( "\n\nObj %d\n", i );
1381 Vec_IntPrint( vWin );
1382 Vec_IntPrint( vIns );
1383 Vec_IntPrint( vOuts );
1384 printf( "\n" );
1385 }
1386 else if ( Vec_IntSize(vWin) > 1000 )
1387 printf( "Obj %d. Window: Ins = %d. Ands = %d. Outs = %d.\n",
1388 i, Vec_IntSize(vIns), Vec_IntSize(vWin)-Vec_IntSize(vIns), Vec_IntSize(vOuts) );
1389
1390 if ( fUseHash )
1391 {
1392 int nEntries = Hsh_VecSize(pHash);
1393 Hsh_VecManAdd( pHash, vWin );
1394 if ( nEntries == Hsh_VecSize(pHash) )
1395 {
1396 Vec_IntFree( vWin );
1397 Vec_IntFree( vIns );
1398 Vec_IntFree( vOuts );
1399 continue;
1400 }
1401 }
1402
1403 pIn = Gia_RsbDeriveGiaFromWindows( p, vWin, vIns, vOuts );
1404 pOut = Gia_ManResub2Test( pIn );
1405 //pOut = Gia_ManDup( pIn );
1406 if ( !Gia_ManVerifyTwoTruths( pIn, pOut ) )
1407 {
1408 Gia_ManPrint( pIn );
1409 Gia_ManPrint( pOut );
1410 pOut = pOut;
1411 }
1412
1413 nNodeGain += Gia_ManAndNum(pIn) - Gia_ManAndNum(pOut);
1414 Gia_ManStop( pIn );
1415 Gia_ManStop( pOut );
1416
1417 Vec_IntFree( vWin );
1418 Vec_IntFree( vIns );
1419 Vec_IntFree( vOuts );
1420 }
1422 Vec_WecFree( vLevels );
1423 Vec_IntFree( vPaths );
1424 Vec_IntFree( vRefs );
1425 printf( "Computed windows for %d nodes (out of %d). Unique = %d. Ave inputs = %.2f. Ave outputs = %.2f. Ave volume = %.2f. Gain = %d. ",
1426 nWins, Gia_ManAndNum(p), Hsh_VecSize(pHash), 1.0*nInsSize/Abc_MaxInt(1,nWins),
1427 1.0*nOutSize/Abc_MaxInt(1,nWins), 1.0*nWinSize/Abc_MaxInt(1,nWins), nNodeGain );
1428 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
1429 Hsh_VecManStop( pHash );
1430}
Gia_Man_t * Gia_ManResub2Test(Gia_Man_t *p)
Definition giaResub2.c:533
int Gia_ManVerifyTwoTruths(Gia_Man_t *p1, Gia_Man_t *p2)
Definition giaResub2.c:1313
int Gia_RsbWindowCompute(Gia_Man_t *p, int iObj, int nInputsMax, int nLevelsMax, Vec_Wec_t *vLevels, Vec_Int_t *vPaths, Vec_Int_t **pvWin, Vec_Int_t **pvIns)
Definition giaResub2.c:1199
Vec_Int_t * Gia_RsbFindOutputs(Gia_Man_t *p, Vec_Int_t *vWin, Vec_Int_t *vIns, Vec_Int_t *vRefs)
Definition giaResub2.c:1239
Gia_Man_t * Gia_RsbDeriveGiaFromWindows(Gia_Man_t *p, Vec_Int_t *vWin, Vec_Int_t *vIns, Vec_Int_t *vOuts)
Definition giaResub2.c:1264
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
#define Gia_ManForEachAnd(p, pObj, i)
Definition gia.h:1214
void Gia_ManPrint(Gia_Man_t *p)
Definition giaUtil.c:1543
struct Hsh_VecMan_t_ Hsh_VecMan_t
Definition vecHsh.h:85
Here is the call graph for this function:

◆ Gia_RsbExpandCut()

int Gia_RsbExpandCut ( Gia_Man_t * p,
Vec_Int_t * vIns )

Definition at line 1048 of file giaResub2.c.

1049{
1050 int fOnlyPis = 0, fChange = 1, nSize = Vec_IntSize(vIns);
1051 while ( fChange )
1052 {
1053 Gia_Obj_t * pObj;
1054 int i, iFan0, iFan1, fHave0, fHave1;
1055 fOnlyPis = 1;
1056 fChange = 0;
1057 // check if some nodes can be expanded without increasing cut size
1058 Gia_ManForEachObjVec( vIns, p, pObj, i )
1059 {
1060 assert( Gia_ObjIsTravIdCurrent(p, pObj) );
1061 if ( !Gia_ObjIsAnd(pObj) )
1062 continue;
1063 fOnlyPis = 0;
1064 iFan0 = Gia_ObjFaninId0p(p, pObj);
1065 iFan1 = Gia_ObjFaninId1p(p, pObj);
1066 fHave0 = Gia_ObjIsTravIdCurrentId(p, iFan0);
1067 fHave1 = Gia_ObjIsTravIdCurrentId(p, iFan1);
1068 if ( !fHave0 && !fHave1 )
1069 continue;
1070 // can expand because one of the fanins is already in the cut
1071 // remove current cut node
1072 Vec_IntDrop( vIns, i );
1073 // add missing fanin
1074 if ( !fHave0 )
1075 {
1076 Vec_IntPush( vIns, iFan0 );
1077 Gia_ObjSetTravIdCurrentId( p, iFan0 );
1078 }
1079 if ( !fHave1 )
1080 {
1081 Vec_IntPush( vIns, iFan1 );
1082 Gia_ObjSetTravIdCurrentId( p, iFan1 );
1083 }
1084 fChange = 1;
1085 break;
1086 }
1087 }
1088 assert( Vec_IntSize(vIns) <= nSize );
1089 return fOnlyPis;
1090}
Here is the caller graph for this function:

◆ Gia_RsbExpandInputs()

void Gia_RsbExpandInputs ( Gia_Man_t * p,
Vec_Wec_t * vLevels,
Vec_Int_t * vWin,
Vec_Int_t * vInputs )

Definition at line 902 of file giaResub2.c.

903{
904 Gia_Obj_t * pObj;
905 int i, n, iFans[2], fChange = 1;
906 while ( fChange )
907 {
908 fChange = 0;
909 Gia_ManForEachObjVec( vInputs, p, pObj, i )
910 {
911 if ( !Gia_ObjIsAnd(pObj) )
912 continue;
913 iFans[0] = Gia_ObjFaninId0p(p, pObj);
914 iFans[1] = Gia_ObjFaninId1p(p, pObj);
915 if ( !Gia_ObjIsTravIdCurrentId(p, iFans[0]) && !Gia_ObjIsTravIdCurrentId(p, iFans[1]) )
916 continue;
917 Vec_IntRemove( vInputs, Gia_ObjId(p, pObj) );
918 assert( Vec_IntFind(vWin, Gia_ObjId(p, pObj)) >= 0 );
919 for ( n = 0; n < 2; n++ )
920 {
921 if ( Gia_ObjIsTravIdCurrentId(p, iFans[n]) )
922 continue;
923 assert( Vec_IntFind(vInputs, iFans[n]) == -1 );
924 Vec_IntPush( vInputs, iFans[n] );
925 Gia_WinTryAddingNode( p, iFans[n], -1, vLevels, vWin );
926 assert( Gia_ObjIsTravIdCurrentId(p, iFans[n]) );
927 }
928 fChange = 1;
929 }
930 }
931}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_RsbFindFaninAdd()

int Gia_RsbFindFaninAdd ( int iFan,
int pFanins[32],
int pFaninCounts[32],
int nFanins )

Definition at line 1091 of file giaResub2.c.

1092{
1093 int i;
1094 for ( i = 0; i < nFanins; i++ )
1095 if ( pFanins[i] == iFan )
1096 break;
1097 pFanins[i] = iFan;
1098 pFaninCounts[i]++;
1099 return nFanins + (i == nFanins);
1100}
Here is the caller graph for this function:

◆ Gia_RsbFindFaninToAddToCut()

int Gia_RsbFindFaninToAddToCut ( Gia_Man_t * p,
Vec_Int_t * vIns )

Definition at line 1101 of file giaResub2.c.

1102{
1103 Gia_Obj_t * pObj;
1104 int nFanins = 0, pFanins[64] = {0}, pFaninCounts[64] = {0};
1105 int i, iFan0, iFan1, iFanMax = -1, CountMax = 0;
1106 Gia_ManForEachObjVec( vIns, p, pObj, i )
1107 {
1108 if ( !Gia_ObjIsAnd(pObj) )
1109 continue;
1110 iFan0 = Gia_ObjFaninId0p(p, pObj);
1111 iFan1 = Gia_ObjFaninId1p(p, pObj);
1112 assert( !Gia_ObjIsTravIdCurrentId(p, iFan0) );
1113 assert( !Gia_ObjIsTravIdCurrentId(p, iFan1) );
1114 nFanins = Gia_RsbFindFaninAdd( iFan0, pFanins, pFaninCounts, nFanins );
1115 nFanins = Gia_RsbFindFaninAdd( iFan1, pFanins, pFaninCounts, nFanins );
1116 assert( nFanins < 64 );
1117 }
1118 // find fanin with the highest count
1119 if ( p->vFanoutNums != NULL )
1120 {
1121 for ( i = 0; i < nFanins; i++ )
1122 if ( CountMax < pFaninCounts[i] || (CountMax == pFaninCounts[i] && (Gia_ObjFanoutNumId(p, iFanMax) < Gia_ObjFanoutNumId(p, pFanins[i]))) )
1123 {
1124 CountMax = pFaninCounts[i];
1125 iFanMax = pFanins[i];
1126 }
1127 }
1128 else
1129 {
1130 for ( i = 0; i < nFanins; i++ )
1131 if ( CountMax < pFaninCounts[i] || (CountMax == pFaninCounts[i] && (Gia_ObjRefNumId(p, iFanMax) < Gia_ObjRefNumId(p, pFanins[i]))) )
1132 {
1133 CountMax = pFaninCounts[i];
1134 iFanMax = pFanins[i];
1135 }
1136 }
1137 return iFanMax;
1138}
int Gia_RsbFindFaninAdd(int iFan, int pFanins[32], int pFaninCounts[32], int nFanins)
Definition giaResub2.c:1091
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_RsbFindOutputs()

Vec_Int_t * Gia_RsbFindOutputs ( Gia_Man_t * p,
Vec_Int_t * vWin,
Vec_Int_t * vIns,
Vec_Int_t * vRefs )

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

Synopsis [Derive GIA from the window]

Description []

SideEffects []

SeeAlso []

Definition at line 1239 of file giaResub2.c.

1240{
1241 Vec_Int_t * vOuts = Vec_IntAlloc( 100 );
1242 Gia_Obj_t * pObj; int i;
1244 Gia_ManForEachObjVec( vIns, p, pObj, i )
1245 Gia_ObjSetTravIdCurrent( p, pObj );
1246 Gia_ManForEachObjVec( vWin, p, pObj, i )
1247 if ( !Gia_ObjIsTravIdCurrent(p, pObj) && Gia_ObjIsAnd(pObj) )
1248 {
1249 Vec_IntAddToEntry( vRefs, Gia_ObjFaninId0p(p, pObj), 1 );
1250 Vec_IntAddToEntry( vRefs, Gia_ObjFaninId1p(p, pObj), 1 );
1251 }
1252 Gia_ManForEachObjVec( vWin, p, pObj, i )
1253 if ( !Gia_ObjIsTravIdCurrent(p, pObj) && Gia_ObjFanoutNum(p, pObj) != Vec_IntEntry(vRefs, Gia_ObjId(p, pObj)) )
1254 Vec_IntPush( vOuts, Gia_ObjId(p, pObj) );
1255 Gia_ManForEachObjVec( vWin, p, pObj, i )
1256 if ( !Gia_ObjIsTravIdCurrent(p, pObj) && Gia_ObjIsAnd(pObj) )
1257 {
1258 Vec_IntAddToEntry( vRefs, Gia_ObjFaninId0p(p, pObj), -1 );
1259 Vec_IntAddToEntry( vRefs, Gia_ObjFaninId1p(p, pObj), -1 );
1260 }
1261 return vOuts;
1262}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_RsbSelectOneInput()

int Gia_RsbSelectOneInput ( Gia_Man_t * p,
Vec_Wec_t * vLevels,
Vec_Int_t * vIns )

Definition at line 933 of file giaResub2.c.

934{
935 int i, iNode = 0, WeightThis, WeightBest = -1;
936 Gia_Obj_t * pObj;
937 Gia_ManForEachObjVec( vIns, p, pObj, i )
938 if ( Gia_ObjIsAnd(pObj) )
939 {
940 int iFan0 = Gia_ObjFaninId0p(p, pObj);
941 int iFan1 = Gia_ObjFaninId1p(p, pObj);
942 assert( !Gia_ObjIsTravIdCurrentId(p, iFan0) && !Gia_ObjIsTravIdCurrentId(p, iFan1) );
943 WeightThis = Gia_WinTryAddingNode( p, iFan0, iFan1, vLevels, NULL );
944 if ( WeightBest < WeightThis )
945 {
946 WeightBest = WeightThis;
947 iNode = Gia_ObjId(p, pObj);
948 }
949 }
950 return iNode;
951}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_RsbTestArray()

void Gia_RsbTestArray ( )

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

Synopsis [Apply k-resub to one AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 1459 of file giaResub2.c.

1460{
1461 int Array[1000] = {
1462 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 6, 3, 7, 15, 17, 8, 19,
1463 5, 20, 5, 12, 8, 24, 4, 12, 9, 28, 27, 31, 23, 32, 4, 13, 8, 36, 5,
1464 13, 18, 40, 9, 18, 5, 44, 19, 36, 9, 48, 47, 51, 10, 18, 40, 54, 8,
1465 56, 25, 37, 44, 61, 59, 63, 8, 28, 8, 18, 25, 68, 66, 70, 64, 73, 11,
1466 19, 8, 13, 76, 78, 10, 19, 40, 82, 9, 84, 81, 87, 20, 61, 19, 28, 30,
1467 92, 91, 95, 88, 96, 74, 98, 9, 40, 49, 103, 27, 104, 10, 107, 8, 40,
1468 9, 24, 111, 113, 11, 115, 109, 117, 11, 66, 51, 121, 118, 122, 18, 36,
1469 18, 110, 93, 127, 10, 131, 129, 133, 11, 38, 32, 137, 103, 138, 19, 141,
1470 134, 143, 28, 76, 9, 146, 11, 110, 19, 150, 149, 153, 87, 95, 9, 19, 10,
1471 159, 61, 160, 18, 30, 61, 158, 9, 12, 25, 169, 19, 171, 111, 173, 10, 175,
1472 167, 177, 18, 102, 4, 20, 18, 171, 183, 185, 11, 187, 181, 189, 178, 190,
1473 24, 44, 11, 194, 8, 54, 4, 198, 197, 201, 45, 49, 10, 39, 9, 126, 73, 209,
1474 11, 211, 54, 168, 213, 215, 43, 167, 67, 218, 10, 221, 26, 54, 18, 18, 34,
1475 34, 38, 38, 40, 40, 42, 42, 52, 52, 100, 100, 124, 124, 126, 126, 144, 144,
1476 148, 148, 154, 154, 156, 156, 162, 162, 164, 164, 192, 192, 70, 70, 202,
1477 202, 204, 204, 206, 206, 216, 216, 222, 222, 224, 224
1478 };
1479 int i, iFan0, iFan1, nResubs;
1480 int * pRes;
1481 // create the internal array
1482 Vec_Int_t * vArray = Vec_IntAlloc( 100 );
1483 for ( i = 0; i < 50 || Array[i] > 0; i++ )
1484 Vec_IntPush( vArray, Array[i] );
1485 Vec_IntPrint( vArray );
1486 // check the nodes
1487 printf( "Constant0 and primary inputs:\n" );
1488 Vec_IntForEachEntryDouble( vArray, iFan0, iFan1, i )
1489 {
1490 if ( iFan0 != iFan1 )
1491 break;
1492 printf( "%2d = %c%2d & %c%2d;\n", i,
1493 Abc_LitIsCompl(iFan0) ? '!' : ' ', Abc_Lit2Var(iFan0),
1494 Abc_LitIsCompl(iFan1) ? '!' : ' ', Abc_Lit2Var(iFan1) );
1495 }
1496 printf( "Primary outputs:\n" );
1497 Vec_IntForEachEntryDoubleStart( vArray, iFan0, iFan1, i, 14 )
1498 {
1499 if ( iFan0 != iFan1 )
1500 continue;
1501 printf( "%2d = %c%2d & %c%2d;\n", i,
1502 Abc_LitIsCompl(iFan0) ? '!' : ' ', Abc_Lit2Var(iFan0),
1503 Abc_LitIsCompl(iFan1) ? '!' : ' ', Abc_Lit2Var(iFan1) );
1504 }
1505 // run the resub
1507 Abc_ResubComputeWindow( Vec_IntArray(vArray), Vec_IntSize(vArray)/2, 10, -1, 0, 0, 1, 1, &pRes, &nResubs );
1509 Vec_IntFree( vArray );
1510}
#define Vec_IntForEachEntryDoubleStart(vVec, Entry1, Entry2, i, Start)
Definition vecInt.h:74
Here is the call graph for this function:

◆ Gia_RsbTryOneWindow()

Gia_Man_t * Gia_RsbTryOneWindow ( Gia_Man_t * p)

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

Synopsis [Apply k-resub to one AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 1443 of file giaResub2.c.

1444{
1445 return Gia_ManResub2Test( p );
1446}
Here is the call graph for this function:

◆ Gia_RsbWindowCompute()

int Gia_RsbWindowCompute ( Gia_Man_t * p,
int iObj,
int nInputsMax,
int nLevelsMax,
Vec_Wec_t * vLevels,
Vec_Int_t * vPaths,
Vec_Int_t ** pvWin,
Vec_Int_t ** pvIns )

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

Synopsis [Create window for the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 1199 of file giaResub2.c.

1200{
1201 Vec_Int_t * vWin, * vIns;
1202 *pvWin = *pvIns = NULL;
1203 vWin = Gia_RsbWindowInit( p, vPaths, iObj, nLevelsMax );
1204 if ( vWin == NULL )
1205 return 0;
1206 vIns = Gia_RsbCreateWindowInputs( p, vWin );
1207 // vWin and vIns are labeled with the current trav ID
1208 //Vec_IntPrint( vWin );
1209 //Vec_IntPrint( vIns );
1210 if ( Vec_IntSize(vIns) <= nInputsMax + 3 ) // consider windows, which initially has a larger input space
1211 Gia_RsbWindowGrow2( p, iObj, vLevels, vWin, vIns, nInputsMax );
1212 if ( Vec_IntSize(vIns) <= nInputsMax )
1213 {
1214 Vec_IntSort( vWin, 0 );
1215 Vec_IntSort( vIns, 0 );
1216 *pvWin = vWin;
1217 *pvIns = vIns;
1218 return 1;
1219 }
1220 else
1221 {
1222 Vec_IntFree( vWin );
1223 Vec_IntFree( vIns );
1224 return 0;
1225 }
1226}
void Gia_RsbWindowGrow2(Gia_Man_t *p, int iObj, Vec_Wec_t *vLevels, Vec_Int_t *vWin, Vec_Int_t *vIns, int nInputsMax)
Definition giaResub2.c:1140
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_RsbWindowExplore()

int Gia_RsbWindowExplore ( Gia_Man_t * p,
Vec_Int_t * vVisited,
int iStart,
Vec_Int_t * vPaths,
int * piMeet,
int * piNode )

Definition at line 756 of file giaResub2.c.

757{
758 int i, n, iObj, iLimit = Vec_IntSize( vVisited );
759 *piMeet = *piNode = 0;
760 Vec_IntForEachEntryStartStop( vVisited, iObj, i, iStart, iLimit )
761 {
762 Gia_Obj_t * pObj = Gia_ManObj( p, iObj );
763 if ( !Gia_ObjIsAnd(pObj) )
764 continue;
765 for ( n = 0; n < 2; n++ )
766 {
767 int iFan = Gia_ObjFaninId( pObj, iObj, n );
768 // if the node was visited on the paths to both fanins, collect it
769 if ( Gia_ObjTravIsTopTwo(p, iObj) && Gia_ObjTravIsTopTwo(p, iFan) && !Gia_ObjTravIsSame(p, iObj, iFan) )
770 {
771 *piMeet = iFan;
772 *piNode = iObj;
773 return 1;
774 }
775 // if the node was visited already on this path, skip it
776 if ( Gia_ObjTravIsTopTwo(p, iFan) )
777 {
778 assert( Gia_ObjTravIsSame(p, iObj, iFan) );
779 continue;
780 }
781 // label the node as visited
782 Gia_ObjTravSetSame( p, iFan, iObj );
783 Vec_IntWriteEntry( vPaths, iFan, iObj );
784 Vec_IntPush( vVisited, iFan );
785 }
786 }
787 return 0;
788}
#define Vec_IntForEachEntryStartStop(vVec, Entry, i, Start, Stop)
Definition vecInt.h:60
Here is the caller graph for this function:

◆ Gia_RsbWindowGather()

void Gia_RsbWindowGather ( Gia_Man_t * p,
Vec_Int_t * vPaths,
int iNode,
Vec_Int_t * vVisited )

Definition at line 743 of file giaResub2.c.

744{
745 int iPrev;
746 if ( iNode == 0 )
747 return;
748 Vec_IntPush( vVisited, iNode );
749 iPrev = Vec_IntEntry( vPaths, iNode );
750 if ( iPrev == 0 )
751 return;
752 assert( Gia_ObjTravIsSame(p, iPrev, iNode) );
753 Gia_RsbWindowGather( p, vPaths, iPrev, vVisited );
754}
void Gia_RsbWindowGather(Gia_Man_t *p, Vec_Int_t *vPaths, int iNode, Vec_Int_t *vVisited)
Definition giaResub2.c:743
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_RsbWindowGrow()

void Gia_RsbWindowGrow ( Gia_Man_t * p,
Vec_Wec_t * vLevels,
Vec_Int_t * vWin,
Vec_Int_t * vIns,
int nInputsMax )

Definition at line 953 of file giaResub2.c.

954{
955 int iNode;
956 Gia_RsbAddSideInputs( p, vLevels, vWin );
957 Gia_RsbExpandInputs( p, vLevels, vWin, vIns );
958 while ( Vec_IntSize(vIns) < nInputsMax && (iNode = Gia_RsbSelectOneInput(p, vLevels, vIns)) )
959 {
960 int iFan0 = Gia_ObjFaninId0p(p, Gia_ManObj(p, iNode));
961 int iFan1 = Gia_ObjFaninId1p(p, Gia_ManObj(p, iNode));
962 assert( !Gia_ObjIsTravIdCurrentId(p, iFan0) && !Gia_ObjIsTravIdCurrentId(p, iFan1) );
963 Gia_WinTryAddingNode( p, iFan0, iFan1, vLevels, vWin );
964 assert( Gia_ObjIsTravIdCurrentId(p, iFan0) && Gia_ObjIsTravIdCurrentId(p, iFan1) );
965 Vec_IntRemove( vIns, iNode );
966 Vec_IntPushTwo( vIns, iFan0, iFan1 );
967 Gia_RsbExpandInputs( p, vLevels, vWin, vIns );
968 }
969}
int Gia_RsbSelectOneInput(Gia_Man_t *p, Vec_Wec_t *vLevels, Vec_Int_t *vIns)
Definition giaResub2.c:933
void Gia_RsbAddSideInputs(Gia_Man_t *p, Vec_Wec_t *vLevels, Vec_Int_t *vWin)
Definition giaResub2.c:866
void Gia_RsbExpandInputs(Gia_Man_t *p, Vec_Wec_t *vLevels, Vec_Int_t *vWin, Vec_Int_t *vInputs)
Definition giaResub2.c:902
Here is the call graph for this function:

◆ Gia_RsbWindowGrow2()

void Gia_RsbWindowGrow2 ( Gia_Man_t * p,
int iObj,
Vec_Wec_t * vLevels,
Vec_Int_t * vWin,
Vec_Int_t * vIns,
int nInputsMax )

Definition at line 1140 of file giaResub2.c.

1141{
1142 // window will be recomputed later
1143 Vec_IntClear( vWin );
1144 // expand the cut without increasing its cost
1145 if ( !Gia_RsbExpandCut( p, vIns ) )
1146 {
1147 // save it as the best cut
1148 Vec_Int_t * vBest = Vec_IntSize(vIns) <= nInputsMax ? Vec_IntDup(vIns) : NULL;
1149 int fOnlyPis = 0, Iter = 0;
1150 // iterate expansion until
1151 // (1) the cut cannot be expanded because all leaves are PIs
1152 // (2) the cut size exceeded the limit for 5 consecutive iterations
1153 while ( !fOnlyPis && (Vec_IntSize(vIns) <= nInputsMax || Iter < 5) )
1154 {
1155 int iFanBest = Gia_RsbFindFaninToAddToCut( p, vIns );
1156 Vec_IntPush( vIns, iFanBest );
1157 Gia_ObjSetTravIdCurrentId( p, iFanBest );
1158 fOnlyPis = Gia_RsbExpandCut( p, vIns );
1159 if ( Vec_IntSize(vIns) > nInputsMax )
1160 Iter++;
1161 else
1162 Iter = 0;
1163 if ( Vec_IntSize(vIns) <= nInputsMax && (!vBest || Vec_IntSize(vBest) <= Vec_IntSize(vIns)) )
1164 {
1165 if ( vBest )
1166 Vec_IntClear(vBest);
1167 else
1168 vBest = Vec_IntAlloc( 10 );
1169 Vec_IntAppend( vBest, vIns );
1170 }
1171 }
1172 if ( vBest )
1173 {
1174 Vec_IntClear( vIns );
1175 Vec_IntAppend( vIns, vBest );
1176 Vec_IntFree( vBest );
1177 }
1178 else
1179 assert( Vec_IntSize(vIns) > nInputsMax );
1180 }
1181 if ( vLevels && Vec_IntSize(vIns) <= nInputsMax )
1182 {
1183 Vec_IntSort( vIns, 0 );
1184 Gia_WinCreateFromCut( p, iObj, vIns, vLevels, vWin );
1185 }
1186}
void Gia_WinCreateFromCut(Gia_Man_t *p, int iPivot, Vec_Int_t *vIn, Vec_Wec_t *vLevels, Vec_Int_t *vWin)
Definition giaResub2.c:995
int Gia_RsbFindFaninToAddToCut(Gia_Man_t *p, Vec_Int_t *vIns)
Definition giaResub2.c:1101
int Gia_RsbExpandCut(Gia_Man_t *p, Vec_Int_t *vIns)
Definition giaResub2.c:1048
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_RsbWindowInit()

Vec_Int_t * Gia_RsbWindowInit ( Gia_Man_t * p,
Vec_Int_t * vPaths,
int iPivot,
int nIter )

Definition at line 789 of file giaResub2.c.

790{
791 Vec_Int_t * vVisited = Vec_IntAlloc( 100 );
792 Gia_Obj_t * pPivot = Gia_ManObj( p, iPivot );
793 int i, n, iStart = 0;
794 assert( Gia_ObjIsAnd(pPivot) );
795 // start paths for both fanins of the pivot node
796 for ( n = 0; n < 2; n++ )
797 {
798 int iFan = Gia_ObjFaninId( pPivot, iPivot, n );
800 Vec_IntPush( vVisited, iFan );
801 Vec_IntWriteEntry( vPaths, iFan, 0 );
802 Gia_ObjSetTravIdCurrentId( p, iFan );
803 }
804 // perform several iterations of breadth-first search
805 for ( i = 0; i < nIter; i++ )
806 {
807 int iMeet, iNode, iNext = Vec_IntSize(vVisited);
808 if ( Gia_RsbWindowExplore( p, vVisited, iStart, vPaths, &iMeet, &iNode ) )
809 {
810 // found the shared path
811 if ( Gia_ObjIsTravIdCurrentId(p, iMeet) )
812 assert( Gia_ObjIsTravIdPreviousId(p, iNode) );
813 else if ( Gia_ObjIsTravIdPreviousId(p, iMeet) )
814 assert( Gia_ObjIsTravIdCurrentId(p, iNode) );
815 else assert( 0 );
816 // collect the initial window
817 Vec_IntClear( vVisited );
818 Gia_RsbWindowGather( p, vPaths, Vec_IntEntry(vPaths, iMeet), vVisited );
819 Gia_RsbWindowGather( p, vPaths, iNode, vVisited );
820 Vec_IntPush( vVisited, iPivot );
821 break;
822 }
823 iStart = iNext;
824 }
825 // if no meeting point is found, make sure to return NULL
826 if ( i == nIter )
827 Vec_IntFreeP( &vVisited );
828 return vVisited;
829}
int Gia_RsbWindowExplore(Gia_Man_t *p, Vec_Int_t *vVisited, int iStart, Vec_Int_t *vPaths, int *piMeet, int *piNode)
Definition giaResub2.c:756
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_WinAddCiWithMaxDivisors()

int Gia_WinAddCiWithMaxDivisors ( Gia_Man_t * p,
Vec_Wec_t * vLevels )

Definition at line 636 of file giaResub2.c.

637{
638 int i, Id, nCurFan, nMaxFan = -1, iMaxFan = -1;
639 Gia_ManForEachCiId( p, Id, i )
640 {
641 if ( Gia_ObjIsTravIdCurrentId( p, Id ) )
642 continue;
643 nCurFan = Gia_WinTryAddingNode( p, Id, -1, vLevels, NULL );
644 if ( nMaxFan < nCurFan )
645 {
646 nMaxFan = nCurFan;
647 iMaxFan = Id;
648 }
649 }
650 assert( iMaxFan >= 0 );
651 return iMaxFan;
652}
#define Gia_ManForEachCiId(p, Id, i)
Definition gia.h:1230
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_WinAddCiWithMaxFanouts()

int Gia_WinAddCiWithMaxFanouts ( Gia_Man_t * p)

Definition at line 623 of file giaResub2.c.

624{
625 int i, Id, nMaxFan = -1, iMaxFan = -1;
626 Gia_ManForEachCiId( p, Id, i )
627 if ( nMaxFan < Gia_ObjFanoutNumId(p, Id) )
628 {
629 nMaxFan = Gia_ObjFanoutNumId(p, Id);
630 iMaxFan = Id;
631 }
632 assert( iMaxFan >= 0 );
633 return iMaxFan;
634}
Here is the caller graph for this function:

◆ Gia_WinCreateFromCut()

void Gia_WinCreateFromCut ( Gia_Man_t * p,
int iPivot,
Vec_Int_t * vIn,
Vec_Wec_t * vLevels,
Vec_Int_t * vWin )

Definition at line 995 of file giaResub2.c.

996{
997 Vec_Int_t * vLevel;
998 Gia_Obj_t * pObj, * pFanout;
999 int k, i, f, iObj, Level;
1000 Vec_Int_t * vUsed = Vec_IntAlloc( 100 );
1001 // precondition: the levelized structure is empty
1002 assert( Vec_WecSizeSize(vLevels) == 0 );
1003 // clean the resulting array
1004 Vec_IntClear( vWin );
1005 // collect leaves
1007 Vec_IntForEachEntry( vIn, iObj, i )
1008 {
1009 Gia_ObjSetTravIdCurrentId( p, iObj );
1010 Vec_IntPush( vWin, iObj );
1011 }
1012 // collect internal cone
1013 Gia_WinCreateFromCut_rec( p, iPivot, vWin );
1014 // add nodes to the levelized structure
1015 Vec_IntForEachEntry( vWin, iObj, i )
1016 {
1017 Vec_WecPush( vLevels, Gia_ObjLevelId(p, iObj), iObj );
1018 Vec_IntPushUniqueOrder( vUsed, Gia_ObjLevelId(p, iObj) );
1019 }
1020 // iterate through all objects and explore their fanouts
1021 //Vec_WecForEachLevel( vLevels, vLevel, k )
1022 Vec_IntForEachEntry( vUsed, Level, k )
1023 {
1024 vLevel = Vec_WecEntry( vLevels, Level );
1025 Gia_ManForEachObjVec( vLevel, p, pObj, i )
1026 Gia_ObjForEachFanoutStatic( p, pObj, pFanout, f )
1027 {
1028 if ( f == 5 ) // explore first 5 fanouts of the node
1029 break;
1030 if ( Gia_ObjIsAnd(pFanout) && // internal node
1031 !Gia_ObjIsTravIdCurrent(p, pFanout) && // not in the window
1032 Gia_ObjIsTravIdCurrent(p, Gia_ObjFanin0(pFanout)) && // but fanins are
1033 Gia_ObjIsTravIdCurrent(p, Gia_ObjFanin1(pFanout)) ) // in the window
1034 {
1035 // add fanout to the window and to the levelized structure
1036 Gia_ObjSetTravIdCurrent( p, pFanout );
1037 Vec_WecPush( vLevels, Gia_ObjLevel(p, pFanout), Gia_ObjId(p, pFanout) );
1038 Vec_IntPush( vWin, Gia_ObjId(p, pFanout) );
1039 Vec_IntPushUniqueOrder( vUsed, Gia_ObjLevel(p, pFanout) );
1040 }
1041 }
1042 Vec_IntClear( vLevel );
1043 }
1044 Vec_IntSort( vWin, 0 );
1045 Vec_IntFree( vUsed );
1046}
void Gia_WinCreateFromCut_rec(Gia_Man_t *p, int iObj, Vec_Int_t *vWin)
Definition giaResub2.c:982
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_WinCreateFromCut_rec()

void Gia_WinCreateFromCut_rec ( Gia_Man_t * p,
int iObj,
Vec_Int_t * vWin )

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

Synopsis [Grow window for the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 982 of file giaResub2.c.

983{
984 Gia_Obj_t * pObj;
985 if ( Gia_ObjIsTravIdCurrentId(p, iObj) )
986 return;
987 Gia_ObjSetTravIdCurrentId(p, iObj);
988 pObj = Gia_ManObj( p, iObj );
989 assert( Gia_ObjIsAnd(pObj) );
990 Gia_WinCreateFromCut_rec( p, Gia_ObjFaninId0(pObj, iObj), vWin );
991 Gia_WinCreateFromCut_rec( p, Gia_ObjFaninId1(pObj, iObj), vWin );
992 Vec_IntPush( vWin, iObj );
993}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_WinNodeHasUnmarkedFanouts()

int Gia_WinNodeHasUnmarkedFanouts ( Gia_Man_t * p,
int iPivot )

Definition at line 654 of file giaResub2.c.

655{
656 int f, iFan;
657 Gia_ObjForEachFanoutStaticId( p, iPivot, iFan, f )
658 if ( !Gia_ObjIsTravIdCurrentId(p, iFan) )
659 return 1;
660 return 0;
661}
#define Gia_ObjForEachFanoutStaticId(p, Id, FanId, i)
Definition gia.h:1127
Here is the caller graph for this function:

◆ Gia_WinTryAddingNode()

int Gia_WinTryAddingNode ( Gia_Man_t * p,
int iPivot,
int iPivot2,
Vec_Wec_t * vLevels,
Vec_Int_t * vNodes )

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

Synopsis [Creating a window with support composed of primary inputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 568 of file giaResub2.c.

569{
570 Vec_Int_t * vLevel;
571 Gia_Obj_t * pObj, * pFanout;
572 int k, i, f, Count = 0;
573 // precondition: the levelized structure is empty
574 assert( Vec_WecSizeSize(vLevels) == 0 );
575 // precondition: the new object to be added (iPivot) is not in the window
576 assert( !Gia_ObjIsTravIdCurrentId(p, iPivot) );
577 // add the object to the window and to the levelized structure
578 Gia_ObjSetTravIdCurrentId( p, iPivot );
579 Vec_WecPush( vLevels, Gia_ObjLevelId(p, iPivot), iPivot );
580 // the same about the second node if it is given
581 if ( iPivot2 != -1 )
582 {
583 // precondition: the new object to be added (iPivot2) is not in the window
584 assert( !Gia_ObjIsTravIdCurrentId(p, iPivot2) );
585 // add the object to the window and to the levelized structure
586 Gia_ObjSetTravIdCurrentId( p, iPivot2 );
587 Vec_WecPush( vLevels, Gia_ObjLevelId(p, iPivot2), iPivot2 );
588 }
589 // iterate through all objects and explore their fanouts
590 Vec_WecForEachLevel( vLevels, vLevel, k )
591 Gia_ManForEachObjVec( vLevel, p, pObj, i )
592 Gia_ObjForEachFanoutStatic( p, pObj, pFanout, f )
593 {
594 if ( f == 5 ) // explore first 5 fanouts of the node
595 break;
596 if ( Gia_ObjIsAnd(pFanout) && // internal node
597 !Gia_ObjIsTravIdCurrent(p, pFanout) && // not in the window
598 Gia_ObjIsTravIdCurrent(p, Gia_ObjFanin0(pFanout)) && // but fanins are
599 Gia_ObjIsTravIdCurrent(p, Gia_ObjFanin1(pFanout)) ) // in the window
600 {
601 // add fanout to the window and to the levelized structure
602 Gia_ObjSetTravIdCurrent( p, pFanout );
603 Vec_WecPush( vLevels, Gia_ObjLevel(p, pFanout), Gia_ObjId(p, pFanout) );
604 // count the number of nodes in the structure
605 Count++;
606 }
607 }
608 // iterate through the nodes in the levelized structure
609 Vec_WecForEachLevel( vLevels, vLevel, k )
610 {
611 Gia_ManForEachObjVec( vLevel, p, pObj, i )
612 if ( vNodes == NULL ) // it was a test run - unmark the node
613 Gia_ObjSetTravIdPrevious( p, pObj );
614 else // it was a real run - permanently add to the node to the window
615 Vec_IntPush( vNodes, Gia_ObjId(p, pObj) );
616 // clean the levelized structure
617 Vec_IntClear( vLevel );
618 }
619 // return the number of nodes to be added
620 return Count;
621}
Here is the caller graph for this function: