abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
nwkObj.c File Reference
#include "nwk.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START
Nwk_Obj_t
Nwk_ManCreateObj (Nwk_Man_t *p, int nFanins, int nFanouts)
 DECLARATIONS ///. More...
 
Nwk_Obj_tNwk_ManCreateCi (Nwk_Man_t *p, int nFanouts)
 
Nwk_Obj_tNwk_ManCreateCo (Nwk_Man_t *p)
 
Nwk_Obj_tNwk_ManCreateLatch (Nwk_Man_t *p)
 
Nwk_Obj_tNwk_ManCreateNode (Nwk_Man_t *p, int nFanins, int nFanouts)
 
void Nwk_ManDeleteNode (Nwk_Obj_t *pObj)
 
void Nwk_ManDeleteNode_rec (Nwk_Obj_t *pObj)
 

Function Documentation

Nwk_Obj_t* Nwk_ManCreateCi ( Nwk_Man_t p,
int  nFanouts 
)

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

Synopsis [Creates a primary input.]

Description []

SideEffects []

SeeAlso []

Definition at line 70 of file nwkObj.c.

71 {
72  Nwk_Obj_t * pObj;
73  pObj = Nwk_ManCreateObj( p, 1, nFanouts );
74  pObj->PioId = Vec_PtrSize( p->vCis );
75  Vec_PtrPush( p->vCis, pObj );
76  pObj->Type = NWK_OBJ_CI;
77  p->nObjs[NWK_OBJ_CI]++;
78  return pObj;
79 }
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
ABC_NAMESPACE_IMPL_START Nwk_Obj_t * Nwk_ManCreateObj(Nwk_Man_t *p, int nFanins, int nFanouts)
DECLARATIONS ///.
Definition: nwkObj.c:45
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Vec_Ptr_t * vCis
Definition: nwk.h:67
Definition: nwk.h:54
int nObjs[NWK_OBJ_VOID]
Definition: nwk.h:70
Nwk_Obj_t* Nwk_ManCreateCo ( Nwk_Man_t p)

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

Synopsis [Creates a primary output.]

Description []

SideEffects []

SeeAlso []

Definition at line 92 of file nwkObj.c.

93 {
94  Nwk_Obj_t * pObj;
95  pObj = Nwk_ManCreateObj( p, 1, 1 );
96  pObj->PioId = Vec_PtrSize( p->vCos );
97  Vec_PtrPush( p->vCos, pObj );
98  pObj->Type = NWK_OBJ_CO;
99  p->nObjs[NWK_OBJ_CO]++;
100  return pObj;
101 }
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
ABC_NAMESPACE_IMPL_START Nwk_Obj_t * Nwk_ManCreateObj(Nwk_Man_t *p, int nFanins, int nFanouts)
DECLARATIONS ///.
Definition: nwkObj.c:45
Vec_Ptr_t * vCos
Definition: nwk.h:68
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int nObjs[NWK_OBJ_VOID]
Definition: nwk.h:70
Definition: nwk.h:55
Nwk_Obj_t* Nwk_ManCreateLatch ( Nwk_Man_t p)

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

Synopsis [Creates a latch.]

Description []

SideEffects []

SeeAlso []

Definition at line 114 of file nwkObj.c.

115 {
116  Nwk_Obj_t * pObj;
117  pObj = Nwk_ManCreateObj( p, 1, 1 );
118  pObj->Type = NWK_OBJ_LATCH;
119  p->nObjs[NWK_OBJ_LATCH]++;
120  return pObj;
121 }
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
ABC_NAMESPACE_IMPL_START Nwk_Obj_t * Nwk_ManCreateObj(Nwk_Man_t *p, int nFanins, int nFanouts)
DECLARATIONS ///.
Definition: nwkObj.c:45
int nObjs[NWK_OBJ_VOID]
Definition: nwk.h:70
Nwk_Obj_t* Nwk_ManCreateNode ( Nwk_Man_t p,
int  nFanins,
int  nFanouts 
)

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

Synopsis [Creates a node.]

Description []

SideEffects []

SeeAlso []

Definition at line 134 of file nwkObj.c.

135 {
136  Nwk_Obj_t * pObj;
137  pObj = Nwk_ManCreateObj( p, nFanins, nFanouts );
138  pObj->Type = NWK_OBJ_NODE;
139  p->nObjs[NWK_OBJ_NODE]++;
140  return pObj;
141 }
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
ABC_NAMESPACE_IMPL_START Nwk_Obj_t * Nwk_ManCreateObj(Nwk_Man_t *p, int nFanins, int nFanouts)
DECLARATIONS ///.
Definition: nwkObj.c:45
int nObjs[NWK_OBJ_VOID]
Definition: nwk.h:70
ABC_NAMESPACE_IMPL_START Nwk_Obj_t* Nwk_ManCreateObj ( Nwk_Man_t p,
int  nFanins,
int  nFanouts 
)

