abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
abcHieNew.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "misc/vec/vec.h"
#include "misc/util/utilNam.h"
#include "misc/extra/extra.h"
#include "abc.h"
#include "aig/gia/gia.h"

Go to the source code of this file.

Data Structures

struct  Au_Obj_t_
 
struct  Au_Ntk_t_
 
struct  Au_Man_t_
 

Macros

#define AU_MAX_FANINS   0x1FFFFFFF
 DECLARATIONS ///. More...
 
#define Au_ManForEachNtk(p, pNtk, i)   for ( i = 1; (i < Vec_PtrSize(&p->vNtks)) && (((pNtk) = Au_ManNtk(p, i)), 1); i++ )
 
#define Au_ManForEachNtkReverse(p, pNtk, i)   for ( i = Vec_PtrSize(&p->vNtks) - 1;(i>=1) && (((pNtk) = Au_ManNtk(p, i)), 1); i-- )
 
#define Au_ObjForEachFaninId(pObj, hFanin, i)   for ( i = 0; (i < Au_ObjFaninNum(pObj)) && (((hFanin) = Au_ObjFaninId(pObj, i)), 1); i++ )
 
#define Au_BoxForEachFanoutId(pObj, hFanout, i)   for ( i = 0; (i < Au_BoxFanoutNum(pObj)) && (((hFanout) = Au_BoxFanoutId(pObj, i)), 1); i++ )
 
#define Au_ObjForEachFanin(pObj, pFanin, i)   for ( i = 0; (i < Au_ObjFaninNum(pObj)) && (((pFanin) = Au_ObjFanin(pObj, i)), 1); i++ )
 
#define Au_BoxForEachFanout(pObj, pFanout, i)   for ( i = 0; (i < Au_BoxFanoutNum(pObj)) && (((pFanout) = Au_BoxFanout(pObj, i)), 1); i++ )
 
#define Au_NtkForEachPi(p, pObj, i)   for ( i = 0; (i < Vec_IntSize(&p->vPis)) && (((pObj) = Au_NtkPi(p, i)), 1); i++ )
 
#define Au_NtkForEachPo(p, pObj, i)   for ( i = 0; (i < Vec_IntSize(&p->vPos)) && (((pObj) = Au_NtkPo(p, i)), 1); i++ )
 
#define Au_NtkForEachObj(p, pObj, i)   for ( i = 0; (i < Vec_IntSize(&p->vObjs)) && (((pObj) = Au_NtkObjI(p, i)), 1); i++ )
 
#define Au_NtkForEachNode(p, pObj, i)   for ( i = 0; (i < Vec_IntSize(&p->vObjs)) && (((pObj) = Au_NtkObjI(p, i)), 1); i++ ) if ( !Au_ObjIsNode(pObj) ) {} else
 
#define Au_NtkForEachBox(p, pObj, i)   for ( i = 0; (i < Vec_IntSize(&p->vObjs)) && (((pObj) = Au_NtkObjI(p, i)), 1); i++ ) if ( !Au_ObjIsBox(pObj) ) {} else
 
#define AU_VAL0   1
 
#define AU_VAL1   2
 
#define AU_VALX   3
 

Typedefs

typedef struct Au_Man_t_ Au_Man_t
 
typedef struct Au_Ntk_t_ Au_Ntk_t
 
typedef struct Au_Obj_t_ Au_Obj_t
 

Enumerations

enum  Au_Type_t {
  AU_OBJ_NONE, AU_OBJ_CONST0, AU_OBJ_PI, AU_OBJ_PO,
  AU_OBJ_FAN, AU_OBJ_FLOP, AU_OBJ_BOX, AU_OBJ_NODE,
  AU_OBJ_VOID
}
 

Functions

static int Au_Var2Lit (int Var, int fCompl)
 
static int Au_Lit2Var (int Lit)
 
static int Au_LitIsCompl (int Lit)
 
static int Au_LitNot (int Lit)
 
static int Au_LitNotCond (int Lit, int c)
 
static int Au_LitRegular (int Lit)
 
static Au_Obj_tAu_Regular (Au_Obj_t *p)
 
static Au_Obj_tAu_Not (Au_Obj_t *p)
 
static Au_Obj_tAu_NotCond (Au_Obj_t *p, int c)
 
static int Au_IsComplement (Au_Obj_t *p)
 
static char * Au_UtilStrsav (char *s)
 
static char * Au_ManName (Au_Man_t *p)
 
static int Au_ManNtkNum (Au_Man_t *p)
 
static Au_Ntk_tAu_ManNtk (Au_Man_t *p, int i)
 
static Au_Ntk_tAu_ManNtkRoot (Au_Man_t *p)
 
static char * Au_NtkName (Au_Ntk_t *p)
 
static Au_Man_tAu_NtkMan (Au_Ntk_t *p)
 
static int Au_NtkPiNum (Au_Ntk_t *p)
 
static int Au_NtkPoNum (Au_Ntk_t *p)
 
static int Au_NtkFanNum (Au_Ntk_t *p)
 
static int Au_NtkFlopNum (Au_Ntk_t *p)
 
static int Au_NtkBoxNum (Au_Ntk_t *p)
 
static int Au_NtkNodeNum (Au_Ntk_t *p)
 
static int Au_NtkObjNumMax (Au_Ntk_t *p)
 
static int Au_NtkObjNum (Au_Ntk_t *p)
 
static Au_Obj_tAu_NtkObj (Au_Ntk_t *p, int h)
 
static Au_Obj_tAu_NtkPi (Au_Ntk_t *p, int i)
 
static Au_Obj_tAu_NtkPo (Au_Ntk_t *p, int i)
 
static Au_Obj_tAu_NtkObjI (Au_Ntk_t *p, int i)
 
static int Au_ObjIsNone (Au_Obj_t *p)
 
static int Au_ObjIsConst0 (Au_Obj_t *p)
 
static int Au_ObjIsPi (Au_Obj_t *p)
 
static int Au_ObjIsPo (Au_Obj_t *p)
 
static int Au_ObjIsFan (Au_Obj_t *p)
 
static int Au_ObjIsFlop (Au_Obj_t *p)
 
static int Au_ObjIsBox (Au_Obj_t *p)
 
static int Au_ObjIsNode (Au_Obj_t *p)
 
static int Au_ObjIsTerm (Au_Obj_t *p)
 
static char * Au_ObjBase (Au_Obj_t *p)
 
static Au_Ntk_tAu_ObjNtk (Au_Obj_t *p)
 
static int Au_ObjId (Au_Obj_t *p)
 
static int Au_ObjPioNum (Au_Obj_t *p)
 
static int Au_ObjFunc (Au_Obj_t *p)
 
static Au_Ntk_tAu_ObjModel (Au_Obj_t *p)
 
static int Au_ObjFaninNum (Au_Obj_t *p)
 
static int Au_ObjFaninId (Au_Obj_t *p, int i)
 
static int Au_ObjFaninId0 (Au_Obj_t *p)
 
static int Au_ObjFaninId1 (Au_Obj_t *p)
 
static int Au_ObjFaninId2 (Au_Obj_t *p)
 
static Au_Obj_tAu_ObjFanin (Au_Obj_t *p, int i)
 
static Au_Obj_tAu_ObjFanin0 (Au_Obj_t *p)
 
static Au_Obj_tAu_ObjFanin1 (Au_Obj_t *p)
 
static Au_Obj_tAu_ObjFanin2 (Au_Obj_t *p)
 
static int Au_ObjFaninC (Au_Obj_t *p, int i)
 
static int Au_ObjFaninC0 (Au_Obj_t *p)
 
static int Au_ObjFaninC1 (Au_Obj_t *p)
 
static int Au_ObjFaninC2 (Au_Obj_t *p)
 
static int Au_ObjFaninLit (Au_Obj_t *p, int i)
 
static void Au_ObjSetFanin (Au_Obj_t *p, int i, int f)
 
static void Au_ObjSetFaninLit (Au_Obj_t *p, int i, int f)
 
static int Au_BoxFanoutNum (Au_Obj_t *p)
 
static int Au_BoxFanoutId (Au_Obj_t *p, int i)
 
static Au_Obj_tAu_BoxFanout (Au_Obj_t *p, int i)
 
static int Au_ObjCopy (Au_Obj_t *p)
 
static void Au_ObjSetCopy (Au_Obj_t *p, int c)
 
static int Au_ObjFanout (Au_Obj_t *p, int i)
 
static void Au_ObjSetFanout (Au_Obj_t *p, int i, int f)
 
static void Au_NtkIncrementTravId (Au_Ntk_t *p)
 
static void Au_ObjSetTravIdCurrent (Au_Obj_t *p)
 
static void Au_ObjSetTravIdPrevious (Au_Obj_t *p)
 
static int Au_ObjIsTravIdCurrent (Au_Obj_t *p)
 
static int Au_ObjIsTravIdPrevious (Au_Obj_t *p)
 
static void Au_ObjSetTravIdCurrentId (Au_Ntk_t *p, int Id)
 
static int Au_ObjIsTravIdCurrentId (Au_Ntk_t *p, int Id)
 
void Au_ManAddNtk (Au_Man_t *pMan, Au_Ntk_t *p)
 
void Au_ManFree (Au_Man_t *p)
 
Au_Ntk_tAu_NtkAlloc (Au_Man_t *pMan, char *pName)
 FUNCTION DEFINITIONS ///. More...
 
void Au_NtkFree (Au_Ntk_t *p)
 
int Au_NtkMemUsage (Au_Ntk_t *p)
 
void Au_NtkPrintStats (Au_Ntk_t *p)
 
void Au_NtkCleanCopy (Au_Ntk_t *p)
 
int Au_NtkNodeNumFunc (Au_Ntk_t *p, int Func)
 
Au_Man_tAu_ManAlloc (char *pName)
 
void Au_ManDelete (Au_Man_t *p)
 
int Au_ManFindNtk (Au_Man_t *p, char *pName)
 
Au_Ntk_tAu_ManFindNtkP (Au_Man_t *p, char *pName)
 
int Au_ManMemUsage (Au_Man_t *p)
 
int Au_ManMemUsageUseful (Au_Man_t *p)
 
void Au_ManPrintStats (Au_Man_t *p)
 
void Au_ManReorderModels_rec (Au_Ntk_t *pNtk, Vec_Int_t *vOrder)
 
void Au_ManReorderModels (Au_Man_t *p, Au_Ntk_t *pRoot)
 
void Au_ManCountThings (Au_Man_t *p)
 
int Au_NtkCompareNames (Au_Ntk_t **p1, Au_Ntk_t **p2)
 
void Au_ManPrintBoxInfo (Au_Ntk_t *pNtk)
 
int Au_NtkCompareSign (Au_Ntk_t **p1, Au_Ntk_t **p2)
 
void Au_ManPrintBoxInfoSorted (Au_Ntk_t *pNtk)
 
int Au_NtkCheckRecursive (Au_Ntk_t *pNtk)
 
int Au_ObjSuppSize_rec (Au_Ntk_t *p, int Id)
 
int Au_ObjSuppSize (Au_Obj_t *pObj)
 
int Au_NtkSuppSizeTest (Au_Ntk_t *p)
 
static void Au_NtkInsertHeader (Au_Ntk_t *p)
 
int Au_NtkAllocObj (Au_Ntk_t *p, int nFanins, int Type)
 
int Au_NtkCreateConst0 (Au_Ntk_t *pNtk)
 
int Au_NtkCreatePi (Au_Ntk_t *pNtk)
 
int Au_NtkCreatePo (Au_Ntk_t *pNtk, int iFanin)
 
int Au_NtkCreateFan (Au_Ntk_t *pNtk, int iFanin, int iFanout, int iModel)
 
int Au_NtkCreateNode (Au_Ntk_t *pNtk, Vec_Int_t *vFanins, int iFunc)
 
int Au_NtkCreateBox (Au_Ntk_t *pNtk, Vec_Int_t *vFanins, int nFanouts, int iModel)
 
static int Au_NtkRemapNum (Vec_Int_t *vNum2Obj, int Num)
 
static void Au_NtkParseCBlifNum (Vec_Int_t *vFanins, char *pToken, Vec_Int_t *vNum2Obj)
 
Au_Ntk_tAu_NtkParseCBlif (char *pFileName)
 
ABC_NAMESPACE_IMPL_END
ABC_NAMESPACE_IMPL_START
Vec_Ptr_t
Abc_NtkDfsBoxes (Abc_Ntk_t *pNtk)
 
int Abc_NtkDeriveFlatGiaSop (Gia_Man_t *pGia, int *gFanins, char *pSop)
 
int Abc_NtkCheckRecursive (Abc_Ntk_t *pNtk)
 
void Au_NtkDeriveFlatGia_rec (Gia_Man_t *pGia, Au_Ntk_t *p)
 
Gia_Man_tAu_NtkDeriveFlatGia (Au_Ntk_t *p)
 
static void Au_ObjSetXsim (Au_Obj_t *pObj, int Value)
 
static int Au_ObjGetXsim (Au_Obj_t *pObj)
 
static int Au_XsimInv (int Value)
 
static int Au_XsimAnd (int Value0, int Value1)
 
static int Au_XsimXor (int Value0, int Value1)
 
static int Au_XsimMux (int ValueC, int Value1, int Value0)
 
static int Au_ObjGetXsimFan0 (Au_Obj_t *pObj)
 
static int Au_ObjGetXsimFan1 (Au_Obj_t *pObj)
 
static int Au_ObjGetXsimFan2 (Au_Obj_t *pObj)
 
void Au_NtkTerSimulate_rec (Au_Ntk_t *p)
 
void Au_NtkTerSimulate (Au_Ntk_t *p)
 
Au_Ntk_tAu_NtkDerive (Au_Man_t *pMan, Abc_Ntk_t *pNtk, Vec_Ptr_t *vOrder)
 
Gia_Man_tAu_ManDeriveTest (Abc_Ntk_t *pRoot)
 
Gia_Man_tAbc_NtkHieCecTest2 (char *pFileName, char *pModelName, int fVerbose)
 

Macro Definition Documentation

#define Au_BoxForEachFanout (   pObj,
  pFanout,
 
)    for ( i = 0; (i < Au_BoxFanoutNum(pObj)) && (((pFanout) = Au_BoxFanout(pObj, i)), 1); i++ )

Definition at line 211 of file abcHieNew.c.

#define Au_BoxForEachFanoutId (   pObj,
  hFanout,
 
)    for ( i = 0; (i < Au_BoxFanoutNum(pObj)) && (((hFanout) = Au_BoxFanoutId(pObj, i)), 1); i++ )

Definition at line 206 of file abcHieNew.c.

#define Au_ManForEachNtk (   p,
  pNtk,
 
)    for ( i = 1; (i < Vec_PtrSize(&p->vNtks)) && (((pNtk) = Au_ManNtk(p, i)), 1); i++ )

Definition at line 199 of file abcHieNew.c.

#define Au_ManForEachNtkReverse (   p,
  pNtk,
 
)    for ( i = Vec_PtrSize(&p->vNtks) - 1;(i>=1) && (((pNtk) = Au_ManNtk(p, i)), 1); i-- )

Definition at line 201 of file abcHieNew.c.

#define AU_MAX_FANINS   0x1FFFFFFF

DECLARATIONS ///.

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

FileName [abcHieNew.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [New hierarchy manager.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Definition at line 36 of file abcHieNew.c.

#define Au_NtkForEachBox (   p,
  pObj,
 
)    for ( i = 0; (i < Vec_IntSize(&p->vObjs)) && (((pObj) = Au_NtkObjI(p, i)), 1); i++ ) if ( !Au_ObjIsBox(pObj) ) {} else

Definition at line 222 of file abcHieNew.c.

#define Au_NtkForEachNode (   p,
  pObj,
 
)    for ( i = 0; (i < Vec_IntSize(&p->vObjs)) && (((pObj) = Au_NtkObjI(p, i)), 1); i++ ) if ( !Au_ObjIsNode(pObj) ) {} else

Definition at line 220 of file abcHieNew.c.

#define Au_NtkForEachObj (   p,
  pObj,
 
)    for ( i = 0; (i < Vec_IntSize(&p->vObjs)) && (((pObj) = Au_NtkObjI(p, i)), 1); i++ )

Definition at line 218 of file abcHieNew.c.

#define Au_NtkForEachPi (   p,
  pObj,
 
)    for ( i = 0; (i < Vec_IntSize(&p->vPis)) && (((pObj) = Au_NtkPi(p, i)), 1); i++ )

Definition at line 214 of file abcHieNew.c.

#define Au_NtkForEachPo (   p,
  pObj,
 
)    for ( i = 0; (i < Vec_IntSize(&p->vPos)) && (((pObj) = Au_NtkPo(p, i)), 1); i++ )

Definition at line 216 of file abcHieNew.c.

#define Au_ObjForEachFanin (   pObj,
  pFanin,
 
)    for ( i = 0; (i < Au_ObjFaninNum(pObj)) && (((pFanin) = Au_ObjFanin(pObj, i)), 1); i++ )

Definition at line 209 of file abcHieNew.c.

#define Au_ObjForEachFaninId (   pObj,
  hFanin,
 
)    for ( i = 0; (i < Au_ObjFaninNum(pObj)) && (((hFanin) = Au_ObjFaninId(pObj, i)), 1); i++ )

Definition at line 204 of file abcHieNew.c.

#define AU_VAL0   1

Definition at line 1254 of file abcHieNew.c.

#define AU_VAL1   2

Definition at line 1255 of file abcHieNew.c.

#define AU_VALX   3

Definition at line 1256 of file abcHieNew.c.

Typedef Documentation

typedef struct Au_Man_t_ Au_Man_t

Definition at line 51 of file abcHieNew.c.

typedef struct Au_Ntk_t_ Au_Ntk_t

Definition at line 52 of file abcHieNew.c.

typedef struct Au_Obj_t_ Au_Obj_t

Definition at line 53 of file abcHieNew.c.

Enumeration Type Documentation

enum Au_Type_t
Enumerator
AU_OBJ_NONE 
AU_OBJ_CONST0 
AU_OBJ_PI 
AU_OBJ_PO 
AU_OBJ_FAN 
AU_OBJ_FLOP 
AU_OBJ_BOX 
AU_OBJ_NODE 
AU_OBJ_VOID 

Definition at line 38 of file abcHieNew.c.

38  {
39  AU_OBJ_NONE, // 0: non-existent object
40  AU_OBJ_CONST0, // 1: constant node
41  AU_OBJ_PI, // 2: primary input
42  AU_OBJ_PO, // 3: primary output
43  AU_OBJ_FAN, // 4: box output
44  AU_OBJ_FLOP, // 5: flip-flop
45  AU_OBJ_BOX, // 6: box
46  AU_OBJ_NODE, // 7: logic node
47  AU_OBJ_VOID // 8: placeholder
48 } Au_Type_t;
Au_Type_t
Definition: abcHieNew.c:38

