abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
giaDfs.c File Reference
#include "gia.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START void Gia_ManCollectCis_rec (Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vSupp)
 DECLARATIONS ///. More...
 
void Gia_ManCollectCis (Gia_Man_t *p, int *pNodes, int nNodes, Vec_Int_t *vSupp)
 
void Gia_ManCollectAnds_rec (Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vNodes)
 
void Gia_ManCollectAnds (Gia_Man_t *p, int *pNodes, int nNodes, Vec_Int_t *vNodes)
 
void Gia_ManCollectNodesCis_rec (Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vNodes)
 
Vec_Int_tGia_ManCollectNodesCis (Gia_Man_t *p, int *pNodes, int nNodes)
 
void Gia_ManCollectTest (Gia_Man_t *p)
 
int Gia_ManSuppSize_rec (Gia_Man_t *p, Gia_Obj_t *pObj)
 
int Gia_ManSuppSizeOne (Gia_Man_t *p, Gia_Obj_t *pObj)
 
int Gia_ManSuppSizeTest (Gia_Man_t *p)
 
int Gia_ManSuppSize (Gia_Man_t *p, int *pNodes, int nNodes)
 
int Gia_ManConeSize_rec (Gia_Man_t *p, Gia_Obj_t *pObj)
 
int Gia_ManConeSize (Gia_Man_t *p, int *pNodes, int nNodes)
 
Vec_Vec_tGia_ManLevelize (Gia_Man_t *p)
 
Vec_Int_tGia_ManOrderReverse (Gia_Man_t *p)
 
void Gia_ManCollectSeq_rec (Gia_Man_t *p, int Id, Vec_Int_t *vRoots, Vec_Int_t *vObjs)
 
Vec_Int_tGia_ManCollectSeq (Gia_Man_t *p, int *pPos, int nPos)
 
void Gia_ManCollectSeqTest (Gia_Man_t *p)
 

Function Documentation

void Gia_ManCollectAnds ( Gia_Man_t p,
int *  pNodes,
int  nNodes,
Vec_Int_t vNodes 
)

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

Synopsis [Collects support nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 123 of file giaDfs.c.

124 {
125  Gia_Obj_t * pObj;
126  int i;
127  Vec_IntClear( vNodes );
128 // Gia_ManIncrementTravId( p );
130  for ( i = 0; i < nNodes; i++ )
131  {
132  pObj = Gia_ManObj( p, pNodes[i] );
133  if ( Gia_ObjIsCo(pObj) )
134  Gia_ManCollectAnds_rec( p, Gia_ObjFanin0(pObj), vNodes );
135  else
136  Gia_ManCollectAnds_rec( p, pObj, vNodes );
137  }
138 }
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
void Gia_ManCollectAnds_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vNodes)
Definition: giaDfs.c:99
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
void Gia_ManCollectAnds_rec ( Gia_Man_t p,
Gia_Obj_t pObj,
Vec_Int_t vNodes 
)

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

Synopsis [Counts the support size of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 99 of file giaDfs.c.

100 {
101  if ( Gia_ObjIsTravIdCurrent(p, pObj) )
102  return;
103  Gia_ObjSetTravIdCurrent(p, pObj);
104  if ( Gia_ObjIsCi(pObj) )
105  return;
106  assert( Gia_ObjIsAnd(pObj) );
107  Gia_ManCollectAnds_rec( p, Gia_ObjFanin0(pObj), vNodes );
108  Gia_ManCollectAnds_rec( p, Gia_ObjFanin1(pObj), vNodes );
109  Vec_IntPush( vNodes, Gia_ObjId(p, pObj) );
110 }
static int Gia_ObjIsTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:533
void Gia_ManCollectAnds_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vNodes)
Definition: giaDfs.c:99
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
void Gia_ManCollectCis ( Gia_Man_t p,
int *  pNodes,
int  nNodes,
Vec_Int_t vSupp 
)

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

