#include "abc.h"
Go to the source code of this file.
Functions | |
static void | Vec_IntPushMem (Extra_MmStep_t *pMemMan, Vec_Int_t *p, int Entry) |
void | Abc_ObjAddFanin (Abc_Obj_t *pObj, Abc_Obj_t *pFanin) |
void | Abc_ObjDeleteFanin (Abc_Obj_t *pObj, Abc_Obj_t *pFanin) |
void | Abc_ObjRemoveFanins (Abc_Obj_t *pObj) |
void | Abc_ObjPatchFanin (Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew) |
Abc_Obj_t * | Abc_ObjInsertBetween (Abc_Obj_t *pNodeIn, Abc_Obj_t *pNodeOut, Abc_ObjType_t Type) |
void | Abc_ObjTransferFanout (Abc_Obj_t *pNodeFrom, Abc_Obj_t *pNodeTo) |
void | Abc_ObjReplace (Abc_Obj_t *pNodeOld, Abc_Obj_t *pNodeNew) |
int | Abc_ObjFanoutFaninNum (Abc_Obj_t *pFanout, Abc_Obj_t *pFanin) |
Function*************************************************************
Synopsis [Creates fanout/fanin relationship between the nodes.]
Description []
SideEffects []
SeeAlso []
Definition at line 81 of file abcFanio.c.
00082 { 00083 Abc_Obj_t * pFaninR = Abc_ObjRegular(pFanin); 00084 assert( !Abc_ObjIsComplement(pObj) ); 00085 assert( pObj->pNtk == pFaninR->pNtk ); 00086 assert( pObj->Id >= 0 && pFaninR->Id >= 0 ); 00087 Vec_IntPushMem( pObj->pNtk->pMmStep, &pObj->vFanins, pFaninR->Id ); 00088 Vec_IntPushMem( pObj->pNtk->pMmStep, &pFaninR->vFanouts, pObj->Id ); 00089 if ( Abc_ObjIsComplement(pFanin) ) 00090 Abc_ObjSetFaninC( pObj, Abc_ObjFaninNum(pObj)-1 ); 00091 if ( Abc_ObjIsNet(pObj) && Abc_ObjFaninNum(pObj) > 1 ) 00092 { 00093 int x = 0; 00094 } 00095 // printf( "Adding fanin of %s ", Abc_ObjName(pObj) ); 00096 // printf( "to be %s\n", Abc_ObjName(pFanin) ); 00097 }
Function*************************************************************
Synopsis [Destroys fanout/fanin relationship between the nodes.]
Description []
SideEffects []
SeeAlso []
Definition at line 111 of file abcFanio.c.
00112 { 00113 assert( !Abc_ObjIsComplement(pObj) ); 00114 assert( !Abc_ObjIsComplement(pFanin) ); 00115 assert( pObj->pNtk == pFanin->pNtk ); 00116 assert( pObj->Id >= 0 && pFanin->Id >= 0 ); 00117 if ( !Vec_IntRemove( &pObj->vFanins, pFanin->Id ) ) 00118 { 00119 printf( "The obj %d is not found among the fanins of obj %d ...\n", pFanin->Id, pObj->Id ); 00120 return; 00121 } 00122 if ( !Vec_IntRemove( &pFanin->vFanouts, pObj->Id ) ) 00123 { 00124 printf( "The obj %d is not found among the fanouts of obj %d ...\n", pObj->Id, pFanin->Id ); 00125 return; 00126 } 00127 }
Function*************************************************************
Synopsis [Returns the index of the fanin in the fanin list of the fanout.]
Description []
SideEffects []
SeeAlso []
Definition at line 321 of file abcFanio.c.
00322 { 00323 Abc_Obj_t * pObj; 00324 int i; 00325 Abc_ObjForEachFanin( pFanout, pObj, i ) 00326 if ( pObj == pFanin ) 00327 return i; 00328 return -1; 00329 }
Abc_Obj_t* Abc_ObjInsertBetween | ( | Abc_Obj_t * | pNodeIn, | |
Abc_Obj_t * | pNodeOut, | |||
Abc_ObjType_t | Type | |||
) |
Function*************************************************************
Synopsis [Inserts one-input node of the type specified between the nodes.]
Description []
SideEffects []
SeeAlso []
Definition at line 223 of file abcFanio.c.
00224 { 00225 Abc_Obj_t * pNodeNew; 00226 int iFanoutIndex, iFaninIndex; 00227 // find pNodeOut among the fanouts of pNodeIn 00228 if ( (iFanoutIndex = Vec_IntFind( &pNodeIn->vFanouts, pNodeOut->Id )) == -1 ) 00229 { 00230 printf( "Node %s is not among", Abc_ObjName(pNodeOut) ); 00231 printf( " the fanouts of node %s...\n", Abc_ObjName(pNodeIn) ); 00232 return NULL; 00233 } 00234 // find pNodeIn among the fanins of pNodeOut 00235 if ( (iFaninIndex = Vec_IntFind( &pNodeOut->vFanins, pNodeIn->Id )) == -1 ) 00236 { 00237 printf( "Node %s is not among", Abc_ObjName(pNodeIn) ); 00238 printf( " the fanins of node %s...\n", Abc_ObjName(pNodeOut) ); 00239 return NULL; 00240 } 00241 // create the new node 00242 pNodeNew = Abc_NtkCreateObj( pNodeIn->pNtk, Type ); 00243 // add pNodeIn as fanin and pNodeOut as fanout 00244 Vec_IntPushMem( pNodeNew->pNtk->pMmStep, &pNodeNew->vFanins, pNodeIn->Id ); 00245 Vec_IntPushMem( pNodeNew->pNtk->pMmStep, &pNodeNew->vFanouts, pNodeOut->Id ); 00246 // update the fanout of pNodeIn 00247 Vec_IntWriteEntry( &pNodeIn->vFanouts, iFanoutIndex, pNodeNew->Id ); 00248 // update the fanin of pNodeOut 00249 Vec_IntWriteEntry( &pNodeOut->vFanins, iFaninIndex, pNodeNew->Id ); 00250 return pNodeNew; 00251 }
Function*************************************************************
Synopsis [Replaces a fanin of the node.]
Description [The node is pObj. An old fanin of this node (pFaninOld) has to be replaced by a new fanin (pFaninNew). Assumes that the node and the old fanin are not complemented. The new fanin can be complemented. In this case, the polarity of the new fanin will change, compared to the polarity of the old fanin.]
SideEffects []
SeeAlso []
Definition at line 172 of file abcFanio.c.
00173 { 00174 Abc_Obj_t * pFaninNewR = Abc_ObjRegular(pFaninNew); 00175 int iFanin;//, nLats;//, fCompl; 00176 assert( !Abc_ObjIsComplement(pObj) ); 00177 assert( !Abc_ObjIsComplement(pFaninOld) ); 00178 assert( pFaninOld != pFaninNewR ); 00179 // assert( pObj != pFaninOld ); 00180 // assert( pObj != pFaninNewR ); 00181 assert( pObj->pNtk == pFaninOld->pNtk ); 00182 assert( pObj->pNtk == pFaninNewR->pNtk ); 00183 if ( (iFanin = Vec_IntFind( &pObj->vFanins, pFaninOld->Id )) == -1 ) 00184 { 00185 printf( "Node %s is not among", Abc_ObjName(pFaninOld) ); 00186 printf( " the fanins of node %s...\n", Abc_ObjName(pObj) ); 00187 return; 00188 } 00189 00190 // remember the attributes of the old fanin 00191 // fCompl = Abc_ObjFaninC(pObj, iFanin); 00192 // replace the old fanin entry by the new fanin entry (removes attributes) 00193 Vec_IntWriteEntry( &pObj->vFanins, iFanin, pFaninNewR->Id ); 00194 // set the attributes of the new fanin 00195 // if ( fCompl ^ Abc_ObjIsComplement(pFaninNew) ) 00196 // Abc_ObjSetFaninC( pObj, iFanin ); 00197 if ( Abc_ObjIsComplement(pFaninNew) ) 00198 Abc_ObjXorFaninC( pObj, iFanin ); 00199 00200 // if ( Abc_NtkIsSeq(pObj->pNtk) && (nLats = Seq_ObjFaninL(pObj, iFanin)) ) 00201 // Seq_ObjSetFaninL( pObj, iFanin, nLats ); 00202 // update the fanout of the fanin 00203 if ( !Vec_IntRemove( &pFaninOld->vFanouts, pObj->Id ) ) 00204 { 00205 printf( "Node %s is not among", Abc_ObjName(pObj) ); 00206 printf( " the fanouts of its old fanin %s...\n", Abc_ObjName(pFaninOld) ); 00207 // return; 00208 } 00209 Vec_IntPushMem( pObj->pNtk->pMmStep, &pFaninNewR->vFanouts, pObj->Id ); 00210 }
void Abc_ObjRemoveFanins | ( | Abc_Obj_t * | pObj | ) |
Function*************************************************************
Synopsis [Destroys fanout/fanin relationship between the nodes.]
Description []
SideEffects []
SeeAlso []
Definition at line 141 of file abcFanio.c.
00142 { 00143 Vec_Int_t * vFaninsOld; 00144 Abc_Obj_t * pFanin; 00145 int k; 00146 // remove old fanins 00147 vFaninsOld = &pObj->vFanins; 00148 for ( k = vFaninsOld->nSize - 1; k >= 0; k-- ) 00149 { 00150 pFanin = Abc_NtkObj( pObj->pNtk, vFaninsOld->pArray[k] ); 00151 Abc_ObjDeleteFanin( pObj, pFanin ); 00152 } 00153 pObj->fCompl0 = 0; 00154 pObj->fCompl1 = 0; 00155 assert( vFaninsOld->nSize == 0 ); 00156 }
Function*************************************************************
Synopsis [Replaces the node by a new node.]
Description []
SideEffects []
SeeAlso []
Definition at line 297 of file abcFanio.c.
00298 { 00299 assert( !Abc_ObjIsComplement(pNodeOld) ); 00300 assert( !Abc_ObjIsComplement(pNodeNew) ); 00301 assert( pNodeOld->pNtk == pNodeNew->pNtk ); 00302 assert( pNodeOld != pNodeNew ); 00303 assert( Abc_ObjFanoutNum(pNodeOld) > 0 ); 00304 // transfer the fanouts to the old node 00305 Abc_ObjTransferFanout( pNodeOld, pNodeNew ); 00306 // remove the old node 00307 Abc_NtkDeleteObj_rec( pNodeOld, 1 ); 00308 }
Function*************************************************************
Synopsis [Transfers fanout from the old node to the new node.]
Description []
SideEffects []
SeeAlso []
Definition at line 264 of file abcFanio.c.
00265 { 00266 Vec_Ptr_t * vFanouts; 00267 int nFanoutsOld, i; 00268 assert( !Abc_ObjIsComplement(pNodeFrom) ); 00269 assert( !Abc_ObjIsComplement(pNodeTo) ); 00270 assert( !Abc_ObjIsPo(pNodeFrom) && !Abc_ObjIsPo(pNodeTo) ); 00271 assert( pNodeFrom->pNtk == pNodeTo->pNtk ); 00272 assert( pNodeFrom != pNodeTo ); 00273 assert( Abc_ObjFanoutNum(pNodeFrom) > 0 ); 00274 // get the fanouts of the old node 00275 nFanoutsOld = Abc_ObjFanoutNum(pNodeTo); 00276 vFanouts = Vec_PtrAlloc( nFanoutsOld ); 00277 Abc_NodeCollectFanouts( pNodeFrom, vFanouts ); 00278 // patch the fanin of each of them 00279 for ( i = 0; i < vFanouts->nSize; i++ ) 00280 Abc_ObjPatchFanin( vFanouts->pArray[i], pNodeFrom, pNodeTo ); 00281 assert( Abc_ObjFanoutNum(pNodeFrom) == 0 ); 00282 assert( Abc_ObjFanoutNum(pNodeTo) == nFanoutsOld + vFanouts->nSize ); 00283 Vec_PtrFree( vFanouts ); 00284 }
static void Vec_IntPushMem | ( | Extra_MmStep_t * | pMemMan, | |
Vec_Int_t * | p, | |||
int | Entry | |||
) | [inline, static] |
CFile****************************************************************
FileName [abcFanio.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Network and node package.]
Synopsis [Various procedures to connect fanins/fanouts.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [
] DECLARATIONS /// FUNCTION DEFINITIONS ///Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 42 of file abcFanio.c.
00043 { 00044 if ( p->nSize == p->nCap ) 00045 { 00046 int * pArray; 00047 int i; 00048 00049 if ( p->nSize == 0 ) 00050 p->nCap = 1; 00051 if ( pMemMan ) 00052 pArray = (int *)Extra_MmStepEntryFetch( pMemMan, p->nCap * 8 ); 00053 else 00054 pArray = ALLOC( int, p->nCap * 2 ); 00055 if ( p->pArray ) 00056 { 00057 for ( i = 0; i < p->nSize; i++ ) 00058 pArray[i] = p->pArray[i]; 00059 if ( pMemMan ) 00060 Extra_MmStepEntryRecycle( pMemMan, (char *)p->pArray, p->nCap * 4 ); 00061 else 00062 free( p->pArray ); 00063 } 00064 p->nCap *= 2; 00065 p->pArray = pArray; 00066 } 00067 p->pArray[p->nSize++] = Entry; 00068 }