abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cgtMan.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [cgtMan.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Clock gating package.]
8 
9  Synopsis [Manipulation of clock gating manager.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - June 20, 2005.]
16 
17  Revision [$Id: cgtMan.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include "cgtInt.h"
22 
24 
25 
26 ////////////////////////////////////////////////////////////////////////
27 /// DECLARATIONS ///
28 ////////////////////////////////////////////////////////////////////////
29 
30 ////////////////////////////////////////////////////////////////////////
31 /// FUNCTION DEFINITIONS ///
32 ////////////////////////////////////////////////////////////////////////
33 
34 /**Function*************************************************************
35 
36  Synopsis [Creates the manager.]
37 
38  Description []
39 
40  SideEffects []
41 
42  SeeAlso []
43 
44 ***********************************************************************/
45 Cgt_Man_t * Cgt_ManCreate( Aig_Man_t * pAig, Aig_Man_t * pCare, Cgt_Par_t * pPars )
46 {
47  Cgt_Man_t * p;
48  // prepare the sequential AIG
49  assert( Saig_ManRegNum(pAig) > 0 );
50  Aig_ManFanoutStart( pAig );
51  Aig_ManSetCioIds( pAig );
52  // create interpolation manager
53  p = ABC_ALLOC( Cgt_Man_t, 1 );
54  memset( p, 0, sizeof(Cgt_Man_t) );
55  p->pPars = pPars;
56  p->pAig = pAig;
57  p->vGatesAll = Vec_VecStart( Saig_ManRegNum(pAig) );
58  p->vFanout = Vec_PtrAlloc( 1000 );
59  p->vVisited = Vec_PtrAlloc( 1000 );
60  p->nPattWords = 16;
61  if ( pCare == NULL )
62  return p;
63  // check out the constraints
64  if ( Aig_ManCiNum(pCare) != Aig_ManCiNum(pAig) )
65  {
66  printf( "The PI count of care (%d) and AIG (%d) differ. Careset is not used.\n",
67  Aig_ManCiNum(pCare), Aig_ManCiNum(pAig) );
68  return p;
69  }
70  p->pCare = pCare;
71  p->vSuppsInv = (Vec_Vec_t *)Aig_ManSupportsInverse( p->pCare );
72  return p;
73 }
74 
75 /**Function*************************************************************
76 
77  Synopsis [Creates the manager.]
78 
79  Description []
80 
81  SideEffects []
82 
83  SeeAlso []
84 
85 ***********************************************************************/
87 {
88  if ( p->pPart )
89  {
90  Aig_ManStop( p->pPart );
91  p->pPart = NULL;
92  }
93  if ( p->pCnf )
94  {
95  Cnf_DataFree( p->pCnf );
96  p->pCnf = NULL;
97  }
98  if ( p->pSat )
99  {
100  sat_solver_delete( p->pSat );
101  p->pSat = NULL;
102  }
103  if ( p->vPatts )
104  {
105  Vec_PtrFree( p->vPatts );
106  p->vPatts = NULL;
107  }
108 }
109 
110 
111 /**Function*************************************************************
112 
113  Synopsis [Prints stats of the manager.]
114 
115  Description []
116 
117  SideEffects []
118 
119  SeeAlso []
120 
121 ***********************************************************************/
123 {
124  printf( "Params: LevMax = %d. CandMax = %d. OdcMax = %d. ConfMax = %d. VarMin = %d. FlopMin = %d.\n",
125  p->pPars->nLevelMax, p->pPars->nCandMax, p->pPars->nOdcMax,
126  p->pPars->nConfMax, p->pPars->nVarsMin, p->pPars->nFlopsMin );
127  printf( "SAT : Calls = %d. Unsat = %d. Sat = %d. Fails = %d. Recycles = %d. ",
128  p->nCalls, p->nCallsUnsat, p->nCallsSat, p->nCallsUndec, p->nRecycles );
129  ABC_PRT( "Time", p->timeTotal );
130 /*
131  p->timeOther = p->timeTotal-p->timeAig-p->timePrepare-p->timeSat-p->timeDecision;
132  ABC_PRTP( "AIG ", p->timeAig, p->timeTotal );
133  ABC_PRTP( "Prepare ", p->timePrepare, p->timeTotal );
134  ABC_PRTP( "SAT solving", p->timeSat, p->timeTotal );
135  ABC_PRTP( " unsat ", p->timeSatUnsat, p->timeTotal );
136  ABC_PRTP( " sat ", p->timeSatSat, p->timeTotal );
137  ABC_PRTP( " undecided", p->timeSatUndec, p->timeTotal );
138  ABC_PRTP( "Other ", p->timeOther, p->timeTotal );
139  ABC_PRTP( "TOTAL ", p->timeTotal, p->timeTotal );
140 */
141 }
142 
143 /**Function*************************************************************
144 
145  Synopsis [Frees the manager.]
146 
147  Description []
148 
149  SideEffects []
150 
151  SeeAlso []
152 
153 ***********************************************************************/
155 {
156  if ( p->pPars->fVerbose )
157  Cgt_ManPrintStats( p );
158  if ( p->pFrame )
159  Aig_ManStop( p->pFrame );
160  Cgt_ManClean( p );
161  Vec_PtrFree( p->vFanout );
162  Vec_PtrFree( p->vVisited );
163  if ( p->vGates )
164  Vec_PtrFree( p->vGates );
165  if ( p->vGatesAll )
166  Vec_VecFree( p->vGatesAll );
167  if ( p->vSuppsInv )
168  Vec_VecFree( p->vSuppsInv );
169  ABC_FREE( p );
170 }
171 
172 
173 ////////////////////////////////////////////////////////////////////////
174 /// END OF FILE ///
175 ////////////////////////////////////////////////////////////////////////
176 
177 
179 
char * memset()
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Cgt_ManStop(Cgt_Man_t *p)
Definition: cgtMan.c:154
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
void sat_solver_delete(sat_solver *s)
Definition: satSolver.c:1141
void Cgt_ManPrintStats(Cgt_Man_t *p)
Definition: cgtMan.c:122
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
void Aig_ManFanoutStart(Aig_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition: aigFanout.c:56
void Cgt_ManClean(Cgt_Man_t *p)
Definition: cgtMan.c:86
ABC_NAMESPACE_IMPL_START Cgt_Man_t * Cgt_ManCreate(Aig_Man_t *pAig, Aig_Man_t *pCare, Cgt_Par_t *pPars)
DECLARATIONS ///.
Definition: cgtMan.c:45
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
static Vec_Vec_t * Vec_VecStart(int nSize)
Definition: vecVec.h:168
typedefABC_NAMESPACE_HEADER_START struct Cgt_Par_t_ Cgt_Par_t
INCLUDES ///.
Definition: cgt.h:48
void Aig_ManSetCioIds(Aig_Man_t *p)
Definition: aigUtil.c:965
static int Saig_ManRegNum(Aig_Man_t *p)
Definition: saig.h:77
Vec_Ptr_t * Aig_ManSupportsInverse(Aig_Man_t *p)
Definition: aigPart.c:385
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define ABC_PRT(a, t)
Definition: abc_global.h:220
void Cnf_DataFree(Cnf_Dat_t *p)
Definition: cnfMan.c:180
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Cgt_Man_t_ Cgt_Man_t
INCLUDES ///.
Definition: cgtInt.h:47
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223