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

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START
Mig_Man_t
Mig_ManStart ()
 DECLARATIONS ///. More...
 
void Mig_ManStop (Mig_Man_t *p)
 
int Mig_ManTypeNum (Mig_Man_t *p, int Type)
 
int Mig_ManAndNum (Mig_Man_t *p)
 
int Mig_ManXorNum (Mig_Man_t *p)
 
int Mig_ManMuxNum (Mig_Man_t *p)
 
void Mig_ManSetRefs (Mig_Man_t *p)
 
int Mig_ManSuppSize_rec (Mig_Obj_t *pObj)
 
int Mig_ManSuppSize2_rec (Mig_Man_t *p, int iObj)
 
int Mig_ManSuppSizeOne (Mig_Obj_t *pObj)
 
int Mig_ManSuppSizeTest (Mig_Man_t *p)
 

Function Documentation

int Mig_ManAndNum ( Mig_Man_t p)

Definition at line 98 of file mpmMig.c.

99 {
100  return Mig_ManTypeNum(p, 1);
101 }
int Mig_ManTypeNum(Mig_Man_t *p, int Type)
Definition: mpmMig.c:90
int Mig_ManMuxNum ( Mig_Man_t p)

Definition at line 106 of file mpmMig.c.

107 {
108  return Mig_ManTypeNum(p, 3);
109 }
int Mig_ManTypeNum(Mig_Man_t *p, int Type)
Definition: mpmMig.c:90
void Mig_ManSetRefs ( Mig_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 123 of file mpmMig.c.

124 {
125  Mig_Obj_t * pObj;
126  int i, iFanin;
127  // increment references
128  Vec_IntFill( &p->vRefs, Mig_ManObjNum(p), 0 );
129  Mig_ManForEachObj( p, pObj )
130  {
131  Mig_ObjForEachFaninId( pObj, iFanin, i )
132  Vec_IntAddToEntry( &p->vRefs, iFanin, 1 );
133  if ( Mig_ObjSiblId(pObj) )
134  Vec_IntAddToEntry( &p->vRefs, Mig_ObjSiblId(pObj), 1 );
135  }
136 }
static int Mig_ManObjNum(Mig_Man_t *p)
Definition: mpmMig.h:109
Vec_Int_t vRefs
Definition: mpmMig.h:78
#define Mig_ManForEachObj(p, pObj)
MACRO DEFINITIONS ///.
Definition: mpmMig.h:304
static void Vec_IntAddToEntry(Vec_Int_t *p, int i, int Addition)
Definition: bblif.c:302
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
if(last==0)
Definition: sparse_int.h:34
#define Mig_ObjForEachFaninId(p, iFanin, i)
Definition: mpmMig.h:333
static int Mig_ObjSiblId(Mig_Obj_t *p)
Definition: mpmMig.h:188

DECLARATIONS ///.

FUNCTION DECLARATIONS ///.

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

FileName [mpmMig.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Configurable technology mapper.]

Synopsis [Subject graph data structure.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 1, 2013.]

Revision [

Id:
mpmMig.c,v 1.00 2013/06/01 00:00:00 alanmi Exp

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file mpmMig.c.

46 {
47  Mig_Man_t * p;
48  assert( sizeof(Mig_Obj_t) >= 16 );
49  assert( (1 << MIG_BASE) == MIG_MASK + 1 );
50  p = ABC_CALLOC( Mig_Man_t, 1 );
51  Vec_IntGrow( &p->vCis, 1024 );
52  Vec_IntGrow( &p->vCos, 1024 );
53  Mig_ManAppendObj( p ); // const0
54  return p;
55 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Mig_Obj_t * Mig_ManAppendObj(Mig_Man_t *p)
Definition: mpmMig.h:217
Vec_Int_t vCis
Definition: mpmMig.h:68
static void Vec_IntGrow(Vec_Int_t *p, int nCapMin)
Definition: bblif.c:336
#define MIG_BASE
Definition: mpmMig.h:41
Vec_Int_t vCos
Definition: mpmMig.h:69
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
#define MIG_MASK
Definition: mpmMig.h:40
void Mig_ManStop ( Mig_Man_t p)

Definition at line 56 of file mpmMig.c.

57 {
58  if ( 0 )
59  printf( "Subject graph uses %d pages of %d objects with %d entries. Total memory = %.2f MB.\n",
60  Vec_PtrSize(&p->vPages), MIG_MASK + 1, p->nObjs,
61  1.0 * Vec_PtrSize(&p->vPages) * (MIG_MASK + 1) * 16 / (1 << 20) );
62  // attributes
63  ABC_FREE( p->vTravIds.pArray );
64  ABC_FREE( p->vCopies.pArray );
65  ABC_FREE( p->vLevels.pArray );
66  ABC_FREE( p->vRefs.pArray );
67  ABC_FREE( p->vSibls.pArray );
68  // pages
70  --p->pPage, ABC_FREE( p->pPage );
71  // objects
72  ABC_FREE( p->vPages.pArray );
73  ABC_FREE( p->vCis.pArray );
74  ABC_FREE( p->vCos.pArray );
75  ABC_FREE( p->pName );
76  ABC_FREE( p );
77 }
Vec_Int_t vLevels
Definition: mpmMig.h:76
Vec_Int_t vCopies
Definition: mpmMig.h:79
Vec_Int_t vRefs
Definition: mpmMig.h:78
int iPage
Definition: mpmMig.h:72
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int nObjs
Definition: mpmMig.h:64
Vec_Int_t vCis
Definition: mpmMig.h:68
Vec_Int_t vSibls
Definition: mpmMig.h:77
Vec_Int_t vCos
Definition: mpmMig.h:69
Mig_Obj_t * pPage
Definition: mpmMig.h:71
Vec_Ptr_t vPages
Definition: mpmMig.h:67
char * pName
Definition: mpmMig.h:63
Vec_Int_t vTravIds
Definition: mpmMig.h:75
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
#define MIG_MASK
Definition: mpmMig.h:40
int Mig_ManSuppSize2_rec ( Mig_Man_t p,
int  iObj 
)

Definition at line 163 of file mpmMig.c.

164 {
165  Mig_Obj_t * pObj;
166  if ( iObj == MIG_NONE )
167  return 0;
168  if ( Mig_ObjIsTravIdCurrentId(p, iObj) )
169  return 0;
170  Mig_ObjSetTravIdCurrentId(p, iObj);
171  pObj = Mig_ManObj( p, iObj );
172  if ( Mig_ObjIsCi(pObj) )
173  return 1;
174  assert( Mig_ObjIsNode(pObj) );
175  return Mig_ManSuppSize2_rec( p, Mig_ObjFaninId0(pObj) ) +
178 }
static Mig_Obj_t * Mig_ManObj(Mig_Man_t *p, int v)
Definition: mpmMig.h:116
#define MIG_NONE
INCLUDES ///.
Definition: mpmMig.h:37
static int Mig_ObjIsNode(Mig_Obj_t *p)
Definition: mpmMig.h:137
static int Mig_ObjIsCi(Mig_Obj_t *p)
Definition: mpmMig.h:134
static int Mig_ObjFaninId1(Mig_Obj_t *p)
Definition: mpmMig.h:172
static int Mig_ObjFaninId2(Mig_Obj_t *p)
Definition: mpmMig.h:173
static int Mig_ObjIsTravIdCurrentId(Mig_Man_t *p, int Id)
Definition: mpmMig.h:204
static int Mig_ObjFaninId0(Mig_Obj_t *p)
Definition: mpmMig.h:171
int Mig_ManSuppSize2_rec(Mig_Man_t *p, int iObj)
Definition: mpmMig.c:163
#define assert(ex)
Definition: util_old.h:213
static void Mig_ObjSetTravIdCurrentId(Mig_Man_t *p, int Id)
Definition: mpmMig.h:203
int Mig_ManSuppSize_rec ( Mig_Obj_t pObj)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 149 of file mpmMig.c.

150 {
151  if ( pObj == NULL )
152  return 0;
153  if ( Mig_ObjIsTravIdCurrent(pObj) )
154  return 0;
156  if ( Mig_ObjIsCi(pObj) )
157  return 1;
158  assert( Mig_ObjIsNode(pObj) );
159  return Mig_ManSuppSize_rec( Mig_ObjFanin0(pObj) ) +
162 }
static int Mig_ObjIsNode(Mig_Obj_t *p)
Definition: mpmMig.h:137
static int Mig_ObjIsCi(Mig_Obj_t *p)
Definition: mpmMig.h:134
static int Mig_ObjIsTravIdCurrent(Mig_Obj_t *p)
Definition: mpmMig.h:201
static Mig_Obj_t * Mig_ObjFanin1(Mig_Obj_t *p)
Definition: mpmMig.h:177
static void Mig_ObjSetTravIdCurrent(Mig_Obj_t *p)
Definition: mpmMig.h:199
static Mig_Obj_t * Mig_ObjFanin0(Mig_Obj_t *p)
Definition: mpmMig.h:176
static Mig_Obj_t * Mig_ObjFanin2(Mig_Obj_t *p)
Definition: mpmMig.h:178
int Mig_ManSuppSize_rec(Mig_Obj_t *pObj)
Definition: mpmMig.c:149
#define assert(ex)
Definition: util_old.h:213
int Mig_ManSuppSizeOne ( Mig_Obj_t pObj)

Definition at line 179 of file mpmMig.c.

180 {
181  Mig_ObjIncrementTravId( pObj );
182 // return Mig_ManSuppSize_rec( pObj );
183  return Mig_ManSuppSize2_rec( Mig_ObjMan(pObj), Mig_ObjId(pObj) );
184 }
static Mig_Man_t * Mig_ObjMan(Mig_Obj_t *p)
Definition: mpmMig.h:153
static int Mig_ObjId(Mig_Obj_t *p)
Definition: mpmMig.h:146
int Mig_ManSuppSize2_rec(Mig_Man_t *p, int iObj)
Definition: mpmMig.c:163
static void Mig_ObjIncrementTravId(Mig_Obj_t *p)
Definition: mpmMig.h:198
int Mig_ManSuppSizeTest ( Mig_Man_t p)

Definition at line 185 of file mpmMig.c.

186 {
187  Mig_Obj_t * pObj;
188  int Counter = 0;
189  abctime clk = Abc_Clock();
190  Mig_ManForEachObj( p, pObj )
191  if ( Mig_ObjIsNode(pObj) )
192  Counter += (Mig_ManSuppSizeOne(pObj) <= 16);
193  printf( "Nodes with small support %d (out of %d)\n", Counter, Mig_ManNodeNum(p) );
194  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
195  return Counter;
196 }
static int Mig_ManNodeNum(Mig_Man_t *p)
Definition: mpmMig.h:110
static int Mig_ObjIsNode(Mig_Obj_t *p)
Definition: mpmMig.h:137
#define Mig_ManForEachObj(p, pObj)
MACRO DEFINITIONS ///.
Definition: mpmMig.h:304
static abctime Abc_Clock()
Definition: abc_global.h:279
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
if(last==0)
Definition: sparse_int.h:34
static int Counter
ABC_INT64_T abctime
Definition: abc_global.h:278
int Mig_ManSuppSizeOne(Mig_Obj_t *pObj)
Definition: mpmMig.c:179
int Mig_ManTypeNum ( Mig_Man_t p,
int  Type 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 90 of file mpmMig.c.

91 {
92  Mig_Obj_t * pObj;
93  int Counter = 0;
94  Mig_ManForEachNode( p, pObj )
95  Counter += (Mig_ObjNodeType(pObj) == Type);
96  return Counter;
97 }
#define Mig_ManForEachNode(p, pObj)
Definition: mpmMig.h:322
static int Counter
static int Mig_ObjNodeType(Mig_Obj_t *p)
Definition: mpmMig.h:144
int Mig_ManXorNum ( Mig_Man_t p)

Definition at line 102 of file mpmMig.c.

103 {
104  return Mig_ManTypeNum(p, 2);
105 }
int Mig_ManTypeNum(Mig_Man_t *p, int Type)
Definition: mpmMig.c:90