src/aig/ivy/ivyFanout.c File Reference

#include "ivy.h"
Include dependency graph for ivyFanout.c:

Go to the source code of this file.

Defines

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

Functions

static Ivy_Obj_tIvy_ObjNextFanout (Ivy_Obj_t *pObj, Ivy_Obj_t *pFanout)
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)
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)

Define Documentation

#define Ivy_ObjForEachFanoutInt ( pObj,
pFanout   ) 
Value:
for ( pFanout = (pObj)->pFanout; pFanout;                    \
          pFanout = Ivy_ObjNextFanout(pObj, pFanout) )

Definition at line 106 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) )

Definition at line 111 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 133 of file ivyFanout.c.

00134 {
00135     Ivy_Obj_t * pObj;
00136     int i;
00137     assert( !p->fFanout );
00138     p->fFanout = 1;
00139     Ivy_ManForEachObj( p, pObj, i )
00140     {
00141         if ( Ivy_ObjFanin0(pObj) )
00142             Ivy_ObjAddFanout( p, Ivy_ObjFanin0(pObj), pObj );
00143         if ( Ivy_ObjFanin1(pObj) )
00144             Ivy_ObjAddFanout( p, Ivy_ObjFanin1(pObj), pObj );
00145     }
00146 }

void Ivy_ManStopFanout ( Ivy_Man_t p  ) 

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

Synopsis [Stops the fanout representation.]

Description []

SideEffects []

SeeAlso []

Definition at line 159 of file ivyFanout.c.

00160 {
00161     Ivy_Obj_t * pObj;
00162     int i;
00163     assert( p->fFanout );
00164     p->fFanout = 0;
00165     Ivy_ManForEachObj( p, pObj, i )
00166         pObj->pFanout = pObj->pNextFan0 = pObj->pNextFan1 = pObj->pPrevFan0 = pObj->pPrevFan1 = NULL;
00167 }

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 180 of file ivyFanout.c.

00181 {
00182     assert( p->fFanout );
00183     if ( pFanin->pFanout )
00184     {
00185         *Ivy_ObjNextFanoutPlace(pFanin, pFanout) = pFanin->pFanout;
00186         *Ivy_ObjPrevFanoutPlace(pFanin, pFanin->pFanout) = pFanout;
00187     }
00188     pFanin->pFanout = pFanout;
00189 }

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 259 of file ivyFanout.c.

00260 {
00261     Ivy_Obj_t * pFanout;
00262     assert( p->fFanout );
00263     assert( !Ivy_IsComplement(pObj) );
00264     Vec_PtrClear( vArray );
00265     Ivy_ObjForEachFanoutInt( pObj, pFanout )
00266         Vec_PtrPush( vArray, pFanout );
00267 }

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 202 of file ivyFanout.c.

00203 {
00204     Ivy_Obj_t ** ppPlace1, ** ppPlace2, ** ppPlaceN;
00205     assert( pFanin->pFanout != NULL );
00206 
00207     ppPlace1 = Ivy_ObjNextFanoutPlace(pFanin, pFanout);
00208     ppPlaceN = Ivy_ObjPrevNextFanoutPlace(pFanin, pFanout);
00209     assert( *ppPlaceN == pFanout );
00210     if ( ppPlaceN )
00211         *ppPlaceN = *ppPlace1;
00212 
00213     ppPlace2 = Ivy_ObjPrevFanoutPlace(pFanin, pFanout);
00214     ppPlaceN = Ivy_ObjNextPrevFanoutPlace(pFanin, pFanout);
00215     assert( ppPlaceN == NULL || *ppPlaceN == pFanout );
00216     if ( ppPlaceN )
00217         *ppPlaceN = *ppPlace2;
00218 
00219     *ppPlace1 = NULL;
00220     *ppPlace2 = NULL;
00221 }

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 296 of file ivyFanout.c.

00297 {
00298     Ivy_Obj_t * pFanout;
00299     int Counter = 0;
00300     Ivy_ObjForEachFanoutInt( pObj, pFanout )
00301         Counter++;
00302     return Counter;
00303 }

static Ivy_Obj_t* Ivy_ObjNextFanout ( Ivy_Obj_t pObj,
Ivy_Obj_t pFanout 
) [inline, static]

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

] DECLARATIONS ///

Definition at line 28 of file ivyFanout.c.

00029 {
00030     assert( !Ivy_IsComplement(pObj) );
00031     assert( !Ivy_IsComplement(pFanout) );
00032     if ( pFanout == NULL )
00033         return NULL;
00034     if ( Ivy_ObjFanin0(pFanout) == pObj )
00035         return pFanout->pNextFan0;
00036     assert( Ivy_ObjFanin1(pFanout) == pObj );
00037     return pFanout->pNextFan1;
00038 }

