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

Go to the source code of this file.

Macros

#define Ivy_ObjForEachFanoutInt(pObj, pFanout)
 
#define Ivy_ObjForEachFanoutIntSafe(pObj, pFanout, pFanout2)
 

Functions

static
ABC_NAMESPACE_IMPL_START
Ivy_Obj_t
Ivy_ObjNextFanout (Ivy_Obj_t *pObj, Ivy_Obj_t *pFanout)
 DECLARATIONS ///. More...
 
static Ivy_Obj_tIvy_ObjPrevFanout (Ivy_Obj_t *pObj, Ivy_Obj_t *pFanout)
 
static Ivy_Obj_t ** Ivy_ObjNextFanoutPlace (Ivy_Obj_t *pObj, Ivy_Obj_t *pFanout)
 
static Ivy_Obj_t ** Ivy_ObjPrevFanoutPlace (Ivy_Obj_t *pObj, Ivy_Obj_t *pFanout)
 
static Ivy_Obj_t ** Ivy_ObjPrevNextFanoutPlace (Ivy_Obj_t *pObj, Ivy_Obj_t *pFanout)
 
static Ivy_Obj_t ** Ivy_ObjNextPrevFanoutPlace (Ivy_Obj_t *pObj, Ivy_Obj_t *pFanout)
 
void Ivy_ManStartFanout (Ivy_Man_t *p)
 FUNCTION DEFINITIONS ///. More...
 
void Ivy_ManStopFanout (Ivy_Man_t *p)
 
void Ivy_ObjAddFanout (Ivy_Man_t *p, Ivy_Obj_t *pFanin, Ivy_Obj_t *pFanout)
 
void Ivy_ObjDeleteFanout (Ivy_Man_t *p, Ivy_Obj_t *pFanin, Ivy_Obj_t *pFanout)
 
void Ivy_ObjPatchFanout (Ivy_Man_t *p, Ivy_Obj_t *pFanin, Ivy_Obj_t *pFanoutOld, Ivy_Obj_t *pFanoutNew)
 
void Ivy_ObjCollectFanouts (Ivy_Man_t *p, Ivy_Obj_t *pObj, Vec_Ptr_t *vArray)
 
Ivy_Obj_tIvy_ObjReadFirstFanout (Ivy_Man_t *p, Ivy_Obj_t *pObj)
 
int Ivy_ObjFanoutNum (Ivy_Man_t *p, Ivy_Obj_t *pObj)
 

Macro Definition Documentation

#define Ivy_ObjForEachFanoutInt (   pObj,
  pFanout 
)
Value:
for ( pFanout = (pObj)->pFanout; pFanout; \
pFanout = Ivy_ObjNextFanout(pObj, pFanout) )
static ABC_NAMESPACE_IMPL_START Ivy_Obj_t * Ivy_ObjNextFanout(Ivy_Obj_t *pObj, Ivy_Obj_t *pFanout)
DECLARATIONS ///.
Definition: ivyFanout.c:31

Definition at line 109 of file ivyFanout.c.

#define Ivy_ObjForEachFanoutIntSafe (   pObj,
  pFanout,
  pFanout2 
)
Value:
for ( pFanout = (pObj)->pFanout, \
pFanout2 = Ivy_ObjNextFanout(pObj, pFanout); \
pFanout; \
pFanout = pFanout2, \
pFanout2 = Ivy_ObjNextFanout(pObj, pFanout) )
static ABC_NAMESPACE_IMPL_START Ivy_Obj_t * Ivy_ObjNextFanout(Ivy_Obj_t *pObj, Ivy_Obj_t *pFanout)
DECLARATIONS ///.
Definition: ivyFanout.c:31

Definition at line 114 of file ivyFanout.c.

Function Documentation

void Ivy_ManStartFanout ( Ivy_Man_t p)

FUNCTION DEFINITIONS ///.

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

Synopsis [Starts the fanout representation.]

Description []

SideEffects []

SeeAlso []

Definition at line 136 of file ivyFanout.c.