Function Documentation

int Abc_NtkCheckRecursive ( Abc_Ntk_t pNtk)

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

Synopsis [Checks if there is a recursive definition.]

Description []

SideEffects []

SeeAlso []

Definition at line 626 of file abcHieCec.c.

627 {
628  Vec_Ptr_t * vMods;
629  Abc_Ntk_t * pModel;
630  Abc_Obj_t * pObj;
631  int i, k, RetValue = 0;
632 
633  assert( Abc_NtkIsNetlist(pNtk) );
634  assert( !Abc_NtkLatchNum(pNtk) );
635 
636  if ( pNtk->pDesign == NULL )
637  return RetValue;
638 
639  vMods = pNtk->pDesign->vModules;
640  Vec_PtrForEachEntry( Abc_Ntk_t *, vMods, pModel, i )
641  {
642  Abc_NtkForEachObj( pModel, pObj, k )
643  if ( Abc_ObjIsBox(pObj) && pObj->pData == (void *)pModel )
644  {
645  printf( "WARNING: Model \"%s\" contains a recursive defition.\n", Abc_NtkName(pModel) );
646  RetValue = 1;
647  break;
648  }
649  }
650  return RetValue;
651 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
if(last==0)
Definition: sparse_int.h:34
static char * Abc_NtkName(Abc_Ntk_t *pNtk)
Definition: abc.h:270
Vec_Ptr_t * vModules
Definition: abc.h:223
#define assert(ex)
Definition: util_old.h:213
static int Abc_ObjIsBox(Abc_Obj_t *pObj)
Definition: abc.h:357
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Abc_Des_t * pDesign
Definition: abc.h:180
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
int Abc_NtkDeriveFlatGiaSop ( Gia_Man_t pGia,
int *  gFanins,
char *  pSop 
)

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

Synopsis [Strashes one logic node using its SOP.]

Description []

SideEffects []

SeeAlso []

Definition at line 131 of file abcHieCec.c.

132 {
133  char * pCube;
134  int gAnd, gSum;
135  int i, Value, nFanins;
136  // get the number of variables
137  nFanins = Abc_SopGetVarNum(pSop);
138  if ( Abc_SopIsExorType(pSop) )
139  {
140  gSum = 0;
141  for ( i = 0; i < nFanins; i++ )
142  gSum = Gia_ManHashXor( pGia, gSum, gFanins[i] );
143  }
144  else
145  {
146  // go through the cubes of the node's SOP
147  gSum = 0;
148  Abc_SopForEachCube( pSop, nFanins, pCube )
149  {
150  // create the AND of literals
151  gAnd = 1;
152  Abc_CubeForEachVar( pCube, Value, i )
153  {
154  if ( Value == '1' )
155  gAnd = Gia_ManHashAnd( pGia, gAnd, gFanins[i] );
156  else if ( Value == '0' )
157  gAnd = Gia_ManHashAnd( pGia, gAnd, Abc_LitNot(gFanins[i]) );
158  }
159  // add to the sum of cubes
160  gSum = Gia_ManHashAnd( pGia, Abc_LitNot(gSum), Abc_LitNot(gAnd) );
161  gSum = Abc_LitNot( gSum );
162  }
163  }
164  // decide whether to complement the result
165  if ( Abc_SopIsComplement(pSop) )
166  gSum = Abc_LitNot(gSum);
167  return gSum;
168 }
int Gia_ManHashXor(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:658
#define Abc_SopForEachCube(pSop, nFanins, pCube)
Definition: abc.h:531
#define Abc_CubeForEachVar(pCube, Value, i)
Definition: abc.h:529
ABC_DLL int Abc_SopIsExorType(char *pSop)
Definition: abcSop.c:802
static int Abc_LitNot(int Lit)
Definition: abc_global.h:266
ABC_DLL int Abc_SopGetVarNum(char *pSop)
Definition: abcSop.c:536
ABC_DLL int Abc_SopIsComplement(char *pSop)
Definition: abcSop.c:655
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572

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

Synopsis [Returns the array of node and boxes reachable from POs.]

Description []

SideEffects []

SeeAlso []

Definition at line 104 of file abcHieCec.c.

105 {
106  Vec_Ptr_t * vNodes;
107  Abc_Obj_t * pObj;
108  int i;
109  assert( Abc_NtkIsNetlist(pNtk) );
110  // set the traversal ID
111  Abc_NtkIncrementTravId( pNtk );
112  // start the array of nodes
113  vNodes = Vec_PtrAlloc( 100 );
114  Abc_NtkForEachPo( pNtk, pObj, i )
115  Abc_NtkDfsBoxes_rec( Abc_ObjFaninReal(pObj, 0), vNodes );
116  return vNodes;
117 }
void Abc_NtkDfsBoxes_rec(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: abcHieCec.c:75
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static Abc_Obj_t * Abc_ObjFaninReal(Abc_Obj_t *pObj, int i)
FUNCTION DEFINITIONS ///.
Definition: abcHieCec.c:49
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
#define assert(ex)
Definition: util_old.h:213
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
Gia_Man_t* Abc_NtkHieCecTest2 ( char *  pFileName,
char *  pModelName,
int  fVerbose 
)

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

Synopsis [Performs hierarchical equivalence checking.]

Description []

SideEffects []

SeeAlso []

Definition at line 1571 of file abcHieNew.c.

1572 {
1573  int fSimulation = 0;
1574  Gia_Man_t * pGia = NULL;
1575  Au_Ntk_t * pNtk, * pNtkClp = NULL;
1576  abctime clk1 = 0, clk = Abc_Clock();
1577 
1578  // read hierarchical netlist
1579  pNtk = Au_NtkParseCBlif( pFileName );
1580  if ( pNtk == NULL )
1581  {
1582  printf( "Reading CBLIF file has failed.\n" );
1583  return NULL;
1584  }
1585  if ( pNtk->pMan == NULL || pNtk->pMan->vNtks.pArray == NULL )
1586  {
1587  printf( "There is no hierarchy information.\n" );
1588  Au_NtkFree( pNtk );
1589  return NULL;
1590  }
1591  Abc_PrintTime( 1, "Reading file", Abc_Clock() - clk );
1592 
1593  if ( fVerbose )
1594  {
1595  Au_ManPrintBoxInfo( pNtk );
1596 // Au_ManPrintBoxInfoSorted( pNtk );
1597  Au_ManPrintStats( pNtk->pMan );
1598  }
1599  Au_ManCountThings( pNtk->pMan );
1600 
1601  // select network
1602  if ( pModelName )
1603  pNtkClp = Au_ManFindNtkP( pNtk->pMan, pModelName );
1604  if ( pNtkClp == NULL )
1605  pNtkClp = pNtk;
1606 
1607  // check if the model is recursive
1608  Au_NtkCheckRecursive( pNtkClp );
1609 
1610  // collapse
1611  clk1 = Abc_Clock();
1612  if ( fSimulation )
1613  {
1614  Au_NtkTerSimulate( pNtkClp );
1615  Abc_PrintTime( 1, "Time sim ", Abc_Clock() - clk1 );
1616  }
1617  else
1618  {
1619  pGia = Au_NtkDeriveFlatGia( pNtkClp );
1620  Abc_PrintTime( 1, "Time GIA ", Abc_Clock() - clk1 );
1621  }
1622 
1623  // delete
1624  Au_ManDelete( pNtk->pMan );
1625  Abc_PrintTime( 1, "Time all ", Abc_Clock() - clk );
1626  return pGia;
1627 }
static abctime Abc_Clock()
Definition: abc_global.h:279
Vec_Ptr_t vNtks
Definition: abcHieNew.c:101
void Au_NtkTerSimulate(Au_Ntk_t *p)
Definition: abcHieNew.c:1402
Au_Ntk_t * Au_ManFindNtkP(Au_Man_t *p, char *pName)
Definition: abcHieNew.c:363
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
void Au_ManDelete(Au_Man_t *p)
Definition: abcHieNew.c:347
Au_Man_t * pMan
Definition: abcHieNew.c:67
void Au_ManPrintStats(Au_Man_t *p)
Definition: abcHieNew.c:393
Gia_Man_t * Au_NtkDeriveFlatGia(Au_Ntk_t *p)
Definition: abcHieNew.c:1222
void Au_ManPrintBoxInfo(Au_Ntk_t *pNtk)
Definition: abcHieNew.c:543
void Au_NtkFree(Au_Ntk_t *p)
Definition: abcHieNew.c:258
Definition: gia.h:95
int Au_NtkCheckRecursive(Au_Ntk_t *pNtk)
Definition: abcHieNew.c:660
Au_Ntk_t * Au_NtkParseCBlif(char *pFileName)
Definition: abcHieNew.c:959
ABC_INT64_T abctime
Definition: abc_global.h:278
void Au_ManCountThings(Au_Man_t *p)
Definition: abcHieNew.c:492
static Au_Obj_t* Au_BoxFanout ( Au_Obj_t p,
int  i 
)
inlinestatic

Definition at line 183 of file abcHieNew.c.

183 { return Au_NtkObj(Au_ObjNtk(p), Au_BoxFanoutId(p, i)); }
static Au_Obj_t * Au_NtkObj(Au_Ntk_t *p, int h)
Definition: abcHieNew.c:141
static int Au_BoxFanoutId(Au_Obj_t *p, int i)
Definition: abcHieNew.c:182
static Au_Ntk_t * Au_ObjNtk(Au_Obj_t *p)
Definition: abcHieNew.c:158
static int Au_BoxFanoutId ( Au_Obj_t p,
int  i 
)
inlinestatic

Definition at line 182 of file abcHieNew.c.

182 { assert(i >= 0 && i < Au_BoxFanoutNum(p)); return p->Fanins[p->nFanins+1+i]; }
int Fanins[2]
Definition: abcHieNew.c:61
static int Au_BoxFanoutNum(Au_Obj_t *p)
Definition: abcHieNew.c:181
unsigned nFanins
Definition: abcHieNew.c:60
#define assert(ex)
Definition: util_old.h:213
static int Au_BoxFanoutNum ( Au_Obj_t p)
inlinestatic

Definition at line 181 of file abcHieNew.c.

181 { assert(Au_ObjIsBox(p)); return p->Fanins[p->nFanins]; }
static int Au_ObjIsBox(Au_Obj_t *p)
Definition: abcHieNew.c:153
int Fanins[2]
Definition: abcHieNew.c:61
unsigned nFanins
Definition: abcHieNew.c:60
#define assert(ex)
Definition: util_old.h:213
static int Au_IsComplement ( Au_Obj_t p)
inlinestatic

Definition at line 122 of file abcHieNew.c.

122 { return (int)((ABC_PTRUINT_T)(p) & 01); }
static int Au_Lit2Var ( int  Lit)
inlinestatic

Definition at line 113 of file abcHieNew.c.

113 { return Lit >> 1; }
static int Au_LitIsCompl ( int  Lit)
inlinestatic

Definition at line 114 of file abcHieNew.c.

114 { return Lit & 1; }
static int Au_LitNot ( int  Lit)
inlinestatic

Definition at line 115 of file abcHieNew.c.

115 { return Lit ^ 1; }
static int Au_LitNotCond ( int  Lit,
int  c 
)
inlinestatic

Definition at line 116 of file abcHieNew.c.

116 { return Lit ^ (int)(c > 0); }
static int Au_LitRegular ( int  Lit)
inlinestatic

Definition at line 117 of file abcHieNew.c.

117 { return Lit & ~01; }
void Au_ManAddNtk ( Au_Man_t pMan,
Au_Ntk_t p 
)

Definition at line 370 of file abcHieNew.c.

371 {
372  assert( Au_ManFindNtk(pMan, Au_NtkName(p)) == -1 );
373  p->pMan = pMan; pMan->nRefs++;
374  p->Id = Vec_PtrSize( &pMan->vNtks );
375  Vec_PtrPush( &pMan->vNtks, p );
376 }
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int nRefs
Definition: abcHieNew.c:103
Vec_Ptr_t vNtks
Definition: abcHieNew.c:101
Au_Man_t * pMan
Definition: abcHieNew.c:67
static char * Au_NtkName(Au_Ntk_t *p)
Definition: abcHieNew.c:131
int Id
Definition: abcHieNew.c:68
#define assert(ex)
Definition: util_old.h:213
int Au_ManFindNtk(Au_Man_t *p, char *pName)
Definition: abcHieNew.c:354
Au_Man_t* Au_ManAlloc ( char *  pName)

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

Synopsis [Working with manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 327 of file abcHieNew.c.

328 {
329  Au_Man_t * p;
330  p = ABC_CALLOC( Au_Man_t, 1 );
331  p->pName = Au_UtilStrsav( pName );
332  Vec_PtrGrow( &p->vNtks, 111 );
333  Vec_PtrPush( &p->vNtks, NULL );
334  return p;
335 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrGrow(Vec_Ptr_t *p, int nCapMin)
Definition: vecPtr.h:430
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
char * pName
Definition: abcHieNew.c:100
Vec_Ptr_t vNtks
Definition: abcHieNew.c:101
static char * Au_UtilStrsav(char *s)
Definition: abcHieNew.c:124
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
void Au_ManCountThings ( Au_Man_t p)

Definition at line 492 of file abcHieNew.c.

493 {
494  Au_Ntk_t * pNtk, * pBoxModel;
495  Au_Obj_t * pBox;
496  int i, k;//, clk = Abc_Clock();
497  Au_ManForEachNtkReverse( p, pNtk, i )
498  {
499  pNtk->nBoxes = Au_NtkBoxNum(pNtk);
500  pNtk->nNodes = Au_NtkNodeNum(pNtk);
501  pNtk->nPorts = Au_NtkPiNum(pNtk) + Au_NtkPoNum(pNtk);
502  pNtk->nNodeAnds = Au_NtkNodeNumFunc( pNtk, 1 );
503  pNtk->nNodeXors = Au_NtkNodeNumFunc( pNtk, 2 );
504  pNtk->nNodeMuxs = Au_NtkNodeNumFunc( pNtk, 3 );
505 // assert( pNtk->nNodes == pNtk->nNodeAnds + pNtk->nNodeXors + pNtk->nNodeMuxs );
506 // printf( "adding %.0f nodes of model %s\n", pNtk->nNodes, Au_NtkName(pNtk) );
507  Au_NtkForEachBox( pNtk, pBox, k )
508  {
509  pBoxModel = Au_ObjModel(pBox);
510  if ( pBoxModel == NULL || pBoxModel == pNtk )
511  continue;
512  assert( Au_ObjFaninNum(pBox) == Au_NtkPiNum(pBoxModel) );
513  assert( Au_BoxFanoutNum(pBox) == Au_NtkPoNum(pBoxModel) );
514  assert( pBoxModel->Id > pNtk->Id );
515  assert( pBoxModel->nPorts > 0 );
516  pNtk->nBoxes += pBoxModel->nBoxes;
517  pNtk->nNodes += pBoxModel->nNodes;
518  pNtk->nPorts += pBoxModel->nPorts;
519  pNtk->nNodeAnds += pBoxModel->nNodeAnds;
520  pNtk->nNodeXors += pBoxModel->nNodeXors;
521  pNtk->nNodeMuxs += pBoxModel->nNodeMuxs;
522 // printf( " adding %.0f nodes of model %s\n", pBoxModel->nNodes, Au_NtkName(pBoxModel) );
523  }
524 // printf( "total %.0f nodes in model %s\n", pNtk->nNodes, Au_NtkName(pNtk) );
525  }
526  pNtk = Au_ManNtkRoot(p);
527  printf( "Total nodes = %15.0f. Total instances = %15.0f. Total ports = %15.0f.\n",
528 // printf( "Total nodes = %.2e. Total instances = %.2e. Total ports = %.2e.\n",
529  pNtk->nNodes, pNtk->nBoxes, pNtk->nPorts );
530 // printf( "Total ANDs = %15.0f. Total XORs = %15.0f. Total MUXes = %15.0f.\n",
531 // printf( "Total ANDs = %.2e. Total XORs = %.2e. Total MUXes = %.2e. ",
532 // pNtk->nNodeAnds, pNtk->nNodeXors, pNtk->nNodeMuxs );
533  printf( "Total ANDs = %15.0f.\n", pNtk->nNodeAnds );
534  printf( "Total XORs = %15.0f.\n", pNtk->nNodeXors );
535  printf( "Total MUXes = %15.0f.\n", pNtk->nNodeMuxs );
536 // Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
537 }
double nNodes
Definition: abcHieNew.c:91
int Au_NtkNodeNumFunc(Au_Ntk_t *p, int Func)
Definition: abcHieNew.c:301
static int Au_NtkNodeNum(Au_Ntk_t *p)
Definition: abcHieNew.c:138
static int Au_NtkPoNum(Au_Ntk_t *p)
Definition: abcHieNew.c:134
static Au_Ntk_t * Au_ManNtkRoot(Au_Man_t *p)
Definition: abcHieNew.c:129
static int Au_BoxFanoutNum(Au_Obj_t *p)
Definition: abcHieNew.c:181
static Au_Ntk_t * Au_ObjModel(Au_Obj_t *p)
Definition: abcHieNew.c:162
static int Au_ObjFaninNum(Au_Obj_t *p)
Definition: abcHieNew.c:164
double nNodeAnds
Definition: abcHieNew.c:93
double nBoxes
Definition: abcHieNew.c:90
double nNodeXors
Definition: abcHieNew.c:94
static int Au_NtkPiNum(Au_Ntk_t *p)
Definition: abcHieNew.c:133
#define Au_NtkForEachBox(p, pObj, i)
Definition: abcHieNew.c:222
int Id
Definition: abcHieNew.c:68
#define Au_ManForEachNtkReverse(p, pNtk, i)
Definition: abcHieNew.c:201
double nPorts
Definition: abcHieNew.c:92
#define assert(ex)
Definition: util_old.h:213
double nNodeMuxs
Definition: abcHieNew.c:95
static int Au_NtkBoxNum(Au_Ntk_t *p)
Definition: abcHieNew.c:137
void Au_ManDelete ( Au_Man_t p)

Definition at line 347 of file abcHieNew.c.

348 {
349  Au_Ntk_t * pNtk;
350  int i;
351  Au_ManForEachNtk( p, pNtk, i )
352  Au_NtkFree( pNtk );
353 }
#define Au_ManForEachNtk(p, pNtk, i)
Definition: abcHieNew.c:199
void Au_NtkFree(Au_Ntk_t *p)
Definition: abcHieNew.c:258
Gia_Man_t* Au_ManDeriveTest ( Abc_Ntk_t pRoot)

Definition at line 1486 of file abcHieNew.c.

1487 {
1488  extern Vec_Ptr_t * Abc_NtkCollectHie( Abc_Ntk_t * pNtk );
1489 
1490 // char * pModelName = NULL;
1491  char * pModelName = "path_0_r_x_lhs";
1492  Gia_Man_t * pGia = NULL;
1493  Vec_Ptr_t * vOrder, * vModels;
1494  Abc_Ntk_t * pMod;
1495  Au_Man_t * pMan;
1496  Au_Ntk_t * pNtk = NULL;
1497  abctime clk1, clk2 = 0, clk3 = 0, clk = Abc_Clock();
1498  int i;
1499 
1500  clk1 = Abc_Clock();
1501  pMan = Au_ManAlloc( pRoot->pDesign ? pRoot->pDesign->pName : pRoot->pName );
1502  pMan->pFuncs = Abc_NamStart( 100, 16 );
1503  clk2 += Abc_Clock() - clk1;
1504 
1505  vModels = Abc_NtkCollectHie( pRoot );
1506  Vec_PtrForEachEntry( Abc_Ntk_t *, vModels, pMod, i )
1507  {
1508  vOrder = Abc_NtkDfsBoxes( pMod );
1509 
1510  clk1 = Abc_Clock();
1511  pNtk = Au_NtkDerive( pMan, pMod, vOrder );
1512  pMod->iStep = pNtk->Id;
1513  pMod->pData = pNtk;
1514  clk2 += Abc_Clock() - clk1;
1515 
1516  Vec_PtrFree( vOrder );
1517  }
1518  Vec_PtrFree( vModels );
1519  // order models in topological order
1520  Au_ManReorderModels( pMan, pNtk );
1521 
1522  // print statistics
1523  Au_ManPrintStats( pMan );
1524  Au_ManCountThings( pNtk->pMan );
1525 
1526  // select network
1527  if ( pModelName )
1528  {
1529  pNtk = Au_ManFindNtkP( pMan, pModelName );
1530  if ( pNtk == NULL )
1531  printf( "Could not find module \"%s\".\n", pModelName );
1532  }
1533  if ( pNtk == NULL )
1534  pNtk = (Au_Ntk_t *)pRoot->pData;
1535 
1536 
1537 // if ( !Abc_NtkCheckRecursive(pRoot) )
1538  {
1539  clk1 = Abc_Clock();
1540  pGia = Au_NtkDeriveFlatGia( pNtk );
1541  clk3 = Abc_Clock() - clk1;
1542 // printf( "GIA objects max = %d.\n", pMan->nGiaObjMax );
1543  }
1544 
1545 // clk1 = Abc_Clock();
1546 // Au_NtkSuppSizeTest( (Au_Ntk_t *)pRoot->pData );
1547 // clk4 = Abc_Clock() - clk1;
1548 
1549  clk1 = Abc_Clock();
1550  Au_ManDelete( pMan );
1551  clk2 += Abc_Clock() - clk1;
1552 
1553  Abc_PrintTime( 1, "Time all ", Abc_Clock() - clk );
1554  Abc_PrintTime( 1, "Time new ", clk2 );
1555  Abc_PrintTime( 1, "Time GIA ", clk3 );
1556 // Abc_PrintTime( 1, "Time supp", clk4 );
1557  return pGia;
1558 }
Vec_Ptr_t * Abc_NtkCollectHie(Abc_Ntk_t *pNtk)
Definition: abcHieCec.c:499
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_NAMESPACE_IMPL_END ABC_NAMESPACE_IMPL_START Vec_Ptr_t * Abc_NtkDfsBoxes(Abc_Ntk_t *pNtk)
Definition: abcHieCec.c:104
char * pName
Definition: abc.h:220
static abctime Abc_Clock()
Definition: abc_global.h:279
Abc_Nam_t * Abc_NamStart(int nObjs, int nAveSize)
FUNCTION DEFINITIONS ///.
Definition: utilNam.c:78
Au_Ntk_t * Au_ManFindNtkP(Au_Man_t *p, char *pName)
Definition: abcHieNew.c:363
void * pData
Definition: abc.h:203
int iStep
Definition: abc.h:178
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
void Au_ManDelete(Au_Man_t *p)
Definition: abcHieNew.c:347
Au_Man_t * pMan
Definition: abcHieNew.c:67
void Au_ManPrintStats(Au_Man_t *p)
Definition: abcHieNew.c:393
Abc_Nam_t * pFuncs
Definition: abcHieNew.c:102
Au_Ntk_t * Au_NtkDerive(Au_Man_t *pMan, Abc_Ntk_t *pNtk, Vec_Ptr_t *vOrder)
Definition: abcHieNew.c:1441
Gia_Man_t * Au_NtkDeriveFlatGia(Au_Ntk_t *p)
Definition: abcHieNew.c:1222
int Id
Definition: abcHieNew.c:68
Au_Man_t * Au_ManAlloc(char *pName)
Definition: abcHieNew.c:327
Definition: gia.h:95
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Au_ManReorderModels(Au_Man_t *p, Au_Ntk_t *pRoot)
Definition: abcHieNew.c:426
ABC_INT64_T abctime
Definition: abc_global.h:278
Abc_Des_t * pDesign
Definition: abc.h:180
void Au_ManCountThings(Au_Man_t *p)
Definition: abcHieNew.c:492
char * pName
Definition: abc.h:158
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
int Au_ManFindNtk ( Au_Man_t p,
char *  pName 
)

Definition at line 354 of file abcHieNew.c.

355 {
356  Au_Ntk_t * pNtk;
357  int i;
358  Au_ManForEachNtk( p, pNtk, i )
359  if ( !strcmp(Au_NtkName(pNtk), pName) )
360  return i;
361  return -1;
362 }
#define Au_ManForEachNtk(p, pNtk, i)
Definition: abcHieNew.c:199
int strcmp()
static char * Au_NtkName(Au_Ntk_t *p)
Definition: abcHieNew.c:131
if(last==0)
Definition: sparse_int.h:34
Au_Ntk_t* Au_ManFindNtkP ( Au_Man_t p,
char *  pName 
)

Definition at line 363 of file abcHieNew.c.

364 {
365  int iNtk = Au_ManFindNtk( p, pName );
366  if ( iNtk == -1 )
367  return NULL;
368  return Au_ManNtk( p, iNtk );
369 }
static Au_Ntk_t * Au_ManNtk(Au_Man_t *p, int i)
Definition: abcHieNew.c:128
int Au_ManFindNtk(Au_Man_t *p, char *pName)
Definition: abcHieNew.c:354
void Au_ManFree ( Au_Man_t p)

Definition at line 336 of file abcHieNew.c.

337 {
338  assert( p->nRefs > 0 );
339  if ( --p->nRefs > 0 )
340  return;
341  if ( p->pFuncs )
342  Abc_NamStop( p->pFuncs );
343  ABC_FREE( p->vNtks.pArray );
344  ABC_FREE( p->pName );
345  ABC_FREE( p );
346 }
void Abc_NamStop(Abc_Nam_t *p)
Definition: utilNam.c:110
char * pName
Definition: abcHieNew.c:100
int nRefs
Definition: abcHieNew.c:103
Vec_Ptr_t vNtks
Definition: abcHieNew.c:101
Abc_Nam_t * pFuncs
Definition: abcHieNew.c:102
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define assert(ex)
Definition: util_old.h:213
int Au_ManMemUsage ( Au_Man_t p)

Definition at line 377 of file abcHieNew.c.

378 {
379  Au_Ntk_t * pNtk;
380  int i, Mem = 0;
381  Au_ManForEachNtk( p, pNtk, i )
382  Mem += 16 * pNtk->nObjsAlloc;
383  return Mem;
384 }
#define Au_ManForEachNtk(p, pNtk, i)
Definition: abcHieNew.c:199
int Au_ManMemUsageUseful ( Au_Man_t p)

Definition at line 385 of file abcHieNew.c.

386 {
387  Au_Ntk_t * pNtk;
388  int i, Mem = 0;
389  Au_ManForEachNtk( p, pNtk, i )
390  Mem += 16 * pNtk->nObjsUsed;
391  return Mem;
392 }
#define Au_ManForEachNtk(p, pNtk, i)
Definition: abcHieNew.c:199
static char* Au_ManName ( Au_Man_t p)
inlinestatic

Definition at line 126 of file abcHieNew.c.

126 { return p->pName; }
char * pName
Definition: abcHieNew.c:100
static Au_Ntk_t* Au_ManNtk ( Au_Man_t p,
int  i 
)
inlinestatic

Definition at line 128 of file abcHieNew.c.

128 { return (Au_Ntk_t *)Vec_PtrEntry(&p->vNtks, i); }
Vec_Ptr_t vNtks
Definition: abcHieNew.c:101
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Au_ManNtkNum ( Au_Man_t p)
inlinestatic

Definition at line 127 of file abcHieNew.c.

127 { return Vec_PtrSize(&p->vNtks) - 1; }
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Vec_Ptr_t vNtks
Definition: abcHieNew.c:101
static Au_Ntk_t* Au_ManNtkRoot ( Au_Man_t p)
inlinestatic

Definition at line 129 of file abcHieNew.c.

129 { return Au_ManNtk( p, 1 ); }
static Au_Ntk_t * Au_ManNtk(Au_Man_t *p, int i)
Definition: abcHieNew.c:128
void Au_ManPrintBoxInfo ( Au_Ntk_t pNtk)

Definition at line 543 of file abcHieNew.c.

544 {
545  Vec_Ptr_t * vMods;
546  Au_Ntk_t * pModel, * pBoxModel;
547  Au_Obj_t * pObj;
548  Vec_Int_t * vCounts;
549  int i, k, Num;
550  if ( pNtk->pMan == NULL )
551  {
552  printf( "There is no hierarchy information.\n" );
553  return;
554  }
555  vMods = &pNtk->pMan->vNtks;
556 
557 /*
558  vMods->nSize--;
559  vMods->pArray++;
560  // sort models by name
561  Vec_PtrSort( vMods, (int(*)())Au_NtkCompareNames );
562  // swap the first model
563  Num = Vec_PtrFind( vMods, pNtk );
564  assert( Num >= 0 && Num < Vec_PtrSize(vMods) );
565  pBoxModel = (Au_Ntk_t *)Vec_PtrEntry(vMods, 0);
566  Vec_PtrWriteEntry(vMods, 0, (Au_Ntk_t *)Vec_PtrEntry(vMods, Num) );
567  Vec_PtrWriteEntry(vMods, Num, pBoxModel );
568  vMods->pArray--;
569  vMods->nSize++;
570 */
571 
572 // Vec_PtrForEachEntry( Au_Ntk_t *, vMods, pModel, i )
573 // printf( "%s\n", Au_NtkName(pModel) );
574 
575  // print models
576  vCounts = Vec_IntStart( Vec_PtrSize(vMods) );
577  Vec_PtrForEachEntryStart( Au_Ntk_t *, vMods, pModel, i, 1 )
578  {
579  if ( Au_NtkBoxNum(pModel) == 0 )
580  continue;
581  Vec_IntFill( vCounts, Vec_IntSize(vCounts), 0 );
582  Au_NtkForEachBox( pModel, pObj, k )
583  {
584  pBoxModel = Au_ObjModel(pObj);
585  if ( pBoxModel == NULL || pBoxModel == pModel )
586  continue;
587  Num = Vec_PtrFind( vMods, pBoxModel );
588  assert( Num >= 0 && Num < Vec_PtrSize(vMods) );
589  Vec_IntAddToEntry( vCounts, Num, 1 );
590  }
591 
592 // Au_NtkPrintStats( pModel, 0, 0, 0, 0, 0, 0, 0 );
593  printf( "MODULE " );
594  printf( "%-30s : ", Au_NtkName(pModel) );
595  printf( "PI=%6d ", Au_NtkPiNum(pModel) );
596  printf( "PO=%6d ", Au_NtkPoNum(pModel) );
597  printf( "BB=%6d ", Au_NtkBoxNum(pModel) );
598  printf( "ND=%6d ", Au_NtkNodeNum(pModel) ); // sans constants
599 // printf( "Lev=%5d ", Au_NtkLevel(pModel) );
600  printf( "\n" );
601 
602  Vec_IntForEachEntry( vCounts, Num, k )
603  if ( Num )
604  printf( "%15d : %s\n", Num, Au_NtkName((Au_Ntk_t *)Vec_PtrEntry(vMods, k)) );
605  }
606  Vec_IntFree( vCounts );
607  Vec_PtrForEachEntryStart( Au_Ntk_t *, vMods, pModel, i, 1 )
608  {
609  if ( Au_NtkBoxNum(pModel) != 0 )
610  continue;
611  printf( "MODULE " );
612  printf( "%-30s : ", Au_NtkName(pModel) );
613  printf( "PI=%6d ", Au_NtkPiNum(pModel) );
614  printf( "PO=%6d ", Au_NtkPoNum(pModel) );
615  printf( "BB=%6d ", Au_NtkBoxNum(pModel) );
616  printf( "ND=%6d ", Au_NtkNodeNum(pModel) );
617 // printf( "Lev=%5d ", Au_NtkLevel(pModel) );
618  printf( "\n" );
619  }
620 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Au_NtkNodeNum(Au_Ntk_t *p)
Definition: abcHieNew.c:138
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
Definition: vecPtr.h:57
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Au_NtkPoNum(Au_Ntk_t *p)
Definition: abcHieNew.c:134
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Vec_Ptr_t vNtks
Definition: abcHieNew.c:101
static int Vec_PtrFind(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:694
static Au_Ntk_t * Au_ObjModel(Au_Obj_t *p)
Definition: abcHieNew.c:162
Au_Man_t * pMan
Definition: abcHieNew.c:67
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 char * Au_NtkName(Au_Ntk_t *p)
Definition: abcHieNew.c:131
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
if(last==0)
Definition: sparse_int.h:34
static int Au_NtkPiNum(Au_Ntk_t *p)
Definition: abcHieNew.c:133
#define Au_NtkForEachBox(p, pObj, i)
Definition: abcHieNew.c:222
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Au_NtkBoxNum(Au_Ntk_t *p)
Definition: abcHieNew.c:137
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
void Au_ManPrintBoxInfoSorted ( Au_Ntk_t pNtk)

Definition at line 628 of file abcHieNew.c.

629 {
630  Vec_Ptr_t * vMods, * vModsNew;
631  Au_Ntk_t * pModel;
632  int i;
633  if ( pNtk->pMan == NULL )
634  {
635  printf( "There is no hierarchy information.\n" );
636  return;
637  }
638  vMods = &pNtk->pMan->vNtks;
639 
640  vMods->nSize--;
641  vMods->pArray++;
642  vModsNew = Vec_PtrDup( vMods );
643  vMods->pArray--;
644  vMods->nSize++;
645 
646  Vec_PtrSort( vModsNew, (int(*)())Au_NtkCompareSign );
647  Vec_PtrForEachEntryStart( Au_Ntk_t *, vModsNew, pModel, i, 1 )
648  {
649  printf( "MODULE " );
650  printf( "%-30s : ", Au_NtkName(pModel) );
651  printf( "PI=%6d ", Au_NtkPiNum(pModel) );
652  printf( "PO=%6d ", Au_NtkPoNum(pModel) );
653  printf( "BB=%6d ", Au_NtkBoxNum(pModel) );
654  printf( "ND=%6d ", Au_NtkNodeNum(pModel) );
655  printf( "\n" );
656  }
657  Vec_PtrFree( vModsNew );
658 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Au_NtkNodeNum(Au_Ntk_t *p)
Definition: abcHieNew.c:138
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
Definition: vecPtr.h:57
static void Vec_PtrSort(Vec_Ptr_t *p, int(*Vec_PtrSortCompare)()) ___unused
Definition: vecPtr.h:851
static int Au_NtkPoNum(Au_Ntk_t *p)
Definition: abcHieNew.c:134
static Vec_Ptr_t * Vec_PtrDup(Vec_Ptr_t *pVec)
Definition: vecPtr.h:169
Vec_Ptr_t vNtks
Definition: abcHieNew.c:101
Au_Man_t * pMan
Definition: abcHieNew.c:67
static char * Au_NtkName(Au_Ntk_t *p)
Definition: abcHieNew.c:131
static int Au_NtkPiNum(Au_Ntk_t *p)
Definition: abcHieNew.c:133
int Au_NtkCompareSign(Au_Ntk_t **p1, Au_Ntk_t **p2)
Definition: abcHieNew.c:621
static int Au_NtkBoxNum(Au_Ntk_t *p)
Definition: abcHieNew.c:137
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Au_ManPrintStats ( Au_Man_t p)

Definition at line 393 of file abcHieNew.c.

394 {
395  Au_Ntk_t * pNtk;
396  int i;
397  if ( Vec_PtrSize(&p->vNtks) > 2 )
398  printf( "Design %-13s\n", Au_ManName(p) );
399  Au_ManForEachNtk( p, pNtk, i )
400  Au_NtkPrintStats( pNtk );
401  printf( "Different functions = %d. ", p->pFuncs ? Abc_NamObjNumMax(p->pFuncs) : 0 );
402  printf( "Memory = %.1f MB", 1.0 * Au_ManMemUsage(p) / (1 << 20) );
403  printf( " %5.1f %%", 100.0 * (Au_ManMemUsage(p) - Au_ManMemUsageUseful(p)) / Au_ManMemUsage(p) );
404  printf( "\n" );
405 // if ( p->pFuncs )
406 // Abc_NamPrint( p->pFuncs );
407 }
static char * Au_ManName(Au_Man_t *p)
Definition: abcHieNew.c:126
#define Au_ManForEachNtk(p, pNtk, i)
Definition: abcHieNew.c:199
int Abc_NamObjNumMax(Abc_Nam_t *p)
Definition: utilNam.c:186
int Au_ManMemUsage(Au_Man_t *p)
Definition: abcHieNew.c:377
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Vec_Ptr_t vNtks
Definition: abcHieNew.c:101
void Au_NtkPrintStats(Au_Ntk_t *p)
Definition: abcHieNew.c:280
int Au_ManMemUsageUseful(Au_Man_t *p)
Definition: abcHieNew.c:385
void Au_ManReorderModels ( Au_Man_t p,
Au_Ntk_t pRoot 
)

Definition at line 426 of file abcHieNew.c.

427 {
428  Vec_Ptr_t * vNtksNew;
429  Vec_Int_t * vOrder, * vTemp;
430  Au_Ntk_t * pNtk, * pBoxModel;
431  Au_Obj_t * pBox, * pFan;
432  int i, k, j, Entry;
433  Au_ManForEachNtk( p, pNtk, i )
434  pNtk->fMark = 0;
435  // collect networks in the DFS order
436  vOrder = Vec_IntAlloc( Au_ManNtkNum(p)+1 );
437  Vec_IntPush( vOrder, 0 );
438  Au_ManReorderModels_rec( pRoot, vOrder );
439  assert( Vec_IntEntryLast(vOrder) == pRoot->Id );
440  // add unconnected ones
441  Vec_IntPop( vOrder );
442  Au_ManForEachNtk( p, pNtk, i )
443  if ( pNtk->fMark == 0 )
444  Vec_IntPush( vOrder, pNtk->Id );
445  Vec_IntPush( vOrder, pRoot->Id );
446  assert( Vec_IntSize(vOrder) == Au_ManNtkNum(p)+1 );
447  // reverse order
448  vOrder->nSize--;
449  vOrder->pArray++;
450  Vec_IntReverseOrder( vOrder );
451  vOrder->pArray--;
452  vOrder->nSize++;
453  // compute new order
454  vNtksNew = Vec_PtrAlloc( Au_ManNtkNum(p)+1 );
455  Vec_IntForEachEntry( vOrder, Entry, i )
456  Vec_PtrPush( vNtksNew, Au_ManNtk(p, Entry) );
457  // invert order
458  assert( Vec_IntEntry(vOrder, 1) == pRoot->Id );
459  vOrder = Vec_IntInvert( vTemp = vOrder, 0 );
460  Vec_IntFree( vTemp );
461  assert( Vec_IntEntry(vOrder, 1) == pRoot->Id );
462  // update model numbers
463  Au_ManForEachNtk( p, pNtk, i )
464  {
465  pNtk->Id = Vec_IntEntry( vOrder, pNtk->Id );
466  Au_NtkForEachBox( pNtk, pBox, k )
467  {
468  pBox->Func = Vec_IntEntry( vOrder, pBox->Func );
469  assert( pBox->Func > 0 );
470  Au_BoxForEachFanout( pBox, pFan, j )
471  pFan->Func = pBox->Func;
472  }
473  }
474  // update
475  ABC_FREE( p->vNtks.pArray );
476  p->vNtks.pArray = vNtksNew->pArray;
477  vNtksNew->pArray = NULL;
478  Vec_PtrFree( vNtksNew );
479  // verify
480  Au_ManForEachNtk( p, pNtk, i )
481  Au_NtkForEachBox( pNtk, pBox, k )
482  {
483  pBoxModel = Au_ObjModel(pBox);
484  if ( pBoxModel == NULL || pBoxModel == pNtk )
485  continue;
486  assert( !pBox->Func || pBox->Func >= (unsigned)pNtk->Id );
487  assert( Au_ObjFaninNum(pBox) == Au_NtkPiNum(pBoxModel) );
488  assert( Au_BoxFanoutNum(pBox) == Au_NtkPoNum(pBoxModel) );
489  }
490  Vec_IntFree( vOrder );
491 }
unsigned Func
Definition: abcHieNew.c:57
#define Au_BoxForEachFanout(pObj, pFanout, i)
Definition: abcHieNew.c:211
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
#define Au_ManForEachNtk(p, pNtk, i)
Definition: abcHieNew.c:199
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void Au_ManReorderModels_rec(Au_Ntk_t *pNtk, Vec_Int_t *vOrder)
Definition: abcHieNew.c:409
static Vec_Int_t * Vec_IntInvert(Vec_Int_t *p, int Fill)
Definition: vecInt.h:1092
static int Au_NtkPoNum(Au_Ntk_t *p)
Definition: abcHieNew.c:134
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static void Vec_IntReverseOrder(Vec_Int_t *p)
Definition: vecInt.h:1042
static int Au_BoxFanoutNum(Au_Obj_t *p)
Definition: abcHieNew.c:181
static Au_Ntk_t * Au_ObjModel(Au_Obj_t *p)
Definition: abcHieNew.c:162
static int Au_ObjFaninNum(Au_Obj_t *p)
Definition: abcHieNew.c:164
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Au_ManNtkNum(Au_Man_t *p)
Definition: abcHieNew.c:127
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
static int Vec_IntPop(Vec_Int_t *p)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Au_NtkPiNum(Au_Ntk_t *p)
Definition: abcHieNew.c:133
#define Au_NtkForEachBox(p, pObj, i)
Definition: abcHieNew.c:222
static int Vec_IntEntryLast(Vec_Int_t *p)
Definition: bblif.c:319
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static Au_Ntk_t * Au_ManNtk(Au_Man_t *p, int i)
Definition: abcHieNew.c:128
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Au_ManReorderModels_rec ( Au_Ntk_t pNtk,
Vec_Int_t vOrder 
)

Definition at line 409 of file abcHieNew.c.

410 {
411  Au_Ntk_t * pBoxModel;
412  Au_Obj_t * pObj;
413  int k;
414  if ( pNtk->fMark )
415  return;
416  pNtk->fMark = 1;
417  Au_NtkForEachBox( pNtk, pObj, k )
418  {
419  pBoxModel = Au_ObjModel(pObj);
420  if ( pBoxModel == NULL || pBoxModel == pNtk )
421  continue;
422  Au_ManReorderModels_rec( pBoxModel, vOrder );
423  }
424  Vec_IntPush( vOrder, pNtk->Id );
425 }
void Au_ManReorderModels_rec(Au_Ntk_t *pNtk, Vec_Int_t *vOrder)
Definition: abcHieNew.c:409
static Au_Ntk_t * Au_ObjModel(Au_Obj_t *p)
Definition: abcHieNew.c:162
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
#define Au_NtkForEachBox(p, pObj, i)
Definition: abcHieNew.c:222
int Id
Definition: abcHieNew.c:68
int fMark
Definition: abcHieNew.c:89
static Au_Obj_t* Au_Not ( Au_Obj_t p)
inlinestatic

Definition at line 120 of file abcHieNew.c.

120 { return (Au_Obj_t *)((ABC_PTRUINT_T)(p) ^ 01); }
static Au_Obj_t* Au_NotCond ( Au_Obj_t p,
int  c 
)
inlinestatic

Definition at line 121 of file abcHieNew.c.

121 { return (Au_Obj_t *)((ABC_PTRUINT_T)(p) ^ (c)); }
Au_Ntk_t* Au_NtkAlloc ( Au_Man_t pMan,
char *  pName 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Working with models.]

Description []

SideEffects []

SeeAlso []

Definition at line 245 of file abcHieNew.c.

246 {
247  Au_Ntk_t * p;
248  p = ABC_CALLOC( Au_Ntk_t, 1 );
249  p->pName = Au_UtilStrsav( pName );
250  p->vChunks = Vec_PtrAlloc( 111 );
251  Vec_IntGrow( &p->vPis, 111 );
252  Vec_IntGrow( &p->vPos, 111 );
253  Vec_IntGrow( &p->vObjs, 1111 );
254  Vec_PtrGrow( &p->vPages, 11 );
255  Au_ManAddNtk( pMan, p );
256  return p;
257 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrGrow(Vec_Ptr_t *p, int nCapMin)
Definition: vecPtr.h:430
Vec_Ptr_t vPages
Definition: abcHieNew.c:76
Vec_Int_t vObjs
Definition: abcHieNew.c:72
static void Vec_IntGrow(Vec_Int_t *p, int nCapMin)
Definition: bblif.c:336
char * pName
Definition: abcHieNew.c:66
static char * Au_UtilStrsav(char *s)
Definition: abcHieNew.c:124
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Vec_Int_t vPos
Definition: abcHieNew.c:71
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
Vec_Ptr_t * vChunks
Definition: abcHieNew.c:75
Vec_Int_t vPis
Definition: abcHieNew.c:70
void Au_ManAddNtk(Au_Man_t *pMan, Au_Ntk_t *p)
Definition: abcHieNew.c:370
int Au_NtkAllocObj ( Au_Ntk_t p,
int  nFanins,
int  Type 
)

Definition at line 761 of file abcHieNew.c.

762 {
763  Au_Obj_t * pMem, * pObj, * pTemp;
764  int nObjInt = ((2+nFanins) >> 2) + (((2+nFanins) & 3) > 0);
765  int Id, nObjIntReal = nObjInt;
766  if ( nObjInt > 63 )
767  nObjInt = 63 + 64 * (((nObjInt-63) >> 6) + (((nObjInt-63) & 63) > 0));
768  if ( Vec_PtrSize(&p->vPages) == 0 || p->iHandle + nObjInt > (1 << 12) )
769  {
770  if ( nObjInt + 64 > (1 << 12) )
771  pMem = ABC_CALLOC( Au_Obj_t, nObjInt + 64 ), p->nObjsAlloc += nObjInt + 64;
772  else
773  pMem = ABC_CALLOC( Au_Obj_t, (1 << 12) + 64 ), p->nObjsAlloc += (1 << 12) + 64;
774  Vec_PtrPush( p->vChunks, pMem );
775  if ( ((ABC_PTRINT_T)pMem & 0xF) )
776  pMem = (Au_Obj_t *)((char *)pMem + 16 - ((ABC_PTRINT_T)pMem & 0xF));
777  assert( ((ABC_PTRINT_T)pMem & 0xF) == 0 );
778  p->iHandle = (((ABC_PTRINT_T)pMem & 0x3FF) >> 4);
779  if ( p->iHandle )
780  {
781  pMem += 64 - (p->iHandle & 63);
782  p->iHandle = 0;
783  }
784  Vec_PtrPush( &p->vPages, pMem );
785  Au_NtkInsertHeader( p );
786  }
787  else
788  {
789  pMem = (Au_Obj_t *)Vec_PtrEntryLast( &p->vPages );
790  if ( (p->iHandle & 63) == 0 || nObjInt > (64 - (p->iHandle & 63)) )
791  {
792  if ( p->iHandle & 63 )
793  p->iHandle += 64 - (p->iHandle & 63);
794  Au_NtkInsertHeader( p );
795  }
796  if ( p->iHandle + nObjInt > (1 << 12) )
797  return Au_NtkAllocObj( p, nFanins, Type );
798  }
799  pObj = pMem + p->iHandle;
800  assert( *((int *)pObj) == 0 );
801  pObj->nFanins = nFanins;
802  p->nObjs[pObj->Type = Type]++;
803  if ( Type == AU_OBJ_PI )
804  {
805  Au_ObjSetFaninLit( pObj, 0, Vec_IntSize(&p->vPis) );
806  Vec_IntPush( &p->vPis, Au_ObjId(pObj) );
807  }
808  else if ( Type == AU_OBJ_PO )
809  {
810  Au_ObjSetFaninLit( pObj, 1, Vec_IntSize(&p->vPos) );
811  Vec_IntPush( &p->vPos, Au_ObjId(pObj) );
812  }
813  p->iHandle += nObjInt;
814  p->nObjsUsed += nObjIntReal;
815 
816  Id = Au_ObjId(pObj);
817  Vec_IntPush( &p->vObjs, Id );
818  pTemp = Au_NtkObj( p, Id );
819  assert( pTemp == pObj );
820  return Id;
821 }
int Au_NtkAllocObj(Au_Ntk_t *p, int nFanins, int Type)
Definition: abcHieNew.c:761
static void Au_NtkInsertHeader(Au_Ntk_t *p)
Definition: abcHieNew.c:753
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static Au_Obj_t * Au_NtkObj(Au_Ntk_t *p, int h)
Definition: abcHieNew.c:141
Vec_Ptr_t vPages
Definition: abcHieNew.c:76
Vec_Int_t vObjs
Definition: abcHieNew.c:72
unsigned Type
Definition: abcHieNew.c:59
unsigned nFanins
Definition: abcHieNew.c:60
static void * Vec_PtrEntryLast(Vec_Ptr_t *p)
Definition: vecPtr.h:413
int nObjsUsed
Definition: abcHieNew.c:79
int nObjs[AU_OBJ_VOID]
Definition: abcHieNew.c:73
static int Au_ObjId(Au_Obj_t *p)
Definition: abcHieNew.c:159
int nObjsAlloc
Definition: abcHieNew.c:78
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Vec_Int_t vPos
Definition: abcHieNew.c:71
static void Au_ObjSetFaninLit(Au_Obj_t *p, int i, int f)
Definition: abcHieNew.c:179
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
int iHandle
Definition: abcHieNew.c:77
Vec_Ptr_t * vChunks
Definition: abcHieNew.c:75
Vec_Int_t vPis
Definition: abcHieNew.c:70
static int Au_NtkBoxNum ( Au_Ntk_t p)
inlinestatic

Definition at line 137 of file abcHieNew.c.

137 { return p->nObjs[AU_OBJ_BOX]; }
int nObjs[AU_OBJ_VOID]
Definition: abcHieNew.c:73
int Au_NtkCheckRecursive ( Au_Ntk_t pNtk)

Definition at line 660 of file abcHieNew.c.

661 {
662  Vec_Ptr_t * vMods;
663  Au_Ntk_t * pModel;
664  Au_Obj_t * pObj;
665  int i, k, RetValue = 0;
666 
667  if ( pNtk->pMan == NULL )
668  {
669  printf( "There is no hierarchy information.\n" );
670  return RetValue;
671  }
672 
673  vMods = &pNtk->pMan->vNtks;
674  Vec_PtrForEachEntryStart( Au_Ntk_t *, vMods, pModel, i, 1 )
675  {
676  Au_NtkForEachObj( pModel, pObj, k )
677  if ( Au_ObjIsBox(pObj) && Au_ObjModel(pObj) == pModel )
678  {
679  printf( "WARNING: Model \"%s\" contains a recursive defition.\n", Au_NtkName(pModel) );
680  RetValue = 1;
681  break;
682  }
683  }
684  return RetValue;
685 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
#define Au_NtkForEachObj(p, pObj, i)
Definition: abcHieNew.c:218
static int Au_ObjIsBox(Au_Obj_t *p)
Definition: abcHieNew.c:153
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
Definition: vecPtr.h:57
Vec_Ptr_t vNtks
Definition: abcHieNew.c:101
static Au_Ntk_t * Au_ObjModel(Au_Obj_t *p)
Definition: abcHieNew.c:162
Au_Man_t * pMan
Definition: abcHieNew.c:67
static char * Au_NtkName(Au_Ntk_t *p)
Definition: abcHieNew.c:131
if(last==0)
Definition: sparse_int.h:34
void Au_NtkCleanCopy ( Au_Ntk_t p)

Definition at line 297 of file abcHieNew.c.

298 {
299  Vec_IntFill( &p->vCopies, Au_NtkObjNumMax(p), -1 );
300 }
Vec_Int_t vCopies
Definition: abcHieNew.c:83
static int Au_NtkObjNumMax(Au_Ntk_t *p)
Definition: abcHieNew.c:139
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
int Au_NtkCompareNames ( Au_Ntk_t **  p1,
Au_Ntk_t **  p2 
)

Definition at line 539 of file abcHieNew.c.

540 {
541  return strcmp( Au_NtkName(*p1), Au_NtkName(*p2) );
542 }
int strcmp()
static char * Au_NtkName(Au_Ntk_t *p)
Definition: abcHieNew.c:131
int Au_NtkCompareSign ( Au_Ntk_t **  p1,
Au_Ntk_t **  p2 
)

Definition at line 621 of file abcHieNew.c.

622 {
623  if ( Au_NtkPiNum(*p1) - Au_NtkPiNum(*p2) != 0 )
624  return Au_NtkPiNum(*p1) - Au_NtkPiNum(*p2);
625  else
626  return Au_NtkPoNum(*p1) - Au_NtkPoNum(*p2);
627 }
static int Au_NtkPoNum(Au_Ntk_t *p)
Definition: abcHieNew.c:134
static int Au_NtkPiNum(Au_Ntk_t *p)
Definition: abcHieNew.c:133
int Au_NtkCreateBox ( Au_Ntk_t pNtk,
Vec_Int_t vFanins,
int  nFanouts,
int  iModel 
)

Definition at line 857 of file abcHieNew.c.

858 {
859  int i, iFanin, nFanins = Vec_IntSize(vFanins);
860  int Id = Au_NtkAllocObj( pNtk, nFanins + 1 + nFanouts, AU_OBJ_BOX );
861  Au_Obj_t * p = Au_NtkObj( pNtk, Id );
862  Vec_IntForEachEntry( vFanins, iFanin, i )
863  Au_ObjSetFaninLit( p, i, iFanin );
864  Au_ObjSetFaninLit( p, nFanins, nFanouts );
865  for ( i = 0; i < nFanouts; i++ )
866  Au_ObjSetFaninLit( p, nFanins + 1 + i, Au_NtkCreateFan(pNtk, Au_Var2Lit(Id,0), i, iModel) );
867  p->nFanins = nFanins;
868  p->Func = iModel;
869  assert( iModel > 0 );
870  return Id;
871 }
int Au_NtkAllocObj(Au_Ntk_t *p, int nFanins, int Type)
Definition: abcHieNew.c:761
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Au_Var2Lit(int Var, int fCompl)
Definition: abcHieNew.c:112
static Au_Obj_t * Au_NtkObj(Au_Ntk_t *p, int h)
Definition: abcHieNew.c:141
for(p=first;p->value< newval;p=p->next)
int Au_NtkCreateFan(Au_Ntk_t *pNtk, int iFanin, int iFanout, int iModel)
Definition: abcHieNew.c:837
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static void Au_ObjSetFaninLit(Au_Obj_t *p, int i, int f)
Definition: abcHieNew.c:179
#define assert(ex)
Definition: util_old.h:213
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
int Au_NtkCreateConst0 ( Au_Ntk_t pNtk)

Definition at line 822 of file abcHieNew.c.

823 {
824  return Au_NtkAllocObj( pNtk, 0, AU_OBJ_CONST0 );
825 }
int Au_NtkAllocObj(Au_Ntk_t *p, int nFanins, int Type)
Definition: abcHieNew.c:761
int Au_NtkCreateFan ( Au_Ntk_t pNtk,
int  iFanin,
int  iFanout,
int  iModel 
)

Definition at line 837 of file abcHieNew.c.

838 {
839  int Id = Au_NtkAllocObj( pNtk, 1, AU_OBJ_FAN );
840  Au_Obj_t * p = Au_NtkObj( pNtk, Id );
841  if ( iFanin )
842  Au_ObjSetFaninLit( p, 0, iFanin );
843  Au_ObjSetFaninLit( p, 1, iFanout );
844  p->Func = iModel;
845  return Id;
846 }
int Au_NtkAllocObj(Au_Ntk_t *p, int nFanins, int Type)
Definition: abcHieNew.c:761
unsigned Func
Definition: abcHieNew.c:57
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Au_Obj_t * Au_NtkObj(Au_Ntk_t *p, int h)
Definition: abcHieNew.c:141
static void Au_ObjSetFaninLit(Au_Obj_t *p, int i, int f)
Definition: abcHieNew.c:179
int Au_NtkCreateNode ( Au_Ntk_t pNtk,
Vec_Int_t vFanins,
int  iFunc 
)

Definition at line 847 of file abcHieNew.c.

848 {
849  int i, iFanin;
850  int Id = Au_NtkAllocObj( pNtk, Vec_IntSize(vFanins), AU_OBJ_NODE );
851  Au_Obj_t * p = Au_NtkObj( pNtk, Id );
852  Vec_IntForEachEntry( vFanins, iFanin, i )
853  Au_ObjSetFaninLit( p, i, iFanin );
854  p->Func = iFunc;
855  return Id;
856 }
int Au_NtkAllocObj(Au_Ntk_t *p, int nFanins, int Type)
Definition: abcHieNew.c:761
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Au_Obj_t * Au_NtkObj(Au_Ntk_t *p, int h)
Definition: abcHieNew.c:141
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static void Au_ObjSetFaninLit(Au_Obj_t *p, int i, int f)
Definition: abcHieNew.c:179
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
int Au_NtkCreatePi ( Au_Ntk_t pNtk)

Definition at line 826 of file abcHieNew.c.

827 {
828  return Au_NtkAllocObj( pNtk, 0, AU_OBJ_PI );
829 }
int Au_NtkAllocObj(Au_Ntk_t *p, int nFanins, int Type)
Definition: abcHieNew.c:761
int Au_NtkCreatePo ( Au_Ntk_t pNtk,
int  iFanin 
)

Definition at line 830 of file abcHieNew.c.

831 {
832  int Id = Au_NtkAllocObj( pNtk, 1, AU_OBJ_PO );
833  if ( iFanin )
834  Au_ObjSetFaninLit( Au_NtkObj(pNtk, Id), 0, iFanin );
835  return Id;
836 }
int Au_NtkAllocObj(Au_Ntk_t *p, int nFanins, int Type)
Definition: abcHieNew.c:761
static Au_Obj_t * Au_NtkObj(Au_Ntk_t *p, int h)
Definition: abcHieNew.c:141
static void Au_ObjSetFaninLit(Au_Obj_t *p, int i, int f)
Definition: abcHieNew.c:179
Au_Ntk_t* Au_NtkDerive ( Au_Man_t pMan,
Abc_Ntk_t pNtk,
Vec_Ptr_t vOrder 
)

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

Synopsis [Duplicates ABC network.]

Description []

SideEffects []

SeeAlso []

Definition at line 1441 of file abcHieNew.c.

1442 {
1443  Au_Ntk_t * p;
1444  Au_Obj_t * pAuObj;
1445  Abc_Obj_t * pObj, * pTerm;
1446 // Vec_Ptr_t * vOrder;
1447  Vec_Int_t * vFanins;
1448  int i, k, iFunc;
1449  assert( Abc_NtkIsNetlist(pNtk) );
1450  Abc_NtkCleanCopy( pNtk );
1451  p = Au_NtkAlloc( pMan, Abc_NtkName(pNtk) );
1452  // copy PIs
1453  Abc_NtkForEachPi( pNtk, pTerm, i )
1454  Abc_ObjFanout0(pTerm)->iTemp = Au_NtkCreatePi(p);
1455  // copy nodes and boxes
1456  vFanins = Vec_IntAlloc( 100 );
1457 // vOrder = Abc_NtkDfsBoxes( pNtk );
1458  Vec_PtrForEachEntry( Abc_Obj_t *, vOrder, pObj, i )
1459  {
1460  Vec_IntClear( vFanins );
1461  if ( Abc_ObjIsNode(pObj) )
1462  {
1463  Abc_ObjForEachFanin( pObj, pTerm, k )
1464  Vec_IntPush( vFanins, Au_Var2Lit(pTerm->iTemp, 0) );
1465  iFunc = Abc_NamStrFindOrAdd( pMan->pFuncs, (char *)pObj->pData, NULL );
1466  Abc_ObjFanout0(pObj)->iTemp = Au_NtkCreateNode(p, vFanins, iFunc);
1467  continue;
1468  }
1469  assert( Abc_ObjIsBox(pObj) );
1470  Abc_ObjForEachFanin( pObj, pTerm, k )
1471  Vec_IntPush( vFanins, Au_Var2Lit(Abc_ObjFanin0(pTerm)->iTemp, 0) );
1472  pObj->iTemp = Au_NtkCreateBox(p, vFanins, Abc_ObjFanoutNum(pObj), ((Abc_Ntk_t *)pObj->pData)->iStep );
1473  pAuObj = Au_NtkObj(p, pObj->iTemp);
1474  Abc_ObjForEachFanout( pObj, pTerm, k )
1475  Abc_ObjFanout0(pTerm)->iTemp = Au_ObjFanout(pAuObj, k);
1476  }
1477 // Vec_PtrFree( vOrder );
1478  Vec_IntFree( vFanins );
1479  // copy POs
1480  Abc_NtkForEachPo( pNtk, pTerm, i )
1481  Au_NtkCreatePo( p, Au_Var2Lit(Abc_ObjFanin0(pTerm)->iTemp, 0) );
1482 // Au_NtkPrintStats( p );
1483  return p;
1484 }
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
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Au_Var2Lit(int Var, int fCompl)
Definition: abcHieNew.c:112
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
int Abc_NamStrFindOrAdd(Abc_Nam_t *p, char *pStr, int *pfFound)
Definition: utilNam.c:392
static int Au_ObjFanout(Au_Obj_t *p, int i)
Definition: abcHieNew.c:188
static Au_Obj_t * Au_NtkObj(Au_Ntk_t *p, int h)
Definition: abcHieNew.c:141
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
Au_Ntk_t * Au_NtkAlloc(Au_Man_t *pMan, char *pName)
FUNCTION DEFINITIONS ///.
Definition: abcHieNew.c:245
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
int Au_NtkCreatePi(Au_Ntk_t *pNtk)
Definition: abcHieNew.c:826
int Au_NtkCreateBox(Au_Ntk_t *pNtk, Vec_Int_t *vFanins, int nFanouts, int iModel)
Definition: abcHieNew.c:857
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
int Au_NtkCreatePo(Au_Ntk_t *pNtk, int iFanin)
Definition: abcHieNew.c:830
int Au_NtkCreateNode(Au_Ntk_t *pNtk, Vec_Int_t *vFanins, int iFunc)
Definition: abcHieNew.c:847
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
static char * Abc_NtkName(Abc_Ntk_t *pNtk)
Definition: abc.h:270
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
#define assert(ex)
Definition: util_old.h:213
static int Abc_ObjIsBox(Abc_Obj_t *pObj)
Definition: abc.h:357
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
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 void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
Gia_Man_t* Au_NtkDeriveFlatGia ( Au_Ntk_t p)

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

Synopsis [Flattens the logic hierarchy of the netlist.]

Description []

SideEffects []

SeeAlso []

Definition at line 1222 of file abcHieNew.c.

1223 {
1224  Gia_Man_t * pTemp, * pGia = NULL;
1225  Au_Obj_t * pTerm;
1226  int i;
1227  printf( "Collapsing model \"%s\"...\n", Au_NtkName(p) );
1228  Au_NtkCleanCopy( p );
1229  // start the network
1230  pGia = Gia_ManStart( (1<<16) );
1231  pGia->pName = Abc_UtilStrsav( Au_NtkName(p) );
1232 // pGia->pSpec = Abc_UtilStrsav( Au_NtkSpec(p) );
1233  Gia_ManHashAlloc( pGia );
1234  Gia_ManFlipVerbose( pGia );
1235  // create PIs
1236  Au_NtkForEachPi( p, pTerm, i )
1237  Au_ObjSetCopy( pTerm, Gia_ManAppendCi(pGia) );
1238  // recursively flatten hierarchy
1239  Au_NtkDeriveFlatGia_rec( pGia, p );
1240  // create POs
1241  Au_NtkForEachPo( p, pTerm, i )
1242  Gia_ManAppendCo( pGia, Au_ObjCopy(pTerm) );
1243  // prepare return value
1244 // Gia_ManHashProfile( pGia );
1245  Gia_ManHashStop( pGia );
1246  Gia_ManSetRegNum( pGia, 0 );
1247  pGia = Gia_ManCleanup( pTemp = pGia );
1248  Gia_ManStop( pTemp );
1249  return pGia;
1250 }
void Au_NtkDeriveFlatGia_rec(Gia_Man_t *pGia, Au_Ntk_t *p)
Definition: abcHieNew.c:1131
#define Au_NtkForEachPi(p, pObj, i)
Definition: abcHieNew.c:214
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
void Au_NtkCleanCopy(Au_Ntk_t *p)
Definition: abcHieNew.c:297
static int Au_ObjCopy(Au_Obj_t *p)
Definition: abcHieNew.c:185
static void Au_ObjSetCopy(Au_Obj_t *p, int c)
Definition: abcHieNew.c:186
char * pName
Definition: gia.h:97
static char * Au_NtkName(Au_Ntk_t *p)
Definition: abcHieNew.c:131
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
#define Au_NtkForEachPo(p, pObj, i)
Definition: abcHieNew.c:216
Definition: gia.h:95
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static void Gia_ManFlipVerbose(Gia_Man_t *p)
Definition: gia.h:396
void Au_NtkDeriveFlatGia_rec ( Gia_Man_t pGia,
Au_Ntk_t p 
)

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

Synopsis [Flattens the logic hierarchy of the netlist.]

Description []

SideEffects []

SeeAlso []

Definition at line 1131 of file abcHieNew.c.

1132 {
1133  Au_Obj_t * pObj, * pTerm;
1134  int i, k, Lit;
1135  Au_NtkForEachPi( p, pTerm, i )
1136  assert( Au_ObjCopy(pTerm) >= 0 );
1137  if ( strcmp(Au_NtkName(p), "ref_egcd") == 0 )
1138  {
1139  printf( "Replacing one instance of recursive model \"%s\" by a black box.\n", "ref_egcd" );
1140  Au_NtkForEachPo( p, pTerm, i )
1141  Au_ObjSetCopy( pTerm, Gia_ManAppendCi(pGia) );
1142  return;
1143  }
1144  Au_NtkForEachObj( p, pObj, i )
1145  {
1146  if ( Au_ObjIsNode(pObj) )
1147  {
1148  if ( p->pMan->pFuncs )
1149  {
1150  int gFanins[16];
1151  char * pSop = Abc_NamStr( p->pMan->pFuncs, pObj->Func );
1152  assert( Au_ObjFaninNum(pObj) <= 16 );
1153  assert( Au_ObjFaninNum(pObj) == Abc_SopGetVarNum(pSop) );
1154  Au_ObjForEachFanin( pObj, pTerm, k )
1155  {
1156  gFanins[k] = Au_ObjCopy(pTerm);
1157  assert( gFanins[k] >= 0 );
1158  }
1159  Lit = Abc_NtkDeriveFlatGiaSop( pGia, gFanins, pSop );
1160  }
1161  else
1162  {
1163  int Lit0, Lit1, Lit2;
1164  assert( pObj->Func >= 1 && pObj->Func <= 3 );
1165  Lit0 = Abc_LitNotCond( Au_ObjCopy(Au_ObjFanin0(pObj)), Au_ObjFaninC0(pObj) );
1166  Lit1 = Abc_LitNotCond( Au_ObjCopy(Au_ObjFanin1(pObj)), Au_ObjFaninC1(pObj) );
1167  if ( pObj->Func == 1 )
1168  Lit = Gia_ManHashAnd( pGia, Lit0, Lit1 );
1169  else if ( pObj->Func == 2 )
1170  Lit = Gia_ManHashXor( pGia, Lit0, Lit1 );
1171  else if ( pObj->Func == 3 )
1172  {
1173  Lit2 = Abc_LitNotCond( Au_ObjCopy(Au_ObjFanin2(pObj)), Au_ObjFaninC2(pObj) );
1174  Lit = Gia_ManHashMux( pGia, Lit0, Lit1, Lit2 );
1175  }
1176  else assert( 0 );
1177  }
1178  assert( Lit >= 0 );
1179  Au_ObjSetCopy( pObj, Lit );
1180  }
1181  else if ( Au_ObjIsBox(pObj) )
1182  {
1183  Au_Ntk_t * pModel = Au_ObjModel(pObj);
1184  Au_NtkCleanCopy( pModel );
1185  // check the match between the number of actual and formal parameters
1186  assert( Au_ObjFaninNum(pObj) == Au_NtkPiNum(pModel) );
1187  assert( Au_BoxFanoutNum(pObj) == Au_NtkPoNum(pModel) );
1188  // assign PIs
1189  Au_ObjForEachFanin( pObj, pTerm, k )
1190  Au_ObjSetCopy( Au_NtkPi(pModel, k), Au_ObjCopy(pTerm) );
1191  // call recursively
1192  Au_NtkDeriveFlatGia_rec( pGia, pModel );
1193  // assign POs
1194  Au_BoxForEachFanout( pObj, pTerm, k )
1195  Au_ObjSetCopy( pTerm, Au_ObjCopy(Au_NtkPo(pModel, k)) );
1196  }
1197  else if ( Au_ObjIsConst0(pObj) )
1198  Au_ObjSetCopy( pObj, 0 );
1199 
1200  }
1201  Au_NtkForEachPo( p, pTerm, i )
1202  {
1203  Lit = Abc_LitNotCond( Au_ObjCopy(Au_ObjFanin0(pTerm)), Au_ObjFaninC0(pTerm) );
1204  Au_ObjSetCopy( pTerm, Lit );
1205  }
1206  Au_NtkForEachPo( p, pTerm, i )
1207  assert( Au_ObjCopy(pTerm) >= 0 );
1208 // p->pMan->nGiaObjMax = Abc_MaxInt( p->pMan->nGiaObjMax, Gia_ManObjNum(pGia) );
1209 }
void Au_NtkDeriveFlatGia_rec(Gia_Man_t *pGia, Au_Ntk_t *p)
Definition: abcHieNew.c:1131
#define Au_NtkForEachPi(p, pObj, i)
Definition: abcHieNew.c:214
#define Au_BoxForEachFanout(pObj, pFanout, i)
Definition: abcHieNew.c:211
static int Au_ObjFaninC0(Au_Obj_t *p)
Definition: abcHieNew.c:174
static int Au_ObjIsConst0(Au_Obj_t *p)
Definition: abcHieNew.c:148
#define Au_NtkForEachObj(p, pObj, i)
Definition: abcHieNew.c:218
static int Au_ObjFaninC1(Au_Obj_t *p)
Definition: abcHieNew.c:175
static int Au_ObjIsBox(Au_Obj_t *p)
Definition: abcHieNew.c:153
#define Au_ObjForEachFanin(pObj, pFanin, i)
Definition: abcHieNew.c:209
int Gia_ManHashXor(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:658
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
static int Au_NtkPoNum(Au_Ntk_t *p)
Definition: abcHieNew.c:134
void Au_NtkCleanCopy(Au_Ntk_t *p)
Definition: abcHieNew.c:297
static Au_Obj_t * Au_ObjFanin0(Au_Obj_t *p)
Definition: abcHieNew.c:170
static int Au_ObjCopy(Au_Obj_t *p)
Definition: abcHieNew.c:185
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
static int Au_BoxFanoutNum(Au_Obj_t *p)
Definition: abcHieNew.c:181
static void Au_ObjSetCopy(Au_Obj_t *p, int c)
Definition: abcHieNew.c:186
int strcmp()
static Au_Ntk_t * Au_ObjModel(Au_Obj_t *p)
Definition: abcHieNew.c:162
static int Au_ObjFaninNum(Au_Obj_t *p)
Definition: abcHieNew.c:164
static int Au_ObjFaninC2(Au_Obj_t *p)
Definition: abcHieNew.c:176
int Abc_NtkDeriveFlatGiaSop(Gia_Man_t *pGia, int *gFanins, char *pSop)
Definition: abcHieCec.c:131
static char * Au_NtkName(Au_Ntk_t *p)
Definition: abcHieNew.c:131
int Gia_ManHashMux(Gia_Man_t *p, int iCtrl, int iData1, int iData0)
Definition: giaHash.c:677
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
#define Au_NtkForEachPo(p, pObj, i)
Definition: abcHieNew.c:216
static int Au_NtkPiNum(Au_Ntk_t *p)
Definition: abcHieNew.c:133
char * Abc_NamStr(Abc_Nam_t *p, int NameId)
Definition: utilNam.c:479
static Au_Obj_t * Au_NtkPi(Au_Ntk_t *p, int i)
Definition: abcHieNew.c:143
static Au_Obj_t * Au_ObjFanin1(Au_Obj_t *p)
Definition: abcHieNew.c:171
ABC_DLL int Abc_SopGetVarNum(char *pSop)
Definition: abcSop.c:536
#define assert(ex)
Definition: util_old.h:213
static Au_Obj_t * Au_NtkPo(Au_Ntk_t *p, int i)
Definition: abcHieNew.c:144
static int Au_ObjIsNode(Au_Obj_t *p)
Definition: abcHieNew.c:154
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
static Au_Obj_t * Au_ObjFanin2(Au_Obj_t *p)
Definition: abcHieNew.c:172
static int Au_NtkFanNum ( Au_Ntk_t p)
inlinestatic

Definition at line 135 of file abcHieNew.c.

135 { return p->nObjs[AU_OBJ_FAN]; }
int nObjs[AU_OBJ_VOID]
Definition: abcHieNew.c:73
static int Au_NtkFlopNum ( Au_Ntk_t p)
inlinestatic

Definition at line 136 of file abcHieNew.c.

136 { return p->nObjs[AU_OBJ_FLOP]; }
int nObjs[AU_OBJ_VOID]
Definition: abcHieNew.c:73
void Au_NtkFree ( Au_Ntk_t p)

Definition at line 258 of file abcHieNew.c.

259 {
260  Au_ManFree( p->pMan );
261  Vec_PtrFreeFree( p->vChunks );
262  ABC_FREE( p->vCopies.pArray );
263  ABC_FREE( p->vPages.pArray );
264  ABC_FREE( p->vObjs.pArray );
265  ABC_FREE( p->vPis.pArray );
266  ABC_FREE( p->vPos.pArray );
267  ABC_FREE( p->pHTable );
268  ABC_FREE( p->pName );
269  ABC_FREE( p );
270 }
void Au_ManFree(Au_Man_t *p)
Definition: abcHieNew.c:336
static void Vec_PtrFreeFree(Vec_Ptr_t *p)
Definition: vecPtr.h:569
Vec_Ptr_t vPages
Definition: abcHieNew.c:76
Vec_Int_t vCopies
Definition: abcHieNew.c:83
Vec_Int_t vObjs
Definition: abcHieNew.c:72
Au_Man_t * pMan
Definition: abcHieNew.c:67
char * pName
Definition: abcHieNew.c:66
int * pHTable
Definition: abcHieNew.c:86
Vec_Int_t vPos
Definition: abcHieNew.c:71
#define ABC_FREE(obj)
Definition: abc_global.h:232
Vec_Ptr_t * vChunks
Definition: abcHieNew.c:75
Vec_Int_t vPis
Definition: abcHieNew.c:70
static void Au_NtkIncrementTravId ( Au_Ntk_t p)
inlinestatic

Definition at line 191 of file abcHieNew.c.

191 { if (p->vTravIds.pArray == NULL) Vec_IntFill(&p->vTravIds, Au_NtkObjNumMax(p)+500, 0); p->nTravIds++; assert(p->nTravIds < (1<<30)); }
Vec_Int_t vTravIds
Definition: abcHieNew.c:82
static int Au_NtkObjNumMax(Au_Ntk_t *p)
Definition: abcHieNew.c:139
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
int nTravIds
Definition: abcHieNew.c:81
#define assert(ex)
Definition: util_old.h:213
static void Au_NtkInsertHeader ( Au_Ntk_t p)
inlinestatic

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

Synopsis [Returns memory for the next object.]

Description []

SideEffects []

SeeAlso []

Definition at line 753 of file abcHieNew.c.

754 {
755  Au_Obj_t * pMem = (Au_Obj_t *)Vec_PtrEntryLast( &p->vPages );
756  assert( (((ABC_PTRINT_T)(pMem + p->iHandle) & 0x3FF) >> 4) == 0 );
757  ((Au_Ntk_t **)(pMem + p->iHandle))[0] = p;
758  ((int *)(pMem + p->iHandle))[2] = ((Vec_PtrSize(&p->vPages) - 1) << 12) | (p->iHandle & 0xFC0);
759  p->iHandle++;
760 }
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Vec_Ptr_t vPages
Definition: abcHieNew.c:76
static void * Vec_PtrEntryLast(Vec_Ptr_t *p)
Definition: vecPtr.h:413
#define assert(ex)
Definition: util_old.h:213
int iHandle
Definition: abcHieNew.c:77
static Au_Man_t* Au_NtkMan ( Au_Ntk_t p)
inlinestatic

Definition at line 132 of file abcHieNew.c.

132 { return p->pMan; }
Au_Man_t * pMan
Definition: abcHieNew.c:67
int Au_NtkMemUsage ( Au_Ntk_t p)

Definition at line 271 of file abcHieNew.c.

272 {
273  int Mem = sizeof(Au_Ntk_t);
274  Mem += 4 * p->vPis.nCap;
275  Mem += 4 * p->vPos.nCap;
276  Mem += 4 * p->vObjs.nCap;
277  Mem += 16 * p->nObjsAlloc;
278  return Mem;
279 }
Vec_Int_t vObjs
Definition: abcHieNew.c:72
int nObjsAlloc
Definition: abcHieNew.c:78
struct Au_Ntk_t_ Au_Ntk_t
Definition: abcHieNew.c:52
Vec_Int_t vPos
Definition: abcHieNew.c:71
Vec_Int_t vPis
Definition: abcHieNew.c:70
static char* Au_NtkName ( Au_Ntk_t p)
inlinestatic

Definition at line 131 of file abcHieNew.c.

131 { return p->pName; }
char * pName
Definition: abcHieNew.c:66
static int Au_NtkNodeNum ( Au_Ntk_t p)
inlinestatic

Definition at line 138 of file abcHieNew.c.

138 { return p->nObjs[AU_OBJ_NODE]; }
int nObjs[AU_OBJ_VOID]
Definition: abcHieNew.c:73
int Au_NtkNodeNumFunc ( Au_Ntk_t p,
int  Func 
)

Definition at line 301 of file abcHieNew.c.

302 {
303  Au_Obj_t * pObj;
304  int i, Counter = 0;
305  if ( p->pMan && p->pMan->pFuncs )
306  return 0;
307  Au_NtkForEachNode( p, pObj, i )
308  {
309  Counter += (pObj->Func == (unsigned)Func);
310 // printf( "%d ", pObj->Func );
311  }
312 // printf( "\n" );
313  return Counter;
314 }
unsigned Func
Definition: abcHieNew.c:57
Au_Man_t * pMan
Definition: abcHieNew.c:67
Abc_Nam_t * pFuncs
Definition: abcHieNew.c:102
#define Au_NtkForEachNode(p, pObj, i)
Definition: abcHieNew.c:220
static int Counter
static Au_Obj_t* Au_NtkObj ( Au_Ntk_t p,
int  h 
)
inlinestatic

Definition at line 141 of file abcHieNew.c.

141 { return (Au_Obj_t *)p->vPages.pArray[h >> 12] + (h & 0xFFF); }
Vec_Ptr_t vPages
Definition: abcHieNew.c:76
static Au_Obj_t* Au_NtkObjI ( Au_Ntk_t p,
int  i 
)
inlinestatic

Definition at line 145 of file abcHieNew.c.

145 { return Au_NtkObj(p, Vec_IntEntry(&p->vObjs, i)); }
static Au_Obj_t * Au_NtkObj(Au_Ntk_t *p, int h)
Definition: abcHieNew.c:141
Vec_Int_t vObjs
Definition: abcHieNew.c:72
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Au_NtkObjNum ( Au_Ntk_t p)
inlinestatic

Definition at line 140 of file abcHieNew.c.

140 { return Vec_IntSize(&p->vObjs); }
Vec_Int_t vObjs
Definition: abcHieNew.c:72
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Au_NtkObjNumMax ( Au_Ntk_t p)
inlinestatic

Definition at line 139 of file abcHieNew.c.

139 { return (Vec_PtrSize(&p->vPages) - 1) * (1 << 12) + p->iHandle; }
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Vec_Ptr_t vPages
Definition: abcHieNew.c:76
int iHandle
Definition: abcHieNew.c:77
Au_Ntk_t* Au_NtkParseCBlif ( char *  pFileName)

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

Synopsis [Parses CBLIF file.]

Description []

SideEffects []

SeeAlso []

Definition at line 959 of file abcHieNew.c.

960 {
961  FILE * pFile;
962  Au_Man_t * pMan;
963  Au_Ntk_t * pRoot = NULL;
964  Au_Obj_t * pBox, * pFan;
965  char * pBuffer, * pCur;
966  Vec_Int_t * vLines, * vNum2Obj, * vFanins;
967  int i, k, j, Id, nInputs, nOutputs;
968  int Line, Num, Func;
969  // read the file
970  pFile = fopen( pFileName, "rb" );
971  if ( pFile == NULL )
972  {
973  printf( "Cannot open file \"%s\".\n", pFileName );
974  return NULL;
975  }
976  pBuffer = Extra_FileRead( pFile );
977  fclose( pFile );
978  // split into lines
979  vLines = Vec_IntAlloc( 1000 );
980  Vec_IntPush( vLines, 0 );
981  for ( pCur = pBuffer; *pCur; pCur++ )
982  if ( *pCur == '\n' )
983  {
984  *pCur = 0;
985  Vec_IntPush( vLines, pCur - pBuffer + 1 );
986  }
987  // start the manager
988  pMan = Au_ManAlloc( pFileName );
989  // parse the lines
990  vNum2Obj = Vec_IntAlloc( 1000 );
991  vFanins = Vec_IntAlloc( 1000 );
992  Vec_IntForEachEntry( vLines, Line, i )
993  {
994  pCur = strtok( pBuffer + Line, " \t\r" );
995  if ( pCur == NULL || *pCur == '#' )
996  continue;
997  if ( *pCur != '.' )
998  {
999  printf( "Cannot read directive in line %d: \"%s\".\n", i, pBuffer + Line );
1000  continue;
1001  }
1002  Vec_IntClear( vFanins );
1003  if ( !strcmp(pCur, ".and") )
1004  {
1005  for ( k = 0; k < 2; k++ )
1006  {
1007  pCur = strtok( NULL, " \t\r" );
1008  Num = atoi( pCur );
1009  Vec_IntPush( vFanins, Au_NtkRemapNum(vNum2Obj, Num) );
1010  }
1011  Id = Au_NtkCreateNode( pRoot, vFanins, 1 );
1012  Vec_IntPush( vNum2Obj, Id );
1013  }
1014  else if ( !strcmp(pCur, ".xor") )
1015  {
1016  for ( k = 0; k < 2; k++ )
1017  {
1018  pCur = strtok( NULL, " \t\r" );
1019  Num = atoi( pCur );
1020  Vec_IntPush( vFanins, Au_NtkRemapNum(vNum2Obj, Num) );
1021  }
1022  Id = Au_NtkCreateNode( pRoot, vFanins, 2 );
1023  Vec_IntPush( vNum2Obj, Id );
1024  }
1025  else if ( !strcmp(pCur, ".mux") )
1026  {
1027  for ( k = 0; k < 3; k++ )
1028  {
1029  pCur = strtok( NULL, " \t\r" );
1030  Num = atoi( pCur );
1031  Vec_IntPush( vFanins, Au_NtkRemapNum(vNum2Obj, Num) );
1032  }
1033  Id = Au_NtkCreateNode( pRoot, vFanins, 3 );
1034  Vec_IntPush( vNum2Obj, Id );
1035  }
1036  else if ( !strcmp(pCur, ".subckt") )
1037  {
1038  pCur = strtok( NULL, " \t\r" );
1039  Func = pCur - pBuffer;
1040  pCur = strtok( NULL, " \t\r" );
1041  nInputs = atoi( pCur );
1042  pCur = strtok( NULL, " \t\r" );
1043  nOutputs = atoi( pCur );
1044  while ( 1 )
1045  {
1046  pCur = strtok( NULL, " \t\r" );
1047  if ( pCur == NULL || *pCur == '#' )
1048  break;
1049  Au_NtkParseCBlifNum( vFanins, pCur, vNum2Obj );
1050  }
1051  assert( Vec_IntSize(vFanins) == nInputs );
1052  Id = Au_NtkCreateBox( pRoot, vFanins, nOutputs, Func );
1053  pBox = Au_NtkObj( pRoot, Id );
1054  Au_BoxForEachFanoutId( pBox, Num, k )
1055  Vec_IntPush( vNum2Obj, Num );
1056  }
1057  else if ( !strcmp(pCur, ".model") )
1058  {
1059  pCur = strtok( NULL, " \t\r" );
1060  pRoot = Au_NtkAlloc( pMan, pCur );
1061  Id = Au_NtkCreateConst0( pRoot );
1062  Vec_IntClear( vNum2Obj );
1063  Vec_IntPush( vNum2Obj, Id );
1064  }
1065  else if ( !strcmp(pCur, ".inputs") )
1066  {
1067  pCur = strtok( NULL, " \t\r" );
1068  Num = atoi( pCur );
1069  for ( k = 0; k < Num; k++ )
1070  Vec_IntPush( vNum2Obj, Au_NtkCreatePi(pRoot) );
1071  }
1072  else if ( !strcmp(pCur, ".outputs") )
1073  {
1074  pCur = strtok( NULL, " \t\r" );
1075  nOutputs = atoi( pCur );
1076  while ( 1 )
1077  {
1078  pCur = strtok( NULL, " \t\r" );
1079  if ( pCur == NULL || *pCur == '#' )
1080  break;
1081  Au_NtkParseCBlifNum( vFanins, pCur, vNum2Obj );
1082  }
1083  assert( Vec_IntSize(vFanins) == nOutputs );
1084  Vec_IntForEachEntry( vFanins, Num, k )
1085  Au_NtkCreatePo( pRoot, Num );
1086  }
1087  else if ( strcmp(pCur, ".end") )
1088  printf( "Unknown directive in line %d: \"%s\".\n", i, pBuffer + Line );
1089  }
1090  Vec_IntFree( vFanins );
1091  Vec_IntFree( vNum2Obj );
1092  Vec_IntFree( vLines );
1093  // set pointers to models
1094  Au_ManForEachNtk( pMan, pRoot, i )
1095  Au_NtkForEachBox( pRoot, pBox, k )
1096  {
1097  pBox->Func = Au_ManFindNtk( pMan, pBuffer + pBox->Func );
1098  assert( pBox->Func > 0 );
1099  Au_BoxForEachFanout( pBox, pFan, j )
1100  pFan->Func = pBox->Func;
1101  }
1102  ABC_FREE( pBuffer );
1103  // order models in topological order
1104  pRoot = Au_ManNtkRoot( pMan );
1105  Au_ManReorderModels( pMan, pRoot );
1106  return pRoot;
1107 }
#define Au_BoxForEachFanout(pObj, pFanout, i)
Definition: abcHieNew.c:211
#define Au_ManForEachNtk(p, pNtk, i)
Definition: abcHieNew.c:199
int Au_NtkCreateConst0(Au_Ntk_t *pNtk)
Definition: abcHieNew.c:822
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
char * strtok()
static Au_Ntk_t * Au_ManNtkRoot(Au_Man_t *p)
Definition: abcHieNew.c:129
static Au_Obj_t * Au_NtkObj(Au_Ntk_t *p, int h)
Definition: abcHieNew.c:141
static void Au_NtkParseCBlifNum(Vec_Int_t *vFanins, char *pToken, Vec_Int_t *vNum2Obj)
Definition: abcHieNew.c:923
int strcmp()
Au_Ntk_t * Au_NtkAlloc(Au_Man_t *pMan, char *pName)
FUNCTION DEFINITIONS ///.
Definition: abcHieNew.c:245
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
int Au_NtkCreatePi(Au_Ntk_t *pNtk)
Definition: abcHieNew.c:826
int Au_NtkCreateBox(Au_Ntk_t *pNtk, Vec_Int_t *vFanins, int nFanouts, int iModel)
Definition: abcHieNew.c:857
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Au_NtkRemapNum(Vec_Int_t *vNum2Obj, int Num)
Definition: abcHieNew.c:908
#define Au_NtkForEachBox(p, pObj, i)
Definition: abcHieNew.c:222
Au_Man_t * Au_ManAlloc(char *pName)
Definition: abcHieNew.c:327
int Au_NtkCreatePo(Au_Ntk_t *pNtk, int iFanin)
Definition: abcHieNew.c:830
int Au_NtkCreateNode(Au_Ntk_t *pNtk, Vec_Int_t *vFanins, int iFunc)
Definition: abcHieNew.c:847
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define Au_BoxForEachFanoutId(pObj, hFanout, i)
Definition: abcHieNew.c:206
char * Extra_FileRead(FILE *pFile)
#define assert(ex)
Definition: util_old.h:213
int Au_ManFindNtk(Au_Man_t *p, char *pName)
Definition: abcHieNew.c:354
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
void Au_ManReorderModels(Au_Man_t *p, Au_Ntk_t *pRoot)
Definition: abcHieNew.c:426
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static void Au_NtkParseCBlifNum ( Vec_Int_t vFanins,
char *  pToken,
Vec_Int_t vNum2Obj 
)
inlinestatic

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

Synopsis [Reads one entry.]

Description []

SideEffects []

SeeAlso []

Definition at line 923 of file abcHieNew.c.

924 {
925  char * pCur;
926  int Num1, Num2, i;
927  assert( pToken[0] >= '0' && pToken[0] <= '9' );
928  Num1 = atoi( pToken );
929  for ( pCur = pToken; *pCur; pCur++ )
930  if ( *pCur == ':' )
931  {
932  Num2 = atoi( pCur+1 );
933  for ( i = 0; i < Num2; i++ )
934  Vec_IntPush( vFanins, Au_NtkRemapNum(vNum2Obj, Num1 + i + i) );
935  return;
936  }
937  else if ( *pCur == '*' )
938  {
939  Num2 = atoi( pCur+1 );
940  for ( i = 0; i < Num2; i++ )
941  Vec_IntPush( vFanins, Au_NtkRemapNum(vNum2Obj, Num1) );
942  return;
943  }
944  assert( *pCur == 0 );
945  Vec_IntPush( vFanins, Au_NtkRemapNum(vNum2Obj, Num1) );
946 }
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Au_NtkRemapNum(Vec_Int_t *vNum2Obj, int Num)
Definition: abcHieNew.c:908
#define assert(ex)
Definition: util_old.h:213
static Au_Obj_t* Au_NtkPi ( Au_Ntk_t p,
int  i 
)
inlinestatic

Definition at line 143 of file abcHieNew.c.

143 { return Au_NtkObj(p, Vec_IntEntry(&p->vPis, i)); }
static Au_Obj_t * Au_NtkObj(Au_Ntk_t *p, int h)
Definition: abcHieNew.c:141
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t vPis
Definition: abcHieNew.c:70
static int Au_NtkPiNum ( Au_Ntk_t p)
inlinestatic

Definition at line 133 of file abcHieNew.c.

133 { return p->nObjs[AU_OBJ_PI]; }
int nObjs[AU_OBJ_VOID]
Definition: abcHieNew.c:73
static Au_Obj_t* Au_NtkPo ( Au_Ntk_t p,
int  i 
)
inlinestatic

Definition at line 144 of file abcHieNew.c.

144 { return Au_NtkObj(p, Vec_IntEntry(&p->vPos, i)); }
static Au_Obj_t * Au_NtkObj(Au_Ntk_t *p, int h)
Definition: abcHieNew.c:141
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t vPos
Definition: abcHieNew.c:71
static int Au_NtkPoNum ( Au_Ntk_t p)
inlinestatic

Definition at line 134 of file abcHieNew.c.

134 { return p->nObjs[AU_OBJ_PO]; }
int nObjs[AU_OBJ_VOID]
Definition: abcHieNew.c:73
void Au_NtkPrintStats ( Au_Ntk_t p)

Definition at line 280 of file abcHieNew.c.

281 {
282  printf( "%-30s:", Au_NtkName(p) );
283  printf( " i/o =%6d/%6d", Au_NtkPiNum(p), Au_NtkPoNum(p) );
284  if ( Au_NtkFlopNum(p) )
285  printf( " lat =%5d", Au_NtkFlopNum(p) );
286  printf( " nd =%6d", Au_NtkNodeNum(p) );
287 // if ( Au_NtkBoxNum(p) )
288  printf( " box =%5d", Au_NtkBoxNum(p) );
289  printf( " obj =%7d", Au_NtkObjNum(p) );
290 // printf( " max =%7d", Au_NtkObjNumMax(p) );
291 // printf( " use =%7d", p->nObjsUsed );
292  printf( " %5.1f %%", 100.0 * (Au_NtkObjNumMax(p) - Au_NtkObjNum(p)) / Au_NtkObjNumMax(p) );
293  printf( " %6.1f MB", 1.0 * Au_NtkMemUsage(p) / (1 << 20) );
294  printf( " %5.1f %%", 100.0 * (p->nObjsAlloc - p->nObjsUsed) / p->nObjsAlloc );
295  printf( "\n" );
296 }
static int Au_NtkFlopNum(Au_Ntk_t *p)
Definition: abcHieNew.c:136
static int Au_NtkNodeNum(Au_Ntk_t *p)
Definition: abcHieNew.c:138
static int Au_NtkObjNum(Au_Ntk_t *p)
Definition: abcHieNew.c:140
static int Au_NtkPoNum(Au_Ntk_t *p)
Definition: abcHieNew.c:134
static int Au_NtkObjNumMax(Au_Ntk_t *p)
Definition: abcHieNew.c:139
int nObjsUsed
Definition: abcHieNew.c:79
int nObjsAlloc
Definition: abcHieNew.c:78
static char * Au_NtkName(Au_Ntk_t *p)
Definition: abcHieNew.c:131
static int Au_NtkPiNum(Au_Ntk_t *p)
Definition: abcHieNew.c:133
int Au_NtkMemUsage(Au_Ntk_t *p)
Definition: abcHieNew.c:271
static int Au_NtkBoxNum(Au_Ntk_t *p)
Definition: abcHieNew.c:137
static int Au_NtkRemapNum ( Vec_Int_t vNum2Obj,
int  Num 
)
inlinestatic

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

Synopsis [Reads one entry.]

Description []

SideEffects []

SeeAlso []

Definition at line 908 of file abcHieNew.c.

909 {
910  return Au_Var2Lit(Vec_IntEntry(vNum2Obj, Au_Lit2Var(Num)), Au_LitIsCompl(Num));
911 }
static int Au_Var2Lit(int Var, int fCompl)
Definition: abcHieNew.c:112
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Au_Lit2Var(int Lit)
Definition: abcHieNew.c:113
static int Au_LitIsCompl(int Lit)
Definition: abcHieNew.c:114
int Au_NtkSuppSizeTest ( Au_Ntk_t p)

Definition at line 731 of file abcHieNew.c.

732 {
733  Au_Obj_t * pObj;
734  int i, Counter = 0;
735  Au_NtkForEachObj( p, pObj, i )
736  if ( Au_ObjIsNode(pObj) )
737  Counter += (Au_ObjSuppSize(pObj) <= 16);
738  printf( "Nodes with small support %d (out of %d)\n", Counter, Au_NtkNodeNum(p) );
739  return Counter;
740 }
#define Au_NtkForEachObj(p, pObj, i)
Definition: abcHieNew.c:218
static int Au_NtkNodeNum(Au_Ntk_t *p)
Definition: abcHieNew.c:138
if(last==0)
Definition: sparse_int.h:34
static int Counter
int Au_ObjSuppSize(Au_Obj_t *pObj)
Definition: abcHieNew.c:703
static int Au_ObjIsNode(Au_Obj_t *p)
Definition: abcHieNew.c:154
void Au_NtkTerSimulate ( Au_Ntk_t p)

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

Synopsis [Flattens the logic hierarchy of the netlist.]

Description []

SideEffects []

SeeAlso []

Definition at line 1402 of file abcHieNew.c.

1403 {
1404  Au_Obj_t * pTerm;
1405  int i, Counter[2] = {0};
1406  assert( p->pMan->pFuncs == NULL );
1407  printf( "Collapsing model \"%s\"...\n", Au_NtkName(p) );
1408  // create PIs
1409  Au_NtkForEachPi( p, pTerm, i )
1410  Au_ObjSetXsim( pTerm, AU_VALX );
1411  // recursively flatten hierarchy
1412  p->pMan->nPortsC0 = 0;
1413  p->pMan->nPortsC1 = 0;
1414  p->pMan->nPortsNC = 0;
1415  Au_NtkTerSimulate_rec( p );
1416  // analyze outputs
1417  Au_NtkForEachPo( p, pTerm, i )
1418  if ( Au_ObjGetXsim(pTerm) == AU_VAL0 )
1419  Counter[0]++;
1420  else if ( Au_ObjGetXsim(pTerm) == AU_VAL1 )
1421  Counter[1]++;
1422  // print results
1423  printf( "Const0 outputs =%15d. Const1 outputs =%15d. Total outputs =%15d.\n",
1424  Counter[0], Counter[1], Au_NtkPoNum(p) );
1425  printf( "Const0 ports = %.0f. Const1 ports = %.0f. Non-const ports= %.0f. Total ports = %.0f.\n",
1426  p->pMan->nPortsC0, p->pMan->nPortsC1, p->pMan->nPortsNC, p->pMan->nPortsC0 + p->pMan->nPortsC1 + p->pMan->nPortsNC );
1427 }
#define Au_NtkForEachPi(p, pObj, i)
Definition: abcHieNew.c:214
static int Au_NtkPoNum(Au_Ntk_t *p)
Definition: abcHieNew.c:134
#define AU_VAL0
Definition: abcHieNew.c:1254
Au_Man_t * pMan
Definition: abcHieNew.c:67
Abc_Nam_t * pFuncs
Definition: abcHieNew.c:102
static int Au_ObjGetXsim(Au_Obj_t *pObj)
Definition: abcHieNew.c:1259
static char * Au_NtkName(Au_Ntk_t *p)
Definition: abcHieNew.c:131
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
#define Au_NtkForEachPo(p, pObj, i)
Definition: abcHieNew.c:216
static int Counter
static void Au_ObjSetXsim(Au_Obj_t *pObj, int Value)
Definition: abcHieNew.c:1258
#define assert(ex)
Definition: util_old.h:213
#define const
Definition: zconf.h:196
void Au_NtkTerSimulate_rec(Au_Ntk_t *p)
Definition: abcHieNew.c:1325
#define AU_VALX
Definition: abcHieNew.c:1256
#define AU_VAL1
Definition: abcHieNew.c:1255
void Au_NtkTerSimulate_rec ( Au_Ntk_t p)

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

Synopsis [Flattens the logic hierarchy of the netlist.]

Description []

SideEffects []

SeeAlso []

Definition at line 1325 of file abcHieNew.c.

1326 {
1327  Au_Obj_t * pObj = NULL, * pTerm;
1328  int i, k;
1329  Au_NtkForEachPi( p, pTerm, i )
1330  {
1331  assert( Au_ObjGetXsim(pTerm) > 0 );
1332  if ( Au_ObjGetXsim(pTerm) == AU_VALX )
1333  p->pMan->nPortsNC++;
1334  else if ( Au_ObjGetXsim(pTerm) == AU_VAL0 )
1335  p->pMan->nPortsC0++;
1336  else
1337  p->pMan->nPortsC1++;
1338  }
1339  if ( strcmp(Au_NtkName(p), "ref_egcd") == 0 )
1340  {
1341  printf( "Replacing one instance of recursive model \"%s\" by a black box.\n", "ref_egcd" );
1342  Au_NtkForEachPo( p, pTerm, i )
1343  Au_ObjSetXsim( pTerm, AU_VALX );
1344  return;
1345  }
1346  Au_NtkForEachObj( p, pObj, i )
1347  {
1348  if ( Au_ObjIsNode(pObj) )
1349  {
1350  if ( pObj->Func == 1 )
1352  else if ( pObj->Func == 2 )
1354  else if ( pObj->Func == 3 )
1356  else assert( 0 );
1357  }
1358  else if ( Au_ObjIsBox(pObj) )
1359  {
1360  Au_Ntk_t * pModel = Au_ObjModel(pObj);
1361  // check the match between the number of actual and formal parameters
1362  assert( Au_ObjFaninNum(pObj) == Au_NtkPiNum(pModel) );
1363  assert( Au_BoxFanoutNum(pObj) == Au_NtkPoNum(pModel) );
1364  // assign PIs
1365  Au_ObjForEachFanin( pObj, pTerm, k )
1366  Au_ObjSetXsim( Au_NtkPi(pModel, k), Au_ObjGetXsim(pTerm) );
1367  // call recursively
1368  Au_NtkTerSimulate_rec( pModel );
1369  // assign POs
1370  Au_BoxForEachFanout( pObj, pTerm, k )
1371  Au_ObjSetXsim( pTerm, Au_ObjGetXsim(Au_NtkPo(pModel, k)) );
1372  }
1373  else if ( Au_ObjIsConst0(pObj) )
1374  Au_ObjSetXsim( pObj, AU_VAL0 );
1375 
1376  }
1377  Au_NtkForEachPo( p, pTerm, i )
1378  Au_ObjSetXsim( pTerm, Au_ObjGetXsimFan0(pObj) );
1379  Au_NtkForEachPo( p, pTerm, i )
1380  {
1381  assert( Au_ObjGetXsim(pTerm) > 0 );
1382  if ( Au_ObjGetXsim(pTerm) == AU_VALX )
1383  p->pMan->nPortsNC++;
1384  else if ( Au_ObjGetXsim(pTerm) == AU_VAL0 )
1385  p->pMan->nPortsC0++;
1386  else
1387  p->pMan->nPortsC1++;
1388  }
1389 }
#define Au_NtkForEachPi(p, pObj, i)
Definition: abcHieNew.c:214
#define Au_BoxForEachFanout(pObj, pFanout, i)
Definition: abcHieNew.c:211
static int Au_ObjIsConst0(Au_Obj_t *p)
Definition: abcHieNew.c:148
#define Au_NtkForEachObj(p, pObj, i)
Definition: abcHieNew.c:218
static int Au_ObjIsBox(Au_Obj_t *p)
Definition: abcHieNew.c:153
static int Au_ObjGetXsimFan2(Au_Obj_t *pObj)
Definition: abcHieNew.c:1308
#define Au_ObjForEachFanin(pObj, pFanin, i)
Definition: abcHieNew.c:209
static int Au_NtkPoNum(Au_Ntk_t *p)
Definition: abcHieNew.c:134
#define AU_VAL0
Definition: abcHieNew.c:1254
static int Au_BoxFanoutNum(Au_Obj_t *p)
Definition: abcHieNew.c:181
double nPortsNC
Definition: abcHieNew.c:108
double nPortsC0
Definition: abcHieNew.c:106
int strcmp()
static Au_Ntk_t * Au_ObjModel(Au_Obj_t *p)
Definition: abcHieNew.c:162
Au_Man_t * pMan
Definition: abcHieNew.c:67
static int Au_ObjFaninNum(Au_Obj_t *p)
Definition: abcHieNew.c:164
double nPortsC1
Definition: abcHieNew.c:107
static int Au_ObjGetXsim(Au_Obj_t *pObj)
Definition: abcHieNew.c:1259
static int Au_ObjGetXsimFan0(Au_Obj_t *pObj)
Definition: abcHieNew.c:1298
static char * Au_NtkName(Au_Ntk_t *p)
Definition: abcHieNew.c:131
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
#define Au_NtkForEachPo(p, pObj, i)
Definition: abcHieNew.c:216
static int Au_NtkPiNum(Au_Ntk_t *p)
Definition: abcHieNew.c:133
static int Au_ObjGetXsimFan1(Au_Obj_t *pObj)
Definition: abcHieNew.c:1303
static int Au_XsimXor(int Value0, int Value1)
Definition: abcHieNew.c:1278
static int Au_XsimMux(int ValueC, int Value1, int Value0)
Definition: abcHieNew.c:1286
static void Au_ObjSetXsim(Au_Obj_t *pObj, int Value)
Definition: abcHieNew.c:1258
static Au_Obj_t * Au_NtkPi(Au_Ntk_t *p, int i)
Definition: abcHieNew.c:143
#define assert(ex)
Definition: util_old.h:213
static Au_Obj_t * Au_NtkPo(Au_Ntk_t *p, int i)
Definition: abcHieNew.c:144
void Au_NtkTerSimulate_rec(Au_Ntk_t *p)
Definition: abcHieNew.c:1325
#define AU_VALX
Definition: abcHieNew.c:1256
static int Au_XsimAnd(int Value0, int Value1)
Definition: abcHieNew.c:1269
static int Au_ObjIsNode(Au_Obj_t *p)
Definition: abcHieNew.c:154
static char* Au_ObjBase ( Au_Obj_t p)
inlinestatic

Definition at line 157 of file abcHieNew.c.

157 { return (char *)p - ((ABC_PTRINT_T)p & 0x3FF); }
static int Au_ObjCopy ( Au_Obj_t p)
inlinestatic

Definition at line 185 of file abcHieNew.c.

185 { return Vec_IntEntry( &Au_ObjNtk(p)->vCopies, Au_ObjId(p) ); }
static int Au_ObjId(Au_Obj_t *p)
Definition: abcHieNew.c:159
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static Au_Ntk_t * Au_ObjNtk(Au_Obj_t *p)
Definition: abcHieNew.c:158
static Au_Obj_t* Au_ObjFanin ( Au_Obj_t p,
int  i 
)
inlinestatic

Definition at line 169 of file abcHieNew.c.

169 { return Au_NtkObj(Au_ObjNtk(p), Au_ObjFaninId(p, i)); }
static int Au_ObjFaninId(Au_Obj_t *p, int i)
Definition: abcHieNew.c:165
static Au_Obj_t * Au_NtkObj(Au_Ntk_t *p, int h)
Definition: abcHieNew.c:141
static Au_Ntk_t * Au_ObjNtk(Au_Obj_t *p)
Definition: abcHieNew.c:158
static Au_Obj_t* Au_ObjFanin0 ( Au_Obj_t p)
inlinestatic

Definition at line 170 of file abcHieNew.c.

170 { return Au_ObjFanin( p, 0 ); }
static Au_Obj_t * Au_ObjFanin(Au_Obj_t *p, int i)
Definition: abcHieNew.c:169
static Au_Obj_t* Au_ObjFanin1 ( Au_Obj_t p)
inlinestatic

Definition at line 171 of file abcHieNew.c.

171 { return Au_ObjFanin( p, 1 ); }
static Au_Obj_t * Au_ObjFanin(Au_Obj_t *p, int i)
Definition: abcHieNew.c:169
static Au_Obj_t* Au_ObjFanin2 ( Au_Obj_t p)
inlinestatic

Definition at line 172 of file abcHieNew.c.

172 { return Au_ObjFanin( p, 2 ); }
static Au_Obj_t * Au_ObjFanin(Au_Obj_t *p, int i)
Definition: abcHieNew.c:169
static int Au_ObjFaninC ( Au_Obj_t p,
int  i 
)
inlinestatic

Definition at line 173 of file abcHieNew.c.

173 { assert(i >= 0 && i < (int)p->nFanins && p->Fanins[i]); return Au_LitIsCompl(p->Fanins[i]); }
int Fanins[2]
Definition: abcHieNew.c:61
unsigned nFanins
Definition: abcHieNew.c:60
static int Au_LitIsCompl(int Lit)
Definition: abcHieNew.c:114
#define assert(ex)
Definition: util_old.h:213
static int Au_ObjFaninC0 ( Au_Obj_t p)
inlinestatic

Definition at line 174 of file abcHieNew.c.

174 { return Au_ObjFaninC(p, 0); }
static int Au_ObjFaninC(Au_Obj_t *p, int i)
Definition: abcHieNew.c:173
static int Au_ObjFaninC1 ( Au_Obj_t p)
inlinestatic

Definition at line 175 of file abcHieNew.c.

175 { return Au_ObjFaninC(p, 1); }
static int Au_ObjFaninC(Au_Obj_t *p, int i)
Definition: abcHieNew.c:173
static int Au_ObjFaninC2 ( Au_Obj_t p)
inlinestatic

Definition at line 176 of file abcHieNew.c.

176 { return Au_ObjFaninC(p, 2); }
static int Au_ObjFaninC(Au_Obj_t *p, int i)
Definition: abcHieNew.c:173
static int Au_ObjFaninId ( Au_Obj_t p,
int  i 
)
inlinestatic

Definition at line 165 of file abcHieNew.c.

165 { assert(i >= 0 && i < (int)p->nFanins && p->Fanins[i]); return Au_Lit2Var(p->Fanins[i]); }
int Fanins[2]
Definition: abcHieNew.c:61
unsigned nFanins
Definition: abcHieNew.c:60
static int Au_Lit2Var(int Lit)
Definition: abcHieNew.c:113
#define assert(ex)
Definition: util_old.h:213
static int Au_ObjFaninId0 ( Au_Obj_t p)
inlinestatic

Definition at line 166 of file abcHieNew.c.

166 { return Au_ObjFaninId(p, 0); }
static int Au_ObjFaninId(Au_Obj_t *p, int i)
Definition: abcHieNew.c:165
static int Au_ObjFaninId1 ( Au_Obj_t p)
inlinestatic

Definition at line 167 of file abcHieNew.c.

167 { return Au_ObjFaninId(p, 1); }
static int Au_ObjFaninId(Au_Obj_t *p, int i)
Definition: abcHieNew.c:165
static int Au_ObjFaninId2 ( Au_Obj_t p)
inlinestatic

Definition at line 168 of file abcHieNew.c.

168 { return Au_ObjFaninId(p, 2); }
static int Au_ObjFaninId(Au_Obj_t *p, int i)
Definition: abcHieNew.c:165
static int Au_ObjFaninLit ( Au_Obj_t p,
int  i 
)
inlinestatic

Definition at line 177 of file abcHieNew.c.

177 { assert(i >= 0 && i < (int)p->nFanins && p->Fanins[i]); return p->Fanins[i]; }
int Fanins[2]
Definition: abcHieNew.c:61
unsigned nFanins
Definition: abcHieNew.c:60
#define assert(ex)
Definition: util_old.h:213
static int Au_ObjFaninNum ( Au_Obj_t p)
inlinestatic

Definition at line 164 of file abcHieNew.c.

164 { return p->nFanins; }
unsigned nFanins
Definition: abcHieNew.c:60
static int Au_ObjFanout ( Au_Obj_t p,
int  i 
)
inlinestatic

Definition at line 188 of file abcHieNew.c.

188 { assert(p->Type == AU_OBJ_BOX && i >= 0 && i < p->Fanins[p->nFanins] && p->Fanins[i]); return p->Fanins[p->nFanins + 1 + i]; }
int Fanins[2]
Definition: abcHieNew.c:61
unsigned Type
Definition: abcHieNew.c:59
unsigned nFanins
Definition: abcHieNew.c:60
#define assert(ex)
Definition: util_old.h:213
static int Au_ObjFunc ( Au_Obj_t p)
inlinestatic

Definition at line 161 of file abcHieNew.c.

161 { return p->Func; }
unsigned Func
Definition: abcHieNew.c:57
static int Au_ObjGetXsim ( Au_Obj_t pObj)
inlinestatic

Definition at line 1259 of file abcHieNew.c.

1259 { return pObj->Value; }
unsigned Value
Definition: abcHieNew.c:58
static int Au_ObjGetXsimFan0 ( Au_Obj_t pObj)
inlinestatic

Definition at line 1298 of file abcHieNew.c.

1299 {
1300  int Value = Au_ObjGetXsim( Au_ObjFanin0(pObj) );
1301  return Au_ObjFaninC0(pObj) ? Au_XsimInv(Value) : Value;
1302 }
static int Au_ObjFaninC0(Au_Obj_t *p)
Definition: abcHieNew.c:174
static Au_Obj_t * Au_ObjFanin0(Au_Obj_t *p)
Definition: abcHieNew.c:170
static int Au_ObjGetXsim(Au_Obj_t *pObj)
Definition: abcHieNew.c:1259
static int Au_XsimInv(int Value)
Definition: abcHieNew.c:1260
static int Au_ObjGetXsimFan1 ( Au_Obj_t pObj)
inlinestatic

Definition at line 1303 of file abcHieNew.c.

1304 {
1305  int Value = Au_ObjGetXsim( Au_ObjFanin1(pObj) );
1306  return Au_ObjFaninC1(pObj) ? Au_XsimInv(Value) : Value;
1307 }
static int Au_ObjFaninC1(Au_Obj_t *p)
Definition: abcHieNew.c:175
static int Au_ObjGetXsim(Au_Obj_t *pObj)
Definition: abcHieNew.c:1259
static Au_Obj_t * Au_ObjFanin1(Au_Obj_t *p)
Definition: abcHieNew.c:171
static int Au_XsimInv(int Value)
Definition: abcHieNew.c:1260
static int Au_ObjGetXsimFan2 ( Au_Obj_t pObj)
inlinestatic

Definition at line 1308 of file abcHieNew.c.

1309 {
1310  int Value = Au_ObjGetXsim( Au_ObjFanin2(pObj) );
1311  return Au_ObjFaninC2(pObj) ? Au_XsimInv(Value) : Value;
1312 }
static int Au_ObjFaninC2(Au_Obj_t *p)
Definition: abcHieNew.c:176
static int Au_ObjGetXsim(Au_Obj_t *pObj)
Definition: abcHieNew.c:1259
static int Au_XsimInv(int Value)
Definition: abcHieNew.c:1260
static Au_Obj_t * Au_ObjFanin2(Au_Obj_t *p)
Definition: abcHieNew.c:172
static int Au_ObjId ( Au_Obj_t p)
inlinestatic

Definition at line 159 of file abcHieNew.c.

159 { return ((int *)Au_ObjBase(p))[2] | (((ABC_PTRINT_T)p & 0x3FF) >> 4); }
static char * Au_ObjBase(Au_Obj_t *p)
Definition: abcHieNew.c:157
static int Au_ObjIsBox ( Au_Obj_t p)
inlinestatic

Definition at line 153 of file abcHieNew.c.

153 { return p->Type == AU_OBJ_BOX; }
unsigned Type
Definition: abcHieNew.c:59
static int Au_ObjIsConst0 ( Au_Obj_t p)
inlinestatic

Definition at line 148 of file abcHieNew.c.

148 { return p->Type == AU_OBJ_CONST0; }
unsigned Type
Definition: abcHieNew.c:59
static int Au_ObjIsFan ( Au_Obj_t p)
inlinestatic

Definition at line 151 of file abcHieNew.c.

151 { return p->Type == AU_OBJ_FAN; }
unsigned Type
Definition: abcHieNew.c:59
static int Au_ObjIsFlop ( Au_Obj_t p)
inlinestatic

Definition at line 152 of file abcHieNew.c.

152 { return p->Type == AU_OBJ_FLOP; }
unsigned Type
Definition: abcHieNew.c:59
static int Au_ObjIsNode ( Au_Obj_t p)
inlinestatic

Definition at line 154 of file abcHieNew.c.

154 { return p->Type == AU_OBJ_NODE; }
unsigned Type
Definition: abcHieNew.c:59
static int Au_ObjIsNone ( Au_Obj_t p)
inlinestatic

Definition at line 147 of file abcHieNew.c.

147 { return p->Type == AU_OBJ_NONE; }
unsigned Type
Definition: abcHieNew.c:59
static int Au_ObjIsPi ( Au_Obj_t p)
inlinestatic

Definition at line 149 of file abcHieNew.c.

149 { return p->Type == AU_OBJ_PI; }
unsigned Type
Definition: abcHieNew.c:59
static int Au_ObjIsPo ( Au_Obj_t p)
inlinestatic

Definition at line 150 of file abcHieNew.c.

150 { return p->Type == AU_OBJ_PO; }
unsigned Type
Definition: abcHieNew.c:59
static int Au_ObjIsTerm ( Au_Obj_t p)
inlinestatic

Definition at line 155 of file abcHieNew.c.

155 { return p->Type >= AU_OBJ_PI && p->Type <= AU_OBJ_FLOP; }
unsigned Type
Definition: abcHieNew.c:59
static int Au_ObjIsTravIdCurrent ( Au_Obj_t p)
inlinestatic

Definition at line 194 of file abcHieNew.c.

194 { return (Vec_IntGetEntry(&Au_ObjNtk(p)->vTravIds, Au_ObjId(p)) == Au_ObjNtk(p)->nTravIds); }
static int Vec_IntGetEntry(Vec_Int_t *p, int i)
Definition: bblif.c:401
static int Au_ObjId(Au_Obj_t *p)
Definition: abcHieNew.c:159
static Au_Ntk_t * Au_ObjNtk(Au_Obj_t *p)
Definition: abcHieNew.c:158
static int Au_ObjIsTravIdCurrentId ( Au_Ntk_t p,
int  Id 
)
inlinestatic

Definition at line 197 of file abcHieNew.c.

197 { return (Vec_IntGetEntry(&p->vTravIds, Id) == p->nTravIds); }
Vec_Int_t vTravIds
Definition: abcHieNew.c:82
static int Vec_IntGetEntry(Vec_Int_t *p, int i)
Definition: bblif.c:401
int nTravIds
Definition: abcHieNew.c:81
static int Au_ObjIsTravIdPrevious ( Au_Obj_t p)
inlinestatic

Definition at line 195 of file abcHieNew.c.

195 { return (Vec_IntGetEntry(&Au_ObjNtk(p)->vTravIds, Au_ObjId(p)) == Au_ObjNtk(p)->nTravIds-1); }
static int Vec_IntGetEntry(Vec_Int_t *p, int i)
Definition: bblif.c:401
static int Au_ObjId(Au_Obj_t *p)
Definition: abcHieNew.c:159
static Au_Ntk_t * Au_ObjNtk(Au_Obj_t *p)
Definition: abcHieNew.c:158
static Au_Ntk_t* Au_ObjModel ( Au_Obj_t p)
inlinestatic

Definition at line 162 of file abcHieNew.c.

162 { assert(Au_ObjIsFan(p)||Au_ObjIsBox(p)); return Au_ManNtk(Au_NtkMan(Au_ObjNtk(p)), p->Func); }
unsigned Func
Definition: abcHieNew.c:57
static int Au_ObjIsBox(Au_Obj_t *p)
Definition: abcHieNew.c:153
static Au_Man_t * Au_NtkMan(Au_Ntk_t *p)
Definition: abcHieNew.c:132
static int Au_ObjIsFan(Au_Obj_t *p)
Definition: abcHieNew.c:151
static Au_Ntk_t * Au_ManNtk(Au_Man_t *p, int i)
Definition: abcHieNew.c:128
#define assert(ex)
Definition: util_old.h:213
static Au_Ntk_t * Au_ObjNtk(Au_Obj_t *p)
Definition: abcHieNew.c:158
static Au_Ntk_t* Au_ObjNtk ( Au_Obj_t p)
inlinestatic

Definition at line 158 of file abcHieNew.c.

158 { return ((Au_Ntk_t **)Au_ObjBase(p))[0]; }
static char * Au_ObjBase(Au_Obj_t *p)
Definition: abcHieNew.c:157
static int Au_ObjPioNum ( Au_Obj_t p)
inlinestatic

Definition at line 160 of file abcHieNew.c.

160 { assert(Au_ObjIsTerm(p)); return p->Fanins[p->nFanins]; }
int Fanins[2]
Definition: abcHieNew.c:61
unsigned nFanins
Definition: abcHieNew.c:60
#define assert(ex)
Definition: util_old.h:213
static int Au_ObjIsTerm(Au_Obj_t *p)
Definition: abcHieNew.c:155
static void Au_ObjSetCopy ( Au_Obj_t p,
int  c 
)
inlinestatic

Definition at line 186 of file abcHieNew.c.

186 { Vec_IntWriteEntry( &Au_ObjNtk(p)->vCopies, Au_ObjId(p), c ); }
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Au_ObjId(Au_Obj_t *p)
Definition: abcHieNew.c:159
static Au_Ntk_t * Au_ObjNtk(Au_Obj_t *p)
Definition: abcHieNew.c:158
static void Au_ObjSetFanin ( Au_Obj_t p,
int  i,
int  f 
)
inlinestatic

Definition at line 178 of file abcHieNew.c.

178 { assert(f > 0 && p->Fanins[i] == 0); p->Fanins[i] = Au_Var2Lit(f,0); }
int Fanins[2]
Definition: abcHieNew.c:61
static int Au_Var2Lit(int Var, int fCompl)
Definition: abcHieNew.c:112
#define assert(ex)
Definition: util_old.h:213
static void Au_ObjSetFaninLit ( Au_Obj_t p,
int  i,
int  f 
)
inlinestatic

Definition at line 179 of file abcHieNew.c.

179 { assert(f >= 0 && p->Fanins[i] == 0); p->Fanins[i] = f; }
int Fanins[2]
Definition: abcHieNew.c:61
#define assert(ex)
Definition: util_old.h:213
static void Au_ObjSetFanout ( Au_Obj_t p,
int  i,
int  f 
)
inlinestatic

Definition at line 189 of file abcHieNew.c.

189 { assert(p->Type == AU_OBJ_BOX && i >= 0 && i < p->Fanins[p->nFanins] && p->Fanins[i] == 0 && f > 0); p->Fanins[p->nFanins + 1 + i] = f; }
int Fanins[2]
Definition: abcHieNew.c:61
unsigned Type
Definition: abcHieNew.c:59
unsigned nFanins
Definition: abcHieNew.c:60
#define assert(ex)
Definition: util_old.h:213
static void Au_ObjSetTravIdCurrent ( Au_Obj_t p)
inlinestatic

Definition at line 192 of file abcHieNew.c.

192 { Vec_IntSetEntry(&Au_ObjNtk(p)->vTravIds, Au_ObjId(p), Au_ObjNtk(p)->nTravIds ); }
static void Vec_IntSetEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:418
static int Au_ObjId(Au_Obj_t *p)
Definition: abcHieNew.c:159
static Au_Ntk_t * Au_ObjNtk(Au_Obj_t *p)
Definition: abcHieNew.c:158
static void Au_ObjSetTravIdCurrentId ( Au_Ntk_t p,
int  Id 
)
inlinestatic

Definition at line 196 of file abcHieNew.c.

196 { Vec_IntSetEntry(&p->vTravIds, Id, p->nTravIds ); }
Vec_Int_t vTravIds
Definition: abcHieNew.c:82
static void Vec_IntSetEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:418
int nTravIds
Definition: abcHieNew.c:81
static void Au_ObjSetTravIdPrevious ( Au_Obj_t p)
inlinestatic

Definition at line 193 of file abcHieNew.c.

193 { Vec_IntSetEntry(&Au_ObjNtk(p)->vTravIds, Au_ObjId(p), Au_ObjNtk(p)->nTravIds-1 ); }
static void Vec_IntSetEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:418
static int Au_ObjId(Au_Obj_t *p)
Definition: abcHieNew.c:159
static Au_Ntk_t * Au_ObjNtk(Au_Obj_t *p)
Definition: abcHieNew.c:158
static void Au_ObjSetXsim ( Au_Obj_t pObj,
int  Value 
)
inlinestatic

Definition at line 1258 of file abcHieNew.c.

1258 { pObj->Value = Value; }
unsigned Value
Definition: abcHieNew.c:58
int Au_ObjSuppSize ( Au_Obj_t pObj)

Definition at line 703 of file abcHieNew.c.

704 {
705  Au_Ntk_t * p = Au_ObjNtk(pObj);
707  return Au_ObjSuppSize_rec( p, Au_ObjId(pObj) );
708 }
int Au_ObjSuppSize_rec(Au_Ntk_t *p, int Id)
Definition: abcHieNew.c:688
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Au_NtkIncrementTravId(Au_Ntk_t *p)
Definition: abcHieNew.c:191
static int Au_ObjId(Au_Obj_t *p)
Definition: abcHieNew.c:159
static Au_Ntk_t * Au_ObjNtk(Au_Obj_t *p)
Definition: abcHieNew.c:158
int Au_ObjSuppSize_rec ( Au_Ntk_t p,
int  Id 
)

Definition at line 688 of file abcHieNew.c.

689 {
690  Au_Obj_t * pObj;
691  int i, iFanin, Counter = 0;
692  if ( Au_ObjIsTravIdCurrentId(p, Id) )
693  return 0;
695  pObj = Au_NtkObj( p, Id );
696  if ( Au_ObjIsPi(pObj) )
697  return 1;
698  assert( Au_ObjIsNode(pObj) || Au_ObjIsBox(pObj) || Au_ObjIsFan(pObj) );
699  Au_ObjForEachFaninId( pObj, iFanin, i )
700  Counter += Au_ObjSuppSize_rec( p, iFanin );
701  return Counter;
702 }
#define Au_ObjForEachFaninId(pObj, hFanin, i)
Definition: abcHieNew.c:204
static int Au_ObjIsBox(Au_Obj_t *p)
Definition: abcHieNew.c:153
int Au_ObjSuppSize_rec(Au_Ntk_t *p, int Id)
Definition: abcHieNew.c:688
static Au_Obj_t * Au_NtkObj(Au_Ntk_t *p, int h)
Definition: abcHieNew.c:141
static int Au_ObjIsFan(Au_Obj_t *p)
Definition: abcHieNew.c:151
static int Counter
static int Au_ObjIsTravIdCurrentId(Au_Ntk_t *p, int Id)
Definition: abcHieNew.c:197
static void Au_ObjSetTravIdCurrentId(Au_Ntk_t *p, int Id)
Definition: abcHieNew.c:196
static int Au_ObjIsPi(Au_Obj_t *p)
Definition: abcHieNew.c:149
#define assert(ex)
Definition: util_old.h:213
static int Au_ObjIsNode(Au_Obj_t *p)
Definition: abcHieNew.c:154
static Au_Obj_t* Au_Regular ( Au_Obj_t p)
inlinestatic

Definition at line 119 of file abcHieNew.c.

119 { return (Au_Obj_t *)((ABC_PTRUINT_T)(p) & ~01); }
static char* Au_UtilStrsav ( char *  s)
inlinestatic

Definition at line 124 of file abcHieNew.c.

124 { return s ? strcpy(ABC_ALLOC(char, strlen(s)+1), s) : NULL; }
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
char * strcpy()
int strlen()
static int Au_Var2Lit ( int  Var,
int  fCompl 
)
inlinestatic

Definition at line 112 of file abcHieNew.c.

112 { return Var + Var + fCompl; }
int Var
Definition: SolverTypes.h:42
static int Au_XsimAnd ( int  Value0,
int  Value1 
)
inlinestatic

Definition at line 1269 of file abcHieNew.c.

1270 {
1271  if ( Value0 == AU_VAL0 || Value1 == AU_VAL0 )
1272  return AU_VAL0;
1273  if ( Value0 == AU_VALX || Value1 == AU_VALX )
1274  return AU_VALX;
1275  assert( Value0 == AU_VAL1 && Value1 == AU_VAL1 );
1276  return AU_VAL1;
1277 }
#define AU_VAL0
Definition: abcHieNew.c:1254
#define assert(ex)
Definition: util_old.h:213
#define AU_VALX
Definition: abcHieNew.c:1256
#define AU_VAL1
Definition: abcHieNew.c:1255
static int Au_XsimInv ( int  Value)
inlinestatic

Definition at line 1260 of file abcHieNew.c.

1261 {
1262  if ( Value == AU_VAL0 )
1263  return AU_VAL1;
1264  if ( Value == AU_VAL1 )
1265  return AU_VAL0;
1266  assert( Value == AU_VALX );
1267  return AU_VALX;
1268 }
#define AU_VAL0
Definition: abcHieNew.c:1254
#define assert(ex)
Definition: util_old.h:213
#define AU_VALX
Definition: abcHieNew.c:1256
#define AU_VAL1
Definition: abcHieNew.c:1255
static int Au_XsimMux ( int  ValueC,
int  Value1,
int  Value0 
)
inlinestatic

Definition at line 1286 of file abcHieNew.c.

1287 {
1288  if ( ValueC == AU_VAL0 )
1289  return Value0;
1290  if ( ValueC == AU_VAL1 )
1291  return Value1;
1292  if ( Value0 == AU_VAL0 && Value1 == AU_VAL0 )
1293  return AU_VAL0;
1294  if ( Value0 == AU_VAL1 && Value1 == AU_VAL1 )
1295  return AU_VAL1;
1296  return AU_VALX;
1297 }
#define AU_VAL0
Definition: abcHieNew.c:1254
#define AU_VALX
Definition: abcHieNew.c:1256
#define AU_VAL1
Definition: abcHieNew.c:1255
static int Au_XsimXor ( int  Value0,
int  Value1 
)
inlinestatic

Definition at line 1278 of file abcHieNew.c.

1279 {
1280  if ( Value0 == AU_VALX || Value1 == AU_VALX )
1281  return AU_VALX;
1282  if ( (Value0 == AU_VAL0) == (Value1 == AU_VAL0) )
1283  return AU_VAL0;
1284  return AU_VAL1;
1285 }
#define AU_VAL0
Definition: abcHieNew.c:1254
#define AU_VALX
Definition: abcHieNew.c:1256
#define AU_VAL1
Definition: abcHieNew.c:1255