static Ivy_Obj_t** Ivy_ObjNextFanoutPlace ( Ivy_Obj_t pObj,
Ivy_Obj_t pFanout 
) [inline, static]

Definition at line 54 of file ivyFanout.c.

00055 {
00056     assert( !Ivy_IsComplement(pObj) );
00057     assert( !Ivy_IsComplement(pFanout) );
00058     if ( Ivy_ObjFanin0(pFanout) == pObj )
00059         return &pFanout->pNextFan0;
00060     assert( Ivy_ObjFanin1(pFanout) == pObj );
00061     return &pFanout->pNextFan1;
00062 }

static Ivy_Obj_t** Ivy_ObjNextPrevFanoutPlace ( Ivy_Obj_t pObj,
Ivy_Obj_t pFanout 
) [inline, static]

Definition at line 91 of file ivyFanout.c.

00092 {
00093     Ivy_Obj_t * pTemp;
00094     assert( !Ivy_IsComplement(pObj) );
00095     assert( !Ivy_IsComplement(pFanout) );
00096     pTemp = Ivy_ObjNextFanout(pObj, pFanout);
00097     if ( pTemp == NULL )
00098         return NULL;
00099     if ( Ivy_ObjFanin0(pTemp) == pObj )
00100         return &pTemp->pPrevFan0;
00101     assert( Ivy_ObjFanin1(pTemp) == pObj );
00102     return &pTemp->pPrevFan1;
00103 }

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 234 of file ivyFanout.c.

00235 {
00236     Ivy_Obj_t ** ppPlace;
00237     ppPlace = Ivy_ObjPrevNextFanoutPlace(pFanin, pFanoutOld);
00238     assert( *ppPlace == pFanoutOld );
00239     if ( ppPlace )
00240         *ppPlace = pFanoutNew;
00241     ppPlace = Ivy_ObjNextPrevFanoutPlace(pFanin, pFanoutOld);
00242     assert( ppPlace == NULL || *ppPlace == pFanoutOld );
00243     if ( ppPlace )
00244         *ppPlace = pFanoutNew;
00245     // assuming that pFanoutNew already points to the next fanout
00246 }

static Ivy_Obj_t* Ivy_ObjPrevFanout ( Ivy_Obj_t pObj,
Ivy_Obj_t pFanout 
) [inline, static]

Definition at line 41 of file ivyFanout.c.

00042 {
00043     assert( !Ivy_IsComplement(pObj) );
00044     assert( !Ivy_IsComplement(pFanout) );
00045     if ( pFanout == NULL )
00046         return NULL;
00047     if ( Ivy_ObjFanin0(pFanout) == pObj )
00048         return pFanout->pPrevFan0;
00049     assert( Ivy_ObjFanin1(pFanout) == pObj );
00050     return pFanout->pPrevFan1;
00051 }

static Ivy_Obj_t** Ivy_ObjPrevFanoutPlace ( Ivy_Obj_t pObj,
Ivy_Obj_t pFanout 
) [inline, static]

Definition at line 65 of file ivyFanout.c.

00066 {
00067     assert( !Ivy_IsComplement(pObj) );
00068     assert( !Ivy_IsComplement(pFanout) );
00069     if ( Ivy_ObjFanin0(pFanout) == pObj )
00070         return &pFanout->pPrevFan0;
00071     assert( Ivy_ObjFanin1(pFanout) == pObj );
00072     return &pFanout->pPrevFan1;
00073 }

static Ivy_Obj_t** Ivy_ObjPrevNextFanoutPlace ( Ivy_Obj_t pObj,
Ivy_Obj_t pFanout 
) [inline, static]

Definition at line 76 of file ivyFanout.c.

00077 {
00078     Ivy_Obj_t * pTemp;
00079     assert( !Ivy_IsComplement(pObj) );
00080     assert( !Ivy_IsComplement(pFanout) );
00081     pTemp = Ivy_ObjPrevFanout(pObj, pFanout);
00082     if ( pTemp == NULL )
00083         return &pObj->pFanout;
00084     if ( Ivy_ObjFanin0(pTemp) == pObj )
00085         return &pTemp->pNextFan0;
00086     assert( Ivy_ObjFanin1(pTemp) == pObj );
00087     return &pTemp->pNextFan1;
00088 }

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 280 of file ivyFanout.c.

00281 {
00282     return pObj->pFanout;
00283 }


Generated on Tue Jan 5 12:18:24 2010 for abc70930 by  doxygen 1.6.1