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

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START void Nwk_ManStrashNode_rec (Aig_Man_t *p, Hop_Obj_t *pObj)
 DECLARATIONS ///. More...
 
Aig_Obj_tNwk_ManStrashNode (Aig_Man_t *p, Nwk_Obj_t *pObj)
 
Aig_Man_tNwk_ManStrash (Nwk_Man_t *pNtk)
 

Function Documentation

Aig_Man_t* Nwk_ManStrash ( Nwk_Man_t pNtk)

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

Synopsis [Derives AIG from the logic network.]

Description [Assumes topological ordering of nodes.]

SideEffects []

SeeAlso []

Definition at line 99 of file nwkStrash.c.

100 {
101  Vec_Ptr_t * vObjs;
102  Aig_Man_t * pMan;
103  Aig_Obj_t * pObjNew;
104  Nwk_Obj_t * pObj;
105  int i, Level;
106  pMan = Aig_ManStart( Nwk_ManGetAigNodeNum(pNtk) );
107  pMan->pName = Abc_UtilStrsav( pNtk->pName );
108  pMan->pSpec = Abc_UtilStrsav( pNtk->pSpec );
109  pMan->pManTime = Tim_ManDup( (Tim_Man_t *)pNtk->pManTime, 1 );
110  Tim_ManIncrementTravId( (Tim_Man_t *)pMan->pManTime );
111  Nwk_ManForEachObj( pNtk, pObj, i )
112  pObj->pCopy = NULL;
113 // Nwk_ManForEachObj( pNtk, pObj, i )
114  vObjs = Nwk_ManDfs( pNtk );
115  Vec_PtrForEachEntry( Nwk_Obj_t *, vObjs, pObj, i )
116  {
117  if ( Nwk_ObjIsCi(pObj) )
118  {
119  pObjNew = Aig_ObjCreateCi(pMan);
120  Level = Tim_ManGetCiArrival( (Tim_Man_t *)pMan->pManTime, pObj->PioId );
121  Aig_ObjSetLevel( pObjNew, Level );
122  }
123  else if ( Nwk_ObjIsCo(pObj) )
124  {
125  pObjNew = Aig_ObjCreateCo( pMan, Aig_NotCond((Aig_Obj_t *)Nwk_ObjFanin0(pObj)->pCopy, pObj->fInvert) );
126  Level = Aig_ObjLevel( pObjNew );
127  Tim_ManSetCoArrival( (Tim_Man_t *)pMan->pManTime, pObj->PioId, (float)Level );
128  }
129  else if ( Nwk_ObjIsNode(pObj) )
130  {
131  pObjNew = Nwk_ManStrashNode( pMan, pObj );
132  }
133  else
134  assert( 0 );
135  pObj->pCopy = pObjNew;
136  }
137  Vec_PtrFree( vObjs );
138  Aig_ManCleanup( pMan );
139  Aig_ManSetRegNum( pMan, 0 );
140  return pMan;
141 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
static int Aig_ObjSetLevel(Aig_Obj_t *pObj, int i)
Definition: aig.h:325
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 Tim_ManIncrementTravId(Tim_Man_t *p)
DECLARATIONS ///.
Definition: timTrav.c:44
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
char * pSpec
Definition: nwk.h:65
Aig_Obj_t * Nwk_ManStrashNode(Aig_Man_t *p, Nwk_Obj_t *pObj)
Definition: nwkStrash.c:68
void Tim_ManSetCoArrival(Tim_Man_t *p, int iCo, float Delay)
Definition: timTime.c:116
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
char * pName
Definition: nwk.h:64
ABC_DLL int Nwk_ManGetAigNodeNum(Nwk_Man_t *pNtk)
Definition: nwkUtil.c:155
ABC_DLL Vec_Ptr_t * Nwk_ManDfs(Nwk_Man_t *pNtk)
Definition: nwkDfs.c:321
static int Nwk_ObjIsCo(Nwk_Obj_t *p)
Definition: nwk.h:147
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
Definition: timMan.c:86
Definition: aig.h:69
Tim_Man_t * pManTime
Definition: nwk.h:74
static int Nwk_ObjIsNode(Nwk_Obj_t *p)
Definition: nwk.h:148
#define Nwk_ManForEachObj(p, pObj, i)
Definition: nwk.h:189
static int Aig_ObjLevel(Aig_Obj_t *pObj)
Definition: aig.h:323
static Nwk_Obj_t * Nwk_ObjFanin0(Nwk_Obj_t *p)
Definition: nwk.h:140
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
float Tim_ManGetCiArrival(Tim_Man_t *p, int iCi)
Definition: timTime.c:174
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Aig_Obj_t* Nwk_ManStrashNode ( Aig_Man_t p,
Nwk_Obj_t pObj 
)

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

Synopsis [Derives AIG from the local functions of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 68 of file nwkStrash.c.

69 {
70  Hop_Man_t * pMan = pObj->pMan->pManHop;
71  Hop_Obj_t * pRoot = pObj->pFunc;
72  Nwk_Obj_t * pFanin;
73  int i;
74  assert( Nwk_ObjIsNode(pObj) );
75  // check the constant case
76  if ( Hop_Regular(pRoot) == Hop_ManConst1(pMan) )
77  return Aig_NotCond( Aig_ManConst1(p), Hop_IsComplement(pRoot) );
78  // set elementary variables
79  Nwk_ObjForEachFanin( pObj, pFanin, i )
80  Hop_IthVar(pMan, i)->pData = pFanin->pCopy;
81  // strash the AIG of this node
84  // return the final node
85  return Aig_NotCond( (Aig_Obj_t *)Hop_Regular(pRoot)->pData, Hop_IsComplement(pRoot) );
86 }
static Hop_Obj_t * Hop_ManConst1(Hop_Man_t *p)
Definition: hop.h:132
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
Definition: hop.h:65
void Hop_ConeUnmark_rec(Hop_Obj_t *pObj)
Definition: hopDfs.c:257
ABC_NAMESPACE_IMPL_START void Nwk_ManStrashNode_rec(Aig_Man_t *p, Hop_Obj_t *pObj)
DECLARATIONS ///.
Definition: nwkStrash.c:45
static int Hop_IsComplement(Hop_Obj_t *p)
Definition: hop.h:129
Definition: aig.h:69
static int Nwk_ObjIsNode(Nwk_Obj_t *p)
Definition: nwk.h:148
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
#define Nwk_ObjForEachFanin(pObj, pFanin, i)
Definition: nwk.h:199
#define assert(ex)
Definition: util_old.h:213
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
static Hop_Obj_t * Hop_Regular(Hop_Obj_t *p)
Definition: hop.h:126
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
Hop_Obj_t * Hop_IthVar(Hop_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
Definition: hopOper.c:63
ABC_NAMESPACE_IMPL_START void Nwk_ManStrashNode_rec ( Aig_Man_t p,
Hop_Obj_t pObj 
)

DECLARATIONS ///.

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

FileName [nwkStrash.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Logic network representation.]

Synopsis [Performs structural hashing for the network.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Derives AIG from the local functions of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file nwkStrash.c.

46 {
47  assert( !Hop_IsComplement(pObj) );
48  if ( !Hop_ObjIsNode(pObj) || Hop_ObjIsMarkA(pObj) )
49  return;
52  pObj->pData = Aig_And( p, (Aig_Obj_t *)Hop_ObjChild0Copy(pObj), (Aig_Obj_t *)Hop_ObjChild1Copy(pObj) );
53  assert( !Hop_ObjIsMarkA(pObj) ); // loop detection
54  Hop_ObjSetMarkA( pObj );
55 }
static Hop_Obj_t * Hop_ObjFanin1(Hop_Obj_t *pObj)
Definition: hop.h:183
static int Hop_ObjIsMarkA(Hop_Obj_t *pObj)
Definition: hop.h:164
static void Hop_ObjSetMarkA(Hop_Obj_t *pObj)
Definition: hop.h:165
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Hop_ObjIsNode(Hop_Obj_t *pObj)
Definition: hop.h:160
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
ABC_NAMESPACE_IMPL_START void Nwk_ManStrashNode_rec(Aig_Man_t *p, Hop_Obj_t *pObj)
DECLARATIONS ///.
Definition: nwkStrash.c:45
static Hop_Obj_t * Hop_ObjChild1Copy(Hop_Obj_t *pObj)
Definition: hop.h:187
static int Hop_IsComplement(Hop_Obj_t *p)
Definition: hop.h:129
static Hop_Obj_t * Hop_ObjChild0Copy(Hop_Obj_t *pObj)
Definition: hop.h:186
Definition: aig.h:69
void * pData
Definition: hop.h:68
static Hop_Obj_t * Hop_ObjFanin0(Hop_Obj_t *pObj)
Definition: hop.h:182
#define assert(ex)
Definition: util_old.h:213