abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
giaShrink7.c File Reference
#include "gia.h"
#include "misc/vec/vecHash.h"
#include "misc/util/utilTruth.h"

Go to the source code of this file.

Data Structures

struct  Unm_Man_t_
 

Typedefs

typedef
typedefABC_NAMESPACE_IMPL_START
struct Unm_Man_t_ 
Unm_Man_t
 DECLARATIONS ///. More...
 

Functions

word Shr_ManComputeTruth6 (Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vLeaves, Vec_Wrd_t *vTruths)
 
Unm_Man_tUnm_ManAlloc (Gia_Man_t *pGia)
 FUNCTION DEFINITIONS ///. More...
 
Gia_Man_tUnm_ManFree (Unm_Man_t *p)
 
int Unm_ManPrintPairStats (Hash_IntMan_t *pHash, int nTotal0, int nPairs0, int nPairs1, int fUseLit)
 
Vec_Int_tUnm_ManComputePairs (Unm_Man_t *p, int fVerbose)
 
Vec_Int_tUnm_ManFindUsedNodes (Vec_Int_t *vPairs, int nObjs)
 
Vec_Wrd_tUnm_ManComputeTruths (Unm_Man_t *p)
 
Vec_Int_tUnm_ManCollectDecomp (Unm_Man_t *p, Vec_Int_t *vPairs, int fVerbose)
 
void Unm_ManWork (Unm_Man_t *p)
 
Gia_Man_tUnm_ManTest (Gia_Man_t *pGia)
 

Typedef Documentation

typedef typedefABC_NAMESPACE_IMPL_START struct Unm_Man_t_ Unm_Man_t

DECLARATIONS ///.

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

