abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ifCache.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [ifCache.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [FPGA mapping based on priority cuts.]
8 
9  Synopsis []
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - November 21, 2006.]
16 
17  Revision [$Id: ifCache.c,v 1.00 2006/11/21 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include "if.h"
22 #include "misc/vec/vecHsh.h"
23 
25 
26 ////////////////////////////////////////////////////////////////////////
27 /// DECLARATIONS ///
28 ////////////////////////////////////////////////////////////////////////
29 
30 ////////////////////////////////////////////////////////////////////////
31 /// FUNCTION DEFINITIONS ///
32 ////////////////////////////////////////////////////////////////////////
33 
34 /**Function*************************************************************
35 
36  Synopsis []
37 
38  Description []
39 
40  SideEffects []
41 
42  SeeAlso []
43 
44 ***********************************************************************/
45 void If_ManCacheRecord( If_Man_t * p, int iDsd0, int iDsd1, int nShared, int iDsd )
46 {
47  assert( nShared >= 0 && nShared <= p->pPars->nLutSize );
48  if ( p->vCutData == NULL )
49  p->vCutData = Vec_IntAlloc( 10000 );
50  if ( iDsd0 > iDsd1 )
51  ABC_SWAP( int, iDsd0, iDsd1 );
52  Vec_IntPush( p->vCutData, iDsd0 );
53  Vec_IntPush( p->vCutData, iDsd1 );
54  Vec_IntPush( p->vCutData, nShared );
55  Vec_IntPush( p->vCutData, iDsd );
56 // printf( "%6d %6d %6d %6d\n", iDsd0, iDsd1, nShared, iDsd );
57 }
58 
59 /**Function*************************************************************
60 
61  Synopsis []
62 
63  Description []
64 
65  SideEffects []
66 
67  SeeAlso []
68 
69 ***********************************************************************/
71 {
72  Vec_Int_t * vRes, * vTest[32];
73  int i, Entry, uUnique;
74  vRes = Hsh_IntManHashArray( p->vCutData, 4 );
75  for ( i = 0; i <= p->pPars->nLutSize; i++ )
76  vTest[i] = Vec_IntAlloc( 1000 );
77  Vec_IntForEachEntry( vRes, Entry, i )
78  Vec_IntPush( vTest[Vec_IntEntry(p->vCutData, 4*i+2)], Entry );
79  for ( i = 0; i <= p->pPars->nLutSize; i++ )
80  {
81  uUnique = Vec_IntCountUnique(vTest[i]);
82  printf( "%2d-var entries = %8d. (%6.2f %%) Unique entries = %8d. (%6.2f %%)\n",
83  i, Vec_IntSize(vTest[i]), 100.0*Vec_IntSize(vTest[i])/Abc_MaxInt(1, Vec_IntSize(vRes)),
84  uUnique, 100.0*uUnique/Abc_MaxInt(1, Vec_IntSize(vTest[i])) );
85  }
86  for ( i = 0; i <= p->pPars->nLutSize; i++ )
87  Vec_IntFree( vTest[i] );
88  uUnique = Vec_IntCountUnique(vRes);
89  printf( "Total entries = %8d. (%6.2f %%) Unique entries = %8d. (%6.2f %%)\n",
90  Vec_IntSize(p->vCutData)/4, 100.0, uUnique, 100.0*uUnique/Abc_MaxInt(1, Vec_IntSize(p->vCutData)/4) );
91  Vec_IntFree( vRes );
92 }
93 
94 ////////////////////////////////////////////////////////////////////////
95 /// END OF FILE ///
96 ////////////////////////////////////////////////////////////////////////
97 
98 
100 
int nLutSize
Definition: if.h:103
static int Vec_IntCountUnique(Vec_Int_t *p)
Definition: vecInt.h:1345
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
void If_ManCacheAnalize(If_Man_t *p)
Definition: ifCache.c:70
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
ABC_NAMESPACE_IMPL_START void If_ManCacheRecord(If_Man_t *p, int iDsd0, int iDsd1, int nShared, int iDsd)
DECLARATIONS ///.
Definition: ifCache.c:45
static Vec_Int_t * Hsh_IntManHashArray(Vec_Int_t *vData, int nSize)
Definition: vecHsh.h:191
#define ABC_SWAP(Type, a, b)
Definition: abc_global.h:218
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
Definition: if.h:180
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
Vec_Int_t * vCutData
Definition: if.h:260
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
If_Par_t * pPars
Definition: if.h:184
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
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54