Synopsis [Collects support nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 71 of file giaDfs.c.

72 {
73  Gia_Obj_t * pObj;
74  int i;
75  Vec_IntClear( vSupp );
78  for ( i = 0; i < nNodes; i++ )
79  {
80  pObj = Gia_ManObj( p, pNodes[i] );
81  if ( Gia_ObjIsCo(pObj) )
82  Gia_ManCollectCis_rec( p, Gia_ObjFanin0(pObj), vSupp );
83  else
84  Gia_ManCollectCis_rec( p, pObj, vSupp );
85  }
86 }
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
ABC_NAMESPACE_IMPL_START void Gia_ManCollectCis_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vSupp)
DECLARATIONS ///.
Definition: giaDfs.c:45
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
ABC_NAMESPACE_IMPL_START void Gia_ManCollectCis_rec ( Gia_Man_t p,
Gia_Obj_t pObj,
Vec_Int_t vSupp 
)

DECLARATIONS ///.

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

FileName [giaDfs.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis [DFS procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Counts the support size of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file giaDfs.c.

46 {
47  if ( Gia_ObjIsTravIdCurrent(p, pObj) )
48  return;
49  Gia_ObjSetTravIdCurrent(p, pObj);
50  if ( Gia_ObjIsCi(pObj) )
51  {
52  Vec_IntPush( vSupp, Gia_ObjId(p, pObj) );
53  return;
54  }
55  assert( Gia_ObjIsAnd(pObj) );
56  Gia_ManCollectCis_rec( p, Gia_ObjFanin0(pObj), vSupp );
57  Gia_ManCollectCis_rec( p, Gia_ObjFanin1(pObj), vSupp );
58 }
static int Gia_ObjIsTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:533
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
ABC_NAMESPACE_IMPL_START void Gia_ManCollectCis_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vSupp)
DECLARATIONS ///.
Definition: giaDfs.c:45
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
Vec_Int_t* Gia_ManCollectNodesCis ( Gia_Man_t p,
int *  pNodes,
int  nNodes 
)

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

Synopsis [Collects support nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 178 of file giaDfs.c.

179 {
180  Vec_Int_t * vNodes;
181  Gia_Obj_t * pObj;
182  int i;
183  vNodes = Vec_IntAlloc( 10000 );
186  for ( i = 0; i < nNodes; i++ )
187  {
188  pObj = Gia_ManObj( p, pNodes[i] );
189  if ( Gia_ObjIsCo(pObj) )
190  Gia_ManCollectNodesCis_rec( p, Gia_ObjFanin0(pObj), vNodes );
191  else
192  Gia_ManCollectNodesCis_rec( p, pObj, vNodes );
193  }
194  return vNodes;
195 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
void Gia_ManCollectNodesCis_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vNodes)
Definition: giaDfs.c:151
void Gia_ManCollectNodesCis_rec ( Gia_Man_t p,
Gia_Obj_t pObj,
Vec_Int_t vNodes 
)

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

Synopsis [Counts the support size of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 151 of file giaDfs.c.

152 {
153  if ( Gia_ObjIsTravIdCurrent(p, pObj) )
154  return;
155  Gia_ObjSetTravIdCurrent(p, pObj);
156  if ( Gia_ObjIsCi(pObj) )
157  {
158  Vec_IntPush( vNodes, Gia_ObjId(p, pObj) );
159  return;
160  }
161  assert( Gia_ObjIsAnd(pObj) );
162  Gia_ManCollectNodesCis_rec( p, Gia_ObjFanin0(pObj), vNodes );
163  Gia_ManCollectNodesCis_rec( p, Gia_ObjFanin1(pObj), vNodes );
164  Vec_IntPush( vNodes, Gia_ObjId(p, pObj) );
165 }
static int Gia_ObjIsTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:533
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
void Gia_ManCollectNodesCis_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vNodes)
Definition: giaDfs.c:151
Vec_Int_t* Gia_ManCollectSeq ( Gia_Man_t p,
int *  pPos,
int  nPos 
)

Definition at line 467 of file giaDfs.c.

468 {
469  Vec_Int_t * vObjs, * vRoots;
470  int i, iRoot;
471  // collect roots
472  vRoots = Vec_IntAlloc( 100 );
473  for ( i = 0; i < nPos; i++ )
474  Vec_IntPush( vRoots, Gia_ObjId(p, Gia_ManPo(p, pPos[i])) );
475  // start trav IDs
478  // collect objects
479  vObjs = Vec_IntAlloc( 1000 );
480  Vec_IntPush( vObjs, 0 );
481  Vec_IntForEachEntry( vRoots, iRoot, i )
482  Gia_ManCollectSeq_rec( p, iRoot, vRoots, vObjs );
483  Vec_IntFree( vRoots );
484  return vObjs;
485 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
void Gia_ManCollectSeq_rec(Gia_Man_t *p, int Id, Vec_Int_t *vRoots, Vec_Int_t *vObjs)
Definition: giaDfs.c:445
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static void Gia_ObjSetTravIdCurrentId(Gia_Man_t *p, int Id)
Definition: gia.h:535
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
void Gia_ManCollectSeq_rec ( Gia_Man_t p,
int  Id,
Vec_Int_t vRoots,
Vec_Int_t vObjs 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 445 of file giaDfs.c.

446 {
447  Gia_Obj_t * pObj;
448  if ( Gia_ObjIsTravIdCurrentId( p, Id ) )
449  return;
450  Gia_ObjSetTravIdCurrentId( p, Id );
451  pObj = Gia_ManObj( p, Id );
452  if ( Gia_ObjIsAnd(pObj) )
453  {
454  Gia_ManCollectSeq_rec( p, Gia_ObjFaninId0(pObj, Id), vRoots, vObjs );
455  Gia_ManCollectSeq_rec( p, Gia_ObjFaninId1(pObj, Id), vRoots, vObjs );
456  }
457  else if ( Gia_ObjIsCi(pObj) )
458  {
459  if ( Gia_ObjIsRo(p, pObj) )
460  Vec_IntPush( vRoots, Gia_ObjId(p, Gia_ObjRoToRi(p, pObj)) );
461  }
462  else if ( Gia_ObjIsCo(pObj) )
463  Gia_ManCollectSeq_rec( p, Gia_ObjFaninId0(pObj, Id), vRoots, vObjs );
464  else assert( 0 );
465  Vec_IntPush( vObjs, Id );
466 }
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
void Gia_ManCollectSeq_rec(Gia_Man_t *p, int Id, Vec_Int_t *vRoots, Vec_Int_t *vObjs)
Definition: giaDfs.c:445
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:443
static Gia_Obj_t * Gia_ObjRoToRi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:446
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjIsTravIdCurrentId(Gia_Man_t *p, int Id)
Definition: gia.h:536
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
static void Gia_ObjSetTravIdCurrentId(Gia_Man_t *p, int Id)
Definition: gia.h:535
static int Gia_ObjFaninId1(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:461
static int Gia_ObjFaninId0(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:460
void Gia_ManCollectSeqTest ( Gia_Man_t p)

Definition at line 486 of file giaDfs.c.

487 {
488  Vec_Int_t * vObjs;
489  int i;
490  abctime clk = Abc_Clock();
491  for ( i = 0; i < Gia_ManPoNum(p); i++ )
492  {
493  if ( i % 10000 == 0 )
494  printf( "%8d finished...\r", i );
495 
496  vObjs = Gia_ManCollectSeq( p, &i, 1 );
497 // printf( "%d ", Vec_IntSize(vObjs) );
498  Vec_IntFree( vObjs );
499  }
500  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
501 
502 }
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static abctime Abc_Clock()
Definition: abc_global.h:279
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Vec_Int_t * Gia_ManCollectSeq(Gia_Man_t *p, int *pPos, int nPos)
Definition: giaDfs.c:467
ABC_INT64_T abctime
Definition: abc_global.h:278
void Gia_ManCollectTest ( Gia_Man_t p)

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

Synopsis [Collects support nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 208 of file giaDfs.c.

209 {
210  Vec_Int_t * vNodes;
211  Gia_Obj_t * pObj;
212  int i, iNode;
213  abctime clk = Abc_Clock();
214  vNodes = Vec_IntAlloc( 100 );
216  Gia_ManForEachCo( p, pObj, i )
217  {
218  iNode = Gia_ObjId(p, pObj);
219  Gia_ManCollectAnds( p, &iNode, 1, vNodes );
220  }
221  Vec_IntFree( vNodes );
222  ABC_PRT( "DFS from each output", Abc_Clock() - clk );
223 }
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static abctime Abc_Clock()
Definition: abc_global.h:279
Definition: gia.h:75
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
#define ABC_PRT(a, t)
Definition: abc_global.h:220
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
void Gia_ManCollectAnds(Gia_Man_t *p, int *pNodes, int nNodes, Vec_Int_t *vNodes)
Definition: giaDfs.c:123
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
ABC_INT64_T abctime
Definition: abc_global.h:278
int Gia_ManConeSize ( Gia_Man_t p,
int *  pNodes,
int  nNodes 
)

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

Synopsis [Collects support nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 351 of file giaDfs.c.

352 {
353  Gia_Obj_t * pObj;
354  int i, Counter = 0;
357  for ( i = 0; i < nNodes; i++ )
358  {
359  pObj = Gia_ManObj( p, pNodes[i] );
360  if ( Gia_ObjIsCo(pObj) )
361  Counter += Gia_ManConeSize_rec( p, Gia_ObjFanin0(pObj) );
362  else
363  Counter += Gia_ManConeSize_rec( p, pObj );
364  }
365  return Counter;
366 }
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
static int Counter
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
int Gia_ManConeSize_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaDfs.c:328
int Gia_ManConeSize_rec ( Gia_Man_t p,
Gia_Obj_t pObj 
)

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

Synopsis [Collects support nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 328 of file giaDfs.c.

329 {
330  if ( Gia_ObjIsTravIdCurrent(p, pObj) )
331  return 0;
332  Gia_ObjSetTravIdCurrent(p, pObj);
333  if ( Gia_ObjIsCi(pObj) )
334  return 0;
335  assert( Gia_ObjIsAnd(pObj) );
336  return 1 + Gia_ManConeSize_rec( p, Gia_ObjFanin0(pObj) ) +
338 }
static int Gia_ObjIsTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:533
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
int Gia_ManConeSize_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaDfs.c:328
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
Vec_Vec_t* Gia_ManLevelize ( Gia_Man_t p)

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

Synopsis [Levelizes the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 379 of file giaDfs.c.

380 {
381  Gia_Obj_t * pObj;
382  Vec_Vec_t * vLevels;
383  int nLevels, Level, i;
384  nLevels = Gia_ManLevelNum( p );
385  vLevels = Vec_VecStart( nLevels + 1 );
386  Gia_ManForEachAnd( p, pObj, i )
387  {
388  Level = Gia_ObjLevel( p, pObj );
389  assert( Level <= nLevels );
390  Vec_VecPush( vLevels, Level, pObj );
391  }
392  return vLevels;
393 }
static void Vec_VecPush(Vec_Vec_t *p, int Level, void *Entry)
Definition: vecVec.h:456
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
Definition: gia.h:75
static int Gia_ObjLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:501
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
static Vec_Vec_t * Vec_VecStart(int nSize)
Definition: vecVec.h:168
#define assert(ex)
Definition: util_old.h:213
int Gia_ManLevelNum(Gia_Man_t *p)
Definition: giaUtil.c:505
Vec_Int_t* Gia_ManOrderReverse ( Gia_Man_t p)

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

Synopsis [Computes reverse topological order.]

Description [Assumes that levels are already assigned. The levels of CO nodes may not be assigned.]

SideEffects []

SeeAlso []

Definition at line 407 of file giaDfs.c.

408 {
409  Gia_Obj_t * pObj;
410  Vec_Vec_t * vLevels;
411  Vec_Ptr_t * vLevel;
412  Vec_Int_t * vResult;
413  int i, k;
414  vLevels = Vec_VecStart( 100 );
415  // make sure levels are assigned
416  Gia_ManForEachAnd( p, pObj, i )
417  assert( Gia_ObjLevel(p, pObj) > 0 );
418  // add CO nodes based on the level of their fanin
419  Gia_ManForEachCo( p, pObj, i )
420  Vec_VecPush( vLevels, Gia_ObjLevel(p, Gia_ObjFanin0(pObj)), pObj );
421  // add other nodes based on their level
422  Gia_ManForEachObj( p, pObj, i )
423  if ( !Gia_ObjIsCo(pObj) )
424  Vec_VecPush( vLevels, Gia_ObjLevel(p, pObj), pObj );
425  // put the nodes in the reverse topological order
426  vResult = Vec_IntAlloc( Gia_ManObjNum(p) );
427  Vec_VecForEachLevelReverse( vLevels, vLevel, i )
428  Vec_PtrForEachEntry( Gia_Obj_t *, vLevel, pObj, k )
429  Vec_IntPush( vResult, Gia_ObjId(p, pObj) );
430  Vec_VecFree( vLevels );
431  return vResult;
432 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static void Vec_VecPush(Vec_Vec_t *p, int Level, void *Entry)
Definition: vecVec.h:456
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
Definition: gia.h:75
static int Gia_ObjLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:501
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
if(last==0)
Definition: sparse_int.h:34
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static Vec_Vec_t * Vec_VecStart(int nSize)
Definition: vecVec.h:168
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
#define Vec_VecForEachLevelReverse(vGlob, vVec, i)
Definition: vecVec.h:63
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
int Gia_ManSuppSize ( Gia_Man_t p,
int *  pNodes,
int  nNodes 
)

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

Synopsis [Collects support nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 300 of file giaDfs.c.

301 {
302  Gia_Obj_t * pObj;
303  int i, Counter = 0;
306  for ( i = 0; i < nNodes; i++ )
307  {
308  pObj = Gia_ManObj( p, pNodes[i] );
309  if ( Gia_ObjIsCo(pObj) )
310  Counter += Gia_ManSuppSize_rec( p, Gia_ObjFanin0(pObj) );
311  else
312  Counter += Gia_ManSuppSize_rec( p, pObj );
313  }
314  return Counter;
315 }
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
static int Counter
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
int Gia_ManSuppSize_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaDfs.c:236
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
int Gia_ManSuppSize_rec ( Gia_Man_t p,
Gia_Obj_t pObj 
)

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

Synopsis [Collects support nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 236 of file giaDfs.c.

237 {
238  if ( Gia_ObjIsTravIdCurrent(p, pObj) )
239  return 0;
240  Gia_ObjSetTravIdCurrent(p, pObj);
241  if ( Gia_ObjIsCi(pObj) )
242  return 1;
243  assert( Gia_ObjIsAnd(pObj) );
244  return Gia_ManSuppSize_rec( p, Gia_ObjFanin0(pObj) ) +
246 }
static int Gia_ObjIsTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:533
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
int Gia_ManSuppSize_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaDfs.c:236
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
int Gia_ManSuppSizeOne ( Gia_Man_t p,
Gia_Obj_t pObj 
)

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

Synopsis [Computes support size of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 259 of file giaDfs.c.

260 {
262  return Gia_ManSuppSize_rec( p, pObj );
263 }
int Gia_ManSuppSize_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaDfs.c:236
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
int Gia_ManSuppSizeTest ( Gia_Man_t p)

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

Synopsis [Computes support size of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 276 of file giaDfs.c.

277 {
278  Gia_Obj_t * pObj;
279  int i, Counter = 0;
280  abctime clk = Abc_Clock();
281  Gia_ManForEachObj( p, pObj, i )
282  if ( Gia_ObjIsAnd(pObj) )
283  Counter += (Gia_ManSuppSizeOne(p, pObj) <= 16);
284  printf( "Nodes with small support %d (out of %d)\n", Counter, Gia_ManAndNum(p) );
285  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
286  return Counter;
287 }
static abctime Abc_Clock()
Definition: abc_global.h:279
Definition: gia.h:75
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
if(last==0)
Definition: sparse_int.h:34
static int Counter
int Gia_ManSuppSizeOne(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaDfs.c:259
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
ABC_INT64_T abctime
Definition: abc_global.h:278