FileName [giaShrink7.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis [Implementation of DAG-aware unmapping for 6-input cuts.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Definition at line 33 of file giaShrink7.c.

Function Documentation

word Shr_ManComputeTruth6 ( Gia_Man_t p,
Gia_Obj_t pObj,
Vec_Int_t vLeaves,
Vec_Wrd_t vTruths 
)

Definition at line 335 of file giaShrink6.c.

336 {
337  int i, iLeaf;
338  assert( Gia_ObjIsAnd(pObj) );
340  Vec_IntForEachEntry( vLeaves, iLeaf, i )
341  {
342  Gia_ObjSetTravIdCurrentId( p, iLeaf );
343  Vec_WrdWriteEntry( vTruths, iLeaf, Truth[i] );
344  }
345  return Shr_ManComputeTruth6_rec( p, Gia_ObjId(p, pObj), vTruths );
346 }
word Shr_ManComputeTruth6_rec(Gia_Man_t *p, int iNode, Vec_Wrd_t *vTruths)
Definition: giaShrink6.c:317
static void Vec_WrdWriteEntry(Vec_Wrd_t *p, int i, word Entry)
Definition: vecWrd.h:418
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static ABC_NAMESPACE_IMPL_START word Truth[8]
DECLARATIONS ///.
Definition: giaShrink6.c:32
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define assert(ex)
Definition: util_old.h:213
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
static void Gia_ObjSetTravIdCurrentId(Gia_Man_t *p, int Id)
Definition: gia.h:535
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
Unm_Man_t* Unm_ManAlloc ( Gia_Man_t pGia)

FUNCTION DEFINITIONS ///.

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 64 of file giaShrink7.c.

65 {
66  Unm_Man_t * p;
67  p = ABC_CALLOC( Unm_Man_t, 1 );
68  p->clkStart = Abc_Clock();
69  p->nNewSize = 3 * Gia_ManObjNum(pGia) / 2;
70  p->pGia = pGia;
71  p->pNew = Gia_ManStart( p->nNewSize );
72  p->pNew->pName = Abc_UtilStrsav( pGia->pName );
73  p->pNew->pSpec = Abc_UtilStrsav( pGia->pSpec );
74  Gia_ManHashAlloc( p->pNew );
75  Gia_ManCleanLevels( p->pNew, p->nNewSize );
76  // allocate traversal IDs
77  p->pNew->nObjs = p->nNewSize;
78  Gia_ManIncrementTravId( p->pNew );
79  p->pNew->nObjs = 1;
80  // start hashing
81  p->pHash = Hash_IntManStart( 1000 );
82  // truth tables
83  p->vLeaves = Vec_IntStart( 10 );
84  return p;
85 }
static Hash_IntMan_t * Hash_IntManStart(int nSize)
FUNCTION DEFINITIONS ///.
Definition: vecHash.h:86
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static abctime Abc_Clock()
Definition: abc_global.h:279
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
char * pName
Definition: gia.h:97
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
void Gia_ManCleanLevels(Gia_Man_t *p, int Size)
Definition: giaUtil.c:470
typedefABC_NAMESPACE_IMPL_START struct Unm_Man_t_ Unm_Man_t
DECLARATIONS ///.
Definition: giaShrink7.c:33
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
Vec_Int_t* Unm_ManCollectDecomp ( Unm_Man_t p,
Vec_Int_t vPairs,
int  fVerbose 
)

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

Synopsis [Collects decomposable pairs.]

Description []

SideEffects []

SeeAlso []

Definition at line 258 of file giaShrink7.c.

259 {
260  word uTruth; int nNonUnique = 0;
261  int i, k, j, s, iObj, iNode, iUsed, FanK, FanJ, Res, Num, nRefs;
262  Vec_Int_t * vNum2Obj = Vec_IntStart( 1 );
263  Vec_Int_t * vPairs2 = Vec_IntAlloc( 1000 );
264  assert( Hash_IntManEntryNum(p->pHash) == 0 );
265  for ( i = 0; i < Vec_IntSize(vPairs); i += 3 )
266  {
267  iObj = Vec_IntEntry( vPairs, i );
268  assert( Gia_ObjIsLut(p->pGia, iObj) );
269  // collect leaves of this gate
270  Vec_IntClear( p->vLeaves );
271  Gia_LutForEachFanin( p->pGia, iObj, iNode, s )
272  Vec_IntPush( p->vLeaves, iNode );
273  assert( Vec_IntSize(p->vLeaves) <= 6 );
274  FanK = Vec_IntEntry(vPairs, i+1);
275  FanJ = Vec_IntEntry(vPairs, i+2);
276  k = Vec_IntFind( p->vLeaves, FanK );
277  j = Vec_IntFind( p->vLeaves, FanJ );
278  assert( FanK < FanJ );
279  iUsed = Vec_IntEntry( p->vId2Used, iObj );
280  uTruth = Vec_WrdEntry( p->vTruths, iUsed );
281  Res = Abc_TtCheckDsdAnd( uTruth, k, j, NULL );
282  if ( Res == -1 )
283  continue;
284  // derive literals
285  FanK = Abc_Var2Lit( FanK, ((Res >> 0) & 1) );
286  FanJ = Abc_Var2Lit( FanJ, ((Res >> 1) & 1) );
287  if ( Res == 4 )
288  ABC_SWAP( int, FanK, FanJ );
289  Num = Hash_Int2ManInsert( p->pHash, FanK, FanJ, 0 );
290  nRefs = Hash_Int2ObjInc(p->pHash, Num);
291  if ( nRefs == 0 )
292  {
293  assert( Num == Hash_IntManEntryNum(p->pHash) );
294  assert( Num == Vec_IntSize(vNum2Obj) );
295  Vec_IntPush( vNum2Obj, iObj );
296  continue;
297  }
298  if ( nRefs == 1 )
299  {
300  assert( Num < Vec_IntSize(vNum2Obj) );
301  Vec_IntPush( vPairs2, Vec_IntEntry(vNum2Obj, Num) );
302  Vec_IntPush( vPairs2, FanK );
303  Vec_IntPush( vPairs2, FanJ );
304  nNonUnique++;
305  }
306  Vec_IntPush( vPairs2, iObj );
307  Vec_IntPush( vPairs2, FanK );
308  Vec_IntPush( vPairs2, FanJ );
309  }
310  Vec_IntFree( vNum2Obj );
311  if ( fVerbose )
312  Unm_ManPrintPairStats( p->pHash, Vec_IntSize(vPairs)/3, Hash_IntManEntryNum(p->pHash), Vec_IntSize(vPairs2)/3, 1 );
313 // Hash_IntManStop( pHash );
314  return vPairs2;
315 }
static int Hash_IntManEntryNum(Hash_IntMan_t *p)
Definition: vecHash.h:101
static int Hash_Int2ObjInc(Hash_IntMan_t *p, int i)
Definition: vecHash.h:67
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_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
static int Vec_IntFind(Vec_Int_t *p, int Entry)
Definition: vecInt.h:895
static int Abc_TtCheckDsdAnd(word t, int i, int j, word *pOut)
Definition: utilTruth.h:2087
#define ABC_SWAP(Type, a, b)
Definition: abc_global.h:218
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
if(last==0)
Definition: sparse_int.h:34
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Hash_Int2ManInsert(Hash_IntMan_t *p, int iData0, int iData1, int iData2)
Definition: vecHash.h:144
Vec_Ptr_t * vLeaves
Definition: llb3Image.c:50
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static word Vec_WrdEntry(Vec_Wrd_t *p, int i)
Definition: vecWrd.h:384
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjIsLut(Gia_Man_t *p, int Id)
Definition: gia.h:952
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
int Unm_ManPrintPairStats(Hash_IntMan_t *pHash, int nTotal0, int nPairs0, int nPairs1, int fUseLit)
Definition: giaShrink7.c:118
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
#define Gia_LutForEachFanin(p, i, iFan, k)
Definition: gia.h:970
Vec_Int_t* Unm_ManComputePairs ( Unm_Man_t p,
int  fVerbose 
)

Definition at line 153 of file giaShrink7.c.

154 {
155  Gia_Obj_t * pObj;
156  Vec_Int_t * vPairs = Vec_IntAlloc( 1000 );
157  Vec_Int_t * vNum2Obj = Vec_IntStart( 1 );
158  Hash_IntMan_t * pHash = Hash_IntManStart( 1000 );
159  int nTotal = 0, nPairs0 = 0, nPairs = 0;
160  int i, k, j, FanK, FanJ, Num, nRefs;
161  Gia_ManSetRefsMapped( p->pGia );
162  Gia_ManForEachLut( p->pGia, i )
163  {
164  nTotal += Gia_ObjLutSize(p->pGia, i) * (Gia_ObjLutSize(p->pGia, i) - 1) / 2;
165  pObj = Gia_ManObj( p->pGia, i );
166  // collect leaves of this gate
167  Vec_IntClear( p->vLeaves );
168  Gia_LutForEachFanin( p->pGia, i, Num, k )
169  if ( Gia_ObjRefNumId(p->pGia, Num) > 1 )
170  Vec_IntPush( p->vLeaves, Num );
171  if ( Vec_IntSize(p->vLeaves) < 2 )
172  continue;
173  nPairs0 += Vec_IntSize(p->vLeaves) * (Vec_IntSize(p->vLeaves) - 1) / 2;
174  // enumerate pairs
175  Vec_IntForEachEntry( p->vLeaves, FanK, k )
176  Vec_IntForEachEntryStart( p->vLeaves, FanJ, j, k+1 )
177  {
178  if ( FanK > FanJ )
179  ABC_SWAP( int, FanK, FanJ );
180  Num = Hash_Int2ManInsert( pHash, FanK, FanJ, 0 );
181  nRefs = Hash_Int2ObjInc(pHash, Num);
182  if ( nRefs == 0 )
183  {
184  assert( Num == Hash_IntManEntryNum(pHash) );
185  assert( Num == Vec_IntSize(vNum2Obj) );
186  Vec_IntPush( vNum2Obj, i );
187  continue;
188  }
189  if ( nRefs == 1 )
190  {
191  assert( Num < Vec_IntSize(vNum2Obj) );
192  Vec_IntPush( vPairs, Vec_IntEntry(vNum2Obj, Num) );
193  Vec_IntPush( vPairs, FanK );
194  Vec_IntPush( vPairs, FanJ);
195  }
196  Vec_IntPush( vPairs, i );
197  Vec_IntPush( vPairs, FanK );
198  Vec_IntPush( vPairs, FanJ );
199  }
200  }
201  Vec_IntFree( vNum2Obj );
202  if ( fVerbose )
203  nPairs = Unm_ManPrintPairStats( pHash, nTotal, nPairs0, Vec_IntSize(vPairs) / 3, 0 );
204  Hash_IntManStop( pHash );
205  return vPairs;
206 }
static Hash_IntMan_t * Hash_IntManStart(int nSize)
FUNCTION DEFINITIONS ///.
Definition: vecHash.h:86
static int Hash_IntManEntryNum(Hash_IntMan_t *p)
Definition: vecHash.h:101
static int Hash_Int2ObjInc(Hash_IntMan_t *p, int i)
Definition: vecHash.h:67
void Gia_ManSetRefsMapped(Gia_Man_t *p)
Definition: giaIf.c:245
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 Gia_ObjRefNumId(Gia_Man_t *p, int Id)
Definition: gia.h:518
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
#define Gia_ManForEachLut(p, i)
Definition: gia.h:968
#define ABC_SWAP(Type, a, b)
Definition: abc_global.h:218
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Gia_ObjLutSize(Gia_Man_t *p, int Id)
Definition: gia.h:953
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static void Hash_IntManStop(Hash_IntMan_t *p)
Definition: vecHash.h:95
if(last==0)
Definition: sparse_int.h:34
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
Definition: vecInt.h:56
static int Hash_Int2ManInsert(Hash_IntMan_t *p, int iData0, int iData1, int iData2)
Definition: vecHash.h:144
Vec_Ptr_t * vLeaves
Definition: llb3Image.c:50
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
int Unm_ManPrintPairStats(Hash_IntMan_t *pHash, int nTotal0, int nPairs0, int nPairs1, int fUseLit)
Definition: giaShrink7.c:118
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
#define Gia_LutForEachFanin(p, i, iFan, k)
Definition: gia.h:970
int nTotal
DECLARATIONS ///.
Definition: cutTruth.c:37
Vec_Wrd_t* Unm_ManComputeTruths ( Unm_Man_t p)

Definition at line 222 of file giaShrink7.c.

223 {
224  Vec_Wrd_t * vTruthsTemp, * vTruths;
225  int i, k, iObj, iNode;
226  word uTruth;
227  vTruths = Vec_WrdAlloc( Vec_IntSize(p->vUsed) );
228  vTruthsTemp = Vec_WrdStart( Gia_ManObjNum(p->pGia) );
229  Vec_IntForEachEntry( p->vUsed, iObj, i )
230  {
231  assert( Gia_ObjIsLut(p->pGia, iObj) );
232  // collect leaves of this gate
233  Vec_IntClear( p->vLeaves );
234  Gia_LutForEachFanin( p->pGia, iObj, iNode, k )
235  Vec_IntPush( p->vLeaves, iNode );
236  assert( Vec_IntSize(p->vLeaves) <= 6 );
237  // compute truth table
238  uTruth = Shr_ManComputeTruth6( p->pGia, Gia_ManObj(p->pGia, iObj), p->vLeaves, vTruthsTemp );
239  Vec_WrdPush( vTruths, uTruth );
240 // if ( i % 100 == 0 )
241 // Kit_DsdPrintFromTruth( (unsigned *)&uTruth, 6 ), printf( "\n" );
242  }
243  Vec_WrdFreeP( &vTruthsTemp );
244  return vTruths;
245 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_WrdPush(Vec_Wrd_t *p, word Entry)
Definition: vecWrd.h:618
static void Vec_WrdFreeP(Vec_Wrd_t **p)
Definition: vecWrd.h:277
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static Vec_Wrd_t * Vec_WrdAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecWrd.h:80
Vec_Ptr_t * vLeaves
Definition: llb3Image.c:50
static Vec_Wrd_t * Vec_WrdStart(int nSize)
Definition: vecWrd.h:103
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
word Shr_ManComputeTruth6(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vLeaves, Vec_Wrd_t *vTruths)
Definition: giaShrink6.c:335
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjIsLut(Gia_Man_t *p, int Id)
Definition: gia.h:952
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition: vecWrd.h:42
#define Gia_LutForEachFanin(p, i, iFan, k)
Definition: gia.h:970
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
Vec_Int_t* Unm_ManFindUsedNodes ( Vec_Int_t vPairs,
int  nObjs 
)

Definition at line 208 of file giaShrink7.c.

209 {
210  Vec_Int_t * vNodes = Vec_IntAlloc( 1000 );
211  Vec_Str_t * vMarks = Vec_StrStart( nObjs ); int i;
212  for ( i = 0; i < Vec_IntSize(vPairs); i += 3 )
213  Vec_StrWriteEntry( vMarks, Vec_IntEntry(vPairs, i), 1 );
214  for ( i = 0; i < nObjs; i++ )
215  if ( Vec_StrEntry( vMarks, i ) )
216  Vec_IntPush( vNodes, i );
217  Vec_StrFree( vMarks );
218  printf( "The number of used nodes = %d\n", Vec_IntSize(vNodes) );
219  return vNodes;
220 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static void Vec_StrWriteEntry(Vec_Str_t *p, int i, char Entry)
Definition: vecStr.h:370
static char Vec_StrEntry(Vec_Str_t *p, int i)
Definition: vecStr.h:336
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_StrFree(Vec_Str_t *p)
Definition: bblif.c:616
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static Vec_Str_t * Vec_StrStart(int nSize)
Definition: vecStr.h:95
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
Gia_Man_t* Unm_ManFree ( Unm_Man_t p)

Definition at line 86 of file giaShrink7.c.

87 {
88  Gia_Man_t * pTemp = p->pNew; p->pNew = NULL;
89  Gia_ManHashStop( pTemp );
90  Vec_IntFreeP( &pTemp->vLevels );
91  Gia_ManSetRegNum( pTemp, Gia_ManRegNum(p->pGia) );
92  // truth tables
93  Vec_WrdFreeP( &p->vTruths );
94  Vec_IntFreeP( &p->vLeaves );
95  Vec_IntFreeP( &p->vUsed );
96  Vec_IntFreeP( &p->vId2Used );
97  // free data structures
98  Hash_IntManStop( p->pHash );
99  ABC_FREE( p );
100 
101  Gia_ManStop( pTemp );
102  pTemp = NULL;
103 
104  return pTemp;
105 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
static void Vec_WrdFreeP(Vec_Wrd_t **p)
Definition: vecWrd.h:277
static void Hash_IntManStop(Hash_IntMan_t *p)
Definition: vecHash.h:95
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
Vec_Ptr_t * vLeaves
Definition: llb3Image.c:50
#define ABC_FREE(obj)
Definition: abc_global.h:232
Definition: gia.h:95
Vec_Int_t * vLevels
Definition: gia.h:115
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
int Unm_ManPrintPairStats ( Hash_IntMan_t pHash,
int  nTotal0,
int  nPairs0,
int  nPairs1,
int  fUseLit 
)

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

Synopsis [Computes information about node pairs.]

Description []

SideEffects []

SeeAlso []

Definition at line 118 of file giaShrink7.c.

119 {
120  int i, Num, nRefs, nPairs = 0, nTotal = 0, Counter[21] = {0};
121  Num = Hash_IntManEntryNum( pHash );
122  for ( i = 1; i <= Num; i++ )
123  {
124  nRefs = Abc_MinInt( 20, Hash_IntObjData2(pHash, i) );
125  nTotal += nRefs;
126  Counter[nRefs]++;
127  nPairs += (nRefs > 1);
128 /*
129  if ( fUseLit )
130  printf( "(%c%c, %c%c) %d\n",
131  Abc_LitIsCompl(Hash_IntObjData0(pHash, i)-2) ? '!' : ' ',
132  'a' + Abc_Lit2Var(Hash_IntObjData0(pHash, i)-2),
133  Abc_LitIsCompl(Hash_IntObjData1(pHash, i)-2) ? '!' : ' ',
134  'a' + Abc_Lit2Var(Hash_IntObjData1(pHash, i)-2), nRefs );
135  else
136  printf( "( %c, %c) %d\n",
137  'a' + Hash_IntObjData0(pHash, i)-1,
138  'a' + Hash_IntObjData1(pHash, i)-1, nRefs );
139 */
140 // printf( "(%4d, %4d) %d\n", Hash_IntObjData0(pHash, i), Hash_IntObjData1(pHash, i), nRefs );
141 
142  }
143  printf( "Statistics for pairs appearing less than 20 times:\n" );
144  for ( i = 0; i < 21; i++ )
145  if ( Counter[i] > 0 )
146  printf( "%3d : %7d %7.2f %%\n", i, Counter[i], 100.0 * Counter[i] * i / Abc_MaxInt(nTotal, 1) );
147  printf( "Pairs: Total = %8d Init = %8d %7.2f %% Final = %8d %7.2f %% Real = %8d %7.2f %%\n", nTotal0,
148  nPairs0, 100.0 * nPairs0 / Abc_MaxInt(nTotal0, 1),
149  nPairs, 100.0 * nPairs / Abc_MaxInt(nTotal0, 1),
150  nPairs1, 100.0 * nPairs1 / Abc_MaxInt(nTotal0, 1) );
151  return nPairs;
152 }
static int Hash_IntManEntryNum(Hash_IntMan_t *p)
Definition: vecHash.h:101
static int Hash_IntObjData2(Hash_IntMan_t *p, int i)
Definition: vecHash.h:65
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static int Abc_MinInt(int a, int b)
Definition: abc_global.h:239
static int Counter
int nTotal
DECLARATIONS ///.
Definition: cutTruth.c:37
Gia_Man_t* Unm_ManTest ( Gia_Man_t pGia)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 357 of file giaShrink7.c.

358 {
359  Unm_Man_t * p;
360  p = Unm_ManAlloc( pGia );
361  Unm_ManWork( p );
362 
363  Abc_PrintTime( 1, "Time", Abc_Clock() - p->clkStart );
364  return Unm_ManFree( p );
365 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static abctime Abc_Clock()
Definition: abc_global.h:279
void Unm_ManWork(Unm_Man_t *p)
Definition: giaShrink7.c:328
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
Unm_Man_t * Unm_ManAlloc(Gia_Man_t *pGia)
FUNCTION DEFINITIONS ///.
Definition: giaShrink7.c:64
typedefABC_NAMESPACE_IMPL_START struct Unm_Man_t_ Unm_Man_t
DECLARATIONS ///.
Definition: giaShrink7.c:33
Gia_Man_t * Unm_ManFree(Unm_Man_t *p)
Definition: giaShrink7.c:86
void Unm_ManWork ( Unm_Man_t p)

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

Synopsis [Compute truth tables for the selected nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 328 of file giaShrink7.c.

329 {
330  Vec_Int_t * vPairs, * vPairs2;
331  // find the duplicated pairs
332  vPairs = Unm_ManComputePairs( p, 1 );
333  // find the used nodes
334  p->vUsed = Unm_ManFindUsedNodes( vPairs, Gia_ManObjNum(p->pGia) );
335  p->vId2Used = Vec_IntInvert( p->vUsed, -1 );
336  Vec_IntFillExtra( p->vId2Used, Gia_ManObjNum(p->pGia), -1 );
337  // compute truth tables for used nodes
338  p->vTruths = Unm_ManComputeTruths( p );
339  // derive new pairs
340  vPairs2 = Unm_ManCollectDecomp( p, vPairs, 1 );
341  Vec_IntFreeP( &vPairs );
342  Vec_IntFreeP( &vPairs2 );
343 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_IntFillExtra(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:376
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Vec_Int_t * Vec_IntInvert(Vec_Int_t *p, int Fill)
Definition: vecInt.h:1092
Vec_Wrd_t * Unm_ManComputeTruths(Unm_Man_t *p)
Definition: giaShrink7.c:222
Vec_Int_t * Unm_ManCollectDecomp(Unm_Man_t *p, Vec_Int_t *vPairs, int fVerbose)
Definition: giaShrink7.c:258
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
Vec_Int_t * Unm_ManFindUsedNodes(Vec_Int_t *vPairs, int nObjs)
Definition: giaShrink7.c:208
Vec_Int_t * Unm_ManComputePairs(Unm_Man_t *p, int fVerbose)
Definition: giaShrink7.c:153
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388