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

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START
Hop_Man_t
Hop_ManStart ()
 DECLARATIONS ///. More...
 
void Hop_ManStop (Hop_Man_t *p)
 
int Hop_ManCleanup (Hop_Man_t *p)
 
void Hop_ManPrintStats (Hop_Man_t *p)
 

Function Documentation

int Hop_ManCleanup ( Hop_Man_t p)

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

Synopsis [Returns the number of dangling nodes removed.]

Description []

SideEffects []

SeeAlso []

Definition at line 120 of file hopMan.c.

121 {
122  Vec_Ptr_t * vObjs;
123  Hop_Obj_t * pNode;
124  int i, nNodesOld;
125  assert( p->fRefCount );
126  nNodesOld = Hop_ManNodeNum(p);
127  // collect roots of dangling nodes
128  vObjs = Vec_PtrAlloc( 100 );
129  Hop_ManForEachNode( p, pNode, i )
130  if ( Hop_ObjRefs(pNode) == 0 )
131  Vec_PtrPush( vObjs, pNode );
132  // recursively remove dangling nodes
133  Vec_PtrForEachEntry( Hop_Obj_t *, vObjs, pNode, i )
134  Hop_ObjDelete_rec( p, pNode );
135  Vec_PtrFree( vObjs );
136  return nNodesOld - Hop_ManNodeNum(p);
137 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Hop_ObjRefs(Hop_Obj_t *pObj)
Definition: hop.h:176
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Hop_ManForEachNode(p, pObj, i)
Definition: hop.h:265
void Hop_ObjDelete_rec(Hop_Man_t *p, Hop_Obj_t *pObj)
Definition: hopObj.c:214
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
Definition: hop.h:65
if(last==0)
Definition: sparse_int.h:34
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static int Hop_ManNodeNum(Hop_Man_t *p)
Definition: hop.h:149
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Hop_ManPrintStats ( Hop_Man_t p)

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

Synopsis [Stops the AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 150 of file hopMan.c.

151 {
152  printf( "PI/PO = %d/%d. ", Hop_ManPiNum(p), Hop_ManPoNum(p) );
153  printf( "A = %7d. ", Hop_ManAndNum(p) );
154  printf( "X = %5d. ", Hop_ManExorNum(p) );
155  printf( "Cre = %7d. ", p->nCreated );
156  printf( "Del = %7d. ", p->nDeleted );
157  printf( "Lev = %3d. ", Hop_ManCountLevels(p) );
158  printf( "\n" );
159 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Hop_ManCountLevels(Hop_Man_t *p)
Definition: hopDfs.c:116
static int Hop_ManPoNum(Hop_Man_t *p)
Definition: hop.h:146
static int Hop_ManAndNum(Hop_Man_t *p)
Definition: hop.h:147
static int Hop_ManExorNum(Hop_Man_t *p)
Definition: hop.h:148
static int Hop_ManPiNum(Hop_Man_t *p)
Definition: hop.h:145

DECLARATIONS ///.

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

FileName [hopMan.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Minimalistic And-Inverter Graph package.]

Synopsis [AIG manager.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - May 11, 2006.]

Revision [

Id:
hopMan.c,v 1.00 2006/05/11 00:00:00 alanmi Exp

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

Synopsis [Starts the AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file hopMan.c.

46 {
47  Hop_Man_t * p;
48  // start the manager
49  p = ABC_ALLOC( Hop_Man_t, 1 );
50  memset( p, 0, sizeof(Hop_Man_t) );
51  // perform initializations
52  p->nTravIds = 1;
53  p->fRefCount = 1;
54  p->fCatchExor = 0;
55  // allocate arrays for nodes
56  p->vPis = Vec_PtrAlloc( 100 );
57  p->vPos = Vec_PtrAlloc( 100 );
58  // prepare the internal memory manager
59  Hop_ManStartMemory( p );
60  // create the constant node
61  p->pConst1 = Hop_ManFetchMemory( p );
62  p->pConst1->Type = AIG_CONST1;
63  p->pConst1->fPhase = 1;
64  p->nCreated = 1;
65  // start the table
66 // p->nTableSize = 107;
67  p->nTableSize = 10007;
68  p->pTable = ABC_ALLOC( Hop_Obj_t *, p->nTableSize );
69  memset( p->pTable, 0, sizeof(Hop_Obj_t *) * p->nTableSize );
70  return p;
71 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Hop_ManStartMemory(Hop_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition: hopMem.c:49
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Definition: hop.h:65
static Hop_Obj_t * Hop_ManFetchMemory(Hop_Man_t *p)
Definition: hop.h:230
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Definition: hop.h:56
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
void Hop_ManStop ( Hop_Man_t p)

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

Synopsis [Stops the AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 84 of file hopMan.c.

85 {
86  Hop_Obj_t * pObj;
87  int i;
88  // make sure the nodes have clean marks
89  pObj = Hop_ManConst1(p);
90  assert( !pObj->fMarkA && !pObj->fMarkB );
91  Hop_ManForEachPi( p, pObj, i )
92  assert( !pObj->fMarkA && !pObj->fMarkB );
93  Hop_ManForEachPo( p, pObj, i )
94  assert( !pObj->fMarkA && !pObj->fMarkB );
95  Hop_ManForEachNode( p, pObj, i )
96  assert( !pObj->fMarkA && !pObj->fMarkB );
97  // print time
98  if ( p->time1 ) { ABC_PRT( "time1", p->time1 ); }
99  if ( p->time2 ) { ABC_PRT( "time2", p->time2 ); }
100 // Hop_TableProfile( p );
101  if ( p->vChunks ) Hop_ManStopMemory( p );
102  if ( p->vPis ) Vec_PtrFree( p->vPis );
103  if ( p->vPos ) Vec_PtrFree( p->vPos );
104  if ( p->vObjs ) Vec_PtrFree( p->vObjs );
105  ABC_FREE( p->pTable );
106  ABC_FREE( p );
107 }
static Hop_Obj_t * Hop_ManConst1(Hop_Man_t *p)
Definition: hop.h:132
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Hop_ManForEachNode(p, pObj, i)
Definition: hop.h:265
#define Hop_ManForEachPi(p, pObj, i)
ITERATORS ///.
Definition: hop.h:259
#define Hop_ManForEachPo(p, pObj, i)
Definition: hop.h:262
Definition: hop.h:65
unsigned int fMarkA
Definition: hop.h:77
if(last==0)
Definition: sparse_int.h:34
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define ABC_PRT(a, t)
Definition: abc_global.h:220
#define assert(ex)
Definition: util_old.h:213
unsigned int fMarkB
Definition: hop.h:78
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Hop_ManStopMemory(Hop_Man_t *p)
Definition: hopMem.c:66