abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cecMan.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [cecMan.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Combinational equivalence checking.]
8 
9  Synopsis [Manager procedures.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - June 20, 2005.]
16 
17  Revision [$Id: cecMan.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include "cecInt.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 ***********************************************************************/
46 {
47  Cec_ManSat_t * p;
48  // create interpolation manager
49  p = ABC_ALLOC( Cec_ManSat_t, 1 );
50  memset( p, 0, sizeof(Cec_ManSat_t) );
51  p->pPars = pPars;
52  p->pAig = pAig;
53  // SAT solving
54  p->nSatVars = 1;
55  p->pSatVars = ABC_CALLOC( int, Gia_ManObjNum(pAig) );
56  p->vUsedNodes = Vec_PtrAlloc( 1000 );
57  p->vFanins = Vec_PtrAlloc( 100 );
58  p->vCex = Vec_IntAlloc( 100 );
59  p->vVisits = Vec_IntAlloc( 100 );
60  return p;
61 }
62 
63 /**Function*************************************************************
64 
65  Synopsis [Prints statistics of the manager.]
66 
67  Description []
68 
69  SideEffects []
70 
71  SeeAlso []
72 
73 ***********************************************************************/
75 {
76  Abc_Print( 1, "CO = %8d ", Gia_ManCoNum(p->pAig) );
77  Abc_Print( 1, "AND = %8d ", Gia_ManAndNum(p->pAig) );
78  Abc_Print( 1, "Conf = %5d ", p->pPars->nBTLimit );
79  Abc_Print( 1, "MinVar = %5d ", p->pPars->nSatVarMax );
80  Abc_Print( 1, "MinCalls = %5d\n", p->pPars->nCallsRecycle );
81  Abc_Print( 1, "Unsat calls %6d (%6.2f %%) Ave conf = %8.1f ",
82  p->nSatUnsat, p->nSatTotal? 100.0*p->nSatUnsat/p->nSatTotal : 0.0, p->nSatUnsat? 1.0*p->nConfUnsat/p->nSatUnsat :0.0 );
83  Abc_PrintTimeP( 1, "Time", p->timeSatUnsat, p->timeTotal );
84  Abc_Print( 1, "Sat calls %6d (%6.2f %%) Ave conf = %8.1f ",
85  p->nSatSat, p->nSatTotal? 100.0*p->nSatSat/p->nSatTotal : 0.0, p->nSatSat? 1.0*p->nConfSat/p->nSatSat : 0.0 );
86  Abc_PrintTimeP( 1, "Time", p->timeSatSat, p->timeTotal );
87  Abc_Print( 1, "Undef calls %6d (%6.2f %%) Ave conf = %8.1f ",
88  p->nSatUndec, p->nSatTotal? 100.0*p->nSatUndec/p->nSatTotal : 0.0, p->nSatUndec? 1.0*p->nConfUndec/p->nSatUndec : 0.0 );
89  Abc_PrintTimeP( 1, "Time", p->timeSatUndec, p->timeTotal );
90  Abc_PrintTime( 1, "Total time", p->timeTotal );
91 }
92 
93 /**Function*************************************************************
94 
95  Synopsis [Frees the manager.]
96 
97  Description []
98 
99  SideEffects []
100 
101  SeeAlso []
102 
103 ***********************************************************************/
105 {
106  if ( p->pSat )
107  sat_solver_delete( p->pSat );
108  Vec_IntFree( p->vCex );
109  Vec_IntFree( p->vVisits );
110  Vec_PtrFree( p->vUsedNodes );
111  Vec_PtrFree( p->vFanins );
112  ABC_FREE( p->pSatVars );
113  ABC_FREE( p );
114 }
115 
116 
117 
118 /**Function*************************************************************
119 
120  Synopsis [Creates AIG.]
121 
122  Description []
123 
124  SideEffects []
125 
126  SeeAlso []
127 
128 ***********************************************************************/
130 {
131  Cec_ManPat_t * p;
132  p = ABC_CALLOC( Cec_ManPat_t, 1 );
133  p->vStorage = Vec_StrAlloc( 1<<20 );
134  p->vPattern1 = Vec_IntAlloc( 1000 );
135  p->vPattern2 = Vec_IntAlloc( 1000 );
136  return p;
137 }
138 
139 /**Function*************************************************************
140 
141  Synopsis [Creates AIG.]
142 
143  Description []
144 
145  SideEffects []
146 
147  SeeAlso []
148 
149 ***********************************************************************/
151 {
152  Abc_Print( 1, "Latest: P = %8d. L = %10d. Lm = %10d. Ave = %6.1f. MEM =%6.2f MB\n",
153  p->nPats, p->nPatLits, p->nPatLitsMin, 1.0 * p->nPatLitsMin/p->nPats,
154  1.0*(Vec_StrSize(p->vStorage)-p->iStart)/(1<<20) );
155  Abc_Print( 1, "Total: P = %8d. L = %10d. Lm = %10d. Ave = %6.1f. MEM =%6.2f MB\n",
156  p->nPatsAll, p->nPatLitsAll, p->nPatLitsMinAll, 1.0 * p->nPatLitsMinAll/p->nPatsAll,
157  1.0*Vec_StrSize(p->vStorage)/(1<<20) );
158  Abc_PrintTimeP( 1, "Finding ", p->timeFind, p->timeTotal );
159  Abc_PrintTimeP( 1, "Shrinking", p->timeShrink, p->timeTotal );
160  Abc_PrintTimeP( 1, "Verifying", p->timeVerify, p->timeTotal );
161  Abc_PrintTimeP( 1, "Sorting ", p->timeSort, p->timeTotal );
162  Abc_PrintTimeP( 1, "Packing ", p->timePack, p->timeTotal );
163  Abc_PrintTime( 1, "TOTAL ", p->timeTotal );
164 }
165 
166 /**Function*************************************************************
167 
168  Synopsis [Deletes AIG.]
169 
170  Description []
171 
172  SideEffects []
173 
174  SeeAlso []
175 
176 ***********************************************************************/
178 {
179  Vec_StrFree( p->vStorage );
180  Vec_IntFree( p->vPattern1 );
181  Vec_IntFree( p->vPattern2 );
182  ABC_FREE( p );
183 }
184 
185 
186 
187 /**Function*************************************************************
188 
189  Synopsis [Creates AIG.]
190 
191  Description []
192 
193  SideEffects []
194 
195  SeeAlso []
196 
197 ***********************************************************************/
199 {
200  Cec_ManSim_t * p;
201  p = ABC_ALLOC( Cec_ManSim_t, 1 );
202  memset( p, 0, sizeof(Cec_ManSim_t) );
203  p->pAig = pAig;
204  p->pPars = pPars;
205  p->nWords = pPars->nWords;
206  p->pSimInfo = ABC_CALLOC( int, Gia_ManObjNum(pAig) );
207  p->vClassOld = Vec_IntAlloc( 1000 );
208  p->vClassNew = Vec_IntAlloc( 1000 );
209  p->vClassTemp = Vec_IntAlloc( 1000 );
210  p->vRefinedC = Vec_IntAlloc( 10000 );
212  if ( pPars->fCheckMiter || Gia_ManRegNum(p->pAig) )
213  {
215  Vec_PtrCleanSimInfo( p->vCoSimInfo, 0, pPars->nWords );
216  }
217  p->iOut = -1;
218  return p;
219 }
220 
221 /**Function*************************************************************
222 
223  Synopsis [Deletes AIG.]
224 
225  Description []
226 
227  SideEffects []
228 
229  SeeAlso []
230 
231 ***********************************************************************/
233 {
234  Vec_IntFree( p->vClassOld );
235  Vec_IntFree( p->vClassNew );
236  Vec_IntFree( p->vClassTemp );
237  Vec_IntFree( p->vRefinedC );
238  if ( p->vCiSimInfo )
239  Vec_PtrFree( p->vCiSimInfo );
240  if ( p->vCoSimInfo )
241  Vec_PtrFree( p->vCoSimInfo );
242  ABC_FREE( p->pScores );
243  ABC_FREE( p->pCexComb );
244  ABC_FREE( p->pCexes );
245  ABC_FREE( p->pMems );
246  ABC_FREE( p->pSimInfo );
247  ABC_FREE( p );
248 }
249 
250 
251 /**Function*************************************************************
252 
253  Synopsis [Creates AIG.]
254 
255  Description []
256 
257  SideEffects []
258 
259  SeeAlso []
260 
261 ***********************************************************************/
263 {
264  Cec_ManFra_t * p;
265  p = ABC_ALLOC( Cec_ManFra_t, 1 );
266  memset( p, 0, sizeof(Cec_ManFra_t) );
267  p->pAig = pAig;
268  p->pPars = pPars;
269  p->vXorNodes = Vec_IntAlloc( 1000 );
270  return p;
271 }
272 
273 /**Function*************************************************************
274 
275  Synopsis [Deletes AIG.]
276 
277  Description []
278 
279  SideEffects []
280 
281  SeeAlso []
282 
283 ***********************************************************************/
285 {
286  Vec_IntFree( p->vXorNodes );
287  ABC_FREE( p );
288 }
289 
290 
291 ////////////////////////////////////////////////////////////////////////
292 /// END OF FILE ///
293 ////////////////////////////////////////////////////////////////////////
294 
295 
297 
char * memset()
int timeSatSat
Definition: cecInt.h:105
Abc_Cex_t * pCexComb
Definition: cecInt.h:133
int timeTotal
Definition: cecInt.h:107
int * pScores
Definition: cecInt.h:136
int nConfUndec
Definition: cecInt.h:102
Cec_ManFra_t * Cec_ManFraStart(Gia_Man_t *pAig, Cec_ParFra_t *pPars)
Definition: cecMan.c:262
static Llb_Mgr_t * p
Definition: llb3Image.c:950
ABC_NAMESPACE_IMPL_START Cec_ManSat_t * Cec_ManSatCreate(Gia_Man_t *pAig, Cec_ParSat_t *pPars)
DECLARATIONS ///.
Definition: cecMan.c:45
Cec_ManSim_t * Cec_ManSimStart(Gia_Man_t *pAig, Cec_ParSim_t *pPars)
Definition: cecMan.c:198
sat_solver * pSat
Definition: cecInt.h:83
int nConfUnsat
Definition: cecInt.h:100
void sat_solver_delete(sat_solver *s)
Definition: satSolver.c:1141
Cec_ParSat_t * pPars
Definition: cecInt.h:78
int nSatUnsat
Definition: cecInt.h:94
static void Vec_PtrCleanSimInfo(Vec_Ptr_t *vInfo, int iWord, int nWords)
Definition: vecPtr.h:968
Vec_Int_t * vVisits
Definition: cecInt.h:92
Gia_Man_t * pAig
Definition: cecInt.h:80
int * pSatVars
Definition: cecInt.h:85
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Gia_Man_t * pAig
Definition: cecInt.h:115
Vec_Int_t * vXorNodes
Definition: cecInt.h:152
static Vec_Str_t * Vec_StrAlloc(int nCap)
Definition: bblif.c:495
static void Abc_PrintTimeP(int level, const char *pStr, abctime time, abctime Time)
Definition: abc_global.h:372
int nSatVars
Definition: cecInt.h:84
int fCheckMiter
Definition: cec.h:67
void Cec_ManSatPrintStats(Cec_ManSat_t *p)
Definition: cecMan.c:74
void Cec_ManSimStop(Cec_ManSim_t *p)
Definition: cecMan.c:232
Cec_ManPat_t * Cec_ManPatStart()
Definition: cecMan.c:129
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
int nSatUndec
Definition: cecInt.h:96
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
Vec_Ptr_t * vFanins
Definition: cecInt.h:89
static void Vec_StrFree(Vec_Str_t *p)
Definition: bblif.c:616
int nWords
Definition: cecInt.h:117
Vec_Int_t * vCex
Definition: cecInt.h:91
typedefABC_NAMESPACE_HEADER_START struct Cec_ManPat_t_ Cec_ManPat_t
INCLUDES ///.
Definition: cecInt.h:48
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
Vec_Ptr_t * vCiSimInfo
Definition: cecInt.h:127
void ** pCexes
Definition: cecInt.h:130
Vec_Int_t * vClassNew
Definition: cecInt.h:139
Vec_Ptr_t * vUsedNodes
Definition: cecInt.h:86
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
int timeSatUnsat
Definition: cecInt.h:104
int nSatTotal
Definition: cecInt.h:97
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
void Cec_ManFraStop(Cec_ManFra_t *p)
Definition: cecMan.c:284
int nConfSat
Definition: cecInt.h:101
static int Vec_StrSize(Vec_Str_t *p)
Definition: bblif.c:600
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
int timeSatUndec
Definition: cecInt.h:106
int * pSimInfo
Definition: cecInt.h:119
int nSatSat
Definition: cecInt.h:95
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define ABC_FREE(obj)
Definition: abc_global.h:232
Definition: gia.h:95
void Cec_ManPatStop(Cec_ManPat_t *p)
Definition: cecMan.c:177
Gia_Man_t * pAig
Definition: cecInt.h:149
Cec_ParSim_t * pPars
Definition: cecInt.h:116
void Cec_ManSatStop(Cec_ManSat_t *p)
Definition: cecMan.c:104
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
Vec_Ptr_t * vCoSimInfo
Definition: cecInt.h:128
typedefABC_NAMESPACE_HEADER_START struct Cec_ParSat_t_ Cec_ParSat_t
INCLUDES ///.
Definition: cec.h:43
Vec_Int_t * vRefinedC
Definition: cecInt.h:141
void Cec_ManPatPrintStats(Cec_ManPat_t *p)
Definition: cecMan.c:150
int nWords
Definition: cec.h:61
Vec_Int_t * vClassTemp
Definition: cecInt.h:140
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
unsigned * pMems
Definition: cecInt.h:120
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static Vec_Ptr_t * Vec_PtrAllocSimInfo(int nEntries, int nWords)
Definition: vecPtr.h:929
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
Cec_ParFra_t * pPars
Definition: cecInt.h:150
Vec_Int_t * vClassOld
Definition: cecInt.h:138
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387