#include "aig.h"
Go to the source code of this file.
Functions | |
static int | Aig_FanoutCreate (int FanId, int Num) |
static int * | Aig_FanoutObj (int *pData, int ObjId) |
static int * | Aig_FanoutPrev (int *pData, int iFan) |
static int * | Aig_FanoutNext (int *pData, int iFan) |
void | Aig_ManFanoutStart (Aig_Man_t *p) |
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) |
static int Aig_FanoutCreate | ( | int | FanId, | |
int | Num | |||
) | [inline, static] |
CFile****************************************************************
FileName [aigFanout.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [AIG package.]
Synopsis [Fanout manipulation.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - April 28, 2007.]
Revision [
] DECLARATIONS ///
Definition at line 33 of file aigFanout.c.
00033 { assert( Num < 2 ); return (FanId << 1) | Num; }
static int* Aig_FanoutNext | ( | int * | pData, | |
int | iFan | |||
) | [inline, static] |
Definition at line 36 of file aigFanout.c.
static int* Aig_FanoutObj | ( | int * | pData, | |
int | ObjId | |||
) | [inline, static] |
Definition at line 34 of file aigFanout.c.
static int* Aig_FanoutPrev | ( | int * | pData, | |
int | iFan | |||
) | [inline, static] |
Definition at line 35 of file aigFanout.c.
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 53 of file aigFanout.c.
00054 { 00055 Aig_Obj_t * pObj; 00056 int i; 00057 assert( Aig_ManBufNum(p) == 0 ); 00058 // allocate fanout datastructure 00059 assert( p->pFanData == NULL ); 00060 p->nFansAlloc = 2 * Aig_ManObjNumMax(p); 00061 if ( p->nFansAlloc < (1<<12) ) 00062 p->nFansAlloc = (1<<12); 00063 p->pFanData = ALLOC( int, 5 * p->nFansAlloc ); 00064 memset( p->pFanData, 0, sizeof(int) * 5 * p->nFansAlloc ); 00065 // add fanouts for all objects 00066 Aig_ManForEachObj( p, pObj, i ) 00067 { 00068 if ( Aig_ObjChild0(pObj) ) 00069 Aig_ObjAddFanout( p, Aig_ObjFanin0(pObj), pObj ); 00070 if ( Aig_ObjChild1(pObj) ) 00071 Aig_ObjAddFanout( p, Aig_ObjFanin1(pObj), pObj ); 00072 } 00073 }
void Aig_ManFanoutStop | ( | Aig_Man_t * | p | ) |
Function*************************************************************
Synopsis [Deletes fanout for all objects in the manager.]
Description []
SideEffects []
SeeAlso []
Definition at line 86 of file aigFanout.c.
Function*************************************************************
Synopsis [Adds fanout (pFanout) of node (pObj).]
Description []
SideEffects []
SeeAlso []
Definition at line 104 of file aigFanout.c.
00105 { 00106 int iFan, * pFirst, * pPrevC, * pNextC, * pPrev, * pNext; 00107 assert( p->pFanData ); 00108 assert( !Aig_IsComplement(pObj) && !Aig_IsComplement(pFanout) ); 00109 assert( pFanout->Id > 0 ); 00110 if ( pObj->Id >= p->nFansAlloc || pFanout->Id >= p->nFansAlloc ) 00111 { 00112 int nFansAlloc = 2 * AIG_MAX( pObj->Id, pFanout->Id ); 00113 p->pFanData = REALLOC( int, p->pFanData, 5 * nFansAlloc ); 00114 memset( p->pFanData + 5 * p->nFansAlloc, 0, sizeof(int) * 5 * (nFansAlloc - p->nFansAlloc) ); 00115 p->nFansAlloc = nFansAlloc; 00116 } 00117 assert( pObj->Id < p->nFansAlloc && pFanout->Id < p->nFansAlloc ); 00118 iFan = Aig_FanoutCreate( pFanout->Id, Aig_ObjWhatFanin(pFanout, pObj) ); 00119 pPrevC = Aig_FanoutPrev( p->pFanData, iFan ); 00120 pNextC = Aig_FanoutNext( p->pFanData, iFan ); 00121 pFirst = Aig_FanoutObj( p->pFanData, pObj->Id ); 00122 if ( *pFirst == 0 ) 00123 { 00124 *pFirst = iFan; 00125 *pPrevC = iFan; 00126 *pNextC = iFan; 00127 } 00128 else 00129 { 00130 pPrev = Aig_FanoutPrev( p->pFanData, *pFirst ); 00131 pNext = Aig_FanoutNext( p->pFanData, *pPrev ); 00132 assert( *pNext == *pFirst ); 00133 *pPrevC = *pPrev; 00134 *pNextC = *pFirst; 00135 *pPrev = iFan; 00136 *pNext = iFan; 00137 } 00138 }
Function*************************************************************
Synopsis [Removes fanout (pFanout) of node (pObj).]
Description []
SideEffects []
SeeAlso []
Definition at line 151 of file aigFanout.c.
00152 { 00153 int iFan, * pFirst, * pPrevC, * pNextC, * pPrev, * pNext; 00154 assert( p->pFanData && pObj->Id < p->nFansAlloc && pFanout->Id < p->nFansAlloc ); 00155 assert( !Aig_IsComplement(pObj) && !Aig_IsComplement(pFanout) ); 00156 assert( pFanout->Id > 0 ); 00157 iFan = Aig_FanoutCreate( pFanout->Id, Aig_ObjWhatFanin(pFanout, pObj) ); 00158 pPrevC = Aig_FanoutPrev( p->pFanData, iFan ); 00159 pNextC = Aig_FanoutNext( p->pFanData, iFan ); 00160 pPrev = Aig_FanoutPrev( p->pFanData, *pNextC ); 00161 pNext = Aig_FanoutNext( p->pFanData, *pPrevC ); 00162 assert( *pPrev == iFan ); 00163 assert( *pNext == iFan ); 00164 pFirst = Aig_FanoutObj( p->pFanData, pObj->Id ); 00165 assert( *pFirst > 0 ); 00166 if ( *pFirst == iFan ) 00167 { 00168 if ( *pNextC == iFan ) 00169 { 00170 *pFirst = 0; 00171 *pPrev = 0; 00172 *pNext = 0; 00173 *pPrevC = 0; 00174 *pNextC = 0; 00175 return; 00176 } 00177 *pFirst = *pNextC; 00178 } 00179 *pPrev = *pPrevC; 00180 *pNext = *pNextC; 00181 *pPrevC = 0; 00182 *pNextC = 0; 00183 }