abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
aigDfs.c File Reference
#include "aig.h"
#include "misc/tim/tim.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START int Aig_ManVerifyTopoOrder (Aig_Man_t *p)
 DECLARATIONS ///. More...
 
void Aig_ManDfs_rec (Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
 
Vec_Ptr_tAig_ManDfs (Aig_Man_t *p, int fNodesOnly)
 
void Aig_ManDfsAll_rec (Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
 
Vec_Ptr_tAig_ManDfsAll (Aig_Man_t *p)
 
void Aig_ManDfsPreorder_rec (Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
 
Vec_Ptr_tAig_ManDfsPreorder (Aig_Man_t *p, int fNodesOnly)
 
Vec_Vec_tAig_ManLevelize (Aig_Man_t *p)
 
Vec_Ptr_tAig_ManDfsNodes (Aig_Man_t *p, Aig_Obj_t **ppNodes, int nNodes)
 
void Aig_ManDfsChoices_rec (Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
 
Vec_Ptr_tAig_ManDfsChoices (Aig_Man_t *p)
 
void Aig_ManDfsReverse_rec (Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
 
Vec_Ptr_tAig_ManDfsReverse (Aig_Man_t *p)
 
int Aig_ManLevelNum (Aig_Man_t *p)
 
void Aig_ManChoiceLevel_rec (Aig_Man_t *p, Aig_Obj_t *pObj)
 
int Aig_ManChoiceLevel (Aig_Man_t *p)
 
void Aig_ConeMark_rec (Aig_Obj_t *pObj)
 
void Aig_ConeCleanAndMark_rec (Aig_Obj_t *pObj)
 
int Aig_ConeCountAndMark_rec (Aig_Obj_t *pObj)
 
void Aig_ConeUnmark_rec (Aig_Obj_t *pObj)
 
int Aig_DagSize (Aig_Obj_t *pObj)
 
void Aig_SupportSize_rec (Aig_Man_t *p, Aig_Obj_t *pObj, int *pCounter)
 
int Aig_SupportSize (Aig_Man_t *p, Aig_Obj_t *pObj)
 
int Aig_SupportSizeTest (Aig_Man_t *p)
 
void Aig_Support_rec (Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vSupp)
 
Vec_Ptr_tAig_Support (Aig_Man_t *p, Aig_Obj_t *pObj)
 
void Aig_SupportNodes (Aig_Man_t *p, Aig_Obj_t **ppObjs, int nObjs, Vec_Ptr_t *vSupp)
 
void Aig_Transfer_rec (Aig_Man_t *pDest, Aig_Obj_t *pObj)
 
Aig_Obj_tAig_Transfer (Aig_Man_t *pSour, Aig_Man_t *pDest, Aig_Obj_t *pRoot, int nVars)
 
void Aig_Compose_rec (Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pFunc, Aig_Obj_t *pVar)
 
Aig_Obj_tAig_Compose (Aig_Man_t *p, Aig_Obj_t *pRoot, Aig_Obj_t *pFunc, int iVar)
 
void Aig_ObjCollectCut_rec (Aig_Obj_t *pNode, Vec_Ptr_t *vNodes)
 
void Aig_ObjCollectCut (Aig_Obj_t *pRoot, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vNodes)
 
int Aig_ObjCollectSuper_rec (Aig_Obj_t *pRoot, Aig_Obj_t *pObj, Vec_Ptr_t *vSuper)
 
int Aig_ObjCollectSuper (Aig_Obj_t *pObj, Vec_Ptr_t *vSuper)
 

Function Documentation

Aig_Obj_t* Aig_Compose ( Aig_Man_t p,
Aig_Obj_t pRoot,
Aig_Obj_t pFunc,
int  iVar 
)

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

Synopsis [Composes the AIG (pRoot) with the function (pFunc) using PI var (iVar).]

Description []

SideEffects []

SeeAlso []

Definition at line 966 of file aigDfs.c.

967 {
968  // quit if the PI variable is not defined
969  if ( iVar >= Aig_ManCiNum(p) )
970  {
971  printf( "Aig_Compose(): The PI variable %d is not defined.\n", iVar );
972  return NULL;
973  }
974  // recursively perform composition
975  Aig_Compose_rec( p, Aig_Regular(pRoot), pFunc, Aig_ManCi(p, iVar) );
976  // clear the markings
978  return Aig_NotCond( (Aig_Obj_t *)Aig_Regular(pRoot)->pData, Aig_IsComplement(pRoot) );
979 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static Aig_Obj_t * Aig_ManCi(Aig_Man_t *p, int i)
Definition: aig.h:266
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
Definition: aig.h:69
void Aig_ConeUnmark_rec(Aig_Obj_t *pObj)
Definition: aigDfs.c:690
void Aig_Compose_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pFunc, Aig_Obj_t *pVar)
Definition: aigDfs.c:938
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
void Aig_Compose_rec ( Aig_Man_t p,
Aig_Obj_t pObj,
Aig_Obj_t pFunc,
Aig_Obj_t pVar 
)

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

Synopsis [Composes the AIG (pRoot) with the function (pFunc) using PI var (iVar).]

Description []

SideEffects []

SeeAlso []

Definition at line 938 of file aigDfs.c.

939 {
940  assert( !Aig_IsComplement(pObj) );
941  if ( Aig_ObjIsMarkA(pObj) )
942  return;
943  if ( Aig_ObjIsConst1(pObj) || Aig_ObjIsCi(pObj) )
944  {
945  pObj->pData = pObj == pVar ? pFunc : pObj;
946  return;
947  }
948  Aig_Compose_rec( p, Aig_ObjFanin0(pObj), pFunc, pVar );
949  Aig_Compose_rec( p, Aig_ObjFanin1(pObj), pFunc, pVar );
950  pObj->pData = Aig_And( p, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
951  assert( !Aig_ObjIsMarkA(pObj) ); // loop detection
952  Aig_ObjSetMarkA( pObj );
953 }
static int Aig_ObjIsMarkA(Aig_Obj_t *pObj)
Definition: aig.h:288
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static void Aig_ObjSetMarkA(Aig_Obj_t *pObj)
Definition: aig.h:289
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
void Aig_Compose_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pFunc, Aig_Obj_t *pVar)
Definition: aigDfs.c:938
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
void Aig_ConeCleanAndMark_rec ( Aig_Obj_t pObj)

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

Synopsis [Counts the number of AIG nodes rooted at this cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 643 of file aigDfs.c.

644 {
645  assert( !Aig_IsComplement(pObj) );
646  if ( !Aig_ObjIsNode(pObj) || Aig_ObjIsMarkA(pObj) )
647  return;
650  assert( !Aig_ObjIsMarkA(pObj) ); // loop detection
651  Aig_ObjSetMarkA( pObj );
652  pObj->pData = NULL;
653 }
static int Aig_ObjIsMarkA(Aig_Obj_t *pObj)
Definition: aig.h:288
void * pData
Definition: aig.h:87
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static void Aig_ObjSetMarkA(Aig_Obj_t *pObj)
Definition: aig.h:289
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
void Aig_ConeCleanAndMark_rec(Aig_Obj_t *pObj)
Definition: aigDfs.c:643
#define assert(ex)
Definition: util_old.h:213
int Aig_ConeCountAndMark_rec ( Aig_Obj_t pObj)

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

Synopsis [Counts the number of AIG nodes rooted at this cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 666 of file aigDfs.c.

667 {
668  int Counter;
669  assert( !Aig_IsComplement(pObj) );
670  if ( !Aig_ObjIsNode(pObj) || Aig_ObjIsMarkA(pObj) )
671  return 0;
672  Counter = 1 + Aig_ConeCountAndMark_rec( Aig_ObjFanin0(pObj) ) +
674  assert( !Aig_ObjIsMarkA(pObj) ); // loop detection
675  Aig_ObjSetMarkA( pObj );
676  return Counter;
677 }
static int Aig_ObjIsMarkA(Aig_Obj_t *pObj)
Definition: aig.h:288
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static void Aig_ObjSetMarkA(Aig_Obj_t *pObj)
Definition: aig.h:289
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
int Aig_ConeCountAndMark_rec(Aig_Obj_t *pObj)
Definition: aigDfs.c:666
static int Counter
#define assert(ex)
Definition: util_old.h:213
void Aig_ConeMark_rec ( Aig_Obj_t pObj)

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

Synopsis [Counts the number of AIG nodes rooted at this cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 621 of file aigDfs.c.

622 {
623  assert( !Aig_IsComplement(pObj) );
624  if ( !Aig_ObjIsNode(pObj) || Aig_ObjIsMarkA(pObj) )
625  return;
628  assert( !Aig_ObjIsMarkA(pObj) ); // loop detection
629  Aig_ObjSetMarkA( pObj );
630 }
static int Aig_ObjIsMarkA(Aig_Obj_t *pObj)
Definition: aig.h:288
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static void Aig_ObjSetMarkA(Aig_Obj_t *pObj)
Definition: aig.h:289
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
void Aig_ConeMark_rec(Aig_Obj_t *pObj)
Definition: aigDfs.c:621
#define assert(ex)
Definition: util_old.h:213
void Aig_ConeUnmark_rec ( Aig_Obj_t pObj)

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

Synopsis [Counts the number of AIG nodes rooted at this cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 690 of file aigDfs.c.

691 {
692  assert( !Aig_IsComplement(pObj) );
693  if ( !Aig_ObjIsNode(pObj) || !Aig_ObjIsMarkA(pObj) )
694  return;
697  assert( Aig_ObjIsMarkA(pObj) ); // loop detection
698  Aig_ObjClearMarkA( pObj );
699 }
static int Aig_ObjIsMarkA(Aig_Obj_t *pObj)
Definition: aig.h:288
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static void Aig_ObjClearMarkA(Aig_Obj_t *pObj)
Definition: aig.h:290
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
void Aig_ConeUnmark_rec(Aig_Obj_t *pObj)
Definition: aigDfs.c:690
#define assert(ex)
Definition: util_old.h:213
int Aig_DagSize ( Aig_Obj_t pObj)

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

Synopsis [Counts the number of AIG nodes rooted at this cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 712 of file aigDfs.c.

713 {
714  int Counter;
715  Counter = Aig_ConeCountAndMark_rec( Aig_Regular(pObj) );
717  return Counter;
718 }
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
int Aig_ConeCountAndMark_rec(Aig_Obj_t *pObj)
Definition: aigDfs.c:666
static int Counter
void Aig_ConeUnmark_rec(Aig_Obj_t *pObj)
Definition: aigDfs.c:690
int Aig_ManChoiceLevel ( Aig_Man_t p)

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

Synopsis [Computes levels for AIG with choices and white boxes.]

Description []

SideEffects []

SeeAlso []

Definition at line 581 of file aigDfs.c.

582 {
583  Aig_Obj_t * pObj;
584  int i, LevelMax = 0;
585  Aig_ManForEachObj( p, pObj, i )
586  Aig_ObjSetLevel( pObj, 0 );
587  Aig_ManSetCioIds( p );
589  Aig_ManForEachCo( p, pObj, i )
590  {
591  Aig_ManChoiceLevel_rec( p, pObj );
592  if ( LevelMax < Aig_ObjLevel(pObj) )
593  LevelMax = Aig_ObjLevel(pObj);
594  }
595  // account for dangling boxes
596  Aig_ManForEachCi( p, pObj, i )
597  {
598  Aig_ManChoiceLevel_rec( p, pObj );
599  if ( LevelMax < Aig_ObjLevel(pObj) )
600  LevelMax = Aig_ObjLevel(pObj);
601  }
602  Aig_ManCleanCioIds( p );
603 // Aig_ManForEachNode( p, pObj, i )
604 // assert( Aig_ObjLevel(pObj) > 0 );
605  return LevelMax;
606 }
static int Aig_ObjSetLevel(Aig_Obj_t *pObj, int i)
Definition: aig.h:325
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
void Aig_ManChoiceLevel_rec(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDfs.c:509
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
Definition: aig.h:69
void Aig_ManSetCioIds(Aig_Man_t *p)
Definition: aigUtil.c:965
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static int Aig_ObjLevel(Aig_Obj_t *pObj)
Definition: aig.h:323
void Aig_ManCleanCioIds(Aig_Man_t *p)
Definition: aigUtil.c:986
void Aig_ManChoiceLevel_rec ( Aig_Man_t p,
Aig_Obj_t pObj 
)

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

Synopsis [Computes levels for AIG with choices and white boxes.]

Description []

SideEffects []

SeeAlso []

Definition at line 509 of file aigDfs.c.

510 {
511  Aig_Obj_t * pNext;
512  int i, iBox, iTerm1, nTerms, LevelMax = 0;
513  if ( Aig_ObjIsTravIdCurrent( p, pObj ) )
514  return;
515  Aig_ObjSetTravIdCurrent( p, pObj );
516  if ( Aig_ObjIsCi(pObj) )
517  {
518  if ( p->pManTime )
519  {
520  iBox = Tim_ManBoxForCi( (Tim_Man_t *)p->pManTime, Aig_ObjCioId(pObj) );
521  if ( iBox >= 0 ) // this is not a true PI
522  {
523  iTerm1 = Tim_ManBoxInputFirst( (Tim_Man_t *)p->pManTime, iBox );
524  nTerms = Tim_ManBoxInputNum( (Tim_Man_t *)p->pManTime, iBox );
525  for ( i = 0; i < nTerms; i++ )
526  {
527  pNext = Aig_ManCo(p, iTerm1 + i);
528  Aig_ManChoiceLevel_rec( p, pNext );
529  if ( LevelMax < Aig_ObjLevel(pNext) )
530  LevelMax = Aig_ObjLevel(pNext);
531  }
532  LevelMax++;
533  }
534  }
535 // printf( "%d ", pObj->Level );
536  }
537  else if ( Aig_ObjIsCo(pObj) )
538  {
539  pNext = Aig_ObjFanin0(pObj);
540  Aig_ManChoiceLevel_rec( p, pNext );
541  if ( LevelMax < Aig_ObjLevel(pNext) )
542  LevelMax = Aig_ObjLevel(pNext);
543  }
544  else if ( Aig_ObjIsNode(pObj) )
545  {
546  // get the maximum level of the two fanins
547  pNext = Aig_ObjFanin0(pObj);
548  Aig_ManChoiceLevel_rec( p, pNext );
549  if ( LevelMax < Aig_ObjLevel(pNext) )
550  LevelMax = Aig_ObjLevel(pNext);
551  pNext = Aig_ObjFanin1(pObj);
552  Aig_ManChoiceLevel_rec( p, pNext );
553  if ( LevelMax < Aig_ObjLevel(pNext) )
554  LevelMax = Aig_ObjLevel(pNext);
555  LevelMax++;
556 
557  // get the level of the nodes in the choice node
558  if ( p->pEquivs && (pNext = Aig_ObjEquiv(p, pObj)) )
559  {
560  Aig_ManChoiceLevel_rec( p, pNext );
561  if ( LevelMax < Aig_ObjLevel(pNext) )
562  LevelMax = Aig_ObjLevel(pNext);
563  }
564  }
565  else if ( !Aig_ObjIsConst1(pObj) )
566  assert( 0 );
567  Aig_ObjSetLevel( pObj, LevelMax );
568 }
int Tim_ManBoxForCi(Tim_Man_t *p, int iCo)
Definition: timBox.c:86
static int Aig_ObjSetLevel(Aig_Obj_t *pObj, int i)
Definition: aig.h:325
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
void Aig_ManChoiceLevel_rec(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDfs.c:509
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
static Aig_Obj_t * Aig_ObjEquiv(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:328
Definition: aig.h:69
int Tim_ManBoxInputNum(Tim_Man_t *p, int iBox)
Definition: timBox.c:186
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
static int Aig_ObjLevel(Aig_Obj_t *pObj)
Definition: aig.h:323
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
int Tim_ManBoxInputFirst(Tim_Man_t *p, int iBox)
Definition: timBox.c:122
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
static int Aig_ObjCioId(Aig_Obj_t *pObj)
Definition: aig.h:285
Vec_Ptr_t* Aig_ManDfs ( Aig_Man_t p,
int  fNodesOnly 
)

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

Synopsis [Collects objects of the AIG in the DFS order.]

Description [Works with choice nodes.]

SideEffects []

SeeAlso []

Definition at line 145 of file aigDfs.c.

146 {
147  Vec_Ptr_t * vNodes;
148  Aig_Obj_t * pObj;
149  int i;
152  // start the array of nodes
153  vNodes = Vec_PtrAlloc( Aig_ManObjNumMax(p) );
154  // mark PIs if they should not be collected
155  if ( fNodesOnly )
156  Aig_ManForEachCi( p, pObj, i )
157  Aig_ObjSetTravIdCurrent( p, pObj );
158  else
159  Vec_PtrPush( vNodes, Aig_ManConst1(p) );
160  // collect nodes reachable in the DFS order
161  Aig_ManForEachCo( p, pObj, i )
162  Aig_ManDfs_rec( p, fNodesOnly? Aig_ObjFanin0(pObj): pObj, vNodes );
163  if ( fNodesOnly )
164  assert( Vec_PtrSize(vNodes) == Aig_ManNodeNum(p) );
165  else
166  assert( Vec_PtrSize(vNodes) == Aig_ManObjNum(p) );
167  return vNodes;
168 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ManObjNum(Aig_Man_t *p)
Definition: aig.h:258
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
Definition: aig.h:69
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
void Aig_ManDfs_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: aigDfs.c:119
#define assert(ex)
Definition: util_old.h:213
void Aig_ManDfs_rec ( Aig_Man_t p,
Aig_Obj_t pObj,
Vec_Ptr_t vNodes 
)

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

Synopsis [Collects internal nodes in the DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 119 of file aigDfs.c.

120 {
121  if ( pObj == NULL )
122  return;
123  assert( !Aig_IsComplement(pObj) );
124  if ( Aig_ObjIsTravIdCurrent(p, pObj) )
125  return;
126  Aig_ObjSetTravIdCurrent(p, pObj);
127  if ( p->pEquivs && Aig_ObjEquiv(p, pObj) )
128  Aig_ManDfs_rec( p, Aig_ObjEquiv(p, pObj), vNodes );
129  Aig_ManDfs_rec( p, Aig_ObjFanin0(pObj), vNodes );
130  Aig_ManDfs_rec( p, Aig_ObjFanin1(pObj), vNodes );
131  Vec_PtrPush( vNodes, pObj );
132 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
static Aig_Obj_t * Aig_ObjEquiv(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:328
void Aig_ManDfs_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: aigDfs.c:119
#define assert(ex)
Definition: util_old.h:213
Vec_Ptr_t* Aig_ManDfsAll ( Aig_Man_t p)

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

Synopsis [Collects objects of the AIG in the DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 214 of file aigDfs.c.

215 {
216  Vec_Ptr_t * vNodes;
217  Aig_Obj_t * pObj;
218  int i;
220  vNodes = Vec_PtrAlloc( Aig_ManObjNumMax(p) );
221  // add constant
223  Vec_PtrPush( vNodes, Aig_ManConst1(p) );
224  // collect nodes reachable in the DFS order
225  Aig_ManForEachCo( p, pObj, i )
226  Aig_ManDfsAll_rec( p, pObj, vNodes );
227  Aig_ManForEachCi( p, pObj, i )
228  if ( !Aig_ObjIsTravIdCurrent(p, pObj) )
229  Vec_PtrPush( vNodes, pObj );
230  assert( Vec_PtrSize(vNodes) == Aig_ManObjNum(p) );
231  return vNodes;
232 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
static int Aig_ManObjNum(Aig_Man_t *p)
Definition: aig.h:258
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
void Aig_ManDfsAll_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: aigDfs.c:181
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
void Aig_ManDfsAll_rec ( Aig_Man_t p,
Aig_Obj_t pObj,
Vec_Ptr_t vNodes 
)

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

Synopsis [Collects internal nodes in the DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 181 of file aigDfs.c.

182 {
183  if ( Aig_ObjIsTravIdCurrent(p, pObj) )
184  return;
185  Aig_ObjSetTravIdCurrent(p, pObj);
186  if ( Aig_ObjIsCi(pObj) )
187  {
188  Vec_PtrPush( vNodes, pObj );
189  return;
190  }
191  if ( Aig_ObjIsCo(pObj) )
192  {
193  Aig_ManDfsAll_rec( p, Aig_ObjFanin0(pObj), vNodes );
194  Vec_PtrPush( vNodes, pObj );
195  return;
196  }
197  assert( Aig_ObjIsNode(pObj) );
198  Aig_ManDfsAll_rec( p, Aig_ObjFanin0(pObj), vNodes );
199  Aig_ManDfsAll_rec( p, Aig_ObjFanin1(pObj), vNodes );
200  Vec_PtrPush( vNodes, pObj );
201 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
void Aig_ManDfsAll_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: aigDfs.c:181
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
Vec_Ptr_t* Aig_ManDfsChoices ( Aig_Man_t p)

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

Synopsis [Collects internal nodes in the DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 391 of file aigDfs.c.

392 {
393  Vec_Ptr_t * vNodes;
394  Aig_Obj_t * pObj;
395  int i, Counter = 0;
396 
397  Aig_ManForEachNode( p, pObj, i )
398  {
399  if ( Aig_ObjEquiv(p, pObj) == NULL )
400  continue;
401  Counter = 0;
402  for ( pObj = Aig_ObjEquiv(p, pObj) ; pObj; pObj = Aig_ObjEquiv(p, pObj) )
403  Counter++;
404 // printf( "%d ", Counter );
405  }
406 // printf( "\n" );
407 
408  assert( p->pEquivs != NULL );
410  // mark constant and PIs
412  Aig_ManForEachCi( p, pObj, i )
413  Aig_ObjSetTravIdCurrent( p, pObj );
414  // go through the nodes
415  vNodes = Vec_PtrAlloc( Aig_ManNodeNum(p) );
416  Aig_ManForEachCo( p, pObj, i )
417  Aig_ManDfsChoices_rec( p, Aig_ObjFanin0(pObj), vNodes );
418  return vNodes;
419 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_ManDfsChoices_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: aigDfs.c:364
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
static Aig_Obj_t * Aig_ObjEquiv(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:328
Definition: aig.h:69
static int Counter
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
void Aig_ManDfsChoices_rec ( Aig_Man_t p,
Aig_Obj_t pObj,
Vec_Ptr_t vNodes 
)

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

Synopsis [Collects internal nodes in the DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 364 of file aigDfs.c.

365 {
366  if ( pObj == NULL )
367  return;
368  assert( !Aig_IsComplement(pObj) );
369  if ( Aig_ObjIsTravIdCurrent(p, pObj) )
370  return;
371  assert( Aig_ObjIsNode(pObj) );
372  Aig_ManDfsChoices_rec( p, Aig_ObjFanin0(pObj), vNodes );
373  Aig_ManDfsChoices_rec( p, Aig_ObjFanin1(pObj), vNodes );
374  Aig_ManDfsChoices_rec( p, Aig_ObjEquiv(p, pObj), vNodes );
375  assert( !Aig_ObjIsTravIdCurrent(p, pObj) ); // loop detection
376  Aig_ObjSetTravIdCurrent(p, pObj);
377  Vec_PtrPush( vNodes, pObj );
378 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
void Aig_ManDfsChoices_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: aigDfs.c:364
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static Aig_Obj_t * Aig_ObjEquiv(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:328
#define assert(ex)
Definition: util_old.h:213
Vec_Ptr_t* Aig_ManDfsNodes ( Aig_Man_t p,
Aig_Obj_t **  ppNodes,
int  nNodes 
)

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

Synopsis [Collects internal nodes and PIs in the DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 333 of file aigDfs.c.

334 {
335  Vec_Ptr_t * vNodes;
336 // Aig_Obj_t * pObj;
337  int i;
339  // mark constant and PIs
341 // Aig_ManForEachCi( p, pObj, i )
342 // Aig_ObjSetTravIdCurrent( p, pObj );
343  // go through the nodes
344  vNodes = Vec_PtrAlloc( Aig_ManNodeNum(p) );
345  for ( i = 0; i < nNodes; i++ )
346  if ( Aig_ObjIsCo(ppNodes[i]) )
347  Aig_ManDfs_rec( p, Aig_ObjFanin0(ppNodes[i]), vNodes );
348  else
349  Aig_ManDfs_rec( p, ppNodes[i], vNodes );
350  return vNodes;
351 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
void Aig_ManDfs_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: aigDfs.c:119
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
Vec_Ptr_t* Aig_ManDfsPreorder ( Aig_Man_t p,
int  fNodesOnly 
)

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

Synopsis [Collects objects of the AIG in the DFS order.]

Description [Works with choice nodes.]

SideEffects []

SeeAlso []

Definition at line 271 of file aigDfs.c.

272 {
273  Vec_Ptr_t * vNodes;
274  Aig_Obj_t * pObj;
275  int i;
278  // start the array of nodes
279  vNodes = Vec_PtrAlloc( Aig_ManObjNumMax(p) );
280  // mark PIs if they should not be collected
281  if ( fNodesOnly )
282  Aig_ManForEachCi( p, pObj, i )
283  Aig_ObjSetTravIdCurrent( p, pObj );
284  else
285  Vec_PtrPush( vNodes, Aig_ManConst1(p) );
286  // collect nodes reachable in the DFS order
287  Aig_ManForEachCo( p, pObj, i )
288  Aig_ManDfsPreorder_rec( p, fNodesOnly? Aig_ObjFanin0(pObj): pObj, vNodes );
289  if ( fNodesOnly )
290  assert( Vec_PtrSize(vNodes) == Aig_ManNodeNum(p) );
291  else
292  assert( Vec_PtrSize(vNodes) == Aig_ManObjNum(p) );
293  return vNodes;
294 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ManObjNum(Aig_Man_t *p)
Definition: aig.h:258
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
Definition: aig.h:69
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
void Aig_ManDfsPreorder_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: aigDfs.c:245
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
void Aig_ManDfsPreorder_rec ( Aig_Man_t p,
Aig_Obj_t pObj,
Vec_Ptr_t vNodes 
)

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

Synopsis [Collects internal nodes in the DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 245 of file aigDfs.c.

246 {
247  if ( pObj == NULL )
248  return;
249  assert( !Aig_IsComplement(pObj) );
250  if ( Aig_ObjIsTravIdCurrent(p, pObj) )
251  return;
252  Aig_ObjSetTravIdCurrent(p, pObj);
253  Vec_PtrPush( vNodes, pObj );
254  if ( p->pEquivs && Aig_ObjEquiv(p, pObj) )
255  Aig_ManDfs_rec( p, Aig_ObjEquiv(p, pObj), vNodes );
256  Aig_ManDfsPreorder_rec( p, Aig_ObjFanin0(pObj), vNodes );
257  Aig_ManDfsPreorder_rec( p, Aig_ObjFanin1(pObj), vNodes );
258 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
static Aig_Obj_t * Aig_ObjEquiv(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:328
void Aig_ManDfsPreorder_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: aigDfs.c:245
void Aig_ManDfs_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: aigDfs.c:119
#define assert(ex)
Definition: util_old.h:213
Vec_Ptr_t* Aig_ManDfsReverse ( Aig_Man_t p)

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

Synopsis [Collects internal nodes in the reverse DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 458 of file aigDfs.c.

459 {
460  Vec_Ptr_t * vNodes;
461  Aig_Obj_t * pObj;
462  int i;
464  // mark POs
465  Aig_ManForEachCo( p, pObj, i )
466  Aig_ObjSetTravIdCurrent( p, pObj );
467  // go through the nodes
468  vNodes = Vec_PtrAlloc( Aig_ManNodeNum(p) );
469  Aig_ManForEachObj( p, pObj, i )
470  if ( Aig_ObjIsNode(pObj) || Aig_ObjIsBuf(pObj) )
471  Aig_ManDfsReverse_rec( p, pObj, vNodes );
472  return vNodes;
473 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
void Aig_ManDfsReverse_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: aigDfs.c:432
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
void Aig_ManDfsReverse_rec ( Aig_Man_t p,
Aig_Obj_t pObj,
Vec_Ptr_t vNodes 
)

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

Synopsis [Collects internal nodes in the reverse DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 432 of file aigDfs.c.

433 {
434  Aig_Obj_t * pFanout;
435  int iFanout = -1, i;
436  assert( !Aig_IsComplement(pObj) );
437  if ( Aig_ObjIsTravIdCurrent(p, pObj) )
438  return;
439  assert( Aig_ObjIsNode(pObj) || Aig_ObjIsBuf(pObj) );
440  Aig_ObjForEachFanout( p, pObj, pFanout, iFanout, i )
441  Aig_ManDfsReverse_rec( p, pFanout, vNodes );
442  assert( !Aig_ObjIsTravIdCurrent(p, pObj) ); // loop detection
443  Aig_ObjSetTravIdCurrent(p, pObj);
444  Vec_PtrPush( vNodes, pObj );
445 }
#define Aig_ObjForEachFanout(p, pObj, pFanout, iFan, i)
Definition: aig.h:427
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
Definition: aig.h:69
void Aig_ManDfsReverse_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: aigDfs.c:432
#define assert(ex)
Definition: util_old.h:213
Vec_Vec_t* Aig_ManLevelize ( Aig_Man_t p)

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

Synopsis [Levelizes the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 307 of file aigDfs.c.

308 {
309  Aig_Obj_t * pObj;
310  Vec_Vec_t * vLevels;
311  int nLevels, i;
312  nLevels = Aig_ManLevelNum( p );
313  vLevels = Vec_VecStart( nLevels + 1 );
314  Aig_ManForEachObj( p, pObj, i )
315  {
316  assert( (int)pObj->Level <= nLevels );
317  Vec_VecPush( vLevels, pObj->Level, pObj );
318  }
319  return vLevels;
320 }
unsigned Level
Definition: aig.h:82
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
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Definition: aig.h:69
static Vec_Vec_t * Vec_VecStart(int nSize)
Definition: vecVec.h:168
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define assert(ex)
Definition: util_old.h:213
int Aig_ManLevelNum(Aig_Man_t *p)
Definition: aigDfs.c:486
int Aig_ManLevelNum ( Aig_Man_t p)

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

Synopsis [Computes the max number of levels in the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 486 of file aigDfs.c.

487 {
488  Aig_Obj_t * pObj;
489  int i, LevelsMax;
490  LevelsMax = 0;
491  Aig_ManForEachCo( p, pObj, i )
492  LevelsMax = Abc_MaxInt( LevelsMax, (int)Aig_ObjFanin0(pObj)->Level );
493  return LevelsMax;
494 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
Definition: aig.h:69
ABC_NAMESPACE_IMPL_START int Aig_ManVerifyTopoOrder ( Aig_Man_t p)

DECLARATIONS ///.

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

FileName [aigDfs.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [AIG package.]

Synopsis [DFS traversal procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - April 28, 2007.]

Revision [

Id:
aigDfs.c,v 1.00 2007/04/28 00:00:00 alanmi Exp

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

Synopsis [Verifies that the objects are in a topo order.]

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file aigDfs.c.

47 {
48  Aig_Obj_t * pObj, * pNext;
49  int i, k, iBox, iTerm1, nTerms;
52  Aig_ManForEachObj( p, pObj, i )
53  {
54  if ( Aig_ObjIsNode(pObj) )
55  {
56  pNext = Aig_ObjFanin0(pObj);
57  if ( !Aig_ObjIsTravIdCurrent(p,pNext) )
58  {
59  printf( "Node %d has fanin %d that is not in a topological order.\n", pObj->Id, pNext->Id );
60  return 0;
61  }
62  pNext = Aig_ObjFanin1(pObj);
63  if ( !Aig_ObjIsTravIdCurrent(p,pNext) )
64  {
65  printf( "Node %d has fanin %d that is not in a topological order.\n", pObj->Id, pNext->Id );
66  return 0;
67  }
68  }
69  else if ( Aig_ObjIsCo(pObj) || Aig_ObjIsBuf(pObj) )
70  {
71  pNext = Aig_ObjFanin0(pObj);
72  if ( !Aig_ObjIsTravIdCurrent(p,pNext) )
73  {
74  printf( "Node %d has fanin %d that is not in a topological order.\n", pObj->Id, pNext->Id );
75  return 0;
76  }
77  }
78  else if ( Aig_ObjIsCi(pObj) )
79  {
80  if ( p->pManTime )
81  {
82  iBox = Tim_ManBoxForCi( (Tim_Man_t *)p->pManTime, Aig_ObjCioId(pObj) );
83  if ( iBox >= 0 ) // this is not a true PI
84  {
85  iTerm1 = Tim_ManBoxInputFirst( (Tim_Man_t *)p->pManTime, iBox );
86  nTerms = Tim_ManBoxInputNum( (Tim_Man_t *)p->pManTime, iBox );
87  for ( k = 0; k < nTerms; k++ )
88  {
89  pNext = Aig_ManCo( p, iTerm1 + k );
90  assert( Tim_ManBoxForCo( (Tim_Man_t *)p->pManTime, Aig_ObjCioId(pNext) ) == iBox );
91  if ( !Aig_ObjIsTravIdCurrent(p,pNext) )
92  {
93  printf( "Box %d has input %d that is not in a topological order.\n", iBox, pNext->Id );
94  return 0;
95  }
96  }
97  }
98  }
99  }
100  else if ( !Aig_ObjIsConst1(pObj) )
101  assert( 0 );
102  Aig_ObjSetTravIdCurrent( p, pObj );
103  }
105  return 1;
106 }
int Tim_ManBoxForCi(Tim_Man_t *p, int iCo)
Definition: timBox.c:86
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
int Tim_ManBoxForCo(Tim_Man_t *p, int iCi)
Definition: timBox.c:104
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Definition: aig.h:69
void Aig_ManSetCioIds(Aig_Man_t *p)
Definition: aigUtil.c:965
int Tim_ManBoxInputNum(Tim_Man_t *p, int iBox)
Definition: timBox.c:186
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
void Aig_ManCleanCioIds(Aig_Man_t *p)
Definition: aigUtil.c:986
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
int Tim_ManBoxInputFirst(Tim_Man_t *p, int iBox)
Definition: timBox.c:122
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
int Id
Definition: aig.h:85
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
static int Aig_ObjCioId(Aig_Obj_t *pObj)
Definition: aig.h:285
void Aig_ObjCollectCut ( Aig_Obj_t pRoot,
Vec_Ptr_t vLeaves,
Vec_Ptr_t vNodes 
)

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

Synopsis [Computes the internal nodes of the cut.]

Description [Does not include the leaves of the cut.]

SideEffects []

SeeAlso []

Definition at line 1017 of file aigDfs.c.

1018 {
1019  Aig_Obj_t * pObj;
1020  int i;
1021  // collect and mark the leaves
1022  Vec_PtrClear( vNodes );
1023  Vec_PtrForEachEntry( Aig_Obj_t *, vLeaves, pObj, i )
1024  {
1025  assert( pObj->fMarkA == 0 );
1026  pObj->fMarkA = 1;
1027 // printf( "%d " , pObj->Id );
1028  }
1029 //printf( "\n" );
1030  // collect and mark the nodes
1031  Aig_ObjCollectCut_rec( pRoot, vNodes );
1032  // clean the nodes
1033  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
1034  pObj->fMarkA = 0;
1035  Vec_PtrForEachEntry( Aig_Obj_t *, vLeaves, pObj, i )
1036  pObj->fMarkA = 0;
1037 }
unsigned int fMarkA
Definition: aig.h:79
Definition: aig.h:69
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Aig_ObjCollectCut_rec(Aig_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: aigDfs.c:992
void Aig_ObjCollectCut_rec ( Aig_Obj_t pNode,
Vec_Ptr_t vNodes 
)

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

Synopsis [Computes the internal nodes of the cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 992 of file aigDfs.c.

993 {
994 // Aig_Obj_t * pFan0 = Aig_ObjFanin0(pNode);
995 // Aig_Obj_t * pFan1 = Aig_ObjFanin1(pNode);
996  if ( pNode->fMarkA )
997  return;
998  pNode->fMarkA = 1;
999  assert( Aig_ObjIsNode(pNode) );
1000  Aig_ObjCollectCut_rec( Aig_ObjFanin0(pNode), vNodes );
1001  Aig_ObjCollectCut_rec( Aig_ObjFanin1(pNode), vNodes );
1002  Vec_PtrPush( vNodes, pNode );
1003 //printf( "added %d ", pNode->Id );
1004 }
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
unsigned int fMarkA
Definition: aig.h:79
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
#define assert(ex)
Definition: util_old.h:213
void Aig_ObjCollectCut_rec(Aig_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: aigDfs.c:992
int Aig_ObjCollectSuper ( Aig_Obj_t pObj,
Vec_Ptr_t vSuper 
)

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

Synopsis [Collects the nodes of the supergate.]

Description []

SideEffects []

SeeAlso []

Definition at line 1097 of file aigDfs.c.

1098 {
1099  int RetValue, i;
1100  assert( !Aig_IsComplement(pObj) );
1101  assert( Aig_ObjIsNode(pObj) );
1102  // collect the nodes in the implication supergate
1103  Vec_PtrClear( vSuper );
1104  RetValue = Aig_ObjCollectSuper_rec( pObj, pObj, vSuper );
1105  assert( Vec_PtrSize(vSuper) > 1 );
1106  // unmark the visited nodes
1107  Vec_PtrForEachEntry( Aig_Obj_t *, vSuper, pObj, i )
1108  Aig_Regular(pObj)->fMarkA = 0;
1109  // if we found the node and its complement in the same implication supergate,
1110  // return empty set of nodes (meaning that we should use constant-0 node)
1111  if ( RetValue == -1 )
1112  vSuper->nSize = 0;
1113  return RetValue;
1114 }
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
int Aig_ObjCollectSuper_rec(Aig_Obj_t *pRoot, Aig_Obj_t *pObj, Vec_Ptr_t *vSuper)
Definition: aigDfs.c:1051
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
int Aig_ObjCollectSuper_rec ( Aig_Obj_t pRoot,
Aig_Obj_t pObj,
Vec_Ptr_t vSuper 
)

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

Synopsis [Collects the nodes of the supergate.]

Description []

SideEffects []

SeeAlso []

Definition at line 1051 of file aigDfs.c.

1052 {
1053  int RetValue1, RetValue2, i;
1054  // check if the node is visited
1055  if ( Aig_Regular(pObj)->fMarkA )
1056  {
1057  // check if the node occurs in the same polarity
1058  for ( i = 0; i < vSuper->nSize; i++ )
1059  if ( vSuper->pArray[i] == pObj )
1060  return 1;
1061  // check if the node is present in the opposite polarity
1062  for ( i = 0; i < vSuper->nSize; i++ )
1063  if ( vSuper->pArray[i] == Aig_Not(pObj) )
1064  return -1;
1065  assert( 0 );
1066  return 0;
1067  }
1068  // if the new node is complemented or a PI, another gate begins
1069  if ( pObj != pRoot && (Aig_IsComplement(pObj) || Aig_ObjType(pObj) != Aig_ObjType(pRoot) || Aig_ObjRefs(pObj) > 1) )
1070  {
1071  Vec_PtrPush( vSuper, pObj );
1072  Aig_Regular(pObj)->fMarkA = 1;
1073  return 0;
1074  }
1075  assert( !Aig_IsComplement(pObj) );
1076  assert( Aig_ObjIsNode(pObj) );
1077  // go through the branches
1078  RetValue1 = Aig_ObjCollectSuper_rec( pRoot, Aig_ObjReal_rec( Aig_ObjChild0(pObj) ), vSuper );
1079  RetValue2 = Aig_ObjCollectSuper_rec( pRoot, Aig_ObjReal_rec( Aig_ObjChild1(pObj) ), vSuper );
1080  if ( RetValue1 == -1 || RetValue2 == -1 )
1081  return -1;
1082  // return 1 if at least one branch has a duplicate
1083  return RetValue1 || RetValue2;
1084 }
static Aig_Type_t Aig_ObjType(Aig_Obj_t *pObj)
Definition: aig.h:272
static Aig_Obj_t * Aig_ObjChild0(Aig_Obj_t *pObj)
Definition: aig.h:310
Aig_Obj_t * Aig_ObjReal_rec(Aig_Obj_t *pObj)
Definition: aigUtil.c:476
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
unsigned int fMarkA
Definition: aig.h:79
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
Definition: aig.h:247
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static Aig_Obj_t * Aig_ObjChild1(Aig_Obj_t *pObj)
Definition: aig.h:311
int Aig_ObjCollectSuper_rec(Aig_Obj_t *pRoot, Aig_Obj_t *pObj, Vec_Ptr_t *vSuper)
Definition: aigDfs.c:1051
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjRefs(Aig_Obj_t *pObj)
Definition: aig.h:300
Vec_Ptr_t* Aig_Support ( Aig_Man_t p,
Aig_Obj_t pObj 
)

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

Synopsis [Counts the support size of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 832 of file aigDfs.c.

833 {
834  Vec_Ptr_t * vSupp;
835  assert( !Aig_IsComplement(pObj) );
836  assert( !Aig_ObjIsCo(pObj) );
838  vSupp = Vec_PtrAlloc( 100 );
839  Aig_Support_rec( p, pObj, vSupp );
840  return vSupp;
841 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
void Aig_Support_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vSupp)
Definition: aigDfs.c:803
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
void Aig_Support_rec ( Aig_Man_t p,
Aig_Obj_t pObj,
Vec_Ptr_t vSupp 
)

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

Synopsis [Counts the support size of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 803 of file aigDfs.c.

804 {
805  if ( Aig_ObjIsTravIdCurrent(p, pObj) )
806  return;
807  Aig_ObjSetTravIdCurrent(p, pObj);
808  if ( Aig_ObjIsConst1(pObj) )
809  return;
810  if ( Aig_ObjIsCi(pObj) )
811  {
812  Vec_PtrPush( vSupp, pObj );
813  return;
814  }
815  assert( Aig_ObjIsNode(pObj) || Aig_ObjIsBuf(pObj) );
816  Aig_Support_rec( p, Aig_ObjFanin0(pObj), vSupp );
817  if ( Aig_ObjFanin1(pObj) )
818  Aig_Support_rec( p, Aig_ObjFanin1(pObj), vSupp );
819 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
void Aig_Support_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vSupp)
Definition: aigDfs.c:803
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
void Aig_SupportNodes ( Aig_Man_t p,
Aig_Obj_t **  ppObjs,
int  nObjs,
Vec_Ptr_t vSupp 
)

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

Synopsis [Counts the support size of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 854 of file aigDfs.c.

855 {
856  int i;
857  Vec_PtrClear( vSupp );
860  for ( i = 0; i < nObjs; i++ )
861  {
862  assert( !Aig_IsComplement(ppObjs[i]) );
863  if ( Aig_ObjIsCo(ppObjs[i]) )
864  Aig_Support_rec( p, Aig_ObjFanin0(ppObjs[i]), vSupp );
865  else
866  Aig_Support_rec( p, ppObjs[i], vSupp );
867  }
868 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
void Aig_Support_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vSupp)
Definition: aigDfs.c:803
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
int Aig_SupportSize ( Aig_Man_t p,
Aig_Obj_t pObj 
)

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

Synopsis [Counts the support size of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 758 of file aigDfs.c.

759 {
760  int Counter = 0;
761  assert( !Aig_IsComplement(pObj) );
762  assert( !Aig_ObjIsCo(pObj) );
764  Aig_SupportSize_rec( p, pObj, &Counter );
765  return Counter;
766 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
static int Counter
void Aig_SupportSize_rec(Aig_Man_t *p, Aig_Obj_t *pObj, int *pCounter)
Definition: aigDfs.c:731
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
void Aig_SupportSize_rec ( Aig_Man_t p,
Aig_Obj_t pObj,
int *  pCounter 
)

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

Synopsis [Counts the support size of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 731 of file aigDfs.c.

732 {
733  if ( Aig_ObjIsTravIdCurrent(p, pObj) )
734  return;
735  Aig_ObjSetTravIdCurrent(p, pObj);
736  if ( Aig_ObjIsCi(pObj) )
737  {
738  (*pCounter)++;
739  return;
740  }
741  assert( Aig_ObjIsNode(pObj) || Aig_ObjIsBuf(pObj) );
742  Aig_SupportSize_rec( p, Aig_ObjFanin0(pObj), pCounter );
743  if ( Aig_ObjFanin1(pObj) )
744  Aig_SupportSize_rec( p, Aig_ObjFanin1(pObj), pCounter );
745 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
void Aig_SupportSize_rec(Aig_Man_t *p, Aig_Obj_t *pObj, int *pCounter)
Definition: aigDfs.c:731
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
int Aig_SupportSizeTest ( Aig_Man_t p)

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

Synopsis [Counts the support size of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 779 of file aigDfs.c.

780 {
781  Aig_Obj_t * pObj;
782  int i, Counter = 0;
783  abctime clk = Abc_Clock();
784  Aig_ManForEachObj( p, pObj, i )
785  if ( Aig_ObjIsNode(pObj) )
786  Counter += (Aig_SupportSize(p, pObj) <= 16);
787  printf( "Nodes with small support %d (out of %d)\n", Counter, Aig_ManNodeNum(p) );
788  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
789  return Counter;
790 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static int Counter
int support
Definition: abcSaucy.c:64
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
int Aig_SupportSize(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDfs.c:758
ABC_INT64_T abctime
Definition: abc_global.h:278
Aig_Obj_t* Aig_Transfer ( Aig_Man_t pSour,
Aig_Man_t pDest,
Aig_Obj_t pRoot,
int  nVars 
)

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

Synopsis [Transfers the AIG from one manager into another.]

Description []

SideEffects []

SeeAlso []

Definition at line 904 of file aigDfs.c.

905 {
906  Aig_Obj_t * pObj;
907  int i;
908  // solve simple cases
909  if ( pSour == pDest )
910  return pRoot;
911  if ( Aig_ObjIsConst1( Aig_Regular(pRoot) ) )
912  return Aig_NotCond( Aig_ManConst1(pDest), Aig_IsComplement(pRoot) );
913  // set the PI mapping
914  Aig_ManForEachCi( pSour, pObj, i )
915  {
916  if ( i == nVars )
917  break;
918  pObj->pData = Aig_IthVar(pDest, i);
919  }
920  // transfer and set markings
921  Aig_Transfer_rec( pDest, Aig_Regular(pRoot) );
922  // clear the markings
924  return Aig_NotCond( (Aig_Obj_t *)Aig_Regular(pRoot)->pData, Aig_IsComplement(pRoot) );
925 }
void * pData
Definition: aig.h:87
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
Aig_Obj_t * Aig_IthVar(Aig_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
Definition: aigOper.c:63
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Definition: aig.h:69
void Aig_ConeUnmark_rec(Aig_Obj_t *pObj)
Definition: aigDfs.c:690
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
void Aig_Transfer_rec(Aig_Man_t *pDest, Aig_Obj_t *pObj)
Definition: aigDfs.c:881
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
void Aig_Transfer_rec ( Aig_Man_t pDest,
Aig_Obj_t pObj 
)

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

Synopsis [Transfers the AIG from one manager into another.]

Description []

SideEffects []

SeeAlso []

Definition at line 881 of file aigDfs.c.

882 {
883  assert( !Aig_IsComplement(pObj) );
884  if ( !Aig_ObjIsNode(pObj) || Aig_ObjIsMarkA(pObj) )
885  return;
886  Aig_Transfer_rec( pDest, Aig_ObjFanin0(pObj) );
887  Aig_Transfer_rec( pDest, Aig_ObjFanin1(pObj) );
888  pObj->pData = Aig_And( pDest, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
889  assert( !Aig_ObjIsMarkA(pObj) ); // loop detection
890  Aig_ObjSetMarkA( pObj );
891 }
static int Aig_ObjIsMarkA(Aig_Obj_t *pObj)
Definition: aig.h:288
void * pData
Definition: aig.h:87
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static void Aig_ObjSetMarkA(Aig_Obj_t *pObj)
Definition: aig.h:289
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
void Aig_Transfer_rec(Aig_Man_t *pDest, Aig_Obj_t *pObj)
Definition: aigDfs.c:881
#define assert(ex)
Definition: util_old.h:213