abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
giaSupMin.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [giaSupMin.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Scalable AIG package.]
8 
9  Synopsis [Support minimization for AIGs with don't-cares.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - June 20, 2005.]
16 
17  Revision [$Id: giaSupMin.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include "gia.h"
22 #include "bool/kit/kit.h"
23 
25 
26 
27 ////////////////////////////////////////////////////////////////////////
28 /// DECLARATIONS ///
29 ////////////////////////////////////////////////////////////////////////
30 
31 // decomposition manager
32 typedef struct Gia_ManSup_t_ Gia_ManSup_t;
34 {
35  int nVarsMax; // the max number of variables
36  int nWordsMax; // the max number of words
37  Vec_Ptr_t * vTruthVars; // elementary truth tables
38  Vec_Ptr_t * vTruthNodes; // internal truth tables
39  // current problem
41  int iData;
42  int iCare;
45  unsigned * pTruthIn;
46  unsigned * pTruthOut;
47 };
48 
49 ////////////////////////////////////////////////////////////////////////
50 /// FUNCTION DEFINITIONS ///
51 ////////////////////////////////////////////////////////////////////////
52 
53 /**Function*************************************************************
54 
55  Synopsis [Starts Decmetry manager.]
56 
57  Description []
58 
59  SideEffects []
60 
61  SeeAlso []
62 
63 ***********************************************************************/
64 Gia_ManSup_t * Gia_ManSupStart( int nVarsMax )
65 {
66  Gia_ManSup_t * p;
67  assert( nVarsMax <= 20 );
68  p = ABC_CALLOC( Gia_ManSup_t, 1 );
69  p->nVarsMax = nVarsMax;
70  p->nWordsMax = Kit_TruthWordNum( p->nVarsMax );
71  p->vTruthVars = Vec_PtrAllocTruthTables( p->nVarsMax );
72  p->vTruthNodes = Vec_PtrAllocSimInfo( 512, p->nWordsMax );
73  p->vConeCare = Vec_IntAlloc( 512 );
74  p->vConeData = Vec_IntAlloc( 512 );
75  p->pTruthIn = ABC_ALLOC( unsigned, p->nWordsMax );
76  p->pTruthOut = ABC_ALLOC( unsigned, p->nWordsMax );
77  return p;
78 }
79 
80 /**Function*************************************************************
81 
82  Synopsis [Stops Decmetry manager.]
83 
84  Description []
85 
86  SideEffects []
87 
88  SeeAlso []
89 
90 ***********************************************************************/
92 {
93  ABC_FREE( p->pTruthIn );
94  ABC_FREE( p->pTruthOut );
95  Vec_IntFreeP( &p->vConeCare );
96  Vec_IntFreeP( &p->vConeData );
97  Vec_PtrFreeP( &p->vTruthVars );
98  Vec_PtrFreeP( &p->vTruthNodes );
99  ABC_FREE( p );
100 }
101 
102 /**Function*************************************************************
103 
104  Synopsis []
105 
106  Description []
107 
108  SideEffects []
109 
110  SeeAlso []
111 
112 ***********************************************************************/
114 {
115  int iData = Gia_ObjId( p->pGia, Gia_Regular(pData) );
116  int iCare = Gia_ObjId( p->pGia, Gia_Regular(pCare) );
117  if ( !Gia_ObjIsAnd(Gia_Regular(pCare)) )
118  {
119  Abc_Print( 1, "Enable is not an AND.\n" );
120  return;
121  }
122  Abc_Print( 1, "DataSupp = %6d. DataCone = %6d. CareSupp = %6d. CareCone = %6d.",
123  Gia_ManSuppSize( p->pGia, &iData, 1 ),
124  Gia_ManConeSize( p->pGia, &iData, 1 ),
125  Gia_ManSuppSize( p->pGia, &iCare, 1 ),
126  Gia_ManConeSize( p->pGia, &iCare, 1 ) );
127  Abc_Print( 1, "\n" );
128 }
129 
130 /**Function*************************************************************
131 
132  Synopsis []
133 
134  Description []
135 
136  SideEffects []
137 
138  SeeAlso []
139 
140 ***********************************************************************/
141 void Gia_ManSupExperiment( Gia_Man_t * pGia, Vec_Int_t * vPairs )
142 {
143  Gia_ManSup_t * p;
144  Gia_Obj_t * pData, * pCare;
145  int i;
146  p = Gia_ManSupStart( 16 );
147  p->pGia = pGia;
148  assert( Vec_IntSize(vPairs) % 2 == 0 );
149  for ( i = 0; i < Vec_IntSize(vPairs)/2; i++ )
150  {
151  Abc_Print( 1, "%6d : ", i );
152  pData = Gia_ManPo( pGia, Vec_IntEntry(vPairs, 2*i+0) );
153  pCare = Gia_ManPo( pGia, Vec_IntEntry(vPairs, 2*i+1) );
155  }
156  Gia_ManSupStop( p );
157 }
158 
159 ////////////////////////////////////////////////////////////////////////
160 /// END OF FILE ///
161 ////////////////////////////////////////////////////////////////////////
162 
163 
165 
Gia_Man_t * pGia
Definition: giaSupMin.c:40
static Gia_Obj_t * Gia_ObjChild0(Gia_Obj_t *pObj)
Definition: gia.h:457
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Vec_Int_t * vConeCare
Definition: giaSupMin.c:43
int Gia_ManSuppSize(Gia_Man_t *p, int *pNodes, int nNodes)
Definition: giaDfs.c:300
static int Kit_TruthWordNum(int nVars)
Definition: kit.h:224
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 Gia_Obj_t * Gia_Regular(Gia_Obj_t *p)
Definition: gia.h:377
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
Vec_Ptr_t * vTruthVars
Definition: giaSupMin.c:37
typedefABC_NAMESPACE_IMPL_START struct Gia_ManSup_t_ Gia_ManSup_t
DECLARATIONS ///.
Definition: giaSupMin.c:32
Gia_ManSup_t * Gia_ManSupStart(int nVarsMax)
FUNCTION DEFINITIONS ///.
Definition: giaSupMin.c:64
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Definition: gia.h:75
static Vec_Ptr_t * Vec_PtrAllocTruthTables(int nVars)
Definition: vecPtr.h:1065
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
Vec_Ptr_t * vTruthNodes
Definition: giaSupMin.c:38
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 * vConeData
Definition: giaSupMin.c:44
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
int Gia_ManConeSize(Gia_Man_t *p, int *pNodes, int nNodes)
Definition: giaDfs.c:351
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
unsigned * pTruthIn
Definition: giaSupMin.c:45
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
void Gia_ManSupStop(Gia_ManSup_t *p)
Definition: giaSupMin.c:91
#define ABC_FREE(obj)
Definition: abc_global.h:232
Definition: gia.h:95
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
void Gia_ManSupExperimentOne(Gia_ManSup_t *p, Gia_Obj_t *pData, Gia_Obj_t *pCare)
Definition: giaSupMin.c:113
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
static void Vec_PtrFreeP(Vec_Ptr_t **p)
Definition: vecPtr.h:240
#define assert(ex)
Definition: util_old.h:213
void Gia_ManSupExperiment(Gia_Man_t *pGia, Vec_Int_t *vPairs)
Definition: giaSupMin.c:141
static Vec_Ptr_t * Vec_PtrAllocSimInfo(int nEntries, int nWords)
Definition: vecPtr.h:929
unsigned * pTruthOut
Definition: giaSupMin.c:46