137 {
138  Ivy_Obj_t * pObj;
139  int i;
140  assert( !p->fFanout );
141  p->fFanout = 1;
142  Ivy_ManForEachObj( p, pObj, i )
143  {
144  if ( Ivy_ObjFanin0(pObj) )
145  Ivy_ObjAddFanout( p, Ivy_ObjFanin0(pObj), pObj );
146  if ( Ivy_ObjFanin1(pObj) )
147  Ivy_ObjAddFanout( p, Ivy_ObjFanin1(pObj), pObj );
148  }
149 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Ivy_Obj_t * Ivy_ObjFanin1(Ivy_Obj_t *pObj)
Definition: ivy.h:272
static Ivy_Obj_t * Ivy_ObjFanin0(Ivy_Obj_t *pObj)
Definition: ivy.h:271
Definition: ivy.h:73
void Ivy_ObjAddFanout(Ivy_Man_t *p, Ivy_Obj_t *pFanin, Ivy_Obj_t *pFanout)
Definition: ivyFanout.c:183
#define assert(ex)
Definition: util_old.h:213
#define Ivy_ManForEachObj(p, pObj, i)
Definition: ivy.h:393
void Ivy_ManStopFanout ( Ivy_Man_t p)

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

Synopsis [Stops the fanout representation.]

Description []

SideEffects []

SeeAlso []

Definition at line 162 of file ivyFanout.c.

163 {
164  Ivy_Obj_t * pObj;
165  int i;
166  assert( p->fFanout );
167  p->fFanout = 0;
168  Ivy_ManForEachObj( p, pObj, i )
169  pObj->pFanout = pObj->pNextFan0 = pObj->pNextFan1 = pObj->pPrevFan0 = pObj->pPrevFan1 = NULL;
170 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Definition: ivy.h:73
#define assert(ex)
Definition: util_old.h:213
#define Ivy_ManForEachObj(p, pObj, i)
Definition: ivy.h:393
void Ivy_ObjAddFanout ( Ivy_Man_t p,
Ivy_Obj_t pFanin,
Ivy_Obj_t pFanout 
)

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

Synopsis [Add the fanout.]

Description []

SideEffects []

SeeAlso []

Definition at line 183 of file ivyFanout.c.

184 {
185  assert( p->fFanout );
186  if ( pFanin->pFanout )
187  {
188  *Ivy_ObjNextFanoutPlace(pFanin, pFanout) = pFanin->pFanout;
189  *Ivy_ObjPrevFanoutPlace(pFanin, pFanin->pFanout) = pFanout;
190  }
191  pFanin->pFanout = pFanout;
192 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Ivy_Obj_t * pFanout
Definition: ivy.h:88
#define assert(ex)
Definition: util_old.h:213
static Ivy_Obj_t ** Ivy_ObjNextFanoutPlace(Ivy_Obj_t *pObj, Ivy_Obj_t *pFanout)
Definition: ivyFanout.c:57
static Ivy_Obj_t ** Ivy_ObjPrevFanoutPlace(Ivy_Obj_t *pObj, Ivy_Obj_t *pFanout)
Definition: ivyFanout.c:68
void Ivy_ObjCollectFanouts ( Ivy_Man_t p,
Ivy_Obj_t pObj,
Vec_Ptr_t vArray 
)

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

Synopsis [Starts iteration through the fanouts.]

Description [Copies the currently available fanouts into the array.]

SideEffects [Can be used while the fanouts are being removed.]

SeeAlso []

Definition at line 262 of file ivyFanout.c.

263 {
264  Ivy_Obj_t * pFanout;
265  assert( p->fFanout );
266  assert( !Ivy_IsComplement(pObj) );
267  Vec_PtrClear( vArray );
268  Ivy_ObjForEachFanoutInt( pObj, pFanout )
269  Vec_PtrPush( vArray, pFanout );
270 }
static int Ivy_IsComplement(Ivy_Obj_t *p)
Definition: ivy.h:196
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Ivy_ObjForEachFanoutInt(pObj, pFanout)
Definition: ivyFanout.c:109
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
Definition: ivy.h:73
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
void Ivy_ObjDeleteFanout ( Ivy_Man_t p,
Ivy_Obj_t pFanin,
Ivy_Obj_t pFanout 
)

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

Synopsis [Removes the fanout.]

Description []

SideEffects []

SeeAlso []

Definition at line 205 of file ivyFanout.c.

206 {
207  Ivy_Obj_t ** ppPlace1, ** ppPlace2, ** ppPlaceN;
208  assert( pFanin->pFanout != NULL );
209 
210  ppPlace1 = Ivy_ObjNextFanoutPlace(pFanin, pFanout);
211  ppPlaceN = Ivy_ObjPrevNextFanoutPlace(pFanin, pFanout);
212  assert( *ppPlaceN == pFanout );
213  if ( ppPlaceN )
214  *ppPlaceN = *ppPlace1;
215 
216  ppPlace2 = Ivy_ObjPrevFanoutPlace(pFanin, pFanout);
217  ppPlaceN = Ivy_ObjNextPrevFanoutPlace(pFanin, pFanout);
218  assert( ppPlaceN == NULL || *ppPlaceN == pFanout );
219  if ( ppPlaceN )
220  *ppPlaceN = *ppPlace2;
221 
222  *ppPlace1 = NULL;
223  *ppPlace2 = NULL;
224 }
Ivy_Obj_t * pFanout
Definition: ivy.h:88
static Ivy_Obj_t ** Ivy_ObjNextPrevFanoutPlace(Ivy_Obj_t *pObj, Ivy_Obj_t *pFanout)
Definition: ivyFanout.c:94
Definition: ivy.h:73
static Ivy_Obj_t ** Ivy_ObjPrevNextFanoutPlace(Ivy_Obj_t *pObj, Ivy_Obj_t *pFanout)
Definition: ivyFanout.c:79
#define assert(ex)
Definition: util_old.h:213
static Ivy_Obj_t ** Ivy_ObjNextFanoutPlace(Ivy_Obj_t *pObj, Ivy_Obj_t *pFanout)
Definition: ivyFanout.c:57
static Ivy_Obj_t ** Ivy_ObjPrevFanoutPlace(Ivy_Obj_t *pObj, Ivy_Obj_t *pFanout)
Definition: ivyFanout.c:68
int Ivy_ObjFanoutNum ( Ivy_Man_t p,
Ivy_Obj_t pObj 
)

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

Synopsis [Reads one fanout.]

Description [Returns fanout if there is only one fanout.]

SideEffects []

SeeAlso []

Definition at line 299 of file ivyFanout.c.

300 {
301  Ivy_Obj_t * pFanout;
302  int Counter = 0;
303  Ivy_ObjForEachFanoutInt( pObj, pFanout )
304  Counter++;
305  return Counter;
306 }
#define Ivy_ObjForEachFanoutInt(pObj, pFanout)
Definition: ivyFanout.c:109
Definition: ivy.h:73
static int Counter
static ABC_NAMESPACE_IMPL_START Ivy_Obj_t* Ivy_ObjNextFanout ( Ivy_Obj_t pObj,
Ivy_Obj_t pFanout 
)
inlinestatic

DECLARATIONS ///.

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

FileName [ivyFanout.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [And-Inverter Graph package.]

Synopsis [Representation of the fanouts.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Definition at line 31 of file ivyFanout.c.

32 {
33  assert( !Ivy_IsComplement(pObj) );
34  assert( !Ivy_IsComplement(pFanout) );
35  if ( pFanout == NULL )
36  return NULL;
37  if ( Ivy_ObjFanin0(pFanout) == pObj )
38  return pFanout->pNextFan0;
39  assert( Ivy_ObjFanin1(pFanout) == pObj );
40  return pFanout->pNextFan1;
41 }
static int Ivy_IsComplement(Ivy_Obj_t *p)
Definition: ivy.h:196
Ivy_Obj_t * pNextFan0
Definition: ivy.h:89
static Ivy_Obj_t * Ivy_ObjFanin1(Ivy_Obj_t *pObj)
Definition: ivy.h:272
Ivy_Obj_t * pNextFan1
Definition: ivy.h:90
static Ivy_Obj_t * Ivy_ObjFanin0(Ivy_Obj_t *pObj)
Definition: ivy.h:271
#define assert(ex)
Definition: util_old.h:213
static Ivy_Obj_t** Ivy_ObjNextFanoutPlace ( Ivy_Obj_t pObj,
Ivy_Obj_t pFanout 
)
inlinestatic

Definition at line 57 of file ivyFanout.c.

58 {
59  assert( !Ivy_IsComplement(pObj) );
60  assert( !Ivy_IsComplement(pFanout) );
61  if ( Ivy_ObjFanin0(pFanout) == pObj )
62  return &pFanout->pNextFan0;
63  assert( Ivy_ObjFanin1(pFanout) == pObj );
64  return &pFanout->pNextFan1;
65 }
static int Ivy_IsComplement(Ivy_Obj_t *p)
Definition: ivy.h:196
Ivy_Obj_t * pNextFan0
Definition: ivy.h:89
static Ivy_Obj_t * Ivy_ObjFanin1(Ivy_Obj_t *pObj)
Definition: ivy.h:272
Ivy_Obj_t * pNextFan1
Definition: ivy.h:90
static Ivy_Obj_t * Ivy_ObjFanin0(Ivy_Obj_t *pObj)
Definition: ivy.h:271
#define assert(ex)
Definition: util_old.h:213
static Ivy_Obj_t** Ivy_ObjNextPrevFanoutPlace ( Ivy_Obj_t pObj,
Ivy_Obj_t pFanout 
)
inlinestatic

Definition at line 94 of file ivyFanout.c.

95 {
96  Ivy_Obj_t * pTemp;
97  assert( !Ivy_IsComplement(pObj) );
98  assert( !Ivy_IsComplement(pFanout) );
99  pTemp = Ivy_ObjNextFanout(pObj, pFanout);
100  if ( pTemp == NULL )
101  return NULL;
102  if ( Ivy_ObjFanin0(pTemp) == pObj )
103  return &pTemp->pPrevFan0;
104  assert( Ivy_ObjFanin1(pTemp) == pObj );
105  return &pTemp->pPrevFan1;
106 }
static int Ivy_IsComplement(Ivy_Obj_t *p)
Definition: ivy.h:196
Ivy_Obj_t * pPrevFan0
Definition: ivy.h:91
static Ivy_Obj_t * Ivy_ObjFanin1(Ivy_Obj_t *pObj)
Definition: ivy.h:272
static Ivy_Obj_t * Ivy_ObjFanin0(Ivy_Obj_t *pObj)
Definition: ivy.h:271
Definition: ivy.h:73
#define assert(ex)
Definition: util_old.h:213
static ABC_NAMESPACE_IMPL_START Ivy_Obj_t * Ivy_ObjNextFanout(Ivy_Obj_t *pObj, Ivy_Obj_t *pFanout)
DECLARATIONS ///.
Definition: ivyFanout.c:31
Ivy_Obj_t * pPrevFan1
Definition: ivy.h:92
void Ivy_ObjPatchFanout ( Ivy_Man_t p,
Ivy_Obj_t pFanin,
Ivy_Obj_t pFanoutOld,
Ivy_Obj_t pFanoutNew 
)

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

Synopsis [Replaces the fanout of pOld to be pFanoutNew.]

Description []

SideEffects []

SeeAlso []

Definition at line 237 of file ivyFanout.c.

238 {
239  Ivy_Obj_t ** ppPlace;
240  ppPlace = Ivy_ObjPrevNextFanoutPlace(pFanin, pFanoutOld);
241  assert( *ppPlace == pFanoutOld );
242  if ( ppPlace )
243  *ppPlace = pFanoutNew;
244  ppPlace = Ivy_ObjNextPrevFanoutPlace(pFanin, pFanoutOld);
245  assert( ppPlace == NULL || *ppPlace == pFanoutOld );
246  if ( ppPlace )
247  *ppPlace = pFanoutNew;
248  // assuming that pFanoutNew already points to the next fanout
249 }
static Ivy_Obj_t ** Ivy_ObjNextPrevFanoutPlace(Ivy_Obj_t *pObj, Ivy_Obj_t *pFanout)
Definition: ivyFanout.c:94
Definition: ivy.h:73
static Ivy_Obj_t ** Ivy_ObjPrevNextFanoutPlace(Ivy_Obj_t *pObj, Ivy_Obj_t *pFanout)
Definition: ivyFanout.c:79
#define assert(ex)
Definition: util_old.h:213
static Ivy_Obj_t* Ivy_ObjPrevFanout ( Ivy_Obj_t pObj,
Ivy_Obj_t pFanout 
)
inlinestatic

Definition at line 44 of file ivyFanout.c.

45 {
46  assert( !Ivy_IsComplement(pObj) );
47  assert( !Ivy_IsComplement(pFanout) );
48  if ( pFanout == NULL )
49  return NULL;
50  if ( Ivy_ObjFanin0(pFanout) == pObj )
51  return pFanout->pPrevFan0;
52  assert( Ivy_ObjFanin1(pFanout) == pObj );
53  return pFanout->pPrevFan1;
54 }
static int Ivy_IsComplement(Ivy_Obj_t *p)
Definition: ivy.h:196
Ivy_Obj_t * pPrevFan0
Definition: ivy.h:91
static Ivy_Obj_t * Ivy_ObjFanin1(Ivy_Obj_t *pObj)
Definition: ivy.h:272
static Ivy_Obj_t * Ivy_ObjFanin0(Ivy_Obj_t *pObj)
Definition: ivy.h:271
#define assert(ex)
Definition: util_old.h:213
Ivy_Obj_t * pPrevFan1
Definition: ivy.h:92
static Ivy_Obj_t** Ivy_ObjPrevFanoutPlace ( Ivy_Obj_t pObj,
Ivy_Obj_t pFanout 
)
inlinestatic

Definition at line 68 of file ivyFanout.c.

69 {
70  assert( !Ivy_IsComplement(pObj) );
71  assert( !Ivy_IsComplement(pFanout) );
72  if ( Ivy_ObjFanin0(pFanout) == pObj )
73  return &pFanout->pPrevFan0;
74  assert( Ivy_ObjFanin1(pFanout) == pObj );
75  return &pFanout->pPrevFan1;
76 }
static int Ivy_IsComplement(Ivy_Obj_t *p)
Definition: ivy.h:196
Ivy_Obj_t * pPrevFan0
Definition: ivy.h:91
static Ivy_Obj_t * Ivy_ObjFanin1(Ivy_Obj_t *pObj)
Definition: ivy.h:272
static Ivy_Obj_t * Ivy_ObjFanin0(Ivy_Obj_t *pObj)
Definition: ivy.h:271
#define assert(ex)
Definition: util_old.h:213
Ivy_Obj_t * pPrevFan1
Definition: ivy.h:92
static Ivy_Obj_t** Ivy_ObjPrevNextFanoutPlace ( Ivy_Obj_t pObj,
Ivy_Obj_t pFanout 
)
inlinestatic

Definition at line 79 of file ivyFanout.c.

80 {
81  Ivy_Obj_t * pTemp;
82  assert( !Ivy_IsComplement(pObj) );
83  assert( !Ivy_IsComplement(pFanout) );
84  pTemp = Ivy_ObjPrevFanout(pObj, pFanout);
85  if ( pTemp == NULL )
86  return &pObj->pFanout;
87  if ( Ivy_ObjFanin0(pTemp) == pObj )
88  return &pTemp->pNextFan0;
89  assert( Ivy_ObjFanin1(pTemp) == pObj );
90  return &pTemp->pNextFan1;
91 }
static int Ivy_IsComplement(Ivy_Obj_t *p)
Definition: ivy.h:196
Ivy_Obj_t * pFanout
Definition: ivy.h:88
Ivy_Obj_t * pNextFan0
Definition: ivy.h:89
static Ivy_Obj_t * Ivy_ObjFanin1(Ivy_Obj_t *pObj)
Definition: ivy.h:272
Ivy_Obj_t * pNextFan1
Definition: ivy.h:90
static Ivy_Obj_t * Ivy_ObjFanin0(Ivy_Obj_t *pObj)
Definition: ivy.h:271
Definition: ivy.h:73
static Ivy_Obj_t * Ivy_ObjPrevFanout(Ivy_Obj_t *pObj, Ivy_Obj_t *pFanout)
Definition: ivyFanout.c:44
#define assert(ex)
Definition: util_old.h:213
Ivy_Obj_t* Ivy_ObjReadFirstFanout ( Ivy_Man_t p,
Ivy_Obj_t pObj 
)

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

Synopsis [Reads one fanout.]

Description [Returns fanout if there is only one fanout.]

SideEffects []

SeeAlso []

Definition at line 283 of file ivyFanout.c.

284 {
285  return pObj->pFanout;
286 }
Ivy_Obj_t * pFanout
Definition: ivy.h:88