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

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START void Gia_ManDupAbsFlops_rec (Gia_Man_t *pNew, Gia_Obj_t *pObj)
 DECLARATIONS ///. More...
 
Gia_Man_tGia_ManDupAbsFlops (Gia_Man_t *p, Vec_Int_t *vFlopClasses)
 FUNCTION DECLARATIONS ///. More...
 
Vec_Int_tGia_GlaCollectAssigned (Gia_Man_t *p, Vec_Int_t *vGateClasses)
 
void Gia_ManGlaCollect (Gia_Man_t *p, Vec_Int_t *vGateClasses, Vec_Int_t **pvPis, Vec_Int_t **pvPPis, Vec_Int_t **pvFlops, Vec_Int_t **pvNodes)
 
void Gia_ManDupAbsGates_rec (Gia_Man_t *pNew, Gia_Obj_t *pObj)
 
Gia_Man_tGia_ManDupAbsGates (Gia_Man_t *p, Vec_Int_t *vGateClasses)
 
void Gia_ManPrintFlopClasses (Gia_Man_t *p)
 
void Gia_ManPrintGateClasses (Gia_Man_t *p)
 
void Gia_ManPrintObjClasses (Gia_Man_t *p)
 

Function Documentation

Vec_Int_t* Gia_GlaCollectAssigned ( Gia_Man_t p,
Vec_Int_t vGateClasses 
)

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

Synopsis [Returns the array of neighbors.]

Description []

SideEffects []

SeeAlso []

Definition at line 121 of file absDup.c.

