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 
24 ABC_NAMESPACE_IMPL_START
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 ***********************************************************************/
If_ManCacheRecord(If_Man_t * p,int iDsd0,int iDsd1,int nShared,int iDsd)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 ***********************************************************************/
If_ManCacheAnalize(If_Man_t * p)70 void If_ManCacheAnalize( If_Man_t * p )
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 
99 ABC_NAMESPACE_IMPL_END
100 
101