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

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START
Csw_Man_t
Csw_ManStart (Aig_Man_t *pMan, int nCutsMax, int nLeafMax, int fVerbose)
 DECLARATIONS ///. More...
 
void Csw_ManStop (Csw_Man_t *p)
 

Function Documentation

ABC_NAMESPACE_IMPL_START Csw_Man_t* Csw_ManStart ( Aig_Man_t pMan,
int  nCutsMax,
int  nLeafMax,
int  fVerbose 
)

DECLARATIONS ///.

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

FileName [cswMan.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Cut sweeping.]

Synopsis []

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - July 11, 2007.]

Revision [

Id:
cswMan.c,v 1.00 2007/07/11 00:00:00 alanmi Exp

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

Synopsis [Starts the cut sweeping manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file cswMan.c.

46 {
47  Csw_Man_t * p;
48  Aig_Obj_t * pObj;
49  int i;
50  assert( nCutsMax >= 2 );
51  assert( nLeafMax <= 16 );
52  // allocate the fraiging manager
53  p = ABC_ALLOC( Csw_Man_t, 1 );
54  memset( p, 0, sizeof(Csw_Man_t) );
55  p->nCutsMax = nCutsMax;
56  p->nLeafMax = nLeafMax;
57  p->fVerbose = fVerbose;
58  p->pManAig = pMan;
59  // create the new manager
60  p->pManRes = Aig_ManStartFrom( pMan );
61  assert( Aig_ManCiNum(p->pManAig) == Aig_ManCiNum(p->pManRes) );
62  // allocate room for cuts and equivalent nodes
63  p->pnRefs = ABC_ALLOC( int, Aig_ManObjNumMax(pMan) );
64  p->pEquiv = ABC_ALLOC( Aig_Obj_t *, Aig_ManObjNumMax(pMan) );
65  p->pCuts = ABC_ALLOC( Csw_Cut_t *, Aig_ManObjNumMax(pMan) );
66  memset( p->pCuts, 0, sizeof(Aig_Obj_t *) * Aig_ManObjNumMax(pMan) );
67  memset( p->pnRefs, 0, sizeof(int) * Aig_ManObjNumMax(pMan) );
68  // allocate memory manager
69  p->nTruthWords = Abc_TruthWordNum(nLeafMax);
70  p->nCutSize = sizeof(Csw_Cut_t) + sizeof(int) * nLeafMax + sizeof(unsigned) * p->nTruthWords;
71  p->pMemCuts = Aig_MmFixedStart( p->nCutSize * p->nCutsMax, 512 );
72  // allocate hash table for cuts
73  p->nTableSize = Abc_PrimeCudd( Aig_ManNodeNum(pMan) * p->nCutsMax / 2 );
74  p->pTable = ABC_ALLOC( Csw_Cut_t *, p->nTableSize );
75  memset( p->pTable, 0, sizeof(Aig_Obj_t *) * p->nTableSize );
76  // set the pointers to the available fraig nodes
77  Csw_ObjSetEquiv( p, Aig_ManConst1(p->pManAig), Aig_ManConst1(p->pManRes) );
78  Aig_ManForEachCi( p->pManAig, pObj, i )
79  Csw_ObjSetEquiv( p, pObj, Aig_ManCi(p->pManRes, i) );
80  // room for temporary truth tables
81  p->puTemp[0] = ABC_ALLOC( unsigned, 4 * p->nTruthWords );
82  p->puTemp[1] = p->puTemp[0] + p->nTruthWords;
83  p->puTemp[2] = p->puTemp[1] + p->nTruthWords;
84  p->puTemp[3] = p->puTemp[2] + p->nTruthWords;
85  return p;
86 }
char * memset()
static int Abc_PrimeCudd(unsigned int p)
Definition: abc_global.h:383
typedefABC_NAMESPACE_HEADER_START struct Csw_Man_t_ Csw_Man_t
INCLUDES ///.
Definition: cswInt.h:52
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static int Abc_TruthWordNum(int nVars)
Definition: abc_global.h:256
Aig_MmFixed_t * Aig_MmFixedStart(int nEntrySize, int nEntriesMax)
FUNCTION DEFINITIONS ///.
Definition: aigMem.c:96
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
static Aig_Obj_t * Aig_ManCi(Aig_Man_t *p, int i)
Definition: aig.h:266
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
Definition: aig.h:69
Aig_Man_t * Aig_ManStartFrom(Aig_Man_t *p)
Definition: aigMan.c:92
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static void Csw_ObjSetEquiv(Csw_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pEquiv)
Definition: cswInt.h:114
#define assert(ex)
Definition: util_old.h:213
struct Csw_Cut_t_ Csw_Cut_t
Definition: cswInt.h:53
void Csw_ManStop ( Csw_Man_t p)

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

Synopsis [Stops the fraiging manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 99 of file cswMan.c.

100 {
101  if ( p->fVerbose )
102  {
103  int nNodesBeg = Aig_ManNodeNum(p->pManAig);
104  int nNodesEnd = Aig_ManNodeNum(p->pManRes);
105  printf( "Beg = %7d. End = %7d. (%6.2f %%) Try = %7d. Cuts = %8d.\n",
106  nNodesBeg, nNodesEnd, 100.0*(nNodesBeg-nNodesEnd)/nNodesBeg,
107  p->nNodesTried, Csw_TableCountCuts( p ) );
108  printf( "Triv0 = %6d. Triv1 = %6d. Triv2 = %6d. Cut-replace = %6d.\n",
109  p->nNodesTriv0, p->nNodesTriv1, p->nNodesTriv2, p->nNodesCuts );
110  ABC_PRTP( "Cuts ", p->timeCuts, p->timeTotal );
111  ABC_PRTP( "Hashing ", p->timeHash, p->timeTotal );
112  ABC_PRTP( "Other ", p->timeOther, p->timeTotal );
113  ABC_PRTP( "TOTAL ", p->timeTotal, p->timeTotal );
114  }
115  ABC_FREE( p->puTemp[0] );
116  Aig_MmFixedStop( p->pMemCuts, 0 );
117  ABC_FREE( p->pnRefs );
118  ABC_FREE( p->pEquiv );
119  ABC_FREE( p->pCuts );
120  ABC_FREE( p->pTable );
121  ABC_FREE( p );
122 }
int Csw_TableCountCuts(Csw_Man_t *p)
Definition: cswTable.c:82
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_MmFixedStop(Aig_MmFixed_t *p, int fVerbose)
Definition: aigMem.c:132
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
#define ABC_PRTP(a, t, T)
Definition: abc_global.h:223
#define ABC_FREE(obj)
Definition: abc_global.h:232