122 {
123  Vec_Int_t * vAssigned;
124  Gia_Obj_t * pObj;
125  int i, Entry;
126  vAssigned = Vec_IntAlloc( 1000 );
127  Vec_IntForEachEntry( vGateClasses, Entry, i )
128  {
129  if ( Entry == 0 )
130  continue;
131  assert( Entry > 0 );
132  pObj = Gia_ManObj( p, i );
133  Vec_IntPush( vAssigned, Gia_ObjId(p, pObj) );
134  if ( Gia_ObjIsAnd(pObj) )
135  {
136  Vec_IntPush( vAssigned, Gia_ObjFaninId0p(p, pObj) );
137  Vec_IntPush( vAssigned, Gia_ObjFaninId1p(p, pObj) );
138  }
139  else if ( Gia_ObjIsRo(p, pObj) )
140  Vec_IntPush( vAssigned, Gia_ObjFaninId0p(p, Gia_ObjRoToRi(p, pObj)) );
141  else assert( Gia_ObjIsConst0(pObj) );
142  }
143  Vec_IntUniqify( vAssigned );
144  return vAssigned;
145 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
static int Gia_ObjFaninId1p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:464
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:443
static Gia_Obj_t * Gia_ObjRoToRi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:446
static int Vec_IntUniqify(Vec_Int_t *p)
Definition: vecInt.h:1314
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static int Gia_ObjFaninId0p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:463
#define assert(ex)
Definition: util_old.h:213
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
Gia_Man_t* Gia_ManDupAbsFlops ( Gia_Man_t p,
Vec_Int_t vFlopClasses 
)

FUNCTION DECLARATIONS ///.

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

Synopsis [Extractes a flop-level abstraction given a flop map.]

Description []

SideEffects []

SeeAlso []

Definition at line 65 of file absDup.c.

66 {
67  Gia_Man_t * pNew, * pTemp;
68  Gia_Obj_t * pObj;
69  int i, nFlops = 0;
70  Gia_ManFillValue( p );
71  // start the new manager
72  pNew = Gia_ManStart( 5000 );
73  pNew->pName = Abc_UtilStrsav( p->pName );
74  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
75  // create PIs
76  Gia_ManConst0(p)->Value = 0;
77  Gia_ManForEachPi( p, pObj, i )
78  pObj->Value = Gia_ManAppendCi(pNew);
79  // create additional PIs
80  Gia_ManForEachRo( p, pObj, i )
81  if ( !Vec_IntEntry(vFlopClasses, i) )
82  pObj->Value = Gia_ManAppendCi(pNew);
83  // create ROs
84  Gia_ManForEachRo( p, pObj, i )
85  if ( Vec_IntEntry(vFlopClasses, i) )
86  pObj->Value = Gia_ManAppendCi(pNew);
87  // create POs
88  Gia_ManHashAlloc( pNew );
89  Gia_ManForEachPo( p, pObj, i )
90  {
92  Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
93  }
94  // create RIs
95  Gia_ManForEachRi( p, pObj, i )
96  if ( Vec_IntEntry(vFlopClasses, i) )
97  {
99  Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
100  nFlops++;
101  }
102  Gia_ManHashStop( pNew );
103  Gia_ManSetRegNum( pNew, nFlops );
104  // clean up
105  pNew = Gia_ManSeqCleanup( pTemp = pNew );
106  Gia_ManStop( pTemp );
107  return pNew;
108 }
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
ABC_NAMESPACE_IMPL_START void Gia_ManDupAbsFlops_rec(Gia_Man_t *pNew, Gia_Obj_t *pObj)
DECLARATIONS ///.
Definition: absDup.c:44
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
Gia_Man_t * Gia_ManSeqCleanup(Gia_Man_t *p)
Definition: giaScl.c:183
char * pName
Definition: gia.h:97
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
ABC_NAMESPACE_IMPL_START void Gia_ManDupAbsFlops_rec ( Gia_Man_t pNew,
Gia_Obj_t pObj 
)

DECLARATIONS ///.

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

FileName [absDup.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Abstraction package.]

Synopsis [Duplication procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Duplicates the AIG manager recursively.]

Description []

SideEffects []

SeeAlso []

Definition at line 44 of file absDup.c.

45 {
46  if ( ~pObj->Value )
47  return;
48  assert( Gia_ObjIsAnd(pObj) );
51  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
52 }
ABC_NAMESPACE_IMPL_START void Gia_ManDupAbsFlops_rec(Gia_Man_t *pNew, Gia_Obj_t *pObj)
DECLARATIONS ///.
Definition: absDup.c:44
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
Gia_Man_t* Gia_ManDupAbsGates ( Gia_Man_t p,
Vec_Int_t vGateClasses 
)

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

Synopsis [Extractes a gate-level abstraction given a gate map.]

Description [The array contains 1 for those objects (const, RO, AND) that are included in the abstraction; 0, otherwise.]

SideEffects []

SeeAlso []

Definition at line 220 of file absDup.c.

221 {
222  Vec_Int_t * vPis, * vPPis, * vFlops, * vNodes;
223  Gia_Man_t * pNew, * pTemp;
224  Gia_Obj_t * pObj, * pCopy;
225  int i;//, nFlops = 0;
226  assert( Gia_ManPoNum(p) == 1 );
227  assert( Vec_IntSize(vGateClasses) == Gia_ManObjNum(p) );
228 
229  // create additional arrays
230  Gia_ManGlaCollect( p, vGateClasses, &vPis, &vPPis, &vFlops, &vNodes );
231 
232  // start the new manager
233  pNew = Gia_ManStart( 5000 );
234  pNew->pName = Abc_UtilStrsav( p->pName );
235  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
236  // create constant
237  Gia_ManFillValue( p );
238  Gia_ManConst0(p)->Value = 0;
239  // create PIs
240  Gia_ManForEachObjVec( vPis, p, pObj, i )
241  pObj->Value = Gia_ManAppendCi(pNew);
242  // create additional PIs
243  Gia_ManForEachObjVec( vPPis, p, pObj, i )
244  pObj->Value = Gia_ManAppendCi(pNew);
245  // create ROs
246  Gia_ManForEachObjVec( vFlops, p, pObj, i )
247  pObj->Value = Gia_ManAppendCi(pNew);
248  // create internal nodes
249  Gia_ManForEachObjVec( vNodes, p, pObj, i )
250  pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
251 // Gia_ManDupAbsGates_rec( pNew, pObj );
252  // create PO
253  Gia_ManForEachPo( p, pObj, i )
254  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
255  // create RIs
256  Gia_ManForEachObjVec( vFlops, p, pObj, i )
257  Gia_ObjRoToRi(p, pObj)->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(Gia_ObjRoToRi(p, pObj)) );
258  Gia_ManSetRegNum( pNew, Vec_IntSize(vFlops) );
259  // clean up
260  pNew = Gia_ManSeqCleanup( pTemp = pNew );
261  // transfer copy values: (p -> pTemp -> pNew) => (p -> pNew)
262  if ( Gia_ManObjNum(pTemp) != Gia_ManObjNum(pNew) )
263  {
264 // printf( "Gia_ManDupAbsGates() Internal error: object mismatch.\n" );
265  Gia_ManForEachObj( p, pObj, i )
266  {
267  if ( !~pObj->Value )
268  continue;
269  assert( !Abc_LitIsCompl(pObj->Value) );
270  pCopy = Gia_ObjCopy( pTemp, pObj );
271  if ( !~pCopy->Value )
272  {
273  Vec_IntWriteEntry( vGateClasses, i, 0 );
274  pObj->Value = ~0;
275  continue;
276  }
277  assert( !Abc_LitIsCompl(pCopy->Value) );
278  pObj->Value = pCopy->Value;
279  }
280  }
281  Gia_ManStop( pTemp );
282 
283  Vec_IntFree( vPis );
284  Vec_IntFree( vPPis );
285  Vec_IntFree( vFlops );
286  Vec_IntFree( vNodes );
287  return pNew;
288 }
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
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
Definition: gia.h:75
void Gia_ManGlaCollect(Gia_Man_t *p, Vec_Int_t *vGateClasses, Vec_Int_t **pvPis, Vec_Int_t **pvPPis, Vec_Int_t **pvFlops, Vec_Int_t **pvNodes)
Definition: absDup.c:158
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
Gia_Man_t * Gia_ManSeqCleanup(Gia_Man_t *p)
Definition: giaScl.c:183
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
static Gia_Obj_t * Gia_ObjRoToRi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:446
if(last==0)
Definition: sparse_int.h:34
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static Gia_Obj_t * Gia_ObjCopy(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:478
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Definition: gia.h:95
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManDupAbsGates_rec ( Gia_Man_t pNew,
Gia_Obj_t pObj 
)

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

Synopsis [Duplicates the AIG manager recursively.]

Description []

SideEffects []

SeeAlso []

Definition at line 198 of file absDup.c.

199 {
200  if ( ~pObj->Value )
201  return;
202  assert( Gia_ObjIsAnd(pObj) );
203  Gia_ManDupAbsGates_rec( pNew, Gia_ObjFanin0(pObj) );
204  Gia_ManDupAbsGates_rec( pNew, Gia_ObjFanin1(pObj) );
205  pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
206 }
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
void Gia_ManDupAbsGates_rec(Gia_Man_t *pNew, Gia_Obj_t *pObj)
Definition: absDup.c:198
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
void Gia_ManGlaCollect ( Gia_Man_t p,
Vec_Int_t vGateClasses,
Vec_Int_t **  pvPis,
Vec_Int_t **  pvPPis,
Vec_Int_t **  pvFlops,
Vec_Int_t **  pvNodes 
)

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

Synopsis [Collects PIs and PPIs of the abstraction.]

Description []

SideEffects []

SeeAlso []

Definition at line 158 of file absDup.c.

159 {
160  Vec_Int_t * vAssigned;
161  Gia_Obj_t * pObj;
162  int i;
163  assert( Gia_ManPoNum(p) == 1 );
164  assert( Vec_IntSize(vGateClasses) == Gia_ManObjNum(p) );
165  // create included objects and their fanins
166  vAssigned = Gia_GlaCollectAssigned( p, vGateClasses );
167  // create additional arrays
168  if ( pvPis ) *pvPis = Vec_IntAlloc( 100 );
169  if ( pvPPis ) *pvPPis = Vec_IntAlloc( 100 );
170  if ( pvFlops ) *pvFlops = Vec_IntAlloc( 100 );
171  if ( pvNodes ) *pvNodes = Vec_IntAlloc( 1000 );
172  Gia_ManForEachObjVec( vAssigned, p, pObj, i )
173  {
174  if ( Gia_ObjIsPi(p, pObj) )
175  { if ( pvPis ) Vec_IntPush( *pvPis, Gia_ObjId(p,pObj) ); }
176  else if ( !Vec_IntEntry(vGateClasses, Gia_ObjId(p,pObj)) )
177  { if ( pvPPis ) Vec_IntPush( *pvPPis, Gia_ObjId(p,pObj) ); }
178  else if ( Gia_ObjIsRo(p, pObj) )
179  { if ( pvFlops ) Vec_IntPush( *pvFlops, Gia_ObjId(p,pObj) ); }
180  else if ( Gia_ObjIsAnd(pObj) )
181  { if ( pvNodes ) Vec_IntPush( *pvNodes, Gia_ObjId(p,pObj) ); }
182  else assert( Gia_ObjIsConst0(pObj) );
183  }
184  Vec_IntFree( vAssigned );
185 }
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Vec_Int_t * Gia_GlaCollectAssigned(Gia_Man_t *p, Vec_Int_t *vGateClasses)
Definition: absDup.c:121
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
Definition: gia.h:75
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:443
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ObjIsPi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:441
void Gia_ManPrintFlopClasses ( Gia_Man_t p)

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

Synopsis [Prints stats for the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 301 of file absDup.c.

302 {
303  int Counter0, Counter1;
304  if ( p->vFlopClasses == NULL )
305  return;
306  if ( Vec_IntSize(p->vFlopClasses) != Gia_ManRegNum(p) )
307  {
308  printf( "Gia_ManPrintFlopClasses(): The number of flop map entries differs from the number of flops.\n" );
309  return;
310  }
311  Counter0 = Vec_IntCountEntry( p->vFlopClasses, 0 );
312  Counter1 = Vec_IntCountEntry( p->vFlopClasses, 1 );
313  printf( "Flop-level abstraction: Excluded FFs = %d Included FFs = %d (%.2f %%) ",
314  Counter0, Counter1, 100.0*Counter1/(Counter0 + Counter1 + 1) );
315  if ( Counter0 + Counter1 < Gia_ManRegNum(p) )
316  printf( "and there are other FF classes..." );
317  printf( "\n" );
318 }
static int Vec_IntCountEntry(Vec_Int_t *p, int Entry)
Definition: vecInt.h:1156
Vec_Int_t * vFlopClasses
Definition: gia.h:140
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
void Gia_ManPrintGateClasses ( Gia_Man_t p)

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

Synopsis [Prints stats for the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 331 of file absDup.c.

332 {
333  Vec_Int_t * vPis, * vPPis, * vFlops, * vNodes;
334  int nTotal;
335  if ( p->vGateClasses == NULL )
336  return;
337  if ( Vec_IntSize(p->vGateClasses) != Gia_ManObjNum(p) )
338  {
339  printf( "Gia_ManPrintGateClasses(): The number of flop map entries differs from the number of flops.\n" );
340  return;
341  }
342  // create additional arrays
343  Gia_ManGlaCollect( p, p->vGateClasses, &vPis, &vPPis, &vFlops, &vNodes );
344  nTotal = 1 + Vec_IntSize(vFlops) + Vec_IntSize(vNodes);
345  printf( "Gate-level abstraction: PI = %d PPI = %d FF = %d (%.2f %%) AND = %d (%.2f %%) Obj = %d (%.2f %%)\n",
346  Vec_IntSize(vPis), Vec_IntSize(vPPis),
347  Vec_IntSize(vFlops), 100.0*Vec_IntSize(vFlops)/(Gia_ManRegNum(p)+1),
348  Vec_IntSize(vNodes), 100.0*Vec_IntSize(vNodes)/(Gia_ManAndNum(p)+1),
349  nTotal, 100.0*nTotal /(Gia_ManRegNum(p)+Gia_ManAndNum(p)+1) );
350  Vec_IntFree( vPis );
351  Vec_IntFree( vPPis );
352  Vec_IntFree( vFlops );
353  Vec_IntFree( vNodes );
354 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void Gia_ManGlaCollect(Gia_Man_t *p, Vec_Int_t *vGateClasses, Vec_Int_t **pvPis, Vec_Int_t **pvPPis, Vec_Int_t **pvFlops, Vec_Int_t **pvNodes)
Definition: absDup.c:158
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
Vec_Int_t * vGateClasses
Definition: gia.h:141
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
int nTotal
DECLARATIONS ///.
Definition: cutTruth.c:37
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
void Gia_ManPrintObjClasses ( Gia_Man_t p)

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

Synopsis [Prints stats for the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 367 of file absDup.c.

368 {
369  Vec_Int_t * vSeens; // objects seen so far
370  Vec_Int_t * vAbs = p->vObjClasses;
371  int i, k, Entry, iStart, iStop = -1, nFrames;
372  int nObjBits, nObjMask, iObj, iFrame, nWords;
373  unsigned * pInfo;
374  int * pCountAll, * pCountUni;
375  if ( vAbs == NULL )
376  return;
377  nFrames = Vec_IntEntry( vAbs, 0 );
378  assert( Vec_IntEntry(vAbs, nFrames+1) == Vec_IntSize(vAbs) );
379  pCountAll = ABC_ALLOC( int, nFrames + 1 );
380  pCountUni = ABC_ALLOC( int, nFrames + 1 );
381  // start storage for seen objects
382  nWords = Abc_BitWordNum( nFrames );
383  vSeens = Vec_IntStart( Gia_ManObjNum(p) * nWords );
384  // get the bitmasks
385  nObjBits = Abc_Base2Log( Gia_ManObjNum(p) );
386  nObjMask = (1 << nObjBits) - 1;
387  assert( Gia_ManObjNum(p) <= nObjMask );
388  // print info about frames
389  printf( "Frame Core F0 F1 F2 F3 ...\n" );
390  for ( i = 0; i < nFrames; i++ )
391  {
392  iStart = Vec_IntEntry( vAbs, i+1 );
393  iStop = Vec_IntEntry( vAbs, i+2 );
394  memset( pCountAll, 0, sizeof(int) * (nFrames + 1) );
395  memset( pCountUni, 0, sizeof(int) * (nFrames + 1) );
396  Vec_IntForEachEntryStartStop( vAbs, Entry, k, iStart, iStop )
397  {
398  iObj = (Entry & nObjMask);
399  iFrame = (Entry >> nObjBits);
400  pInfo = (unsigned *)Vec_IntEntryP( vSeens, nWords * iObj );
401  if ( Abc_InfoHasBit(pInfo, iFrame) == 0 )
402  {
403  Abc_InfoSetBit( pInfo, iFrame );
404  pCountUni[iFrame+1]++;
405  pCountUni[0]++;
406  }
407  pCountAll[iFrame+1]++;
408  pCountAll[0]++;
409  }
410  assert( pCountAll[0] == (iStop - iStart) );
411 // printf( "%5d%5d ", pCountAll[0], pCountUni[0] );
412  printf( "%3d :", i );
413  printf( "%7d", pCountAll[0] );
414  if ( i >= 10 )
415  {
416  for ( k = 0; k < 4; k++ )
417  printf( "%5d", pCountAll[k+1] );
418  printf( " ..." );
419  for ( k = i-4; k <= i; k++ )
420  printf( "%5d", pCountAll[k+1] );
421  }
422  else
423  {
424  for ( k = 0; k <= i; k++ )
425  if ( k <= i )
426  printf( "%5d", pCountAll[k+1] );
427  }
428 // for ( k = 0; k < nFrames; k++ )
429 // if ( k <= i )
430 // printf( "%5d", pCountAll[k+1] );
431  printf( "\n" );
432  }
433  assert( iStop == Vec_IntSize(vAbs) );
434  Vec_IntFree( vSeens );
435  ABC_FREE( pCountAll );
436  ABC_FREE( pCountUni );
437 }
char * memset()
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
Vec_Int_t * vObjClasses
Definition: gia.h:142
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int nWords
Definition: abcNpn.c:127
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static void Abc_InfoSetBit(unsigned *p, int i)
Definition: abc_global.h:259
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define ABC_FREE(obj)
Definition: abc_global.h:232
static int Abc_Base2Log(unsigned n)
Definition: abc_global.h:251
static int Abc_BitWordNum(int nBits)
Definition: abc_global.h:255
#define assert(ex)
Definition: util_old.h:213
static int * Vec_IntEntryP(Vec_Int_t *p, int i)
Definition: vecInt.h:417
#define Vec_IntForEachEntryStartStop(vVec, Entry, i, Start, Stop)
Definition: vecInt.h:60
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388