DECLARATIONS ///.

CFile****************************************************************

FileName [nwkObj.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Logic network representation.]

Synopsis [Manipulation of objects.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
nwkObj.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Creates an object.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file nwkObj.c.

46 {
47  Nwk_Obj_t * pObj;
48  pObj = (Nwk_Obj_t *)Aig_MmFlexEntryFetch( p->pMemObjs, sizeof(Nwk_Obj_t) + (nFanins + nFanouts + p->nFanioPlus) * sizeof(Nwk_Obj_t *) );
49  memset( pObj, 0, sizeof(Nwk_Obj_t) );
50  pObj->pFanio = (Nwk_Obj_t **)((char *)pObj + sizeof(Nwk_Obj_t));
51  pObj->Id = Vec_PtrSize( p->vObjs );
52  Vec_PtrPush( p->vObjs, pObj );
53  pObj->pMan = p;
54  pObj->nFanioAlloc = nFanins + nFanouts + p->nFanioPlus;
55  return pObj;
56 }
char * memset()
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
static Llb_Mgr_t * p
Definition: llb3Image.c:950
char * Aig_MmFlexEntryFetch(Aig_MmFlex_t *p, int nBytes)
Definition: aigMem.c:366
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
Aig_MmFlex_t * pMemObjs
Definition: nwk.h:76
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Vec_Ptr_t * vObjs
Definition: nwk.h:69
int nFanioPlus
Definition: nwk.h:71
void Nwk_ManDeleteNode ( Nwk_Obj_t pObj)

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

Synopsis [Deletes the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 155 of file nwkObj.c.

156 {
157  Vec_Ptr_t * vNodes = pObj->pMan->vTemp;
158  Nwk_Obj_t * pTemp;
159  int i;
160  assert( Nwk_ObjFanoutNum(pObj) == 0 );
161  // delete fanins
162  Nwk_ObjCollectFanins( pObj, vNodes );
163  Vec_PtrForEachEntry( Nwk_Obj_t *, vNodes, pTemp, i )
164  Nwk_ObjDeleteFanin( pObj, pTemp );
165  // remove from the list of objects
166  Vec_PtrWriteEntry( pObj->pMan->vObjs, pObj->Id, NULL );
167  pObj->pMan->nObjs[pObj->Type]--;
168  memset( pObj, 0, sizeof(Nwk_Obj_t) );
169  pObj->Id = -1;
170 }
char * memset()
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Nwk_ObjFanoutNum(Nwk_Obj_t *p)
Definition: nwk.h:138
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
ABC_DLL void Nwk_ObjCollectFanins(Nwk_Obj_t *pNode, Vec_Ptr_t *vNodes)
DECLARATIONS ///.
Definition: nwkFanio.c:45
ABC_DLL void Nwk_ObjDeleteFanin(Nwk_Obj_t *pObj, Nwk_Obj_t *pFanin)
Definition: nwkFanio.c:192
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Nwk_ManDeleteNode_rec ( Nwk_Obj_t pObj)

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

Synopsis [Deletes the node and MFFC of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 183 of file nwkObj.c.

184 {
185  Vec_Ptr_t * vNodes;
186  int i;
187  assert( !Nwk_ObjIsCi(pObj) );
188  assert( Nwk_ObjFanoutNum(pObj) == 0 );
189  vNodes = Vec_PtrAlloc( 100 );
190  Nwk_ObjCollectFanins( pObj, vNodes );
191  Nwk_ManDeleteNode( pObj );
192  Vec_PtrForEachEntry( Nwk_Obj_t *, vNodes, pObj, i )
193  if ( Nwk_ObjIsNode(pObj) && Nwk_ObjFanoutNum(pObj) == 0 )
194  Nwk_ManDeleteNode_rec( pObj );
195  Vec_PtrFree( vNodes );
196 }
static int Nwk_ObjIsCi(Nwk_Obj_t *p)
Definition: nwk.h:146
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Nwk_ManDeleteNode(Nwk_Obj_t *pObj)
Definition: nwkObj.c:155
static int Nwk_ObjFanoutNum(Nwk_Obj_t *p)
Definition: nwk.h:138
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
void Nwk_ManDeleteNode_rec(Nwk_Obj_t *pObj)
Definition: nwkObj.c:183
if(last==0)
Definition: sparse_int.h:34
static int Nwk_ObjIsNode(Nwk_Obj_t *p)
Definition: nwk.h:148
ABC_DLL void Nwk_ObjCollectFanins(Nwk_Obj_t *pNode, Vec_Ptr_t *vNodes)
DECLARATIONS ///.
Definition: nwkFanio.c:45
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223