ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
aigFanout.c File Reference
#include "aig.h"
Include dependency graph for aigFanout.c:

Go to the source code of this file.

Functions

void Aig_ManFanoutStart (Aig_Man_t *p)
 FUNCTION DEFINITIONS ///.
 
void Aig_ManFanoutStop (Aig_Man_t *p)
 
void Aig_ObjAddFanout (Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pFanout)
 
void Aig_ObjRemoveFanout (Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pFanout)
 

Function Documentation

◆ Aig_ManFanoutStart()

void Aig_ManFanoutStart ( Aig_Man_t * p)

FUNCTION DEFINITIONS ///.

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

Synopsis [Create fanout for all objects in the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 56 of file aigFanout.c.

57{
58 Aig_Obj_t * pObj;
59 int i;
60 assert( Aig_ManBufNum(p) == 0 );
61 // allocate fanout datastructure
62 assert( p->pFanData == NULL );
63 p->nFansAlloc = 2 * Aig_ManObjNumMax(p);
64 if ( p->nFansAlloc < (1<<12) )
65 p->nFansAlloc = (1<<12);
66 p->pFanData = ABC_ALLOC( int, 5 * p->nFansAlloc );
67 memset( p->pFanData, 0, sizeof(int) * 5 * p->nFansAlloc );
68 // add fanouts for all objects
69 Aig_ManForEachObj( p, pObj, i )
70 {
71 if ( Aig_ObjChild0(pObj) )
72 Aig_ObjAddFanout( p, Aig_ObjFanin0(pObj), pObj );
73 if ( Aig_ObjChild1(pObj) )
74 Aig_ObjAddFanout( p, Aig_ObjFanin1(pObj), pObj );
75 }
76}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
void Aig_ObjAddFanout(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pFanout)
Definition aigFanout.c:107
#define Aig_ManForEachObj(p, pObj, i)
Definition aig.h:403
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
Cube * p
Definition exorList.c:222
#define assert(ex)
Definition util_old.h:213
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Aig_ManFanoutStop()

void Aig_ManFanoutStop ( Aig_Man_t * p)

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

Synopsis [Deletes fanout for all objects in the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 89 of file aigFanout.c.

90{
91 assert( p->pFanData != NULL );
92 ABC_FREE( p->pFanData );
93 p->nFansAlloc = 0;
94}
#define ABC_FREE(obj)
Definition abc_global.h:267
Here is the caller graph for this function:

◆ Aig_ObjAddFanout()

void Aig_ObjAddFanout ( Aig_Man_t * p,
Aig_Obj_t * pObj,
Aig_Obj_t * pFanout )

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

Synopsis [Adds fanout (pFanout) of node (pObj).]

Description []

SideEffects []

SeeAlso []

Definition at line 107 of file aigFanout.c.

108{
109 int iFan, * pFirst, * pPrevC, * pNextC, * pPrev, * pNext;
110 assert( p->pFanData );
111 assert( !Aig_IsComplement(pObj) && !Aig_IsComplement(pFanout) );
112 assert( pFanout->Id > 0 );
113 if ( pObj->Id >= p->nFansAlloc || pFanout->Id >= p->nFansAlloc )
114 {
115 int nFansAlloc = 2 * Abc_MaxInt( pObj->Id, pFanout->Id );
116 p->pFanData = ABC_REALLOC( int, p->pFanData, 5 * nFansAlloc );
117 memset( p->pFanData + 5 * p->nFansAlloc, 0, sizeof(int) * 5 * (nFansAlloc - p->nFansAlloc) );
118 p->nFansAlloc = nFansAlloc;
119 }
120 assert( pObj->Id < p->nFansAlloc && pFanout->Id < p->nFansAlloc );
121 iFan = Aig_FanoutCreate( pFanout->Id, Aig_ObjWhatFanin(pFanout, pObj) );
122 pPrevC = Aig_FanoutPrev( p->pFanData, iFan );
123 pNextC = Aig_FanoutNext( p->pFanData, iFan );
124 pFirst = Aig_FanoutObj( p->pFanData, pObj->Id );
125 if ( *pFirst == 0 )
126 {
127 *pFirst = iFan;
128 *pPrevC = iFan;
129 *pNextC = iFan;
130 }
131 else
132 {
133 pPrev = Aig_FanoutPrev( p->pFanData, *pFirst );
134 pNext = Aig_FanoutNext( p->pFanData, *pPrev );
135 assert( *pNext == *pFirst );
136 *pPrevC = *pPrev;
137 *pNextC = *pFirst;
138 *pPrev = iFan;
139 *pNext = iFan;
140 }
141}
#define ABC_REALLOC(type, obj, num)
Definition abc_global.h:268
int Id
Definition aig.h:85
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Aig_ObjRemoveFanout()

void Aig_ObjRemoveFanout ( Aig_Man_t * p,
Aig_Obj_t * pObj,
Aig_Obj_t * pFanout )

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

Synopsis [Removes fanout (pFanout) of node (pObj).]

Description []

SideEffects []

SeeAlso []

Definition at line 154 of file aigFanout.c.

155{
156 int iFan, * pFirst, * pPrevC, * pNextC, * pPrev, * pNext;
157 assert( p->pFanData && pObj->Id < p->nFansAlloc && pFanout->Id < p->nFansAlloc );
158 assert( !Aig_IsComplement(pObj) && !Aig_IsComplement(pFanout) );
159 assert( pFanout->Id > 0 );
160 iFan = Aig_FanoutCreate( pFanout->Id, Aig_ObjWhatFanin(pFanout, pObj) );
161 pPrevC = Aig_FanoutPrev( p->pFanData, iFan );
162 pNextC = Aig_FanoutNext( p->pFanData, iFan );
163 pPrev = Aig_FanoutPrev( p->pFanData, *pNextC );
164 pNext = Aig_FanoutNext( p->pFanData, *pPrevC );
165 assert( *pPrev == iFan );
166 assert( *pNext == iFan );
167 pFirst = Aig_FanoutObj( p->pFanData, pObj->Id );
168 assert( *pFirst > 0 );
169 if ( *pFirst == iFan )
170 {
171 if ( *pNextC == iFan )
172 {
173 *pFirst = 0;
174 *pPrev = 0;
175 *pNext = 0;
176 *pPrevC = 0;
177 *pNextC = 0;
178 return;
179 }
180 *pFirst = *pNextC;
181 }
182 *pPrev = *pPrevC;
183 *pNext = *pNextC;
184 *pPrevC = 0;
185 *pNextC = 0;
186}
Here is the caller graph for this function: