abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
nwk.h File Reference
#include "aig/aig/aig.h"
#include "aig/hop/hop.h"
#include "misc/tim/tim.h"
#include "map/if/if.h"
#include "bool/bdc/bdc.h"
#include "proof/fra/fra.h"
#include "proof/ssw/ssw.h"
#include "ntlnwk.h"

Go to the source code of this file.

Data Structures

struct  Nwk_Man_t_
 
struct  Nwk_Obj_t_
 

Macros

#define Nwk_ManForEachCi(p, pObj, i)   Vec_PtrForEachEntry( Nwk_Obj_t *, p->vCis, pObj, i )
 ITERATORS ///. More...
 
#define Nwk_ManForEachCo(p, pObj, i)   Vec_PtrForEachEntry( Nwk_Obj_t *, p->vCos, pObj, i )
 
#define Nwk_ManForEachPi(p, pObj, i)
 
#define Nwk_ManForEachPo(p, pObj, i)
 
#define Nwk_ManForEachObj(p, pObj, i)
 
#define Nwk_ManForEachNode(p, pObj, i)
 
#define Nwk_ManForEachLatch(p, pObj, i)
 
#define Nwk_ObjForEachFanin(pObj, pFanin, i)   for ( i = 0; (i < (int)(pObj)->nFanins) && ((pFanin) = (pObj)->pFanio[i]); i++ )
 
#define Nwk_ObjForEachFanout(pObj, pFanout, i)   for ( i = 0; (i < (int)(pObj)->nFanouts) && ((pFanout) = (pObj)->pFanio[(pObj)->nFanins+i]); i++ )
 
#define Nwk_ManForEachPiSeq(p, pObj, i)   Vec_PtrForEachEntryStop( Nwk_Obj_t *, p->vCis, pObj, i, (p)->nTruePis )
 
#define Nwk_ManForEachPoSeq(p, pObj, i)   Vec_PtrForEachEntryStop( Nwk_Obj_t *, p->vCos, pObj, i, (p)->nTruePos )
 
#define Nwk_ManForEachLoSeq(p, pObj, i)   for ( i = 0; (i < (p)->nLatches) && (((pObj) = (Nwk_Obj_t *)Vec_PtrEntry(p->vCis, i+(p)->nTruePis)), 1); i++ )
 
#define Nwk_ManForEachLiSeq(p, pObj, i)   for ( i = 0; (i < (p)->nLatches) && (((pObj) = (Nwk_Obj_t *)Vec_PtrEntry(p->vCos, i+(p)->nTruePos)), 1); i++ )
 
#define Nwk_ManForEachLiLoSeq(p, pObjLi, pObjLo, i)
 

Typedefs

typedef
typedefABC_NAMESPACE_HEADER_START
struct Nwk_Obj_t_ 
Nwk_Obj_t
 INCLUDES ///. More...
 

Enumerations

enum  Nwk_Type_t {
  NWK_OBJ_NONE, NWK_OBJ_CI, NWK_OBJ_CO, NWK_OBJ_NODE,
  NWK_OBJ_LATCH, NWK_OBJ_VOID
}
 

Functions

static int Nwk_ManCiNum (Nwk_Man_t *p)
 MACRO DEFINITIONS ///. More...
 
static int Nwk_ManCoNum (Nwk_Man_t *p)
 
static int Nwk_ManNodeNum (Nwk_Man_t *p)
 
static int Nwk_ManLatchNum (Nwk_Man_t *p)
 
static int Nwk_ManObjNumMax (Nwk_Man_t *p)
 
static Nwk_Obj_tNwk_ManCi (Nwk_Man_t *p, int i)
 
static Nwk_Obj_tNwk_ManCo (Nwk_Man_t *p, int i)
 
static Nwk_Obj_tNwk_ManObj (Nwk_Man_t *p, int i)
 
static int Nwk_ObjId (Nwk_Obj_t *p)
 
static int Nwk_ObjPioNum (Nwk_Obj_t *p)
 
static int Nwk_ObjFaninNum (Nwk_Obj_t *p)
 
static int Nwk_ObjFanoutNum (Nwk_Obj_t *p)
 
static Nwk_Obj_tNwk_ObjFanin0 (Nwk_Obj_t *p)
 
static Nwk_Obj_tNwk_ObjFanout0 (Nwk_Obj_t *p)
 
static Nwk_Obj_tNwk_ObjFanin (Nwk_Obj_t *p, int i)
 
static Nwk_Obj_tNwk_ObjFanout (Nwk_Obj_t *p, int i)
 
static int Nwk_ObjIsNone (Nwk_Obj_t *p)
 
static int Nwk_ObjIsCi (Nwk_Obj_t *p)
 
static int Nwk_ObjIsCo (Nwk_Obj_t *p)
 
static int Nwk_ObjIsNode (Nwk_Obj_t *p)
 
static int Nwk_ObjIsLatch (Nwk_Obj_t *p)
 
static int Nwk_ObjIsPi (Nwk_Obj_t *p)
 
static int Nwk_ObjIsPo (Nwk_Obj_t *p)
 
static int Nwk_ObjIsLi (Nwk_Obj_t *p)
 
static int Nwk_ObjIsLo (Nwk_Obj_t *p)
 
static float Nwk_ObjArrival (Nwk_Obj_t *pObj)
 
static float Nwk_ObjRequired (Nwk_Obj_t *pObj)
 
static float Nwk_ObjSlack (Nwk_Obj_t *pObj)
 
static void Nwk_ObjSetArrival (Nwk_Obj_t *pObj, float Time)
 
static void Nwk_ObjSetRequired (Nwk_Obj_t *pObj, float Time)
 
static void Nwk_ObjSetSlack (Nwk_Obj_t *pObj, float Time)
 
static int Nwk_ObjLevel (Nwk_Obj_t *pObj)
 
static void Nwk_ObjSetLevel (Nwk_Obj_t *pObj, int Level)
 
static void Nwk_ObjSetTravId (Nwk_Obj_t *pObj, int TravId)
 
static void Nwk_ObjSetTravIdCurrent (Nwk_Obj_t *pObj)
 
static void Nwk_ObjSetTravIdPrevious (Nwk_Obj_t *pObj)
 
static int Nwk_ObjIsTravIdCurrent (Nwk_Obj_t *pObj)
 
static int Nwk_ObjIsTravIdPrevious (Nwk_Obj_t *pObj)
 
static int Nwk_ManTimeEqual (float f1, float f2, float Eps)
 
static int Nwk_ManTimeLess (float f1, float f2, float Eps)
 
static int Nwk_ManTimeMore (float f1, float f2, float Eps)
 
ABC_DLL Vec_Ptr_tNwk_ManDeriveRetimingCut (Aig_Man_t *p, int fForward, int fVerbose)
 FUNCTION DECLARATIONS ///. More...
 
ABC_DLL void Nwk_ManBidecResyn (Nwk_Man_t *pNtk, int fVerbose)
 
ABC_DLL Hop_Obj_tNwk_NodeIfNodeResyn (Bdc_Man_t *p, Hop_Man_t *pHop, Hop_Obj_t *pRoot, int nVars, Vec_Int_t *vTruth, unsigned *puCare, float dProb)
 FUNCTION DEFINITIONS ///. More...
 
ABC_DLL int Nwk_ManCheck (Nwk_Man_t *p)
 DECLARATIONS ///. More...
 
ABC_DLL int Nwk_ManVerifyTopoOrder (Nwk_Man_t *pNtk)
 DECLARATIONS ///. More...
 
ABC_DLL int Nwk_ManLevelBackup (Nwk_Man_t *pNtk)
 
ABC_DLL int Nwk_ManLevel (Nwk_Man_t *pNtk)
 
ABC_DLL int Nwk_ManLevelMax (Nwk_Man_t *pNtk)
 
ABC_DLL Vec_Vec_tNwk_ManLevelize (Nwk_Man_t *pNtk)
 
ABC_DLL Vec_Ptr_tNwk_ManDfs (Nwk_Man_t *pNtk)
 
ABC_DLL Vec_Ptr_tNwk_ManDfsNodes (Nwk_Man_t *pNtk, Nwk_Obj_t **ppNodes, int nNodes)
 
ABC_DLL Vec_Ptr_tNwk_ManDfsReverse (Nwk_Man_t *pNtk)
 
ABC_DLL Vec_Ptr_tNwk_ManSupportNodes (Nwk_Man_t *pNtk, Nwk_Obj_t **ppNodes, int nNodes)
 
ABC_DLL void Nwk_ManSupportSum (Nwk_Man_t *pNtk)
 
ABC_DLL int Nwk_ObjMffcLabel (Nwk_Obj_t *pNode)
 
ABC_DLL void Nwk_ObjCollectFanins (Nwk_Obj_t *pNode, Vec_Ptr_t *vNodes)
 DECLARATIONS ///. More...
 
ABC_DLL void Nwk_ObjCollectFanouts (Nwk_Obj_t *pNode, Vec_Ptr_t *vNodes)
 
ABC_DLL int Nwk_ObjFindFanin (Nwk_Obj_t *pObj, Nwk_Obj_t *pFanin)
 
ABC_DLL int Nwk_ObjFindFanout (Nwk_Obj_t *pObj, Nwk_Obj_t *pFanout)
 
ABC_DLL void Nwk_ObjAddFanin (Nwk_Obj_t *pObj, Nwk_Obj_t *pFanin)
 
ABC_DLL void Nwk_ObjDeleteFanin (Nwk_Obj_t *pObj, Nwk_Obj_t *pFanin)
 
ABC_DLL void Nwk_ObjPatchFanin (Nwk_Obj_t *pObj, Nwk_Obj_t *pFaninOld, Nwk_Obj_t *pFaninNew)
 
ABC_DLL void Nwk_ObjTransferFanout (Nwk_Obj_t *pNodeFrom, Nwk_Obj_t *pNodeTo)
 
ABC_DLL void Nwk_ObjReplace (Nwk_Obj_t *pNodeOld, Nwk_Obj_t *pNodeNew)
 
ABC_DLL Vec_Ptr_tNwk_ManRetimeCutForward (Nwk_Man_t *pMan, int nLatches, int fVerbose)
 
ABC_DLL Vec_Ptr_tNwk_ManRetimeCutBackward (Nwk_Man_t *pMan, int nLatches, int fVerbose)
 
ABC_DLL Nwk_Man_tNwk_ManAlloc ()
 DECLARATIONS ///. More...
 
ABC_DLL void Nwk_ManFree (Nwk_Man_t *p)
 
ABC_DLL float Nwl_ManComputeTotalSwitching (Nwk_Man_t *pNtk)
 
ABC_DLL void Nwk_ManPrintStats (Nwk_Man_t *p, If_LibLut_t *pLutLib, int fSaveBest, int fDumpResult, int fPower, Ntl_Man_t *pNtl)
 
ABC_DLL Nwk_Man_tNwk_MappingIf (Aig_Man_t *p, Tim_Man_t *pManTime, If_Par_t *pPars)
 
ABC_DLL Nwk_Obj_tNwk_ManCreateCi (Nwk_Man_t *pMan, int nFanouts)
 
ABC_DLL Nwk_Obj_tNwk_ManCreateCo (Nwk_Man_t *pMan)
 
ABC_DLL Nwk_Obj_tNwk_ManCreateNode (Nwk_Man_t *pMan, int nFanins, int nFanouts)
 
ABC_DLL Nwk_Obj_tNwk_ManCreateBox (Nwk_Man_t *pMan, int nFanins, int nFanouts)
 
ABC_DLL Nwk_Obj_tNwk_ManCreateLatch (Nwk_Man_t *pMan)
 
ABC_DLL void Nwk_ManDeleteNode (Nwk_Obj_t *pObj)
 
ABC_DLL void Nwk_ManDeleteNode_rec (Nwk_Obj_t *pObj)
 
ABC_DLL Aig_Man_tNwk_ManSpeedup (Nwk_Man_t *pNtk, int fUseLutLib, int Percentage, int Degree, int fVerbose, int fVeryVerbose)
 
ABC_DLL Aig_Man_tNwk_ManStrash (Nwk_Man_t *pNtk)
 
ABC_DLL int Nwk_ManVerifyTiming (Nwk_Man_t *pNtk)
 
ABC_DLL void Nwk_ManDelayTraceSortPins (Nwk_Obj_t *pNode, int *pPinPerm, float *pPinDelays)
 
ABC_DLL float Nwk_ManDelayTraceLut (Nwk_Man_t *pNtk)
 
ABC_DLL void Nwk_ManDelayTracePrint (Nwk_Man_t *pNtk)
 
ABC_DLL void Nwk_ManUpdate (Nwk_Obj_t *pObj, Nwk_Obj_t *pObjNew, Vec_Vec_t *vLevels)
 
ABC_DLL int Nwk_ManVerifyLevel (Nwk_Man_t *pNtk)
 
ABC_DLL void Nwk_ManIncrementTravId (Nwk_Man_t *pNtk)
 DECLARATIONS ///. More...
 
ABC_DLL int Nwk_ManGetFaninMax (Nwk_Man_t *pNtk)
 
ABC_DLL int Nwk_ManGetTotalFanins (Nwk_Man_t *pNtk)
 
ABC_DLL int Nwk_ManPiNum (Nwk_Man_t *pNtk)
 
ABC_DLL int Nwk_ManPoNum (Nwk_Man_t *pNtk)
 
ABC_DLL int Nwk_ManGetAigNodeNum (Nwk_Man_t *pNtk)
 
ABC_DLL int Nwk_NodeCompareLevelsIncrease (Nwk_Obj_t **pp1, Nwk_Obj_t **pp2)
 
ABC_DLL int Nwk_NodeCompareLevelsDecrease (Nwk_Obj_t **pp1, Nwk_Obj_t **pp2)
 
ABC_DLL void Nwk_ObjPrint (Nwk_Obj_t *pObj)
 
ABC_DLL void Nwk_ManDumpBlif (Nwk_Man_t *pNtk, char *pFileName, Vec_Ptr_t *vCiNames, Vec_Ptr_t *vCoNames)
 
ABC_DLL void Nwk_ManPrintFanioNew (Nwk_Man_t *pNtk)
 
ABC_DLL void Nwk_ManCleanMarks (Nwk_Man_t *pNtk)
 
ABC_DLL void Nwk_ManMinimumBase (Nwk_Man_t *pNtk, int fVerbose)
 
ABC_DLL void Nwk_ManRemoveDupFanins (Nwk_Man_t *pNtk, int fVerbose)
 

Macro Definition Documentation

#define Nwk_ManForEachCi (   p,
  pObj,
 
)    Vec_PtrForEachEntry( Nwk_Obj_t *, p->vCis, pObj, i )

ITERATORS ///.

Definition at line 179 of file nwk.h.

#define Nwk_ManForEachCo (   p,
  pObj,
 
)    Vec_PtrForEachEntry( Nwk_Obj_t *, p->vCos, pObj, i )

Definition at line 181 of file nwk.h.

#define Nwk_ManForEachLatch (   p,
  pObj,
 
)
Value:
for ( i = 0; (i < Vec_PtrSize(p->vObjs)) && (((pObj) = (Nwk_Obj_t *)Vec_PtrEntry(p->vObjs, i)), 1); i++ ) \
if ( (pObj) == NULL || !Nwk_ObjIsLatch(pObj) ) {} else
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
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Nwk_ObjIsLatch(Nwk_Obj_t *p)
Definition: nwk.h:149
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362

Definition at line 195 of file nwk.h.

#define Nwk_ManForEachLiLoSeq (   p,
  pObjLi,
  pObjLo,
 
)
Value:
for ( i = 0; (i < (p)->nLatches) && (((pObjLi) = Nwk_ManCo(p, i+(p)->nTruePos)), 1) \
&& (((pObjLo) = Nwk_ManCi(p, i+(p)->nTruePis)), 1); i++ )
static Nwk_Obj_t * Nwk_ManCo(Nwk_Man_t *p, int i)
Definition: nwk.h:132
static Nwk_Obj_t * Nwk_ManCi(Nwk_Man_t *p, int i)
Definition: nwk.h:131
static Llb_Mgr_t * p
Definition: llb3Image.c:950

Definition at line 213 of file nwk.h.

#define Nwk_ManForEachLiSeq (   p,
  pObj,
 
)    for ( i = 0; (i < (p)->nLatches) && (((pObj) = (Nwk_Obj_t *)Vec_PtrEntry(p->vCos, i+(p)->nTruePos)), 1); i++ )

Definition at line 211 of file nwk.h.

#define Nwk_ManForEachLoSeq (   p,
  pObj,
 
)    for ( i = 0; (i < (p)->nLatches) && (((pObj) = (Nwk_Obj_t *)Vec_PtrEntry(p->vCis, i+(p)->nTruePis)), 1); i++ )

Definition at line 209 of file nwk.h.

#define Nwk_ManForEachNode (   p,
  pObj,
 
)
Value:
for ( i = 0; (i < Vec_PtrSize(p->vObjs)) && (((pObj) = (Nwk_Obj_t *)Vec_PtrEntry(p->vObjs, i)), 1); i++ ) \
if ( (pObj) == NULL || !Nwk_ObjIsNode(pObj) ) {} else
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
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Nwk_ObjIsNode(Nwk_Obj_t *p)
Definition: nwk.h:148
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362

Definition at line 192 of file nwk.h.

#define Nwk_ManForEachObj (   p,
  pObj,
 
)
Value:
for ( i = 0; (i < Vec_PtrSize(p->vObjs)) && (((pObj) = (Nwk_Obj_t *)Vec_PtrEntry(p->vObjs, i)), 1); i++ ) \
if ( pObj == NULL ) {} else
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
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362

Definition at line 189 of file nwk.h.

#define Nwk_ManForEachPi (   p,
  pObj,
 
)
Value:
Vec_PtrForEachEntry( Nwk_Obj_t *, p->vCis, pObj, i ) \
if ( !Nwk_ObjIsPi(pObj) ) {} else
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
static int Nwk_ObjIsPi(Nwk_Obj_t *p)
Definition: nwk.h:150
if(last==0)
Definition: sparse_int.h:34
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55

Definition at line 183 of file nwk.h.

#define Nwk_ManForEachPiSeq (   p,
  pObj,
 
)    Vec_PtrForEachEntryStop( Nwk_Obj_t *, p->vCis, pObj, i, (p)->nTruePis )

Definition at line 205 of file nwk.h.

#define Nwk_ManForEachPo (   p,
  pObj,
 
)
Value:
Vec_PtrForEachEntry( Nwk_Obj_t *, p->vCos, pObj, i ) \
if ( !Nwk_ObjIsPo(pObj) ) {} else
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
if(last==0)
Definition: sparse_int.h:34
static int Nwk_ObjIsPo(Nwk_Obj_t *p)
Definition: nwk.h:151
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55

Definition at line 186 of file nwk.h.

#define Nwk_ManForEachPoSeq (   p,
  pObj,
 
)    Vec_PtrForEachEntryStop( Nwk_Obj_t *, p->vCos, pObj, i, (p)->nTruePos )

Definition at line 207 of file nwk.h.

#define Nwk_ObjForEachFanin (   pObj,
  pFanin,
 
)    for ( i = 0; (i < (int)(pObj)->nFanins) && ((pFanin) = (pObj)->pFanio[i]); i++ )

Definition at line 199 of file nwk.h.

#define Nwk_ObjForEachFanout (   pObj,
  pFanout,
 
)    for ( i = 0; (i < (int)(pObj)->nFanouts) && ((pFanout) = (pObj)->pFanio[(pObj)->nFanins+i]); i++ )

Definition at line 201 of file nwk.h.

Typedef Documentation

typedef typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t

INCLUDES ///.

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

FileName [nwk.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Logic network representation.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

Id:
nwk.h,v 1.1 2008/05/14 22:13:09 wudenni Exp

]PARAMETERS ///BASIC TYPES ///

Definition at line 49 of file nwk.h.

Enumeration Type Documentation

enum Nwk_Type_t
Enumerator
NWK_OBJ_NONE 
NWK_OBJ_CI 
NWK_OBJ_CO 
NWK_OBJ_NODE 
NWK_OBJ_LATCH 
NWK_OBJ_VOID 

Definition at line 52 of file nwk.h.

52  {
53  NWK_OBJ_NONE, // 0: non-existant object
54  NWK_OBJ_CI, // 1: combinational input
55  NWK_OBJ_CO, // 2: combinational output
56  NWK_OBJ_NODE, // 3: logic node
57  NWK_OBJ_LATCH, // 4: register
58  NWK_OBJ_VOID // 5: unused object
59 } Nwk_Type_t;
Definition: nwk.h:54
Definition: nwk.h:55
Nwk_Type_t
Definition: nwk.h:52

Function Documentation

ABC_DLL Nwk_Man_t* Nwk_ManAlloc ( )

DECLARATIONS ///.

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

FileName [nwkMan.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Logic network representation.]

Synopsis [Network manager.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

Id:
nwkMan.c,v 1.1 2008/10/10 14:09:30 mjarvin Exp

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

Synopsis [Allocates the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file nwkMan.c.

46 {
47  Nwk_Man_t * p;
48  p = ABC_ALLOC( Nwk_Man_t, 1 );
49  memset( p, 0, sizeof(Nwk_Man_t) );
50  p->vCis = Vec_PtrAlloc( 1000 );
51  p->vCos = Vec_PtrAlloc( 1000 );
52  p->vObjs = Vec_PtrAlloc( 1000 );
53  p->vTemp = Vec_PtrAlloc( 1000 );
54  p->nFanioPlus = 2;
56  p->pManHop = Hop_ManStart();
57  return p;
58 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Aig_MmFlex_t * pMemObjs
Definition: nwk.h:76
Vec_Ptr_t * vCos
Definition: nwk.h:68
Vec_Ptr_t * vCis
Definition: nwk.h:67
Hop_Man_t * pManHop
Definition: nwk.h:73
Definition: nwk.h:61
Hop_Man_t * Hop_ManStart()
DECLARATIONS ///.
Definition: hopMan.c:45
Vec_Ptr_t * vObjs
Definition: nwk.h:69
Vec_Ptr_t * vTemp
Definition: nwk.h:77
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Aig_MmFlex_t * Aig_MmFlexStart()
Definition: aigMem.c:305
int nFanioPlus
Definition: nwk.h:71
ABC_DLL void Nwk_ManBidecResyn ( Nwk_Man_t pNtk,
int  fVerbose 
)

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

Synopsis [Resynthesizes nodes using bi-decomposition.]

Description []

SideEffects []

SeeAlso []

Definition at line 129 of file nwkBidec.c.

130 {
131  Bdc_Par_t Pars = {0}, * pPars = &Pars;
132  Bdc_Man_t * p;
133  Nwk_Obj_t * pObj;
134  Vec_Int_t * vTruth;
135  int i, nGainTotal = 0, nNodes1, nNodes2;
136  abctime clk = Abc_Clock();
137  pPars->nVarsMax = Nwk_ManGetFaninMax( pNtk );
138  pPars->fVerbose = fVerbose;
139  if ( pPars->nVarsMax < 2 )
140  {
141  printf( "Resynthesis is not performed for networks whose nodes are less than 2 inputs.\n" );
142  return;
143  }
144  if ( pPars->nVarsMax > 15 )
145  {
146  if ( fVerbose )
147  printf( "Resynthesis is not performed for nodes with more than 15 inputs.\n" );
148  pPars->nVarsMax = 15;
149  }
150  vTruth = Vec_IntAlloc( 0 );
151  p = Bdc_ManAlloc( pPars );
152  Nwk_ManForEachNode( pNtk, pObj, i )
153  {
154  if ( Nwk_ObjFaninNum(pObj) > 15 )
155  continue;
156  nNodes1 = Hop_DagSize(pObj->pFunc);
157  pObj->pFunc = Nwk_NodeIfNodeResyn( p, pNtk->pManHop, pObj->pFunc, Nwk_ObjFaninNum(pObj), vTruth, NULL, -1.0 );
158  nNodes2 = Hop_DagSize(pObj->pFunc);
159  nGainTotal += nNodes1 - nNodes2;
160  }
161  Bdc_ManFree( p );
162  Vec_IntFree( vTruth );
163  if ( fVerbose )
164  {
165  printf( "Total gain in AIG nodes = %d. ", nGainTotal );
166  ABC_PRT( "Total runtime", Abc_Clock() - clk );
167  }
168 }
int Hop_DagSize(Hop_Obj_t *pObj)
Definition: hopDfs.c:279
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
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Bdc_Man_t * Bdc_ManAlloc(Bdc_Par_t *pPars)
MACRO DEFINITIONS ///.
Definition: bdcCore.c:68
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Nwk_ObjFaninNum(Nwk_Obj_t *p)
Definition: nwk.h:137
Hop_Man_t * pManHop
Definition: nwk.h:73
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
ABC_DLL int Nwk_ManGetFaninMax(Nwk_Man_t *pNtk)
Definition: nwkUtil.c:71
Definition: bdc.h:45
#define ABC_PRT(a, t)
Definition: abc_global.h:220
Hop_Obj_t * Nwk_NodeIfNodeResyn(Bdc_Man_t *p, Hop_Man_t *pHop, Hop_Obj_t *pRoot, int nVars, Vec_Int_t *vTruth, unsigned *puCare, float dProb)
FUNCTION DEFINITIONS ///.
Definition: nwkBidec.c:67
void Bdc_ManFree(Bdc_Man_t *p)
Definition: bdcCore.c:113
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
ABC_INT64_T abctime
Definition: abc_global.h:278
#define Nwk_ManForEachNode(p, pObj, i)
Definition: nwk.h:192
ABC_DLL int Nwk_ManCheck ( Nwk_Man_t p)

DECLARATIONS ///.

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

FileName [nwkCheck.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Logic network representation.]

Synopsis [Consistency checking procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Checking the logic network for consistency.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file nwkCheck.c.

46 {
47  Nwk_Obj_t * pObj, * pNext;
48  int i, k, m;
49  // check if the nodes have duplicated fanins
50  Nwk_ManForEachNode( p, pObj, i )
51  {
52  for ( k = 0; k < pObj->nFanins; k++ )
53  for ( m = k + 1; m < pObj->nFanins; m++ )
54  if ( pObj->pFanio[k] == pObj->pFanio[m] )
55  printf( "Node %d has duplicated fanin %d.\n", pObj->Id, pObj->pFanio[k]->Id );
56  }
57  // check if all nodes are in the correct fanin/fanout relationship
58  Nwk_ManForEachObj( p, pObj, i )
59  {
60  Nwk_ObjForEachFanin( pObj, pNext, k )
61  if ( Nwk_ObjFanoutNum(pNext) < 100 && Nwk_ObjFindFanout( pNext, pObj ) == -1 )
62  printf( "Nwk_ManCheck(): Object %d has fanin %d which does not have a corresponding fanout.\n", pObj->Id, pNext->Id );
63  Nwk_ObjForEachFanout( pObj, pNext, k )
64  if ( Nwk_ObjFindFanin( pNext, pObj ) == -1 )
65  printf( "Nwk_ManCheck(): Object %d has fanout %d which does not have a corresponding fanin.\n", pObj->Id, pNext->Id );
66  }
67  return 1;
68 }
ABC_DLL int Nwk_ObjFindFanout(Nwk_Obj_t *pObj, Nwk_Obj_t *pFanout)
Definition: nwkFanio.c:106
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
#define Nwk_ObjForEachFanout(pObj, pFanout, i)
Definition: nwk.h:201
ABC_DLL int Nwk_ObjFindFanin(Nwk_Obj_t *pObj, Nwk_Obj_t *pFanin)
Definition: nwkFanio.c:85
if(last==0)
Definition: sparse_int.h:34
ABC_NAMESPACE_IMPL_START int Nwk_ManCheck(Nwk_Man_t *p)
DECLARATIONS ///.
Definition: nwkCheck.c:45
#define Nwk_ObjForEachFanin(pObj, pFanin, i)
Definition: nwk.h:199
#define Nwk_ManForEachObj(p, pObj, i)
Definition: nwk.h:189
#define Nwk_ManForEachNode(p, pObj, i)
Definition: nwk.h:192
static Nwk_Obj_t* Nwk_ManCi ( Nwk_Man_t p,
int  i 
)
inlinestatic

Definition at line 131 of file nwk.h.

131 { return (Nwk_Obj_t *)Vec_PtrEntry( p->vCis, i ); }
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
Vec_Ptr_t * vCis
Definition: nwk.h:67
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Nwk_ManCiNum ( Nwk_Man_t p)
inlinestatic

MACRO DEFINITIONS ///.

INLINED FUNCTIONS ///

Definition at line 125 of file nwk.h.

125 { return p->nObjs[NWK_OBJ_CI]; }
Definition: nwk.h:54
int nObjs[NWK_OBJ_VOID]
Definition: nwk.h:70
ABC_DLL void Nwk_ManCleanMarks ( Nwk_Man_t pMan)

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

Synopsis [Cleans the temporary marks of the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 464 of file nwkUtil.c.

465 {
466  Nwk_Obj_t * pObj;
467  int i;
468  Nwk_ManForEachObj( pMan, pObj, i )
469  pObj->MarkA = pObj->MarkB = 0;
470 }
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
#define Nwk_ManForEachObj(p, pObj, i)
Definition: nwk.h:189
static Nwk_Obj_t* Nwk_ManCo ( Nwk_Man_t p,
int  i 
)
inlinestatic

Definition at line 132 of file nwk.h.

132 { return (Nwk_Obj_t *)Vec_PtrEntry( p->vCos, i ); }
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
Vec_Ptr_t * vCos
Definition: nwk.h:68
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Nwk_ManCoNum ( Nwk_Man_t p)
inlinestatic

Definition at line 126 of file nwk.h.

126 { return p->nObjs[NWK_OBJ_CO]; }
int nObjs[NWK_OBJ_VOID]
Definition: nwk.h:70
Definition: nwk.h:55
ABC_DLL Nwk_Obj_t* Nwk_ManCreateBox ( Nwk_Man_t pMan,
int  nFanins,
int  nFanouts 
)
ABC_DLL 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
ABC_DLL 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
ABC_DLL 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
ABC_DLL 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_DLL float Nwk_ManDelayTraceLut ( Nwk_Man_t pNtk)

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

Synopsis [Computes the delay trace of the given network.]

Description []

SideEffects []

SeeAlso []

Definition at line 326 of file nwkTiming.c.

327 {
328  Vec_Ptr_t * vObjs;
329  int fUseSorting = 1;
330  If_LibLut_t * pLutLib = pNtk->pLutLib;
331  Vec_Ptr_t * vNodes;
332  Nwk_Obj_t * pObj;
333  float tArrival, tRequired, tSlack;
334  int i;
335 
336  // get the library
337  if ( pLutLib && pLutLib->LutMax < Nwk_ManGetFaninMax(pNtk) )
338  {
339  printf( "The max LUT size (%d) is less than the max fanin count (%d).\n",
340  pLutLib->LutMax, Nwk_ManGetFaninMax(pNtk) );
341  return -TIM_ETERNITY;
342  }
343 
344  // compute the reverse order of all objects
345  vNodes = Nwk_ManDfsReverse( pNtk );
346 
347  // initialize the arrival times
348  Nwk_ManCleanTiming( pNtk );
349 
350  // propagate arrival times
351  if ( pNtk->pManTime )
353 // Nwk_ManForEachObj( pNtk, pObj, i )
354  vObjs = Nwk_ManDfs( pNtk );
355  Vec_PtrForEachEntry( Nwk_Obj_t *, vObjs, pObj, i )
356  {
357  tArrival = Nwk_NodeComputeArrival( pObj, fUseSorting );
358  if ( Nwk_ObjIsCi(pObj) && pNtk->pManTime )
359  tArrival = Tim_ManGetCiArrival( pNtk->pManTime, pObj->PioId );
360  if ( Nwk_ObjIsCo(pObj) && pNtk->pManTime )
361  Tim_ManSetCoArrival( pNtk->pManTime, pObj->PioId, tArrival );
362  Nwk_ObjSetArrival( pObj, tArrival );
363  }
364  Vec_PtrFree( vObjs );
365 
366  // get the latest arrival times
367  tArrival = -TIM_ETERNITY;
368  Nwk_ManForEachPo( pNtk, pObj, i )
369  if ( tArrival < Nwk_ObjArrival(pObj) )
370  tArrival = Nwk_ObjArrival(pObj);
371 
372  // initialize the required times
373  if ( pNtk->pManTime )
374  {
376  Tim_ManInitPoRequiredAll( pNtk->pManTime, tArrival );
377  }
378  else
379  {
380  Nwk_ManForEachCo( pNtk, pObj, i )
381  Nwk_ObjSetRequired( pObj, tArrival );
382  }
383 
384  // propagate the required times
385  Vec_PtrForEachEntry( Nwk_Obj_t *, vNodes, pObj, i )
386  {
387  if ( Nwk_ObjIsNode(pObj) )
388  {
389  Nwk_NodePropagateRequired( pObj, fUseSorting );
390  }
391  else if ( Nwk_ObjIsCi(pObj) )
392  {
393  if ( pNtk->pManTime )
394  Tim_ManSetCiRequired( pNtk->pManTime, pObj->PioId, Nwk_ObjRequired(pObj) );
395  }
396  else if ( Nwk_ObjIsCo(pObj) )
397  {
398  if ( pNtk->pManTime )
399  {
400  tRequired = Tim_ManGetCoRequired( pNtk->pManTime, pObj->PioId );
401  Nwk_ObjSetRequired( pObj, tRequired );
402  }
403  if ( Nwk_ObjRequired(Nwk_ObjFanin0(pObj)) > Nwk_ObjRequired(pObj) )
405  }
406 
407  // set slack for this object
408  tSlack = Nwk_ObjRequired(pObj) - Nwk_ObjArrival(pObj);
409  assert( tSlack + 0.01 > 0.0 );
410  Nwk_ObjSetSlack( pObj, tSlack < 0.0 ? 0.0 : tSlack );
411  }
412  Vec_PtrFree( vNodes );
413  return tArrival;
414 }
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
#define Nwk_ManForEachCo(p, pObj, i)
Definition: nwk.h:181
void Tim_ManIncrementTravId(Tim_Man_t *p)
DECLARATIONS ///.
Definition: timTrav.c:44
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
ABC_DLL Vec_Ptr_t * Nwk_ManDfsReverse(Nwk_Man_t *pNtk)
Definition: nwkDfs.c:451
static void Nwk_ObjSetSlack(Nwk_Obj_t *pObj, float Time)
Definition: nwk.h:160
void Tim_ManSetCoArrival(Tim_Man_t *p, int iCo, float Delay)
Definition: timTime.c:116
int LutMax
Definition: if.h:173
float Nwk_NodePropagateRequired(Nwk_Obj_t *pObj, int fUseSorting)
Definition: nwkTiming.c:264
float Nwk_NodeComputeArrival(Nwk_Obj_t *pObj, int fUseSorting)
Definition: nwkTiming.c:131
void Tim_ManSetCiRequired(Tim_Man_t *p, int iCi, float Delay)
Definition: timTime.c:135
ABC_NAMESPACE_IMPL_START void Nwk_ManCleanTiming(Nwk_Man_t *pNtk)
DECLARATIONS ///.
Definition: nwkTiming.c:45
static float Nwk_ObjArrival(Nwk_Obj_t *pObj)
Definition: nwk.h: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
If_LibLut_t * pLutLib
Definition: nwk.h:75
if(last==0)
Definition: sparse_int.h:34
#define Nwk_ManForEachPo(p, pObj, i)
Definition: nwk.h:186
Tim_Man_t * pManTime
Definition: nwk.h:74
static int Nwk_ObjIsNode(Nwk_Obj_t *p)
Definition: nwk.h:148
ABC_DLL int Nwk_ManGetFaninMax(Nwk_Man_t *pNtk)
Definition: nwkUtil.c:71
static void Nwk_ObjSetArrival(Nwk_Obj_t *pObj, float Time)
Definition: nwk.h:158
#define TIM_ETERNITY
MACRO DEFINITIONS ///.
Definition: tim.h:98
static Nwk_Obj_t * Nwk_ObjFanin0(Nwk_Obj_t *p)
Definition: nwk.h:140
float Tim_ManGetCoRequired(Tim_Man_t *p, int iCo)
Definition: timTime.c:222
#define assert(ex)
Definition: util_old.h:213
static float Nwk_ObjRequired(Nwk_Obj_t *pObj)
Definition: nwk.h:156
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
float Tim_ManGetCiArrival(Tim_Man_t *p, int iCi)
Definition: timTime.c:174
static void Nwk_ObjSetRequired(Nwk_Obj_t *pObj, float Time)
Definition: nwk.h:159
void Tim_ManInitPoRequiredAll(Tim_Man_t *p, float Delay)
Definition: timTime.c:97
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL void Nwk_ManDelayTracePrint ( Nwk_Man_t pNtk)

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

Synopsis [Prints the delay trace for the given network.]

Description []

SideEffects []

SeeAlso []

Definition at line 459 of file nwkTiming.c.

460 {
461  If_LibLut_t * pLutLib = pNtk->pLutLib;
462  Nwk_Obj_t * pNode;
463  int i, Nodes, * pCounters;
464  float tArrival, tDelta, nSteps, Num;
465  // get the library
466  if ( pLutLib && pLutLib->LutMax < Nwk_ManGetFaninMax(pNtk) )
467  {
468  printf( "The max LUT size (%d) is less than the max fanin count (%d).\n",
469  pLutLib->LutMax, Nwk_ManGetFaninMax(pNtk) );
470  return;
471  }
472  // decide how many steps
473  nSteps = pLutLib ? 20 : Nwk_ManLevelMax(pNtk);
474  pCounters = ABC_ALLOC( int, nSteps + 1 );
475  memset( pCounters, 0, sizeof(int)*(nSteps + 1) );
476  // perform delay trace
477  tArrival = Nwk_ManDelayTraceLut( pNtk );
478  tDelta = tArrival / nSteps;
479  // count how many nodes have slack in the corresponding intervals
480  Nwk_ManForEachNode( pNtk, pNode, i )
481  {
482  if ( Nwk_ObjFaninNum(pNode) == 0 )
483  continue;
484  Num = Nwk_ObjSlack(pNode) / tDelta;
485  if ( Num > nSteps )
486  continue;
487  assert( Num >=0 && Num <= nSteps );
488  pCounters[(int)Num]++;
489  }
490  // print the results
491  printf( "Max delay = %6.2f. Delay trace using %s model:\n", tArrival, pLutLib? "LUT library" : "unit-delay" );
492  Nodes = 0;
493  for ( i = 0; i < nSteps; i++ )
494  {
495  Nodes += pCounters[i];
496  printf( "%3d %s : %5d (%6.2f %%)\n", pLutLib? 5*(i+1) : i+1,
497  pLutLib? "%":"lev", Nodes, 100.0*Nodes/Nwk_ManNodeNum(pNtk) );
498  }
499  ABC_FREE( pCounters );
500 }
char * memset()
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
static float Nwk_ObjSlack(Nwk_Obj_t *pObj)
Definition: nwk.h:157
int LutMax
Definition: if.h:173
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
ABC_DLL int Nwk_ManLevelMax(Nwk_Man_t *pNtk)
Definition: nwkDfs.c:248
static int Nwk_ObjFaninNum(Nwk_Obj_t *p)
Definition: nwk.h:137
If_LibLut_t * pLutLib
Definition: nwk.h:75
ABC_DLL int Nwk_ManGetFaninMax(Nwk_Man_t *pNtk)
Definition: nwkUtil.c:71
#define ABC_FREE(obj)
Definition: abc_global.h:232
static int Nwk_ManNodeNum(Nwk_Man_t *p)
Definition: nwk.h:127
#define assert(ex)
Definition: util_old.h:213
float Nwk_ManDelayTraceLut(Nwk_Man_t *pNtk)
Definition: nwkTiming.c:326
#define Nwk_ManForEachNode(p, pObj, i)
Definition: nwk.h:192
ABC_DLL void Nwk_ManDelayTraceSortPins ( Nwk_Obj_t pNode,
int *  pPinPerm,
float *  pPinDelays 
)

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

Synopsis [Sorts the pins in the decreasing order of delays.]

Description []

SideEffects []

SeeAlso []

Definition at line 67 of file nwkTiming.c.

68 {
69  Nwk_Obj_t * pFanin;
70  int i, j, best_i, temp;
71  // start the trivial permutation and collect pin delays
72  Nwk_ObjForEachFanin( pNode, pFanin, i )
73  {
74  pPinPerm[i] = i;
75  pPinDelays[i] = Nwk_ObjArrival(pFanin);
76  }
77  // selection sort the pins in the decreasible order of delays
78  // this order will match the increasing order of LUT input pins
79  for ( i = 0; i < Nwk_ObjFaninNum(pNode)-1; i++ )
80  {
81  best_i = i;
82  for ( j = i+1; j < Nwk_ObjFaninNum(pNode); j++ )
83  if ( pPinDelays[pPinPerm[j]] > pPinDelays[pPinPerm[best_i]] )
84  best_i = j;
85  if ( best_i == i )
86  continue;
87  temp = pPinPerm[i];
88  pPinPerm[i] = pPinPerm[best_i];
89  pPinPerm[best_i] = temp;
90  }
91  // verify
92  assert( Nwk_ObjFaninNum(pNode) == 0 || pPinPerm[0] < Nwk_ObjFaninNum(pNode) );
93  for ( i = 1; i < Nwk_ObjFaninNum(pNode); i++ )
94  {
95  assert( pPinPerm[i] < Nwk_ObjFaninNum(pNode) );
96  assert( pPinDelays[pPinPerm[i-1]] >= pPinDelays[pPinPerm[i]] );
97  }
98 }
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
static int Nwk_ObjFaninNum(Nwk_Obj_t *p)
Definition: nwk.h:137
static float Nwk_ObjArrival(Nwk_Obj_t *pObj)
Definition: nwk.h:155
#define Nwk_ObjForEachFanin(pObj, pFanin, i)
Definition: nwk.h:199
#define assert(ex)
Definition: util_old.h:213
ABC_DLL 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
ABC_DLL 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
ABC_DLL Vec_Ptr_t* Nwk_ManDeriveRetimingCut ( Aig_Man_t p,
int  fForward,
int  fVerbose 
)

FUNCTION DECLARATIONS ///.

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

Synopsis [Converts AIG into the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 85 of file nwkAig.c.

86 {
87  Vec_Ptr_t * vNodes;
88  Nwk_Man_t * pNtk;
89  Nwk_Obj_t * pNode;
90  Aig_Obj_t * pObj;
91  int i;
92  pNtk = Nwk_ManDeriveFromAig( p );
93  if ( fForward )
94  vNodes = Nwk_ManRetimeCutForward( pNtk, Aig_ManRegNum(p), fVerbose );
95  else
96  vNodes = Nwk_ManRetimeCutBackward( pNtk, Aig_ManRegNum(p), fVerbose );
97  Aig_ManForEachObj( p, pObj, i )
98  ((Nwk_Obj_t *)pObj->pData)->pCopy = pObj;
99  Vec_PtrForEachEntry( Nwk_Obj_t *, vNodes, pNode, i )
100  Vec_PtrWriteEntry( vNodes, i, pNode->pCopy );
101  Nwk_ManFree( pNtk );
102 // assert( Vec_PtrSize(vNodes) <= Aig_ManRegNum(p) );
103  return vNodes;
104 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_DLL Vec_Ptr_t * Nwk_ManRetimeCutForward(Nwk_Man_t *pMan, int nLatches, int fVerbose)
Definition: nwkFlow.c:442
ABC_DLL void Nwk_ManFree(Nwk_Man_t *p)
Definition: nwkMan.c:71
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
ABC_NAMESPACE_IMPL_START Nwk_Man_t * Nwk_ManDeriveFromAig(Aig_Man_t *p)
DECLARATIONS ///.
Definition: nwkAig.c:45
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
ABC_DLL Vec_Ptr_t * Nwk_ManRetimeCutBackward(Nwk_Man_t *pMan, int nLatches, int fVerbose)
Definition: nwkFlow.c:523
Definition: nwk.h:61
Definition: aig.h:69
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_DLL Vec_Ptr_t* Nwk_ManDfs ( Nwk_Man_t pNtk)

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

Synopsis [Returns the DFS ordered array of all objects except latches.]

Description []

SideEffects []

SeeAlso []

Definition at line 321 of file nwkDfs.c.

322 {
323  Vec_Ptr_t * vNodes;
324  Nwk_Obj_t * pObj;
325  int i;
326  Nwk_ManIncrementTravId( pNtk );
327  vNodes = Vec_PtrAlloc( 100 );
328  Nwk_ManForEachObj( pNtk, pObj, i )
329  {
330  if ( Nwk_ObjIsCi(pObj) )
331  {
332  Nwk_ObjSetTravIdCurrent( pObj );
333  Vec_PtrPush( vNodes, pObj );
334  }
335  else if ( Nwk_ObjIsCo(pObj) )
336  Nwk_ManDfs_rec( pObj, vNodes );
337  }
338  return vNodes;
339 }
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
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
static void Nwk_ObjSetTravIdCurrent(Nwk_Obj_t *pObj)
Definition: nwk.h:166
static int Nwk_ObjIsCo(Nwk_Obj_t *p)
Definition: nwk.h:147
void Nwk_ManDfs_rec(Nwk_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: nwkDfs.c:298
ABC_DLL void Nwk_ManIncrementTravId(Nwk_Man_t *pNtk)
DECLARATIONS ///.
Definition: nwkUtil.c:47
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define Nwk_ManForEachObj(p, pObj, i)
Definition: nwk.h:189
ABC_DLL Vec_Ptr_t* Nwk_ManDfsNodes ( Nwk_Man_t pNtk,
Nwk_Obj_t **  ppNodes,
int  nNodes 
)

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

Synopsis [Returns the set of internal nodes rooted in the given nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 378 of file nwkDfs.c.

379 {
380  Vec_Ptr_t * vNodes;
381  int i;
382  // set the traversal ID
383  Nwk_ManIncrementTravId( pNtk );
384  // start the array of nodes
385  vNodes = Vec_PtrAlloc( 100 );
386  // go through the PO nodes and call for each of them
387  for ( i = 0; i < nNodes; i++ )
388  if ( Nwk_ObjIsCo(ppNodes[i]) )
389  Nwk_ManDfsNodes_rec( Nwk_ObjFanin0(ppNodes[i]), vNodes );
390  else
391  Nwk_ManDfsNodes_rec( ppNodes[i], vNodes );
392  return vNodes;
393 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Nwk_ManDfsNodes_rec(Nwk_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: nwkDfs.c:352
static int Nwk_ObjIsCo(Nwk_Obj_t *p)
Definition: nwk.h:147
ABC_DLL void Nwk_ManIncrementTravId(Nwk_Man_t *pNtk)
DECLARATIONS ///.
Definition: nwkUtil.c:47
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static Nwk_Obj_t * Nwk_ObjFanin0(Nwk_Obj_t *p)
Definition: nwk.h:140
ABC_DLL Vec_Ptr_t* Nwk_ManDfsReverse ( Nwk_Man_t pNtk)

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

Synopsis [Returns the DFS ordered array of all objects except latches.]

Description []

SideEffects []

SeeAlso []

Definition at line 451 of file nwkDfs.c.

452 {
453  Vec_Ptr_t * vNodes;
454  Nwk_Obj_t * pObj;
455  int i;
456  Nwk_ManIncrementTravId( pNtk );
457  vNodes = Vec_PtrAlloc( 100 );
458  Nwk_ManForEachPi( pNtk, pObj, i )
459  Nwk_ManDfsReverse_rec( pObj, vNodes );
460  // add nodes without fanins
461  Nwk_ManForEachNode( pNtk, pObj, i )
462  if ( Nwk_ObjFaninNum(pObj) == 0 && !Nwk_ObjIsTravIdCurrent(pObj) )
463  Vec_PtrPush( vNodes, pObj );
464  return vNodes;
465 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
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
#define Nwk_ManForEachPi(p, pObj, i)
Definition: nwk.h:183
static int Nwk_ObjFaninNum(Nwk_Obj_t *p)
Definition: nwk.h:137
static int Nwk_ObjIsTravIdCurrent(Nwk_Obj_t *pObj)
Definition: nwk.h:168
if(last==0)
Definition: sparse_int.h:34
ABC_DLL void Nwk_ManIncrementTravId(Nwk_Man_t *pNtk)
DECLARATIONS ///.
Definition: nwkUtil.c:47
void Nwk_ManDfsReverse_rec(Nwk_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: nwkDfs.c:406
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define Nwk_ManForEachNode(p, pObj, i)
Definition: nwk.h:192
ABC_DLL void Nwk_ManDumpBlif ( Nwk_Man_t pNtk,
char *  pFileName,
Vec_Ptr_t vPiNames,
Vec_Ptr_t vPoNames 
)

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

Synopsis [Dumps the BLIF file for the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 257 of file nwkUtil.c.

258 {
259  FILE * pFile;
260  Vec_Ptr_t * vNodes;
261  Vec_Int_t * vTruth;
262  Vec_Int_t * vCover;
263  Nwk_Obj_t * pObj, * pFanin;
264  Aig_MmFlex_t * pMem;
265  char * pSop = NULL;
266  unsigned * pTruth;
267  int i, k, nDigits;
268  if ( Nwk_ManPoNum(pNtk) == 0 )
269  {
270  printf( "Nwk_ManDumpBlif(): Network does not have POs.\n" );
271  return;
272  }
273  // collect nodes in the DFS order
274  nDigits = Abc_Base10Log( Nwk_ManObjNumMax(pNtk) );
275  // write the file
276  pFile = fopen( pFileName, "w" );
277  fprintf( pFile, "# BLIF file written by procedure Nwk_ManDumpBlif()\n" );
278 // fprintf( pFile, "# http://www.eecs.berkeley.edu/~alanmi/abc/\n" );
279  fprintf( pFile, ".model %s\n", pNtk->pName );
280  // write PIs
281  fprintf( pFile, ".inputs" );
282  Nwk_ManForEachCi( pNtk, pObj, i )
283  if ( vPiNames )
284  fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPiNames, i) );
285  else
286  fprintf( pFile, " n%0*d", nDigits, pObj->Id );
287  fprintf( pFile, "\n" );
288  // write POs
289  fprintf( pFile, ".outputs" );
290  Nwk_ManForEachCo( pNtk, pObj, i )
291  if ( vPoNames )
292  fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPoNames, i) );
293  else
294  fprintf( pFile, " n%0*d", nDigits, pObj->Id );
295  fprintf( pFile, "\n" );
296  // write nodes
297  pMem = Aig_MmFlexStart();
298  vTruth = Vec_IntAlloc( 1 << 16 );
299  vCover = Vec_IntAlloc( 1 << 16 );
300  vNodes = Nwk_ManDfs( pNtk );
301  Vec_PtrForEachEntry( Nwk_Obj_t *, vNodes, pObj, i )
302  {
303  if ( !Nwk_ObjIsNode(pObj) )
304  continue;
305  // derive SOP for the AIG
306  pTruth = Hop_ManConvertAigToTruth( pNtk->pManHop, Hop_Regular(pObj->pFunc), Nwk_ObjFaninNum(pObj), vTruth, 0 );
307  if ( Hop_IsComplement(pObj->pFunc) )
308  Kit_TruthNot( pTruth, pTruth, Nwk_ObjFaninNum(pObj) );
309  pSop = Kit_PlaFromTruth( pMem, pTruth, Nwk_ObjFaninNum(pObj), vCover );
310  // write the node
311  fprintf( pFile, ".names" );
312  if ( !Kit_TruthIsConst0(pTruth, Nwk_ObjFaninNum(pObj)) && !Kit_TruthIsConst1(pTruth, Nwk_ObjFaninNum(pObj)) )
313  {
314  Nwk_ObjForEachFanin( pObj, pFanin, k )
315  if ( vPiNames && Nwk_ObjIsPi(pFanin) )
316  fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPiNames, Nwk_ObjPioNum(pFanin)) );
317  else
318  fprintf( pFile, " n%0*d", nDigits, pFanin->Id );
319  }
320  fprintf( pFile, " n%0*d\n", nDigits, pObj->Id );
321  // write the function
322  fprintf( pFile, "%s", pSop );
323  }
324  Vec_IntFree( vCover );
325  Vec_IntFree( vTruth );
326  Vec_PtrFree( vNodes );
327  Aig_MmFlexStop( pMem, 0 );
328  // write POs
329  Nwk_ManForEachCo( pNtk, pObj, i )
330  {
331  fprintf( pFile, ".names" );
332  if ( vPiNames && Nwk_ObjIsPi(Nwk_ObjFanin0(pObj)) )
333  fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPiNames, Nwk_ObjPioNum(Nwk_ObjFanin0(pObj))) );
334  else
335  fprintf( pFile, " n%0*d", nDigits, Nwk_ObjFanin0(pObj)->Id );
336  if ( vPoNames )
337  fprintf( pFile, " %s\n", (char*)Vec_PtrEntry(vPoNames, Nwk_ObjPioNum(pObj)) );
338  else
339  fprintf( pFile, " n%0*d\n", nDigits, pObj->Id );
340  fprintf( pFile, "%d 1\n", !pObj->fInvert );
341  }
342  fprintf( pFile, ".end\n\n" );
343  fclose( pFile );
344 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
#define Nwk_ManForEachCo(p, pObj, i)
Definition: nwk.h:181
int Nwk_ManPoNum(Nwk_Man_t *pNtk)
Definition: nwkUtil.c:135
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
char * Kit_PlaFromTruth(void *p, unsigned *pTruth, int nVars, Vec_Int_t *vCover)
Definition: kitPla.c:337
#define Nwk_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: nwk.h:179
static int Nwk_ObjIsPi(Nwk_Obj_t *p)
Definition: nwk.h:150
static int Kit_TruthIsConst0(unsigned *pIn, int nVars)
Definition: kit.h:315
char * pName
Definition: nwk.h:64
static int Nwk_ObjFaninNum(Nwk_Obj_t *p)
Definition: nwk.h:137
static int Kit_TruthIsConst1(unsigned *pIn, int nVars)
Definition: kit.h:323
ABC_DLL Vec_Ptr_t * Nwk_ManDfs(Nwk_Man_t *pNtk)
Definition: nwkDfs.c:321
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Abc_Base10Log(unsigned n)
Definition: abc_global.h:252
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
static int Hop_IsComplement(Hop_Obj_t *p)
Definition: hop.h:129
static void Kit_TruthNot(unsigned *pOut, unsigned *pIn, int nVars)
Definition: kit.h:373
static int Nwk_ObjIsNode(Nwk_Obj_t *p)
Definition: nwk.h:148
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Nwk_ObjPioNum(Nwk_Obj_t *p)
Definition: nwk.h:136
#define Nwk_ObjForEachFanin(pObj, pFanin, i)
Definition: nwk.h:199
static int Nwk_ManObjNumMax(Nwk_Man_t *p)
Definition: nwk.h:129
Aig_MmFlex_t * Aig_MmFlexStart()
Definition: aigMem.c:305
void Aig_MmFlexStop(Aig_MmFlex_t *p, int fVerbose)
Definition: aigMem.c:337
static Nwk_Obj_t * Nwk_ObjFanin0(Nwk_Obj_t *p)
Definition: nwk.h:140
unsigned * Hop_ManConvertAigToTruth(Hop_Man_t *p, Hop_Obj_t *pRoot, int nVars, Vec_Int_t *vTruth, int fMsbFirst)
Definition: hopTruth.c:143
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static Hop_Obj_t * Hop_Regular(Hop_Obj_t *p)
Definition: hop.h:126
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL void Nwk_ManFree ( Nwk_Man_t p)

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

Synopsis [Deallocates the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 71 of file nwkMan.c.

72 {
73 // printf( "The number of realloced nodes = %d.\n", p->nRealloced );
74  if ( p->pName ) ABC_FREE( p->pName );
75  if ( p->pSpec ) ABC_FREE( p->pSpec );
76  if ( p->vCis ) Vec_PtrFree( p->vCis );
77  if ( p->vCos ) Vec_PtrFree( p->vCos );
78  if ( p->vObjs ) Vec_PtrFree( p->vObjs );
79  if ( p->vTemp ) Vec_PtrFree( p->vTemp );
80  if ( p->pManTime ) Tim_ManStop( p->pManTime );
81  if ( p->pMemObjs ) Aig_MmFlexStop( p->pMemObjs, 0 );
82  if ( p->pManHop ) Hop_ManStop( p->pManHop );
83  ABC_FREE( p );
84 }
char * pSpec
Definition: nwk.h:65
Aig_MmFlex_t * pMemObjs
Definition: nwk.h:76
Vec_Ptr_t * vCos
Definition: nwk.h:68
char * pName
Definition: nwk.h:64
void Hop_ManStop(Hop_Man_t *p)
Definition: hopMan.c:84
Vec_Ptr_t * vCis
Definition: nwk.h:67
Hop_Man_t * pManHop
Definition: nwk.h:73
void Tim_ManStop(Tim_Man_t *p)
Definition: timMan.c:375
Tim_Man_t * pManTime
Definition: nwk.h:74
Vec_Ptr_t * vObjs
Definition: nwk.h:69
Vec_Ptr_t * vTemp
Definition: nwk.h:77
#define ABC_FREE(obj)
Definition: abc_global.h:232
void Aig_MmFlexStop(Aig_MmFlex_t *p, int fVerbose)
Definition: aigMem.c:337
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL int Nwk_ManGetAigNodeNum ( Nwk_Man_t pNtk)

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

Synopsis [Reads the number of AIG nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 155 of file nwkUtil.c.

156 {
157  Nwk_Obj_t * pNode;
158  int i, nNodes = 0;
159  Nwk_ManForEachNode( pNtk, pNode, i )
160  {
161  if ( pNode->pFunc == NULL )
162  {
163  printf( "Nwk_ManGetAigNodeNum(): Local AIG of node %d is not assigned.\n", pNode->Id );
164  continue;
165  }
166  if ( Nwk_ObjFaninNum(pNode) < 2 )
167  continue;
168  nNodes += Hop_DagSize( pNode->pFunc );
169  }
170  return nNodes;
171 }
int Hop_DagSize(Hop_Obj_t *pObj)
Definition: hopDfs.c:279
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
static int Nwk_ObjFaninNum(Nwk_Obj_t *p)
Definition: nwk.h:137
#define Nwk_ManForEachNode(p, pObj, i)
Definition: nwk.h:192
ABC_DLL int Nwk_ManGetFaninMax ( Nwk_Man_t pNtk)

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

Synopsis [Reads the maximum number of fanins of a node.]

Description []

SideEffects []

SeeAlso []

Definition at line 71 of file nwkUtil.c.

72 {
73  Nwk_Obj_t * pNode;
74  int i, nFaninsMax = 0;
75  Nwk_ManForEachNode( pNtk, pNode, i )
76  {
77  if ( nFaninsMax < Nwk_ObjFaninNum(pNode) )
78  nFaninsMax = Nwk_ObjFaninNum(pNode);
79  }
80  return nFaninsMax;
81 }
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
static int Nwk_ObjFaninNum(Nwk_Obj_t *p)
Definition: nwk.h:137
#define Nwk_ManForEachNode(p, pObj, i)
Definition: nwk.h:192
ABC_DLL int Nwk_ManGetTotalFanins ( Nwk_Man_t pNtk)

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

Synopsis [Reads the total number of all fanins.]

Description []

SideEffects []

SeeAlso []

Definition at line 94 of file nwkUtil.c.

95 {
96  Nwk_Obj_t * pNode;
97  int i, nFanins = 0;
98  Nwk_ManForEachNode( pNtk, pNode, i )
99  nFanins += Nwk_ObjFaninNum(pNode);
100  return nFanins;
101 }
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
static int Nwk_ObjFaninNum(Nwk_Obj_t *p)
Definition: nwk.h:137
#define Nwk_ManForEachNode(p, pObj, i)
Definition: nwk.h:192
ABC_DLL void Nwk_ManIncrementTravId ( Nwk_Man_t pNtk)

DECLARATIONS ///.

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

FileName [nwkUtil.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Logic network representation.]

Synopsis [Various utilities.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Increments the current traversal ID of the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 47 of file nwkUtil.c.

48 {
49  Nwk_Obj_t * pObj;
50  int i;
51  if ( pNtk->nTravIds >= (1<<26)-1 )
52  {
53  pNtk->nTravIds = 0;
54  Nwk_ManForEachObj( pNtk, pObj, i )
55  pObj->TravId = 0;
56  }
57  pNtk->nTravIds++;
58 }
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
#define Nwk_ManForEachObj(p, pObj, i)
Definition: nwk.h:189
int nTravIds
Definition: nwk.h:78
static int Nwk_ManLatchNum ( Nwk_Man_t p)
inlinestatic

Definition at line 128 of file nwk.h.

128 { return p->nObjs[NWK_OBJ_LATCH]; }
int nObjs[NWK_OBJ_VOID]
Definition: nwk.h:70
ABC_DLL int Nwk_ManLevel ( Nwk_Man_t pNtk)

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

Synopsis [Computes the number of logic levels not counting PIs/POs.]

Description [Does not assume that the objects are in a topo order.]

SideEffects []

SeeAlso []

Definition at line 215 of file nwkDfs.c.

216 {
217  Nwk_Obj_t * pObj;
218  int i, LevelMax = 0;
219  Nwk_ManForEachObj( pNtk, pObj, i )
220  Nwk_ObjSetLevel( pObj, 0 );
221  Nwk_ManIncrementTravId( pNtk );
222  Nwk_ManForEachPo( pNtk, pObj, i )
223  {
224  Nwk_ManLevel_rec( pObj );
225  if ( LevelMax < Nwk_ObjLevel(pObj) )
226  LevelMax = Nwk_ObjLevel(pObj);
227  }
228  Nwk_ManForEachCi( pNtk, pObj, i )
229  {
230  Nwk_ManLevel_rec( pObj );
231  if ( LevelMax < Nwk_ObjLevel(pObj) )
232  LevelMax = Nwk_ObjLevel(pObj);
233  }
234  return LevelMax;
235 }
void Nwk_ManLevel_rec(Nwk_Obj_t *pObj)
Definition: nwkDfs.c:160
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
#define Nwk_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: nwk.h:179
#define Nwk_ManForEachPo(p, pObj, i)
Definition: nwk.h:186
ABC_DLL void Nwk_ManIncrementTravId(Nwk_Man_t *pNtk)
DECLARATIONS ///.
Definition: nwkUtil.c:47
static void Nwk_ObjSetLevel(Nwk_Obj_t *pObj, int Level)
Definition: nwk.h:163
#define Nwk_ManForEachObj(p, pObj, i)
Definition: nwk.h:189
static int Nwk_ObjLevel(Nwk_Obj_t *pObj)
Definition: nwk.h:162
ABC_DLL int Nwk_ManLevelBackup ( Nwk_Man_t pNtk)

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

Synopsis [Computes the number of logic levels not counting PIs/POs.]

Description [Assumes that white boxes have unit level.]

SideEffects []

SeeAlso []

Definition at line 102 of file nwkDfs.c.

103 {
104  Tim_Man_t * pManTimeUnit;
105  Nwk_Obj_t * pObj, * pFanin;
106  int i, k, LevelMax, Level;
108  // clean the levels
109  Nwk_ManForEachObj( pNtk, pObj, i )
110  Nwk_ObjSetLevel( pObj, 0 );
111  // perform level computation
112  LevelMax = 0;
113  pManTimeUnit = pNtk->pManTime ? Tim_ManDup( pNtk->pManTime, 1 ) : NULL;
114  if ( pManTimeUnit )
115  Tim_ManIncrementTravId( pManTimeUnit );
116  Nwk_ManForEachObj( pNtk, pObj, i )
117  {
118  if ( Nwk_ObjIsCi(pObj) )
119  {
120  Level = pManTimeUnit? (int)Tim_ManGetCiArrival( pManTimeUnit, pObj->PioId ) : 0;
121  Nwk_ObjSetLevel( pObj, Level );
122  }
123  else if ( Nwk_ObjIsCo(pObj) )
124  {
125  Level = Nwk_ObjLevel( Nwk_ObjFanin0(pObj) );
126  if ( pManTimeUnit )
127  Tim_ManSetCoArrival( pManTimeUnit, pObj->PioId, (float)Level );
128  Nwk_ObjSetLevel( pObj, Level );
129  if ( LevelMax < Nwk_ObjLevel(pObj) )
130  LevelMax = Nwk_ObjLevel(pObj);
131  }
132  else if ( Nwk_ObjIsNode(pObj) )
133  {
134  Level = 0;
135  Nwk_ObjForEachFanin( pObj, pFanin, k )
136  if ( Level < Nwk_ObjLevel(pFanin) )
137  Level = Nwk_ObjLevel(pFanin);
138  Nwk_ObjSetLevel( pObj, Level + 1 );
139  }
140  else
141  assert( 0 );
142  }
143  // set the old timing manager
144  if ( pManTimeUnit )
145  Tim_ManStop( pManTimeUnit );
146  return LevelMax;
147 }
static int Nwk_ObjIsCi(Nwk_Obj_t *p)
Definition: nwk.h:146
void Tim_ManIncrementTravId(Tim_Man_t *p)
DECLARATIONS ///.
Definition: timTrav.c:44
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
void Tim_ManSetCoArrival(Tim_Man_t *p, int iCo, float Delay)
Definition: timTime.c:116
static int Nwk_ObjIsCo(Nwk_Obj_t *p)
Definition: nwk.h:147
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
Definition: timMan.c:86
void Tim_ManStop(Tim_Man_t *p)
Definition: timMan.c:375
ABC_NAMESPACE_IMPL_START int Nwk_ManVerifyTopoOrder(Nwk_Man_t *pNtk)
DECLARATIONS ///.
Definition: nwkDfs.c:45
static int Nwk_ObjIsNode(Nwk_Obj_t *p)
Definition: nwk.h:148
static void Nwk_ObjSetLevel(Nwk_Obj_t *pObj, int Level)
Definition: nwk.h:163
#define Nwk_ObjForEachFanin(pObj, pFanin, i)
Definition: nwk.h:199
#define Nwk_ManForEachObj(p, pObj, i)
Definition: nwk.h:189
static Nwk_Obj_t * Nwk_ObjFanin0(Nwk_Obj_t *p)
Definition: nwk.h:140
static int Nwk_ObjLevel(Nwk_Obj_t *pObj)
Definition: nwk.h:162
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
float Tim_ManGetCiArrival(Tim_Man_t *p, int iCi)
Definition: timTime.c:174
ABC_DLL Vec_Vec_t* Nwk_ManLevelize ( Nwk_Man_t pNtk)

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

Synopsis [Returns the array of objects in the AIG manager ordered by level.]

Description []

SideEffects []

SeeAlso []

Definition at line 269 of file nwkDfs.c.

270 {
271  Nwk_Obj_t * pObj;
272  Vec_Vec_t * vLevels;
273  int nLevels, i;
274  assert( Nwk_ManVerifyLevel(pNtk) );
275  nLevels = Nwk_ManLevelMax( pNtk );
276  vLevels = Vec_VecStart( nLevels + 1 );
277  Nwk_ManForEachNode( pNtk, pObj, i )
278  {
279  assert( Nwk_ObjLevel(pObj) <= nLevels );
280  Vec_VecPush( vLevels, Nwk_ObjLevel(pObj), pObj );
281  }
282  return vLevels;
283 }
static void Vec_VecPush(Vec_Vec_t *p, int Level, void *Entry)
Definition: vecVec.h:456
ABC_DLL int Nwk_ManVerifyLevel(Nwk_Man_t *pNtk)
Definition: nwkTiming.c:832
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
int Nwk_ManLevelMax(Nwk_Man_t *pNtk)
Definition: nwkDfs.c:248
static Vec_Vec_t * Vec_VecStart(int nSize)
Definition: vecVec.h:168
static int Nwk_ObjLevel(Nwk_Obj_t *pObj)
Definition: nwk.h:162
#define assert(ex)
Definition: util_old.h:213
#define Nwk_ManForEachNode(p, pObj, i)
Definition: nwk.h:192
ABC_DLL int Nwk_ManLevelMax ( Nwk_Man_t pNtk)

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

Synopsis [Computes the number of logic levels not counting PIs/POs.]

Description [Does not assume that the objects are in a topo order.]

SideEffects []

SeeAlso []

Definition at line 248 of file nwkDfs.c.

249 {
250  Nwk_Obj_t * pObj;
251  int i, LevelMax = 0;
252  Nwk_ManForEachPo( pNtk, pObj, i )
253  if ( LevelMax < Nwk_ObjLevel(pObj) )
254  LevelMax = Nwk_ObjLevel(pObj);
255  return LevelMax;
256 }
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
if(last==0)
Definition: sparse_int.h:34
#define Nwk_ManForEachPo(p, pObj, i)
Definition: nwk.h:186
static int Nwk_ObjLevel(Nwk_Obj_t *pObj)
Definition: nwk.h:162
ABC_DLL void Nwk_ManMinimumBase ( Nwk_Man_t pNtk,
int  fVerbose 
)

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

Synopsis [Minimizes the support of all nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 563 of file nwkUtil.c.

564 {
565  Vec_Int_t * vTruth;
566  Nwk_Obj_t * pObj;
567  int i, Counter = 0;
568  vTruth = Vec_IntAlloc( 1 << 16 );
569  Nwk_ManForEachNode( pNtk, pObj, i )
570  Counter += Nwk_ManMinimumBaseNode( pObj, vTruth, fVerbose );
571  if ( fVerbose && Counter )
572  printf( "Support minimization reduced support of %d nodes.\n", Counter );
573  Vec_IntFree( vTruth );
574 }
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
int Nwk_ManMinimumBaseNode(Nwk_Obj_t *pObj, Vec_Int_t *vTruth, int fVerbose)
Definition: nwkUtil.c:483
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
if(last==0)
Definition: sparse_int.h:34
static int Counter
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Nwk_ManForEachNode(p, pObj, i)
Definition: nwk.h:192
static int Nwk_ManNodeNum ( Nwk_Man_t p)
inlinestatic

Definition at line 127 of file nwk.h.

127 { return p->nObjs[NWK_OBJ_NODE]; }
int nObjs[NWK_OBJ_VOID]
Definition: nwk.h:70
static Nwk_Obj_t* Nwk_ManObj ( Nwk_Man_t p,
int  i 
)
inlinestatic

Definition at line 133 of file nwk.h.

133 { return (Nwk_Obj_t *)Vec_PtrEntry( p->vObjs, i ); }
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
Vec_Ptr_t * vObjs
Definition: nwk.h:69
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Nwk_ManObjNumMax ( Nwk_Man_t p)
inlinestatic

Definition at line 129 of file nwk.h.

129 { return Vec_PtrSize(p->vObjs); }
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Vec_Ptr_t * vObjs
Definition: nwk.h:69
ABC_DLL int Nwk_ManPiNum ( Nwk_Man_t pNtk)

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

Synopsis [Returns the number of true PIs.]

Description []

SideEffects []

SeeAlso []

Definition at line 115 of file nwkUtil.c.

116 {
117  Nwk_Obj_t * pNode;
118  int i, Counter = 0;
119  Nwk_ManForEachCi( pNtk, pNode, i )
120  Counter += Nwk_ObjIsPi( pNode );
121  return Counter;
122 }
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
#define Nwk_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: nwk.h:179
static int Nwk_ObjIsPi(Nwk_Obj_t *p)
Definition: nwk.h:150
static int Counter
ABC_DLL int Nwk_ManPoNum ( Nwk_Man_t pNtk)

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

Synopsis [Returns the number of true POs.]

Description []

SideEffects []

SeeAlso []

Definition at line 135 of file nwkUtil.c.

136 {
137  Nwk_Obj_t * pNode;
138  int i, Counter = 0;
139  Nwk_ManForEachCo( pNtk, pNode, i )
140  Counter += Nwk_ObjIsPo( pNode );
141  return Counter;
142 }
#define Nwk_ManForEachCo(p, pObj, i)
Definition: nwk.h:181
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
static int Nwk_ObjIsPo(Nwk_Obj_t *p)
Definition: nwk.h:151
static int Counter
ABC_DLL void Nwk_ManPrintFanioNew ( Nwk_Man_t pNtk)

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

Synopsis [Prints the distribution of fanins/fanouts in the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 357 of file nwkUtil.c.

358 {
359  char Buffer[100];
360  Nwk_Obj_t * pNode;
361  Vec_Int_t * vFanins, * vFanouts;
362  int nFanins, nFanouts, nFaninsMax, nFanoutsMax, nFaninsAll, nFanoutsAll;
363  int i, k, nSizeMax;
364 
365  // determine the largest fanin and fanout
366  nFaninsMax = nFanoutsMax = 0;
367  nFaninsAll = nFanoutsAll = 0;
368  Nwk_ManForEachNode( pNtk, pNode, i )
369  {
370  nFanins = Nwk_ObjFaninNum(pNode);
371  nFanouts = Nwk_ObjFanoutNum(pNode);
372  nFaninsAll += nFanins;
373  nFanoutsAll += nFanouts;
374  nFaninsMax = Abc_MaxInt( nFaninsMax, nFanins );
375  nFanoutsMax = Abc_MaxInt( nFanoutsMax, nFanouts );
376  }
377 
378  // allocate storage for fanin/fanout numbers
379  nSizeMax = Abc_MaxInt( 10 * (Abc_Base10Log(nFaninsMax) + 1), 10 * (Abc_Base10Log(nFanoutsMax) + 1) );
380  vFanins = Vec_IntStart( nSizeMax );
381  vFanouts = Vec_IntStart( nSizeMax );
382 
383  // count the number of fanins and fanouts
384  Nwk_ManForEachNode( pNtk, pNode, i )
385  {
386  nFanins = Nwk_ObjFaninNum(pNode);
387  nFanouts = Nwk_ObjFanoutNum(pNode);
388 // nFanouts = Nwk_NodeMffcSize(pNode);
389 
390  if ( nFanins < 10 )
391  Vec_IntAddToEntry( vFanins, nFanins, 1 );
392  else if ( nFanins < 100 )
393  Vec_IntAddToEntry( vFanins, 10 + nFanins/10, 1 );
394  else if ( nFanins < 1000 )
395  Vec_IntAddToEntry( vFanins, 20 + nFanins/100, 1 );
396  else if ( nFanins < 10000 )
397  Vec_IntAddToEntry( vFanins, 30 + nFanins/1000, 1 );
398  else if ( nFanins < 100000 )
399  Vec_IntAddToEntry( vFanins, 40 + nFanins/10000, 1 );
400  else if ( nFanins < 1000000 )
401  Vec_IntAddToEntry( vFanins, 50 + nFanins/100000, 1 );
402  else if ( nFanins < 10000000 )
403  Vec_IntAddToEntry( vFanins, 60 + nFanins/1000000, 1 );
404 
405  if ( nFanouts < 10 )
406  Vec_IntAddToEntry( vFanouts, nFanouts, 1 );
407  else if ( nFanouts < 100 )
408  Vec_IntAddToEntry( vFanouts, 10 + nFanouts/10, 1 );
409  else if ( nFanouts < 1000 )
410  Vec_IntAddToEntry( vFanouts, 20 + nFanouts/100, 1 );
411  else if ( nFanouts < 10000 )
412  Vec_IntAddToEntry( vFanouts, 30 + nFanouts/1000, 1 );
413  else if ( nFanouts < 100000 )
414  Vec_IntAddToEntry( vFanouts, 40 + nFanouts/10000, 1 );
415  else if ( nFanouts < 1000000 )
416  Vec_IntAddToEntry( vFanouts, 50 + nFanouts/100000, 1 );
417  else if ( nFanouts < 10000000 )
418  Vec_IntAddToEntry( vFanouts, 60 + nFanouts/1000000, 1 );
419  }
420 
421  printf( "The distribution of fanins and fanouts in the network:\n" );
422  printf( " Number Nodes with fanin Nodes with fanout\n" );
423  for ( k = 0; k < nSizeMax; k++ )
424  {
425  if ( vFanins->pArray[k] == 0 && vFanouts->pArray[k] == 0 )
426  continue;
427  if ( k < 10 )
428  printf( "%15d : ", k );
429  else
430  {
431  sprintf( Buffer, "%d - %d", (int)pow((double)10, k/10) * (k%10), (int)pow((double)10, k/10) * (k%10+1) - 1 );
432  printf( "%15s : ", Buffer );
433  }
434  if ( vFanins->pArray[k] == 0 )
435  printf( " " );
436  else
437  printf( "%12d ", vFanins->pArray[k] );
438  printf( " " );
439  if ( vFanouts->pArray[k] == 0 )
440  printf( " " );
441  else
442  printf( "%12d ", vFanouts->pArray[k] );
443  printf( "\n" );
444  }
445  Vec_IntFree( vFanins );
446  Vec_IntFree( vFanouts );
447 
448  printf( "Fanins: Max = %d. Ave = %.2f. Fanouts: Max = %d. Ave = %.2f.\n",
449  nFaninsMax, 1.0*nFaninsAll/Nwk_ManNodeNum(pNtk),
450  nFanoutsMax, 1.0*nFanoutsAll/Nwk_ManNodeNum(pNtk) );
451 }
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
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static int Nwk_ObjFaninNum(Nwk_Obj_t *p)
Definition: nwk.h:137
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static void Vec_IntAddToEntry(Vec_Int_t *p, int i, int Addition)
Definition: bblif.c:302
static int Abc_Base10Log(unsigned n)
Definition: abc_global.h:252
char * sprintf()
static int Nwk_ManNodeNum(Nwk_Man_t *p)
Definition: nwk.h:127
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Nwk_ManForEachNode(p, pObj, i)
Definition: nwk.h:192
ABC_DLL void Nwk_ManPrintStats ( Nwk_Man_t pNtk,
If_LibLut_t pLutLib,
int  fSaveBest,
int  fDumpResult,
int  fPower,
Ntl_Man_t pNtl 
)

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

Synopsis [Prints stats of the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 234 of file nwkMan.c.

235 {
236 // extern int Ntl_ManLatchNum( Ntl_Man_t * p );
237 // extern void Ntl_ManWriteBlifLogic( Nwk_Man_t * pNtk, void * pNtl, char * pFileName );
238  if ( fSaveBest )
239  Nwk_ManCompareAndSaveBest( pNtk, pNtl );
240  if ( fDumpResult )
241  {
242  char Buffer[1000] = {0};
243  const char * pNameGen = pNtk->pSpec? Nwk_FileNameGeneric( pNtk->pSpec ) : "nameless_";
244  sprintf( Buffer, "%s_dump.blif", pNameGen );
245 // Ntl_ManWriteBlifLogic( pNtk, pNtl, Buffer );
246 // sprintf( Buffer, "%s_dump_map.blif", pNameGen );
247 // Nwk_ManDumpBlif( pNtk, Buffer, NULL, NULL );
248  if ( pNtk->pSpec ) ABC_FREE( pNameGen );
249  }
250 
251  pNtk->pLutLib = pLutLib;
252  printf( "%-15s : ", pNtk->pName );
253  printf( "pi = %5d ", Nwk_ManPiNum(pNtk) );
254  printf( "po = %5d ", Nwk_ManPoNum(pNtk) );
255  printf( "ci = %5d ", Nwk_ManCiNum(pNtk) );
256  printf( "co = %5d ", Nwk_ManCoNum(pNtk) );
257 // printf( "lat = %5d ", Ntl_ManLatchNum(pNtl) );
258  printf( "node = %5d ", Nwk_ManNodeNum(pNtk) );
259  printf( "edge = %5d ", Nwk_ManGetTotalFanins(pNtk) );
260  printf( "aig = %6d ", Nwk_ManGetAigNodeNum(pNtk) );
261  printf( "lev = %3d ", Nwk_ManLevel(pNtk) );
262 // printf( "lev2 = %3d ", Nwk_ManLevelBackup(pNtk) );
263  printf( "delay = %5.2f ", Nwk_ManDelayTraceLut(pNtk) );
264  if ( fPower )
265  printf( "power = %7.2f ", Nwl_ManComputeTotalSwitching(pNtk) );
266  Nwk_ManPrintLutSizes( pNtk, pLutLib );
267  printf( "\n" );
268 // Nwk_ManDelayTracePrint( pNtk, pLutLib );
269  fflush( stdout );
270 }
ABC_DLL int Nwk_ManLevel(Nwk_Man_t *pNtk)
Definition: nwkDfs.c:215
ABC_DLL int Nwk_ManPoNum(Nwk_Man_t *pNtk)
Definition: nwkUtil.c:135
char * pSpec
Definition: nwk.h:65
char * pName
Definition: nwk.h:64
ABC_DLL int Nwk_ManGetAigNodeNum(Nwk_Man_t *pNtk)
Definition: nwkUtil.c:155
char * Nwk_FileNameGeneric(char *FileName)
Definition: nwkMan.c:178
If_LibLut_t * pLutLib
Definition: nwk.h:75
ABC_DLL int Nwk_ManPiNum(Nwk_Man_t *pNtk)
Definition: nwkUtil.c:115
char * sprintf()
static int Nwk_ManCiNum(Nwk_Man_t *p)
MACRO DEFINITIONS ///.
Definition: nwk.h:125
#define ABC_FREE(obj)
Definition: abc_global.h:232
int Nwk_ManCompareAndSaveBest(Nwk_Man_t *pNtk, void *pNtl)
Definition: nwkMan.c:121
ABC_DLL float Nwk_ManDelayTraceLut(Nwk_Man_t *pNtk)
Definition: nwkTiming.c:326
float Nwl_ManComputeTotalSwitching(Nwk_Man_t *pNtk)
Definition: nwkMan.c:198
ABC_DLL int Nwk_ManGetTotalFanins(Nwk_Man_t *pNtk)
Definition: nwkUtil.c:94
static int Nwk_ManNodeNum(Nwk_Man_t *p)
Definition: nwk.h:127
void Nwk_ManPrintLutSizes(Nwk_Man_t *p, If_LibLut_t *pLutLib)
Definition: nwkMan.c:97
static int Nwk_ManCoNum(Nwk_Man_t *p)
Definition: nwk.h:126
ABC_DLL void Nwk_ManRemoveDupFanins ( Nwk_Man_t pNtk,
int  fVerbose 
)

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

Synopsis [Minimizes the support of all nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 608 of file nwkUtil.c.

609 {
610  Vec_Int_t * vTruth;
611  Nwk_Obj_t * pObj;
612  int i, k, m, fFound;
613  // check if the nodes have duplicated fanins
614  vTruth = Vec_IntAlloc( 1 << 16 );
615  Nwk_ManForEachNode( pNtk, pObj, i )
616  {
617  fFound = 0;
618  for ( k = 0; k < pObj->nFanins; k++ )
619  {
620  for ( m = k + 1; m < pObj->nFanins; m++ )
621  if ( pObj->pFanio[k] == pObj->pFanio[m] )
622  {
623  if ( fVerbose )
624  printf( "Removing duplicated fanins of node %d (fanins %d and %d).\n",
625  pObj->Id, pObj->pFanio[k]->Id, pObj->pFanio[m]->Id );
626  Nwk_ManRemoveDupFaninsNode( pObj, k, m, vTruth );
627  fFound = 1;
628  break;
629  }
630  if ( fFound )
631  break;
632  }
633  }
634  Vec_IntFree( vTruth );
635 // Nwk_ManMinimumBase( pNtk, fVerbose );
636 }
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
void Nwk_ManRemoveDupFaninsNode(Nwk_Obj_t *pObj, int iFan0, int iFan1, Vec_Int_t *vTruth)
Definition: nwkUtil.c:587
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Nwk_ManForEachNode(p, pObj, i)
Definition: nwk.h:192
ABC_DLL Vec_Ptr_t* Nwk_ManRetimeCutBackward ( Nwk_Man_t pMan,
int  nLatches,
int  fVerbose 
)

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

Synopsis [Computes minimum cut for backward retiming.]

Description []

SideEffects []

SeeAlso []

Definition at line 523 of file nwkFlow.c.

524 {
525  Vec_Ptr_t * vNodes;
526  Nwk_Obj_t * pObj;
527  int i, RetValue, Counter = 0, Counter2 = 0;
528  abctime clk = Abc_Clock();
529  // set the sequential parameters
530  pMan->nLatches = nLatches;
531  pMan->nTruePis = Nwk_ManCiNum(pMan) - nLatches;
532  pMan->nTruePos = Nwk_ManCoNum(pMan) - nLatches;
533  // mark the CIs, the TFI of POs, and the constant nodes
534  Nwk_ManForEachCi( pMan, pObj, i )
535  pObj->MarkA = 1;
536  Nwk_ManForEachPoSeq( pMan, pObj, i )
537  Nwk_ManMarkTfiCone_rec( pObj );
538  Nwk_ManForEachNode( pMan, pObj, i )
539  if ( Nwk_ObjFaninNum(pObj) == 0 )
540  pObj->MarkA = 1;
541  // start flow computation from each LI driver
543  Nwk_ManForEachLiSeq( pMan, pObj, i )
544  {
545  if ( !Nwk_ManPushBackwardFast_rec( Nwk_ObjFanin0(pObj), NULL ) )
546  continue;
548  Counter++;
549  }
550  if ( fVerbose )
551  printf( "Backward: Max-flow = %4d -> ", Counter );
552  // continue flow computation from each LI driver
554  Nwk_ManForEachLiSeq( pMan, pObj, i )
555  {
556  if ( !Nwk_ManPushBackwardBot_rec( Nwk_ObjFanin0(pObj), NULL ) )
557  continue;
559  Counter2++;
560  }
561  if ( fVerbose )
562  printf( "%4d. ", Counter+Counter2 );
563  // repeat flow computation from each LI driver
564  if ( Counter2 > 0 )
565  {
567  Nwk_ManForEachLiSeq( pMan, pObj, i )
568  {
569  RetValue = Nwk_ManPushBackwardBot_rec( Nwk_ObjFanin0(pObj), NULL );
570  assert( !RetValue );
571  }
572  }
573  // cut is a set of nodes whose bottom is visited but top is not visited
574  vNodes = Vec_PtrAlloc( Counter+Counter2 );
575  Nwk_ManForEachObj( pMan, pObj, i )
576  {
577  if ( Nwk_ObjVisitedBotOnly(pObj) )
578  {
579  assert( Nwk_ObjHasFlow(pObj) );
580  assert( !Nwk_ObjIsCo(pObj) );
581  Vec_PtrPush( vNodes, pObj );
582  }
583  }
584  // count CO drivers
585  Counter = 0;
586  Nwk_ManForEachLiSeq( pMan, pObj, i )
588  Counter++;
589  Nwk_ManCleanMarks( pMan );
590 // assert( Nwk_ManRetimeVerifyCutBackward(pMan, vNodes) );
591  if ( fVerbose )
592  {
593  printf( "Min-cut = %4d. Unmoved = %4d. ", Vec_PtrSize(vNodes), Counter );
594  ABC_PRT( "Time", Abc_Clock() - clk );
595  }
596  return vNodes;
597 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Nwk_ObjVisitedBotOnly(Nwk_Obj_t *pObj)
Definition: nwkFlow.c:54
ABC_DLL void Nwk_ManCleanMarks(Nwk_Man_t *pNtk)
Definition: nwkUtil.c:464
int nTruePis
Definition: nwk.h:82
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
#define Nwk_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: nwk.h:179
int Nwk_ManPushBackwardFast_rec(Nwk_Obj_t *pObj, Nwk_Obj_t *pPred)
Definition: nwkFlow.c:190
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Nwk_ObjFaninNum(Nwk_Obj_t *p)
Definition: nwk.h:137
static int Nwk_ObjIsCo(Nwk_Obj_t *p)
Definition: nwk.h:147
#define Nwk_ManForEachPoSeq(p, pObj, i)
Definition: nwk.h:207
if(last==0)
Definition: sparse_int.h:34
void Nwk_ManMarkTfiCone_rec(Nwk_Obj_t *pObj)
FUNCTION DEFINITIONS ///.
Definition: nwkFlow.c:112
static int Counter
static int Nwk_ManCiNum(Nwk_Man_t *p)
MACRO DEFINITIONS ///.
Definition: nwk.h:125
static int Nwk_ObjHasFlow(Nwk_Obj_t *pObj)
Definition: nwkFlow.c:45
#define Nwk_ManForEachLiSeq(p, pObj, i)
Definition: nwk.h:211
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define ABC_PRT(a, t)
Definition: abc_global.h:220
#define Nwk_ManForEachObj(p, pObj, i)
Definition: nwk.h:189
static Nwk_Obj_t * Nwk_ObjFanin0(Nwk_Obj_t *p)
Definition: nwk.h:140
#define assert(ex)
Definition: util_old.h:213
static void Nwk_ManIncrementTravIdFlow(Nwk_Man_t *pMan)
Definition: nwkFlow.c:84
static int Nwk_ManPushBackwardBot_rec(Nwk_Obj_t *pObj, Nwk_Obj_t *pPred)
Definition: nwkFlow.c:296
int nLatches
Definition: nwk.h:81
ABC_INT64_T abctime
Definition: abc_global.h:278
int nTruePos
Definition: nwk.h:83
static int Nwk_ManCoNum(Nwk_Man_t *p)
Definition: nwk.h:126
#define Nwk_ManForEachNode(p, pObj, i)
Definition: nwk.h:192
ABC_DLL Vec_Ptr_t* Nwk_ManRetimeCutForward ( Nwk_Man_t pMan,
int  nLatches,
int  fVerbose 
)

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

Synopsis [Computes minimum cut for forward retiming.]

Description []

SideEffects []

SeeAlso []

Definition at line 442 of file nwkFlow.c.

443 {
444  Vec_Ptr_t * vNodes;
445  Nwk_Obj_t * pObj;
446  int i, RetValue, Counter = 0, Counter2 = 0;
447  abctime clk = Abc_Clock();
448  // set the sequential parameters
449  pMan->nLatches = nLatches;
450  pMan->nTruePis = Nwk_ManCiNum(pMan) - nLatches;
451  pMan->nTruePos = Nwk_ManCoNum(pMan) - nLatches;
452  // mark the COs and the TFO of PIs
453  Nwk_ManForEachCo( pMan, pObj, i )
454  pObj->MarkA = 1;
455  Nwk_ManForEachPiSeq( pMan, pObj, i )
456  Nwk_ManMarkTfoCone_rec( pObj );
457  // start flow computation from each LO
459  Nwk_ManForEachLoSeq( pMan, pObj, i )
460  {
461  if ( !Nwk_ManPushForwardFast_rec( pObj, NULL ) )
462  continue;
464  Counter++;
465  }
466  if ( fVerbose )
467  printf( "Forward: Max-flow = %4d -> ", Counter );
468  // continue flow computation from each LO
470  Nwk_ManForEachLoSeq( pMan, pObj, i )
471  {
472  if ( !Nwk_ManPushForwardBot_rec( pObj, NULL ) )
473  continue;
475  Counter2++;
476  }
477  if ( fVerbose )
478  printf( "%4d. ", Counter+Counter2 );
479  // repeat flow computation from each LO
480  if ( Counter2 > 0 )
481  {
483  Nwk_ManForEachLoSeq( pMan, pObj, i )
484  {
485  RetValue = Nwk_ManPushForwardBot_rec( pObj, NULL );
486  assert( !RetValue );
487  }
488  }
489  // cut is a set of nodes whose bottom is visited but top is not visited
490  vNodes = Vec_PtrAlloc( Counter+Counter2 );
491  Counter = 0;
492  Nwk_ManForEachObj( pMan, pObj, i )
493  {
494  if ( Nwk_ObjVisitedBotOnly(pObj) )
495  {
496  assert( Nwk_ObjHasFlow(pObj) );
497  assert( !Nwk_ObjIsCo(pObj) );
498  Vec_PtrPush( vNodes, pObj );
499  Counter += Nwk_ObjIsCi(pObj);
500  }
501  }
502  Nwk_ManCleanMarks( pMan );
503 // assert( Nwk_ManRetimeVerifyCutForward(pMan, vNodes) );
504  if ( fVerbose )
505  {
506  printf( "Min-cut = %4d. Unmoved = %4d. ", Vec_PtrSize(vNodes), Counter );
507  ABC_PRT( "Time", Abc_Clock() - clk );
508  }
509  return vNodes;
510 }
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
static int Nwk_ObjVisitedBotOnly(Nwk_Obj_t *pObj)
Definition: nwkFlow.c:54
ABC_DLL void Nwk_ManCleanMarks(Nwk_Man_t *pNtk)
Definition: nwkUtil.c:464
#define Nwk_ManForEachCo(p, pObj, i)
Definition: nwk.h:181
int nTruePis
Definition: nwk.h:82
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
#define Nwk_ManForEachLoSeq(p, pObj, i)
Definition: nwk.h:209
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
#define Nwk_ManForEachPiSeq(p, pObj, i)
Definition: nwk.h:205
int Nwk_ManPushForwardFast_rec(Nwk_Obj_t *pObj, Nwk_Obj_t *pPred)
Definition: nwkFlow.c:156
void Nwk_ManMarkTfoCone_rec(Nwk_Obj_t *pObj)
Definition: nwkFlow.c:134
static int Nwk_ObjIsCo(Nwk_Obj_t *p)
Definition: nwk.h:147
static int Nwk_ManPushForwardBot_rec(Nwk_Obj_t *pObj, Nwk_Obj_t *pPred)
Definition: nwkFlow.c:224
static int Counter
static int Nwk_ManCiNum(Nwk_Man_t *p)
MACRO DEFINITIONS ///.
Definition: nwk.h:125
static int Nwk_ObjHasFlow(Nwk_Obj_t *pObj)
Definition: nwkFlow.c:45
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define ABC_PRT(a, t)
Definition: abc_global.h:220
#define Nwk_ManForEachObj(p, pObj, i)
Definition: nwk.h:189
#define assert(ex)
Definition: util_old.h:213
static void Nwk_ManIncrementTravIdFlow(Nwk_Man_t *pMan)
Definition: nwkFlow.c:84
int nLatches
Definition: nwk.h:81
ABC_INT64_T abctime
Definition: abc_global.h:278
int nTruePos
Definition: nwk.h:83
static int Nwk_ManCoNum(Nwk_Man_t *p)
Definition: nwk.h:126
ABC_DLL Aig_Man_t* Nwk_ManSpeedup ( Nwk_Man_t pNtk,
int  fUseLutLib,
int  Percentage,
int  Degree,
int  fVerbose,
int  fVeryVerbose 
)

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

Synopsis [Adds choices to speed up the network by the given percentage.]

Description []

SideEffects []

SeeAlso []

Definition at line 203 of file nwkSpeedup.c.

204 {
205  Aig_Man_t * pAig, * pTemp;
206  Vec_Ptr_t * vTimeCries, * vTimeFanins;
207  Nwk_Obj_t * pNode, * pFanin, * pFanin2;
208  Aig_Obj_t * pAnd;
209  If_LibLut_t * pTempLib = pNtk->pLutLib;
210  Tim_Man_t * pTempTim = NULL;
211  float tDelta, tArrival;
212  int i, k, k2, Counter, CounterRes, nTimeCris;
213  unsigned * puTCEdges;
214  // perform delay trace
215  if ( !fUseLutLib )
216  {
217  pNtk->pLutLib = NULL;
218  if ( pNtk->pManTime )
219  {
220  pTempTim = pNtk->pManTime;
221  pNtk->pManTime = Tim_ManDup( pTempTim, 1 );
222  }
223  }
224  tArrival = Nwk_ManDelayTraceLut( pNtk );
225  tDelta = fUseLutLib ? tArrival*Percentage/100.0 : 1.0;
226  if ( fVerbose )
227  {
228  printf( "Max delay = %.2f. Delta = %.2f. ", tArrival, tDelta );
229  printf( "Using %s model. ", fUseLutLib? "LUT library" : "unit-delay" );
230  if ( fUseLutLib )
231  printf( "Percentage = %d. ", Percentage );
232  printf( "\n" );
233  }
234  // mark the timing critical nodes and edges
235  puTCEdges = ABC_ALLOC( unsigned, Nwk_ManObjNumMax(pNtk) );
236  memset( puTCEdges, 0, sizeof(unsigned) * Nwk_ManObjNumMax(pNtk) );
237  Nwk_ManForEachNode( pNtk, pNode, i )
238  {
239  if ( Nwk_ObjSlack(pNode) >= tDelta )
240  continue;
241  puTCEdges[pNode->Id] = Nwk_ManDelayTraceTCEdges( pNtk, pNode, tDelta, fUseLutLib );
242  }
243  if ( fVerbose )
244  {
245  Counter = CounterRes = 0;
246  Nwk_ManForEachNode( pNtk, pNode, i )
247  {
248  Nwk_ObjForEachFanin( pNode, pFanin, k )
249  if ( !Nwk_ObjIsCi(pFanin) && Nwk_ObjSlack(pFanin) < tDelta )
250  Counter++;
251  CounterRes += Aig_WordCountOnes( puTCEdges[pNode->Id] );
252  }
253  printf( "Edges: Total = %7d. 0-slack = %7d. Critical = %7d. Ratio = %4.2f\n",
254  Nwk_ManGetTotalFanins(pNtk), Counter, CounterRes, Counter? 1.0*CounterRes/Counter : 0.0 );
255  }
256  // start the resulting network
257  pAig = Nwk_ManStrash( pNtk );
258  pAig->pEquivs = ABC_ALLOC( Aig_Obj_t *, 3 * Aig_ManObjNumMax(pAig) );
259  memset( pAig->pEquivs, 0, sizeof(Aig_Obj_t *) * 3 * Aig_ManObjNumMax(pAig) );
260 
261  // collect nodes to be used for resynthesis
262  Counter = CounterRes = 0;
263  vTimeCries = Vec_PtrAlloc( 16 );
264  vTimeFanins = Vec_PtrAlloc( 16 );
265  Nwk_ManForEachNode( pNtk, pNode, i )
266  {
267  if ( Nwk_ObjSlack(pNode) >= tDelta )
268  continue;
269  // count the number of non-PI timing-critical nodes
270  nTimeCris = 0;
271  Nwk_ObjForEachFanin( pNode, pFanin, k )
272  if ( !Nwk_ObjIsCi(pFanin) && (puTCEdges[pNode->Id] & (1<<k)) )
273  nTimeCris++;
274  if ( !fVeryVerbose && nTimeCris == 0 )
275  continue;
276  Counter++;
277  // count the total number of timing critical second-generation nodes
278  Vec_PtrClear( vTimeCries );
279  if ( nTimeCris )
280  {
281  Nwk_ObjForEachFanin( pNode, pFanin, k )
282  if ( !Nwk_ObjIsCi(pFanin) && (puTCEdges[pNode->Id] & (1<<k)) )
283  Nwk_ObjForEachFanin( pFanin, pFanin2, k2 )
284  if ( puTCEdges[pFanin->Id] & (1<<k2) )
285  Vec_PtrPushUnique( vTimeCries, pFanin2 );
286  }
287 // if ( !fVeryVerbose && (Vec_PtrSize(vTimeCries) == 0 || Vec_PtrSize(vTimeCries) > Degree) )
288  if ( (Vec_PtrSize(vTimeCries) == 0 || Vec_PtrSize(vTimeCries) > Degree) )
289  continue;
290  CounterRes++;
291  // collect second generation nodes
292  Vec_PtrClear( vTimeFanins );
293  Nwk_ObjForEachFanin( pNode, pFanin, k )
294  {
295  if ( Nwk_ObjIsCi(pFanin) )
296  Vec_PtrPushUnique( vTimeFanins, pFanin );
297  else
298  Nwk_ObjForEachFanin( pFanin, pFanin2, k2 )
299  Vec_PtrPushUnique( vTimeFanins, pFanin2 );
300  }
301  // print the results
302  if ( fVeryVerbose )
303  {
304  printf( "%5d Node %5d : %d %2d %2d ", Counter, pNode->Id,
305  nTimeCris, Vec_PtrSize(vTimeCries), Vec_PtrSize(vTimeFanins) );
306  Nwk_ObjForEachFanin( pNode, pFanin, k )
307  printf( "%d(%.2f)%s ", pFanin->Id, Nwk_ObjSlack(pFanin), (puTCEdges[pNode->Id] & (1<<k))? "*":"" );
308  printf( "\n" );
309  }
310  // add the node to choices
311  if ( Vec_PtrSize(vTimeCries) == 0 || Vec_PtrSize(vTimeCries) > Degree )
312  continue;
313  // order the fanins in the increasing order of criticalily
314  if ( Vec_PtrSize(vTimeCries) > 1 )
315  {
316  pFanin = (Nwk_Obj_t *)Vec_PtrEntry( vTimeCries, 0 );
317  pFanin2 = (Nwk_Obj_t *)Vec_PtrEntry( vTimeCries, 1 );
318  if ( Nwk_ObjSlack(pFanin) < Nwk_ObjSlack(pFanin2) )
319  {
320  Vec_PtrWriteEntry( vTimeCries, 0, pFanin2 );
321  Vec_PtrWriteEntry( vTimeCries, 1, pFanin );
322  }
323  }
324  if ( Vec_PtrSize(vTimeCries) > 2 )
325  {
326  pFanin = (Nwk_Obj_t *)Vec_PtrEntry( vTimeCries, 1 );
327  pFanin2 = (Nwk_Obj_t *)Vec_PtrEntry( vTimeCries, 2 );
328  if ( Nwk_ObjSlack(pFanin) < Nwk_ObjSlack(pFanin2) )
329  {
330  Vec_PtrWriteEntry( vTimeCries, 1, pFanin2 );
331  Vec_PtrWriteEntry( vTimeCries, 2, pFanin );
332  }
333  pFanin = (Nwk_Obj_t *)Vec_PtrEntry( vTimeCries, 0 );
334  pFanin2 = (Nwk_Obj_t *)Vec_PtrEntry( vTimeCries, 1 );
335  if ( Nwk_ObjSlack(pFanin) < Nwk_ObjSlack(pFanin2) )
336  {
337  Vec_PtrWriteEntry( vTimeCries, 0, pFanin2 );
338  Vec_PtrWriteEntry( vTimeCries, 1, pFanin );
339  }
340  }
341  // add choice
342  Aig_ManSpeedupNode( pNtk, pAig, pNode, vTimeFanins, vTimeCries );
343  }
344  Vec_PtrFree( vTimeCries );
345  Vec_PtrFree( vTimeFanins );
346  ABC_FREE( puTCEdges );
347  if ( fVerbose )
348  printf( "Nodes: Total = %7d. 0-slack = %7d. Workable = %7d. Ratio = %4.2f\n",
349  Nwk_ManNodeNum(pNtk), Counter, CounterRes, Counter? 1.0*CounterRes/Counter : 0.0 );
350 
351  // remove invalid choice nodes
352  Aig_ManForEachNode( pAig, pAnd, i )
353  if ( Aig_ObjEquiv(pAig, pAnd) )
354  {
355  if ( Aig_ObjRefs(Aig_ObjEquiv(pAig, pAnd)) > 0 )
356  pAig->pEquivs[pAnd->Id] = NULL;
357  }
358 
359  // put back the library
360  if ( !fUseLutLib )
361  pNtk->pLutLib = pTempLib;
362  if ( pTempTim )
363  {
364  Tim_ManStop( pNtk->pManTime );
365  pNtk->pManTime = pTempTim;
366  }
367 
368  // reconstruct the network
369  pAig = Aig_ManDupDfs( pTemp = pAig );
370  Aig_ManStop( pTemp );
371  // reset levels
372  Aig_ManChoiceLevel( pAig );
373  return pAig;
374 }
char * memset()
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
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
static float Nwk_ObjSlack(Nwk_Obj_t *pObj)
Definition: nwk.h:157
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
static int Vec_PtrPushUnique(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:656
Aig_Man_t * Aig_ManDupDfs(Aig_Man_t *p)
Definition: aigDup.c:563
ABC_DLL Aig_Man_t * Nwk_ManStrash(Nwk_Man_t *p)
Definition: nwkStrash.c:99
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int Aig_ManChoiceLevel(Aig_Man_t *p)
Definition: aigDfs.c:581
static int Aig_WordCountOnes(unsigned uWord)
Definition: aig.h:229
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
If_LibLut_t * pLutLib
Definition: nwk.h:75
void Aig_ManSpeedupNode(Nwk_Man_t *pNtk, Aig_Man_t *pAig, Nwk_Obj_t *pNode, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vTimes)
Definition: nwkSpeedup.c:72
if(last==0)
Definition: sparse_int.h:34
static Aig_Obj_t * Aig_ObjEquiv(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:328
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
Definition: timMan.c:86
Definition: aig.h:69
static int Counter
void Tim_ManStop(Tim_Man_t *p)
Definition: timMan.c:375
Tim_Man_t * pManTime
Definition: nwk.h:74
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
unsigned Nwk_ManDelayTraceTCEdges(Nwk_Man_t *pNtk, Nwk_Obj_t *pNode, float tDelta, int fUseLutLib)
Definition: nwkSpeedup.c:158
#define Nwk_ObjForEachFanin(pObj, pFanin, i)
Definition: nwk.h:199
static int Nwk_ManObjNumMax(Nwk_Man_t *p)
Definition: nwk.h:129
#define ABC_FREE(obj)
Definition: abc_global.h:232
ABC_DLL float Nwk_ManDelayTraceLut(Nwk_Man_t *pNtk)
Definition: nwkTiming.c:326
ABC_DLL int Nwk_ManGetTotalFanins(Nwk_Man_t *pNtk)
Definition: nwkUtil.c:94
static int Nwk_ManNodeNum(Nwk_Man_t *p)
Definition: nwk.h:127
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
static int Aig_ObjRefs(Aig_Obj_t *pObj)
Definition: aig.h:300
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
#define Nwk_ManForEachNode(p, pObj, i)
Definition: nwk.h:192
ABC_DLL 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
ABC_DLL Vec_Ptr_t* Nwk_ManSupportNodes ( Nwk_Man_t pNtk,
Nwk_Obj_t **  ppNodes,
int  nNodes 
)

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

Synopsis [Returns the set of CI nodes in the support of the given nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 510 of file nwkDfs.c.

511 {
512  Vec_Ptr_t * vNodes;
513  int i;
514  // set the traversal ID
515  Nwk_ManIncrementTravId( pNtk );
516  // start the array of nodes
517  vNodes = Vec_PtrAlloc( 100 );
518  // go through the PO nodes and call for each of them
519  for ( i = 0; i < nNodes; i++ )
520  if ( Nwk_ObjIsCo(ppNodes[i]) )
521  Nwk_ManSupportNodes_rec( Nwk_ObjFanin0(ppNodes[i]), vNodes );
522  else
523  Nwk_ManSupportNodes_rec( ppNodes[i], vNodes );
524  return vNodes;
525 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Nwk_ManSupportNodes_rec(Nwk_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: nwkDfs.c:478
static int Nwk_ObjIsCo(Nwk_Obj_t *p)
Definition: nwk.h:147
ABC_DLL void Nwk_ManIncrementTravId(Nwk_Man_t *pNtk)
DECLARATIONS ///.
Definition: nwkUtil.c:47
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static Nwk_Obj_t * Nwk_ObjFanin0(Nwk_Obj_t *p)
Definition: nwk.h:140
ABC_DLL void Nwk_ManSupportSum ( Nwk_Man_t pNtk)

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

Synopsis [Computes the sum total of supports of all outputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 538 of file nwkDfs.c.

539 {
540  Vec_Ptr_t * vSupp;
541  Nwk_Obj_t * pObj;
542  int i, nTotalSupps = 0;
543  Nwk_ManForEachCo( pNtk, pObj, i )
544  {
545  vSupp = Nwk_ManSupportNodes( pNtk, &pObj, 1 );
546  nTotalSupps += Vec_PtrSize( vSupp );
547  Vec_PtrFree( vSupp );
548  }
549  printf( "Total supports = %d.\n", nTotalSupps );
550 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
#define Nwk_ManForEachCo(p, pObj, i)
Definition: nwk.h:181
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
Vec_Ptr_t * Nwk_ManSupportNodes(Nwk_Man_t *pNtk, Nwk_Obj_t **ppNodes, int nNodes)
Definition: nwkDfs.c:510
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
static int Nwk_ManTimeEqual ( float  f1,
float  f2,
float  Eps 
)
inlinestatic

Definition at line 171 of file nwk.h.

171 { return (f1 < f2 + Eps) && (f2 < f1 + Eps); }
static int Nwk_ManTimeLess ( float  f1,
float  f2,
float  Eps 
)
inlinestatic

Definition at line 172 of file nwk.h.

172 { return (f1 < f2 + Eps); }
static int Nwk_ManTimeMore ( float  f1,
float  f2,
float  Eps 
)
inlinestatic

Definition at line 173 of file nwk.h.

173 { return (f1 + Eps > f2); }
ABC_DLL void Nwk_ManUpdate ( Nwk_Obj_t pObj,
Nwk_Obj_t pObjNew,
Vec_Vec_t vLevels 
)

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

Synopsis [Replaces the node and incrementally updates levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 860 of file nwkTiming.c.

861 {
862  assert( pObj->pMan == pObjNew->pMan );
863  assert( pObj != pObjNew );
864  assert( Nwk_ObjFanoutNum(pObj) > 0 );
865  assert( Nwk_ObjIsNode(pObj) && !Nwk_ObjIsCo(pObjNew) );
866  // transfer fanouts to the old node
867  Nwk_ObjTransferFanout( pObj, pObjNew );
868  // transfer the timing information
869  // (this is needed because updating level happens if the level has changed;
870  // when we set the old level, it will be recomputed by the level updating
871  // procedure, which will update level of other nodes if there is a difference)
872  pObjNew->Level = pObj->Level;
873  pObjNew->tArrival = pObj->tArrival;
874  pObjNew->tRequired = pObj->tRequired;
875  // update required times of the old fanins
876  pObj->tRequired = TIM_ETERNITY;
877  Nwk_NodeUpdateRequired( pObj );
878  // remove the old node
879  Nwk_ManDeleteNode_rec( pObj );
880  // update the information of the new node
881  Nwk_ManUpdateLevel( pObjNew );
882  Nwk_NodeUpdateArrival( pObjNew );
883  Nwk_NodeUpdateRequired( pObjNew );
884 //Nwk_ManVerifyTiming( pObjNew->pMan );
885 }
ABC_DLL void Nwk_ManDeleteNode_rec(Nwk_Obj_t *pObj)
Definition: nwkObj.c:183
static int Nwk_ObjFanoutNum(Nwk_Obj_t *p)
Definition: nwk.h:138
ABC_DLL void Nwk_ObjTransferFanout(Nwk_Obj_t *pNodeFrom, Nwk_Obj_t *pNodeTo)
Definition: nwkFanio.c:272
void Nwk_ManUpdateLevel(Nwk_Obj_t *pObj)
Definition: nwkTiming.c:766
static int Nwk_ObjIsCo(Nwk_Obj_t *p)
Definition: nwk.h:147
static int Nwk_ObjIsNode(Nwk_Obj_t *p)
Definition: nwk.h:148
void Nwk_NodeUpdateArrival(Nwk_Obj_t *pObj)
Definition: nwkTiming.c:562
#define TIM_ETERNITY
MACRO DEFINITIONS ///.
Definition: tim.h:98
void Nwk_NodeUpdateRequired(Nwk_Obj_t *pObj)
Definition: nwkTiming.c:641
#define assert(ex)
Definition: util_old.h:213
ABC_DLL int Nwk_ManVerifyLevel ( Nwk_Man_t pNtk)

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

Synopsis [Computes the level of the node using its fanin levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 832 of file nwkTiming.c.

833 {
834  Nwk_Obj_t * pObj;
835  int LevelNew, i;
836  Nwk_ManForEachObj( pNtk, pObj, i )
837  {
838  assert( pObj->MarkA == 0 );
839  LevelNew = Nwk_ObjLevelNew( pObj );
840  if ( Nwk_ObjLevel(pObj) != LevelNew )
841  {
842  printf( "Object %6d: Mismatch betweeh levels: Actual = %d. Correct = %d.\n",
843  i, Nwk_ObjLevel(pObj), LevelNew );
844  }
845  }
846  return 1;
847 }
int Nwk_ObjLevelNew(Nwk_Obj_t *pObj)
Definition: nwkTiming.c:725
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
#define Nwk_ManForEachObj(p, pObj, i)
Definition: nwk.h:189
static int Nwk_ObjLevel(Nwk_Obj_t *pObj)
Definition: nwk.h:162
#define assert(ex)
Definition: util_old.h:213
ABC_DLL int Nwk_ManVerifyTiming ( Nwk_Man_t pNtk)

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

Synopsis [Computes the arrival times for the given node.]

Description []

SideEffects []

SeeAlso []

Definition at line 427 of file nwkTiming.c.

428 {
429  Nwk_Obj_t * pObj;
430  float tArrival, tRequired;
431  int i;
432  Nwk_ManForEachObj( pNtk, pObj, i )
433  {
434  if ( Nwk_ObjIsCi(pObj) && Nwk_ObjFanoutNum(pObj) == 0 )
435  continue;
436  tArrival = Nwk_NodeComputeArrival( pObj, 1 );
437  tRequired = Nwk_NodeComputeRequired( pObj, 1 );
438  if ( !Nwk_ManTimeEqual( tArrival, Nwk_ObjArrival(pObj), (float)0.01 ) )
439  printf( "Nwk_ManVerifyTiming(): Object %d has different arrival time (%.2f) from computed (%.2f).\n",
440  pObj->Id, Nwk_ObjArrival(pObj), tArrival );
441  if ( !Nwk_ManTimeEqual( tRequired, Nwk_ObjRequired(pObj), (float)0.01 ) )
442  printf( "Nwk_ManVerifyTiming(): Object %d has different required time (%.2f) from computed (%.2f).\n",
443  pObj->Id, Nwk_ObjRequired(pObj), tRequired );
444  }
445  return 1;
446 }
float Nwk_NodeComputeRequired(Nwk_Obj_t *pObj, int fUseSorting)
Definition: nwkTiming.c:191
static int Nwk_ObjIsCi(Nwk_Obj_t *p)
Definition: nwk.h:146
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
float Nwk_NodeComputeArrival(Nwk_Obj_t *pObj, int fUseSorting)
Definition: nwkTiming.c:131
static float Nwk_ObjArrival(Nwk_Obj_t *pObj)
Definition: nwk.h:155
static int Nwk_ManTimeEqual(float f1, float f2, float Eps)
Definition: nwk.h:171
#define Nwk_ManForEachObj(p, pObj, i)
Definition: nwk.h:189
static float Nwk_ObjRequired(Nwk_Obj_t *pObj)
Definition: nwk.h:156
ABC_DLL int Nwk_ManVerifyTopoOrder ( Nwk_Man_t pNtk)

DECLARATIONS ///.

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

FileName [nwkDfs.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Logic network representation.]

Synopsis [DFS traversals.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Verifies that the objects are in a topo order.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file nwkDfs.c.

46 {
47  Nwk_Obj_t * pObj, * pNext;
48  int i, k, iBox, iTerm1, nTerms;
49  Nwk_ManIncrementTravId( pNtk );
50  Nwk_ManForEachObj( pNtk, pObj, i )
51  {
52  if ( Nwk_ObjIsNode(pObj) || Nwk_ObjIsCo(pObj) )
53  {
54  Nwk_ObjForEachFanin( pObj, pNext, k )
55  {
56  if ( !Nwk_ObjIsTravIdCurrent(pNext) )
57  {
58  printf( "Node %d has fanin %d that is not in a topological order.\n", pObj->Id, pNext->Id );
59  return 0;
60  }
61  }
62  }
63  else if ( Nwk_ObjIsCi(pObj) )
64  {
65  if ( pNtk->pManTime )
66  {
67  iBox = Tim_ManBoxForCi( pNtk->pManTime, pObj->PioId );
68  if ( iBox >= 0 ) // this is not a true PI
69  {
70  iTerm1 = Tim_ManBoxInputFirst( pNtk->pManTime, iBox );
71  nTerms = Tim_ManBoxInputNum( pNtk->pManTime, iBox );
72  for ( k = 0; k < nTerms; k++ )
73  {
74  pNext = Nwk_ManCo( pNtk, iTerm1 + k );
75  if ( !Nwk_ObjIsTravIdCurrent(pNext) )
76  {
77  printf( "Box %d has input %d that is not in a topological order.\n", iBox, pNext->Id );
78  return 0;
79  }
80  }
81  }
82  }
83  }
84  else
85  assert( 0 );
87  }
88  return 1;
89 }
int Tim_ManBoxForCi(Tim_Man_t *p, int iCo)
Definition: timBox.c:86
static Nwk_Obj_t * Nwk_ManCo(Nwk_Man_t *p, int i)
Definition: nwk.h:132
static int Nwk_ObjIsCi(Nwk_Obj_t *p)
Definition: nwk.h:146
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
static void Nwk_ObjSetTravIdCurrent(Nwk_Obj_t *pObj)
Definition: nwk.h:166
static int Nwk_ObjIsCo(Nwk_Obj_t *p)
Definition: nwk.h:147
static int Nwk_ObjIsTravIdCurrent(Nwk_Obj_t *pObj)
Definition: nwk.h:168
ABC_DLL void Nwk_ManIncrementTravId(Nwk_Man_t *pNtk)
DECLARATIONS ///.
Definition: nwkUtil.c:47
Tim_Man_t * pManTime
Definition: nwk.h:74
int Tim_ManBoxInputNum(Tim_Man_t *p, int iBox)
Definition: timBox.c:186
static int Nwk_ObjIsNode(Nwk_Obj_t *p)
Definition: nwk.h:148
#define Nwk_ObjForEachFanin(pObj, pFanin, i)
Definition: nwk.h:199
#define Nwk_ManForEachObj(p, pObj, i)
Definition: nwk.h:189
#define assert(ex)
Definition: util_old.h:213
int Tim_ManBoxInputFirst(Tim_Man_t *p, int iBox)
Definition: timBox.c:122
ABC_DLL Nwk_Man_t* Nwk_MappingIf ( Aig_Man_t p,
Tim_Man_t pManTime,
If_Par_t pPars 
)

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

Synopsis [Interface with the FPGA mapping package.]

Description []

SideEffects []

SeeAlso []

Definition at line 360 of file nwkMap.c.

361 {
362  Nwk_Man_t * pNtk;
363  If_Man_t * pIfMan;
364  Vec_Ptr_t * vAigToIf;
365  // set the arrival times
366  pPars->pTimesArr = ABC_ALLOC( float, Aig_ManCiNum(p) );
367  memset( pPars->pTimesArr, 0, sizeof(float) * Aig_ManCiNum(p) );
368  // translate into the mapper
369  vAigToIf = Vec_PtrStart( Aig_ManObjNumMax(p) );
370  pIfMan = Nwk_ManToIf( p, pPars, vAigToIf );
371  if ( pIfMan == NULL )
372  return NULL;
373  pIfMan->pManTim = Tim_ManDup( pManTime, 0 );
374  pIfMan->pPars->fCutMin = 0; // is not compatible with deriving result
375  if ( !If_ManPerformMapping( pIfMan ) )
376  {
377  If_ManStop( pIfMan );
378  return NULL;
379  }
380  // transform the result of mapping into the new network
381  pNtk = Nwk_ManFromIf( pIfMan, p, vAigToIf );
382  if ( pPars->fBidec && pPars->nLutSize <= 8 )
383  Nwk_ManBidecResyn( pNtk, 0 );
384  If_ManStop( pIfMan );
385  Vec_PtrFree( vAigToIf );
386  return pNtk;
387 }
char * memset()
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
int nLutSize
Definition: if.h:103
static Llb_Mgr_t * p
Definition: llb3Image.c:950
If_Man_t * Nwk_ManToIf(Aig_Man_t *p, If_Par_t *pPars, Vec_Ptr_t *vAigToIf)
Definition: nwkMap.c:103
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Tim_Man_t * pManTim
Definition: if.h:263
Definition: nwk.h:61
Definition: if.h:180
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
float * pTimesArr
Definition: if.h:161
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
Definition: timMan.c:86
int fBidec
Definition: if.h:125
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
If_Par_t * pPars
Definition: if.h:184
int If_ManPerformMapping(If_Man_t *p)
Definition: ifCore.c:80
ABC_DLL void Nwk_ManBidecResyn(Nwk_Man_t *p, int fVerbose)
Definition: nwkBidec.c:129
int fCutMin
Definition: if.h:120
Nwk_Man_t * Nwk_ManFromIf(If_Man_t *pIfMan, Aig_Man_t *p, Vec_Ptr_t *vAigToIf)
Definition: nwkMap.c:275
void If_ManStop(If_Man_t *p)
Definition: ifMan.c:205
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL int Nwk_NodeCompareLevelsDecrease ( Nwk_Obj_t **  pp1,
Nwk_Obj_t **  pp2 
)

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

Synopsis [Procedure used for sorting the nodes in decreasing order of levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 205 of file nwkUtil.c.

206 {
207  int Diff = (*pp1)->Level - (*pp2)->Level;
208  if ( Diff > 0 )
209  return -1;
210  if ( Diff < 0 )
211  return 1;
212  return 0;
213 }
ABC_DLL int Nwk_NodeCompareLevelsIncrease ( Nwk_Obj_t **  pp1,
Nwk_Obj_t **  pp2 
)

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

Synopsis [Procedure used for sorting the nodes in increasing order of levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 184 of file nwkUtil.c.

185 {
186  int Diff = (*pp1)->Level - (*pp2)->Level;
187  if ( Diff < 0 )
188  return -1;
189  if ( Diff > 0 )
190  return 1;
191  return 0;
192 }
ABC_DLL Hop_Obj_t* Nwk_NodeIfNodeResyn ( Bdc_Man_t p,
Hop_Man_t pHop,
Hop_Obj_t pRoot,
int  nVars,
Vec_Int_t vTruth,
unsigned *  puCare,
float  dProb 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Resynthesizes nodes using bi-decomposition.]

Description []

SideEffects []

SeeAlso []

Definition at line 67 of file nwkBidec.c.

68 {
69  unsigned * pTruth;
70  Bdc_Fun_t * pFunc;
71  int nNodes, i;
72  assert( nVars <= 16 );
73  // derive truth table
74  pTruth = Hop_ManConvertAigToTruth( pHop, Hop_Regular(pRoot), nVars, vTruth, 0 );
75  if ( Hop_IsComplement(pRoot) )
76  for ( i = Abc_TruthWordNum(nVars)-1; i >= 0; i-- )
77  pTruth[i] = ~pTruth[i];
78  // perform power-aware decomposition
79  if ( dProb >= 0.0 )
80  {
81  float Prob = (float)2.0 * dProb * (1.0 - dProb);
82  assert( Prob >= 0.0 && Prob <= 0.5 );
83  if ( Prob >= 0.4 )
84  {
85  Extra_TruthNot( puCare, puCare, nVars );
86  if ( dProb > 0.5 ) // more 1s than 0s
87  Extra_TruthOr( pTruth, pTruth, puCare, nVars );
88  else
89  Extra_TruthSharp( pTruth, pTruth, puCare, nVars );
90  Extra_TruthNot( puCare, puCare, nVars );
91  // decompose truth table
92  Bdc_ManDecompose( p, pTruth, NULL, nVars, NULL, 1000 );
93  }
94  else
95  {
96  // decompose truth table
97  Bdc_ManDecompose( p, pTruth, puCare, nVars, NULL, 1000 );
98  }
99  }
100  else
101  {
102  // decompose truth table
103  Bdc_ManDecompose( p, pTruth, puCare, nVars, NULL, 1000 );
104  }
105  // convert back into HOP
106  Bdc_FuncSetCopy( Bdc_ManFunc( p, 0 ), Hop_ManConst1( pHop ) );
107  for ( i = 0; i < nVars; i++ )
108  Bdc_FuncSetCopy( Bdc_ManFunc( p, i+1 ), Hop_ManPi( pHop, i ) );
109  nNodes = Bdc_ManNodeNum(p);
110  for ( i = nVars + 1; i < nNodes; i++ )
111  {
112  pFunc = Bdc_ManFunc( p, i );
114  }
115  return Bdc_FunCopyHop( Bdc_ManRoot(p) );
116 }
Bdc_Fun_t * Bdc_ManRoot(Bdc_Man_t *p)
Definition: bdcCore.c:47
static Hop_Obj_t * Bdc_FunCopyHop(Bdc_Fun_t *pObj)
Definition: nwkBidec.c:50
static Hop_Obj_t * Hop_ManConst1(Hop_Man_t *p)
Definition: hop.h:132
Hop_Obj_t * Hop_And(Hop_Man_t *p, Hop_Obj_t *p0, Hop_Obj_t *p1)
Definition: hopOper.c:104
static int Abc_TruthWordNum(int nVars)
Definition: abc_global.h:256
int Bdc_ManDecompose(Bdc_Man_t *p, unsigned *puFunc, unsigned *puCare, int nVars, Vec_Ptr_t *vDivs, int nNodesMax)
Definition: bdcCore.c:291
Bdc_Fun_t * Bdc_ManFunc(Bdc_Man_t *p, int i)
DECLARATIONS ///.
Definition: bdcCore.c:46
static Hop_Obj_t * Hop_ManPi(Hop_Man_t *p, int i)
Definition: hop.h:134
void Bdc_FuncSetCopy(Bdc_Fun_t *p, void *pCopy)
Definition: bdcCore.c:54
typedefABC_NAMESPACE_HEADER_START struct Bdc_Fun_t_ Bdc_Fun_t
INCLUDES ///.
Definition: bdc.h:42
static void Extra_TruthNot(unsigned *pOut, unsigned *pIn, int nVars)
Definition: nwkBidec.c:31
static int Hop_IsComplement(Hop_Obj_t *p)
Definition: hop.h:129
static void Extra_TruthSharp(unsigned *pOut, unsigned *pIn0, unsigned *pIn1, int nVars)
Definition: nwkBidec.c:43
Bdc_Fun_t * Bdc_FuncFanin0(Bdc_Fun_t *p)
Definition: bdcCore.c:50
static void Extra_TruthOr(unsigned *pOut, unsigned *pIn0, unsigned *pIn1, int nVars)
Definition: nwkBidec.c:37
unsigned * Hop_ManConvertAigToTruth(Hop_Man_t *p, Hop_Obj_t *pRoot, int nVars, Vec_Int_t *vTruth, int fMsbFirst)
Definition: hopTruth.c:143
int Bdc_ManNodeNum(Bdc_Man_t *p)
Definition: bdcCore.c:48
#define assert(ex)
Definition: util_old.h:213
Bdc_Fun_t * Bdc_FuncFanin1(Bdc_Fun_t *p)
Definition: bdcCore.c:51
static Hop_Obj_t * Hop_Regular(Hop_Obj_t *p)
Definition: hop.h:126
ABC_DLL void Nwk_ObjAddFanin ( Nwk_Obj_t pObj,
Nwk_Obj_t pFanin 
)

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

Synopsis [Creates fanout/fanin relationship between the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 165 of file nwkFanio.c.

166 {
167  int i;
168  assert( pObj->pMan == pFanin->pMan );
169  assert( pObj->Id >= 0 && pFanin->Id >= 0 );
170  if ( Nwk_ObjReallocIsNeeded(pObj) )
171  Nwk_ManReallocNode( pObj );
172  if ( Nwk_ObjReallocIsNeeded(pFanin) )
173  Nwk_ManReallocNode( pFanin );
174  for ( i = pObj->nFanins + pObj->nFanouts; i > pObj->nFanins; i-- )
175  pObj->pFanio[i] = pObj->pFanio[i-1];
176  pObj->pFanio[pObj->nFanins++] = pFanin;
177  pFanin->pFanio[pFanin->nFanins + pFanin->nFanouts++] = pObj;
178  pObj->Level = Abc_MaxInt( pObj->Level, pFanin->Level + Nwk_ObjIsNode(pObj) );
179 }
static Nwk_Obj_t * Nwk_ManReallocNode(Nwk_Obj_t *pObj)
Definition: nwkFanio.c:143
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static int Nwk_ObjIsNode(Nwk_Obj_t *p)
Definition: nwk.h:148
#define assert(ex)
Definition: util_old.h:213
static int Nwk_ObjReallocIsNeeded(Nwk_Obj_t *pObj)
Definition: nwkFanio.c:127
static float Nwk_ObjArrival ( Nwk_Obj_t pObj)
inlinestatic

Definition at line 155 of file nwk.h.

155 { return pObj->tArrival; }
ABC_DLL void Nwk_ObjCollectFanins ( Nwk_Obj_t pNode,
Vec_Ptr_t vNodes 
)

DECLARATIONS ///.

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

FileName [nwkFanio.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Logic network representation.]

Synopsis [Manipulation of fanins/fanouts.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Collects fanins of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file nwkFanio.c.

46 {
47  Nwk_Obj_t * pFanin;
48  int i;
49  Vec_PtrClear(vNodes);
50  Nwk_ObjForEachFanin( pNode, pFanin, i )
51  Vec_PtrPush( vNodes, pFanin );
52 }
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
#define Nwk_ObjForEachFanin(pObj, pFanin, i)
Definition: nwk.h:199
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
ABC_DLL void Nwk_ObjCollectFanouts ( Nwk_Obj_t pNode,
Vec_Ptr_t vNodes 
)

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

Synopsis [Collects fanouts of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 65 of file nwkFanio.c.

66 {
67  Nwk_Obj_t * pFanout;
68  int i;
69  Vec_PtrClear(vNodes);
70  Nwk_ObjForEachFanout( pNode, pFanout, i )
71  Vec_PtrPush( vNodes, pFanout );
72 }
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
#define Nwk_ObjForEachFanout(pObj, pFanout, i)
Definition: nwk.h:201
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
ABC_DLL void Nwk_ObjDeleteFanin ( Nwk_Obj_t pObj,
Nwk_Obj_t pFanin 
)

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

Synopsis [Removes fanout/fanin relationship between the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 192 of file nwkFanio.c.

193 {
194  int i, k, Limit, fFound;
195  // remove pFanin from the fanin list of pObj
196  Limit = pObj->nFanins + pObj->nFanouts;
197  fFound = 0;
198  for ( k = i = 0; i < Limit; i++ )
199  if ( fFound || pObj->pFanio[i] != pFanin )
200  pObj->pFanio[k++] = pObj->pFanio[i];
201  else
202  fFound = 1;
203  assert( i == k + 1 ); // if it fails, likely because of duplicated fanin
204  pObj->nFanins--;
205  // remove pObj from the fanout list of pFanin
206  Limit = pFanin->nFanins + pFanin->nFanouts;
207  fFound = 0;
208  for ( k = i = pFanin->nFanins; i < Limit; i++ )
209  if ( fFound || pFanin->pFanio[i] != pObj )
210  pFanin->pFanio[k++] = pFanin->pFanio[i];
211  else
212  fFound = 1;
213  assert( i == k + 1 ); // if it fails, likely because of duplicated fanout
214  pFanin->nFanouts--;
215 }
#define assert(ex)
Definition: util_old.h:213
static Nwk_Obj_t* Nwk_ObjFanin ( Nwk_Obj_t p,
int  i 
)
inlinestatic

Definition at line 142 of file nwk.h.

142 { return p->pFanio[i]; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Nwk_Obj_t* Nwk_ObjFanin0 ( Nwk_Obj_t p)
inlinestatic

Definition at line 140 of file nwk.h.

140 { return p->pFanio[0]; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Nwk_ObjFaninNum ( Nwk_Obj_t p)
inlinestatic

Definition at line 137 of file nwk.h.

137 { return p->nFanins; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Nwk_Obj_t* Nwk_ObjFanout ( Nwk_Obj_t p,
int  i 
)
inlinestatic

Definition at line 143 of file nwk.h.

143 { return p->pFanio[p->nFanins+1]; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Nwk_Obj_t* Nwk_ObjFanout0 ( Nwk_Obj_t p)
inlinestatic

Definition at line 141 of file nwk.h.

141 { return p->pFanio[p->nFanins]; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Nwk_ObjFanoutNum ( Nwk_Obj_t p)
inlinestatic

Definition at line 138 of file nwk.h.

138 { return p->nFanouts; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
ABC_DLL int Nwk_ObjFindFanin ( Nwk_Obj_t pObj,
Nwk_Obj_t pFanin 
)

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

Synopsis [Returns the number of the fanin of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 85 of file nwkFanio.c.

86 {
87  Nwk_Obj_t * pTemp;
88  int i;
89  Nwk_ObjForEachFanin( pObj, pTemp, i )
90  if ( pTemp == pFanin )
91  return i;
92  return -1;
93 }
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
if(last==0)
Definition: sparse_int.h:34
#define Nwk_ObjForEachFanin(pObj, pFanin, i)
Definition: nwk.h:199
ABC_DLL int Nwk_ObjFindFanout ( Nwk_Obj_t pObj,
Nwk_Obj_t pFanout 
)

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

Synopsis [Returns the number of the fanout of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 106 of file nwkFanio.c.

107 {
108  Nwk_Obj_t * pTemp;
109  int i;
110  Nwk_ObjForEachFanout( pObj, pTemp, i )
111  if ( pTemp == pFanout )
112  return i;
113  return -1;
114 }
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
#define Nwk_ObjForEachFanout(pObj, pFanout, i)
Definition: nwk.h:201
if(last==0)
Definition: sparse_int.h:34
static int Nwk_ObjId ( Nwk_Obj_t p)
inlinestatic

Definition at line 135 of file nwk.h.

135 { return p->Id; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Nwk_ObjIsCi ( Nwk_Obj_t p)
inlinestatic

Definition at line 146 of file nwk.h.

146 { return p->Type == NWK_OBJ_CI; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Definition: nwk.h:54
static int Nwk_ObjIsCo ( Nwk_Obj_t p)
inlinestatic

Definition at line 147 of file nwk.h.

147 { return p->Type == NWK_OBJ_CO; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Definition: nwk.h:55
static int Nwk_ObjIsLatch ( Nwk_Obj_t p)
inlinestatic

Definition at line 149 of file nwk.h.

149 { return p->Type == NWK_OBJ_LATCH; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Nwk_ObjIsLi ( Nwk_Obj_t p)
inlinestatic

Definition at line 152 of file nwk.h.

152 { return p->pMan->nTruePos && Nwk_ObjIsCo(p) && (int)p->PioId >= p->pMan->nTruePos; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Nwk_ObjIsCo(Nwk_Obj_t *p)
Definition: nwk.h:147
static int Nwk_ObjIsLo ( Nwk_Obj_t p)
inlinestatic

Definition at line 153 of file nwk.h.

153 { return p->pMan->nTruePis && Nwk_ObjIsCi(p) && (int)p->PioId >= p->pMan->nTruePis; }
static int Nwk_ObjIsCi(Nwk_Obj_t *p)
Definition: nwk.h:146
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Nwk_ObjIsNode ( Nwk_Obj_t p)
inlinestatic

Definition at line 148 of file nwk.h.

148 { return p->Type == NWK_OBJ_NODE; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Nwk_ObjIsNone ( Nwk_Obj_t p)
inlinestatic

Definition at line 145 of file nwk.h.

145 { return p->Type == NWK_OBJ_NONE; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Nwk_ObjIsPi ( Nwk_Obj_t p)
inlinestatic

Definition at line 150 of file nwk.h.

150 { return Nwk_ObjIsCi(p) && (p->pMan->pManTime == NULL || Tim_ManBoxForCi(p->pMan->pManTime, p->PioId) == -1); }
int Tim_ManBoxForCi(Tim_Man_t *p, int iCo)
Definition: timBox.c:86
static int Nwk_ObjIsCi(Nwk_Obj_t *p)
Definition: nwk.h:146
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Nwk_ObjIsPo ( Nwk_Obj_t p)
inlinestatic

Definition at line 151 of file nwk.h.

151 { return Nwk_ObjIsCo(p) && (p->pMan->pManTime == NULL || Tim_ManBoxForCo(p->pMan->pManTime, p->PioId) == -1); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Tim_ManBoxForCo(Tim_Man_t *p, int iCi)
Definition: timBox.c:104
static int Nwk_ObjIsCo(Nwk_Obj_t *p)
Definition: nwk.h:147
static int Nwk_ObjIsTravIdCurrent ( Nwk_Obj_t pObj)
inlinestatic

Definition at line 168 of file nwk.h.

168 { return pObj->TravId == pObj->pMan->nTravIds; }
static int Nwk_ObjIsTravIdPrevious ( Nwk_Obj_t pObj)
inlinestatic

Definition at line 169 of file nwk.h.

169 { return pObj->TravId == pObj->pMan->nTravIds - 1; }
static int Nwk_ObjLevel ( Nwk_Obj_t pObj)
inlinestatic

Definition at line 162 of file nwk.h.

162 { return pObj->Level; }
ABC_DLL int Nwk_ObjMffcLabel ( Nwk_Obj_t pNode)

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

Synopsis [Collects the internal nodes of the MFFC limited by cut.]

Description []

SideEffects [Increments the trav ID and marks visited nodes.]

SeeAlso []

Definition at line 644 of file nwkDfs.c.

645 {
646  int Count1, Count2;
647  // dereference the node
648  Count1 = Nwk_ObjDeref_rec( pNode );
649  // collect the nodes inside the MFFC
650  Nwk_ManIncrementTravId( pNode->pMan );
651  Nwk_ObjMffcLabel_rec( pNode, 1 );
652  // reference it back
653  Count2 = Nwk_ObjRef_rec( pNode );
654  assert( Count1 == Count2 );
655  return Count1;
656 }
void Nwk_ObjMffcLabel_rec(Nwk_Obj_t *pNode, int fTopmost)
Definition: nwkDfs.c:615
int Nwk_ObjDeref_rec(Nwk_Obj_t *pNode)
Definition: nwkDfs.c:564
int Nwk_ObjRef_rec(Nwk_Obj_t *pNode)
Definition: nwkDfs.c:590
ABC_DLL void Nwk_ManIncrementTravId(Nwk_Man_t *pNtk)
DECLARATIONS ///.
Definition: nwkUtil.c:47
#define assert(ex)
Definition: util_old.h:213
ABC_DLL void Nwk_ObjPatchFanin ( Nwk_Obj_t pObj,
Nwk_Obj_t pFaninOld,
Nwk_Obj_t pFaninNew 
)

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 231 of file nwkFanio.c.

232 {
233  int i, k, iFanin, Limit;
234  assert( pFaninOld != pFaninNew );
235  assert( pObj != pFaninOld );
236  assert( pObj != pFaninNew );
237  assert( pObj->pMan == pFaninOld->pMan );
238  assert( pObj->pMan == pFaninNew->pMan );
239  // update the fanin
240  iFanin = Nwk_ObjFindFanin( pObj, pFaninOld );
241  if ( iFanin == -1 )
242  {
243  printf( "Nwk_ObjPatchFanin(); Error! Node %d is not among", pFaninOld->Id );
244  printf( " the fanins of node %d...\n", pObj->Id );
245  return;
246  }
247  pObj->pFanio[iFanin] = pFaninNew;
248  // remove pObj from the fanout list of pFaninOld
249  Limit = pFaninOld->nFanins + pFaninOld->nFanouts;
250  for ( k = i = pFaninOld->nFanins; i < Limit; i++ )
251  if ( pFaninOld->pFanio[i] != pObj )
252  pFaninOld->pFanio[k++] = pFaninOld->pFanio[i];
253  pFaninOld->nFanouts--;
254  // add pObj to the fanout list of pFaninNew
255  if ( Nwk_ObjReallocIsNeeded(pFaninNew) )
256  Nwk_ManReallocNode( pFaninNew );
257  pFaninNew->pFanio[pFaninNew->nFanins + pFaninNew->nFanouts++] = pObj;
258 }
static Nwk_Obj_t * Nwk_ManReallocNode(Nwk_Obj_t *pObj)
Definition: nwkFanio.c:143
int Nwk_ObjFindFanin(Nwk_Obj_t *pObj, Nwk_Obj_t *pFanin)
Definition: nwkFanio.c:85
#define assert(ex)
Definition: util_old.h:213
static int Nwk_ObjReallocIsNeeded(Nwk_Obj_t *pObj)
Definition: nwkFanio.c:127
static int Nwk_ObjPioNum ( Nwk_Obj_t p)
inlinestatic

Definition at line 136 of file nwk.h.

136 { return p->PioId; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
ABC_DLL void Nwk_ObjPrint ( Nwk_Obj_t pObj)

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

Synopsis [Prints the objects.]

Description []

SideEffects []

SeeAlso []

Definition at line 226 of file nwkUtil.c.

227 {
228  Nwk_Obj_t * pNext;
229  int i;
230  printf( "ObjId = %5d. ", pObj->Id );
231  if ( Nwk_ObjIsPi(pObj) )
232  printf( "PI" );
233  if ( Nwk_ObjIsPo(pObj) )
234  printf( "PO" );
235  if ( Nwk_ObjIsNode(pObj) )
236  printf( "Node" );
237  printf( " Fanins = " );
238  Nwk_ObjForEachFanin( pObj, pNext, i )
239  printf( "%d ", pNext->Id );
240  printf( " Fanouts = " );
241  Nwk_ObjForEachFanout( pObj, pNext, i )
242  printf( "%d ", pNext->Id );
243  printf( "\n" );
244 }
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
static int Nwk_ObjIsPi(Nwk_Obj_t *p)
Definition: nwk.h:150
#define Nwk_ObjForEachFanout(pObj, pFanout, i)
Definition: nwk.h:201
static int Nwk_ObjIsPo(Nwk_Obj_t *p)
Definition: nwk.h:151
static int Nwk_ObjIsNode(Nwk_Obj_t *p)
Definition: nwk.h:148
#define Nwk_ObjForEachFanin(pObj, pFanin, i)
Definition: nwk.h:199
ABC_DLL void Nwk_ObjReplace ( Nwk_Obj_t pNodeOld,
Nwk_Obj_t pNodeNew 
)

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

Synopsis [Replaces the node by a new node.]

Description []

SideEffects []

SeeAlso []

Definition at line 302 of file nwkFanio.c.

303 {
304  assert( pNodeOld->pMan == pNodeNew->pMan );
305  assert( pNodeOld != pNodeNew );
306  assert( Nwk_ObjFanoutNum(pNodeOld) > 0 );
307  // transfer the fanouts to the old node
308  Nwk_ObjTransferFanout( pNodeOld, pNodeNew );
309  // remove the old node
310  Nwk_ManDeleteNode_rec( pNodeOld );
311 }
ABC_DLL void Nwk_ManDeleteNode_rec(Nwk_Obj_t *pObj)
Definition: nwkObj.c:183
static int Nwk_ObjFanoutNum(Nwk_Obj_t *p)
Definition: nwk.h:138
#define assert(ex)
Definition: util_old.h:213
void Nwk_ObjTransferFanout(Nwk_Obj_t *pNodeFrom, Nwk_Obj_t *pNodeTo)
Definition: nwkFanio.c:272
static float Nwk_ObjRequired ( Nwk_Obj_t pObj)
inlinestatic

Definition at line 156 of file nwk.h.

156 { return pObj->tRequired; }
static void Nwk_ObjSetArrival ( Nwk_Obj_t pObj,
float  Time 
)
inlinestatic

Definition at line 158 of file nwk.h.

158 { pObj->tArrival = Time; }
static void Nwk_ObjSetLevel ( Nwk_Obj_t pObj,
int  Level 
)
inlinestatic

Definition at line 163 of file nwk.h.

163 { pObj->Level = Level; }
static void Nwk_ObjSetRequired ( Nwk_Obj_t pObj,
float  Time 
)
inlinestatic

Definition at line 159 of file nwk.h.

159 { pObj->tRequired = Time; }
static void Nwk_ObjSetSlack ( Nwk_Obj_t pObj,
float  Time 
)
inlinestatic

Definition at line 160 of file nwk.h.

160 { pObj->tSlack = Time; }
static void Nwk_ObjSetTravId ( Nwk_Obj_t pObj,
int  TravId 
)
inlinestatic

Definition at line 165 of file nwk.h.

165 { pObj->TravId = TravId; }
static void Nwk_ObjSetTravIdCurrent ( Nwk_Obj_t pObj)
inlinestatic

Definition at line 166 of file nwk.h.

166 { pObj->TravId = pObj->pMan->nTravIds; }
static void Nwk_ObjSetTravIdPrevious ( Nwk_Obj_t pObj)
inlinestatic

Definition at line 167 of file nwk.h.

167 { pObj->TravId = pObj->pMan->nTravIds - 1; }
static float Nwk_ObjSlack ( Nwk_Obj_t pObj)
inlinestatic

Definition at line 157 of file nwk.h.

157 { return pObj->tSlack; }
ABC_DLL void Nwk_ObjTransferFanout ( Nwk_Obj_t pNodeFrom,
Nwk_Obj_t pNodeTo 
)

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

Synopsis [Transfers fanout from the old node to the new node.]

Description []

SideEffects []

SeeAlso []

Definition at line 272 of file nwkFanio.c.

273 {
274  Vec_Ptr_t * vFanouts = pNodeFrom->pMan->vTemp;
275  Nwk_Obj_t * pTemp;
276  int nFanoutsOld, i;
277  assert( !Nwk_ObjIsCo(pNodeFrom) && !Nwk_ObjIsCo(pNodeTo) );
278  assert( pNodeFrom->pMan == pNodeTo->pMan );
279  assert( pNodeFrom != pNodeTo );
280  assert( Nwk_ObjFanoutNum(pNodeFrom) > 0 );
281  // get the fanouts of the old node
282  nFanoutsOld = Nwk_ObjFanoutNum(pNodeTo);
283  Nwk_ObjCollectFanouts( pNodeFrom, vFanouts );
284  // patch the fanin of each of them
285  Vec_PtrForEachEntry( Nwk_Obj_t *, vFanouts, pTemp, i )
286  Nwk_ObjPatchFanin( pTemp, pNodeFrom, pNodeTo );
287  assert( Nwk_ObjFanoutNum(pNodeFrom) == 0 );
288  assert( Nwk_ObjFanoutNum(pNodeTo) == nFanoutsOld + Vec_PtrSize(vFanouts) );
289 }
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 int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Nwk_ObjIsCo(Nwk_Obj_t *p)
Definition: nwk.h:147
void Nwk_ObjCollectFanouts(Nwk_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: nwkFanio.c:65
void Nwk_ObjPatchFanin(Nwk_Obj_t *pObj, Nwk_Obj_t *pFaninOld, Nwk_Obj_t *pFaninNew)
Definition: nwkFanio.c:231
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_DLL float Nwl_ManComputeTotalSwitching ( Nwk_Man_t pNtk)

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

Synopsis [Marks nodes for power-optimization.]

Description []

SideEffects []

SeeAlso []

Definition at line 198 of file nwkMan.c.

199 {
200  extern Vec_Int_t * Saig_ManComputeSwitchProbs( Aig_Man_t * p, int nFrames, int nPref, int fProbOne );
201  Vec_Int_t * vSwitching;
202  float * pSwitching;
203  Aig_Man_t * pAig;
204  Aig_Obj_t * pObjAig;
205  Nwk_Obj_t * pObjAbc;
206  float Result = (float)0;
207  int i;
208  // strash the network
209  // map network into an AIG
210  pAig = Nwk_ManStrash( pNtk );
211  vSwitching = Saig_ManComputeSwitchProbs( pAig, 48, 16, 0 );
212  pSwitching = (float *)vSwitching->pArray;
213  Nwk_ManForEachObj( pNtk, pObjAbc, i )
214  {
215  if ( (pObjAig = Aig_Regular((Aig_Obj_t *)pObjAbc->pCopy)) )
216  Result += Nwk_ObjFanoutNum(pObjAbc) * pSwitching[pObjAig->Id];
217  }
218  Vec_IntFree( vSwitching );
219  Aig_ManStop( pAig );
220  return Result;
221 }
static int Nwk_ObjFanoutNum(Nwk_Obj_t *p)
Definition: nwk.h:138
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
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
ABC_DLL Aig_Man_t * Nwk_ManStrash(Nwk_Man_t *p)
Definition: nwkStrash.c:99
Vec_Int_t * Saig_ManComputeSwitchProbs(Aig_Man_t *pAig, int nFrames, int nPref, int fProbOne)
Definition: giaSwitch.c:684
Definition: aig.h:69
#define Nwk_ManForEachObj(p, pObj, i)
Definition: nwk.h:189
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
int Id
Definition: aig.h:85