#include "hop.h"
Go to the source code of this file.
Functions | |
Hop_Obj_t * | Hop_ObjCreatePi (Hop_Man_t *p) |
Hop_Obj_t * | Hop_ObjCreatePo (Hop_Man_t *p, Hop_Obj_t *pDriver) |
Hop_Obj_t * | Hop_ObjCreate (Hop_Man_t *p, Hop_Obj_t *pGhost) |
void | Hop_ObjConnect (Hop_Man_t *p, Hop_Obj_t *pObj, Hop_Obj_t *pFan0, Hop_Obj_t *pFan1) |
void | Hop_ObjDisconnect (Hop_Man_t *p, Hop_Obj_t *pObj) |
void | Hop_ObjDelete (Hop_Man_t *p, Hop_Obj_t *pObj) |
void | Hop_ObjDelete_rec (Hop_Man_t *p, Hop_Obj_t *pObj) |
Hop_Obj_t * | Hop_ObjRepr (Hop_Obj_t *pObj) |
void | Hop_ObjCreateChoice (Hop_Obj_t *pOld, Hop_Obj_t *pNew) |
Function*************************************************************
Synopsis [Connect the object to the fanin.]
Description []
SideEffects []
SeeAlso []
Definition at line 121 of file hopObj.c.
00122 { 00123 assert( !Hop_IsComplement(pObj) ); 00124 assert( Hop_ObjIsNode(pObj) ); 00125 // add the first fanin 00126 pObj->pFanin0 = pFan0; 00127 pObj->pFanin1 = pFan1; 00128 // increment references of the fanins and add their fanouts 00129 if ( p->fRefCount ) 00130 { 00131 if ( pFan0 != NULL ) 00132 Hop_ObjRef( Hop_ObjFanin0(pObj) ); 00133 if ( pFan1 != NULL ) 00134 Hop_ObjRef( Hop_ObjFanin1(pObj) ); 00135 } 00136 else 00137 pObj->nRefs = Hop_ObjLevelNew( pObj ); 00138 // set the phase 00139 pObj->fPhase = Hop_ObjFaninPhase(pFan0) & Hop_ObjFaninPhase(pFan1); 00140 // add the node to the structural hash table 00141 Hop_TableInsert( p, pObj ); 00142 }
Function*************************************************************
Synopsis [Create the new node assuming it does not exist.]
Description []
SideEffects []
SeeAlso []
Definition at line 93 of file hopObj.c.
00094 { 00095 Hop_Obj_t * pObj; 00096 assert( !Hop_IsComplement(pGhost) ); 00097 assert( Hop_ObjIsNode(pGhost) ); 00098 assert( pGhost == &p->Ghost ); 00099 // get memory for the new object 00100 pObj = Hop_ManFetchMemory( p ); 00101 pObj->Type = pGhost->Type; 00102 // add connections 00103 Hop_ObjConnect( p, pObj, pGhost->pFanin0, pGhost->pFanin1 ); 00104 // update node counters of the manager 00105 p->nObjs[Hop_ObjType(pObj)]++; 00106 assert( pObj->pData == NULL ); 00107 return pObj; 00108 }
Function*************************************************************
Synopsis [Sets an equivalence relation between the nodes.]
Description [Makes the representative of pNew point to the representaive of pOld.]
SideEffects []
SeeAlso []
Definition at line 256 of file hopObj.c.
00257 { 00258 Hop_Obj_t * pOldRepr; 00259 Hop_Obj_t * pNewRepr; 00260 assert( pOld != NULL && pNew != NULL ); 00261 pOldRepr = Hop_ObjRepr(pOld); 00262 pNewRepr = Hop_ObjRepr(pNew); 00263 if ( pNewRepr != pOldRepr ) 00264 pNewRepr->pData = pOldRepr; 00265 }
CFile****************************************************************
FileName [hopObj.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Minimalistic And-Inverter Graph package.]
Synopsis [Adding/removing objects.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - May 11, 2006.]
Revision [
] DECLARATIONS /// FUNCTION DEFINITIONS ///Function*************************************************************
Synopsis [Creates primary input.]
Description []
SideEffects []
SeeAlso []
Definition at line 42 of file hopObj.c.
00043 { 00044 Hop_Obj_t * pObj; 00045 pObj = Hop_ManFetchMemory( p ); 00046 pObj->Type = AIG_PI; 00047 Vec_PtrPush( p->vPis, pObj ); 00048 p->nObjs[AIG_PI]++; 00049 return pObj; 00050 }
Function*************************************************************
Synopsis [Creates primary output with the given driver.]
Description []
SideEffects []
SeeAlso []
Definition at line 63 of file hopObj.c.
00064 { 00065 Hop_Obj_t * pObj; 00066 pObj = Hop_ManFetchMemory( p ); 00067 pObj->Type = AIG_PO; 00068 Vec_PtrPush( p->vPos, pObj ); 00069 // add connections 00070 pObj->pFanin0 = pDriver; 00071 if ( p->fRefCount ) 00072 Hop_ObjRef( Hop_Regular(pDriver) ); 00073 else 00074 pObj->nRefs = Hop_ObjLevel( Hop_Regular(pDriver) ); 00075 // set the phase 00076 pObj->fPhase = Hop_ObjFaninPhase(pDriver); 00077 // update node counters of the manager 00078 p->nObjs[AIG_PO]++; 00079 return pObj; 00080 }
Function*************************************************************
Synopsis [Deletes the node.]
Description []
SideEffects []
SeeAlso []
Definition at line 182 of file hopObj.c.
00183 { 00184 assert( !Hop_IsComplement(pObj) ); 00185 assert( !Hop_ObjIsTerm(pObj) ); 00186 assert( Hop_ObjRefs(pObj) == 0 ); 00187 // update node counters of the manager 00188 p->nObjs[pObj->Type]--; 00189 p->nDeleted++; 00190 // remove connections 00191 Hop_ObjDisconnect( p, pObj ); 00192 // remove PIs/POs from the arrays 00193 if ( Hop_ObjIsPi(pObj) ) 00194 Vec_PtrRemove( p->vPis, pObj ); 00195 // free the node 00196 Hop_ManRecycleMemory( p, pObj ); 00197 }
Function*************************************************************
Synopsis [Deletes the MFFC of the node.]
Description []
SideEffects []
SeeAlso []
Definition at line 210 of file hopObj.c.
00211 { 00212 Hop_Obj_t * pFanin0, * pFanin1; 00213 assert( !Hop_IsComplement(pObj) ); 00214 if ( Hop_ObjIsConst1(pObj) || Hop_ObjIsPi(pObj) ) 00215 return; 00216 assert( Hop_ObjIsNode(pObj) ); 00217 pFanin0 = Hop_ObjFanin0(pObj); 00218 pFanin1 = Hop_ObjFanin1(pObj); 00219 Hop_ObjDelete( p, pObj ); 00220 if ( pFanin0 && !Hop_ObjIsNone(pFanin0) && Hop_ObjRefs(pFanin0) == 0 ) 00221 Hop_ObjDelete_rec( p, pFanin0 ); 00222 if ( pFanin1 && !Hop_ObjIsNone(pFanin1) && Hop_ObjRefs(pFanin1) == 0 ) 00223 Hop_ObjDelete_rec( p, pFanin1 ); 00224 }
Function*************************************************************
Synopsis [Connect the object to the fanin.]
Description []
SideEffects []
SeeAlso []
Definition at line 155 of file hopObj.c.
00156 { 00157 assert( !Hop_IsComplement(pObj) ); 00158 assert( Hop_ObjIsNode(pObj) ); 00159 // remove connections 00160 if ( pObj->pFanin0 != NULL ) 00161 Hop_ObjDeref(Hop_ObjFanin0(pObj)); 00162 if ( pObj->pFanin1 != NULL ) 00163 Hop_ObjDeref(Hop_ObjFanin1(pObj)); 00164 // remove the node from the structural hash table 00165 Hop_TableDelete( p, pObj ); 00166 // add the first fanin 00167 pObj->pFanin0 = NULL; 00168 pObj->pFanin1 = NULL; 00169 }
Function*************************************************************
Synopsis [Returns the representative of the node.]
Description []
SideEffects []
SeeAlso []
Definition at line 237 of file hopObj.c.
00238 { 00239 assert( !Hop_IsComplement(pObj) ); 00240 if ( pObj->pData == NULL || pObj->pData == pObj ) 00241 return pObj; 00242 return Hop_ObjRepr( pObj->pData ); 00243 }