abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cecInt.h
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [cecInt.h]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Combinational equivalence checking.]
8 
9  Synopsis [External declarations.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - June 20, 2005.]
16 
17  Revision [$Id: cecInt.h,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #ifndef ABC__aig__cec__cecInt_h
22 #define ABC__aig__cec__cecInt_h
23 
24 
25 ////////////////////////////////////////////////////////////////////////
26 /// INCLUDES ///
27 ////////////////////////////////////////////////////////////////////////
28 
29 #include "sat/bsat/satSolver.h"
30 #include "misc/bar/bar.h"
31 #include "aig/gia/gia.h"
32 #include "cec.h"
33 
34 ////////////////////////////////////////////////////////////////////////
35 /// PARAMETERS ///
36 ////////////////////////////////////////////////////////////////////////
37 
38 
39 
41 
42 
43 ////////////////////////////////////////////////////////////////////////
44 /// BASIC TYPES ///
45 ////////////////////////////////////////////////////////////////////////
46 
47 // simulation pattern manager
48 typedef struct Cec_ManPat_t_ Cec_ManPat_t;
50 {
51  Vec_Int_t * vPattern1; // pattern in terms of primary inputs
52  Vec_Int_t * vPattern2; // pattern in terms of primary inputs
53  Vec_Str_t * vStorage; // storage for compressed patterns
54  int iStart; // position in the array where recent patterns begin
55  int nPats; // total number of recent patterns
56  int nPatsAll; // total number of all patterns
57  int nPatLits; // total number of literals in recent patterns
58  int nPatLitsAll; // total number of literals in all patterns
59  int nPatLitsMin; // total number of literals in minimized recent patterns
60  int nPatLitsMinAll; // total number of literals in minimized all patterns
61  int nSeries; // simulation series
62  int fVerbose; // verbose stats
63  // runtime statistics
64  abctime timeFind; // detecting the pattern
65  abctime timeShrink; // minimizing the pattern
66  abctime timeVerify; // verifying the result of minimisation
67  abctime timeSort; // sorting literals
68  abctime timePack; // packing into sim info structures
69  abctime timeTotal; // total runtime
70  abctime timeTotalSave; // total runtime for saving
71 };
72 
73 // SAT solving manager
74 typedef struct Cec_ManSat_t_ Cec_ManSat_t;
76 {
77  // parameters
79  // AIGs used in the package
80  Gia_Man_t * pAig; // the AIG whose outputs are considered
81  Vec_Int_t * vStatus; // status for each output
82  // SAT solving
83  sat_solver * pSat; // recyclable SAT solver
84  int nSatVars; // the counter of SAT variables
85  int * pSatVars; // mapping of each node into its SAT var
86  Vec_Ptr_t * vUsedNodes; // nodes whose SAT vars are assigned
87  int nRecycles; // the number of times SAT solver was recycled
88  int nCallsSince; // the number of calls since the last recycle
89  Vec_Ptr_t * vFanins; // fanins of the CNF node
90  // counter-examples
91  Vec_Int_t * vCex; // the latest counter-example
92  Vec_Int_t * vVisits; // temporary array for visited nodes
93  // SAT calls statistics
94  int nSatUnsat; // the number of proofs
95  int nSatSat; // the number of failure
96  int nSatUndec; // the number of timeouts
97  int nSatTotal; // the number of calls
98  int nCexLits;
99  // conflicts
100  int nConfUnsat; // conflicts in unsat problems
101  int nConfSat; // conflicts in sat problems
102  int nConfUndec; // conflicts in undec problems
103  // runtime stats
104  int timeSatUnsat; // unsat
105  int timeSatSat; // sat
106  int timeSatUndec; // undecided
107  int timeTotal; // total runtime
108 };
109 
110 // combinational simulation manager
113 {
114  // parameters
115  Gia_Man_t * pAig; // the AIG to be used for simulation
116  Cec_ParSim_t * pPars; // simulation parameters
117  int nWords; // the number of simulation words
118  // recycable memory
119  int * pSimInfo; // simulation information offsets
120  unsigned * pMems; // allocated simulaton memory
121  int nWordsAlloc; // the number of allocated entries
122  int nMems; // the number of used entries
123  int nMemsMax; // the max number of used entries
124  int MemFree; // next free entry
125  int nWordsOld; // the number of simulation words after previous relink
126  // internal simulation info
127  Vec_Ptr_t * vCiSimInfo; // CI simulation info
128  Vec_Ptr_t * vCoSimInfo; // CO simulation info
129  // counter examples
130  void ** pCexes; // counter-examples for each output
131  int iOut; // first failed output
132  int nOuts; // the number of failed outputs
133  Abc_Cex_t * pCexComb; // counter-example for the first failed output
134  Abc_Cex_t * pBestState; // the state that led to most of the refinements
135  // scoring simulation patterns
136  int * pScores; // counters of refinement for each pattern
137  // temporaries
138  Vec_Int_t * vClassOld; // old class numbers
139  Vec_Int_t * vClassNew; // new class numbers
140  Vec_Int_t * vClassTemp; // temporary storage
141  Vec_Int_t * vRefinedC; // refined const reprs
142 };
143 
144 // combinational simulation manager
147 {
148  // parameters
149  Gia_Man_t * pAig; // the AIG to be used for simulation
150  Cec_ParFra_t * pPars; // SAT sweeping parameters
151  // simulation patterns
152  Vec_Int_t * vXorNodes; // nodes used in speculative reduction
153  int nAllProved; // total number of proved nodes
154  int nAllDisproved; // total number of disproved nodes
155  int nAllFailed; // total number of failed nodes
156  // runtime stats
157  abctime timeSim; // unsat
158  abctime timePat; // unsat
159  abctime timeSat; // sat
160  abctime timeTotal; // total runtime
161 };
162 
163 ////////////////////////////////////////////////////////////////////////
164 /// MACRO DEFINITIONS ///
165 ////////////////////////////////////////////////////////////////////////
166 
167 ////////////////////////////////////////////////////////////////////////
168 /// FUNCTION DECLARATIONS ///
169 ////////////////////////////////////////////////////////////////////////
170 
171 /*=== cecCorr.c ============================================================*/
172 extern void Cec_ManRefinedClassPrintStats( Gia_Man_t * p, Vec_Str_t * vStatus, int iIter, abctime Time );
173 /*=== cecClass.c ============================================================*/
174 extern int Cec_ManSimClassRemoveOne( Cec_ManSim_t * p, int i );
175 extern int Cec_ManSimClassesPrepare( Cec_ManSim_t * p, int LevelMax );
176 extern int Cec_ManSimClassesRefine( Cec_ManSim_t * p );
177 extern int Cec_ManSimSimulateRound( Cec_ManSim_t * p, Vec_Ptr_t * vInfoCis, Vec_Ptr_t * vInfoCos );
178 /*=== cecIso.c ============================================================*/
179 extern int * Cec_ManDetectIsomorphism( Gia_Man_t * p );
180 /*=== cecMan.c ============================================================*/
181 extern Cec_ManSat_t * Cec_ManSatCreate( Gia_Man_t * pAig, Cec_ParSat_t * pPars );
182 extern void Cec_ManSatPrintStats( Cec_ManSat_t * p );
183 extern void Cec_ManSatStop( Cec_ManSat_t * p );
184 extern Cec_ManPat_t * Cec_ManPatStart();
185 extern void Cec_ManPatPrintStats( Cec_ManPat_t * p );
186 extern void Cec_ManPatStop( Cec_ManPat_t * p );
187 extern Cec_ManSim_t * Cec_ManSimStart( Gia_Man_t * pAig, Cec_ParSim_t * pPars );
188 extern void Cec_ManSimStop( Cec_ManSim_t * p );
189 extern Cec_ManFra_t * Cec_ManFraStart( Gia_Man_t * pAig, Cec_ParFra_t * pPars );
190 extern void Cec_ManFraStop( Cec_ManFra_t * p );
191 /*=== cecPat.c ============================================================*/
192 extern void Cec_ManPatSavePattern( Cec_ManPat_t * pPat, Cec_ManSat_t * p, Gia_Obj_t * pObj );
193 extern void Cec_ManPatSavePatternCSat( Cec_ManPat_t * pMan, Vec_Int_t * vPat );
194 extern Vec_Ptr_t * Cec_ManPatCollectPatterns( Cec_ManPat_t * pMan, int nInputs, int nWords );
195 extern Vec_Ptr_t * Cec_ManPatPackPatterns( Vec_Int_t * vCexStore, int nInputs, int nRegs, int nWordsInit );
196 /*=== cecSeq.c ============================================================*/
197 extern int Cec_ManSeqResimulate( Cec_ManSim_t * p, Vec_Ptr_t * vInfo );
198 extern int Cec_ManSeqResimulateInfo( Gia_Man_t * pAig, Vec_Ptr_t * vSimInfo, Abc_Cex_t * pBestState, int fCheckMiter );
199 extern void Cec_ManSeqDeriveInfoInitRandom( Vec_Ptr_t * vInfo, Gia_Man_t * pAig, Abc_Cex_t * pCex );
200 extern int Cec_ManCountNonConstOutputs( Gia_Man_t * pAig );
201 extern int Cec_ManCheckNonTrivialCands( Gia_Man_t * pAig );
202 /*=== cecSolve.c ============================================================*/
203 extern int Cec_ObjSatVarValue( Cec_ManSat_t * p, Gia_Obj_t * pObj );
204 extern void Cec_ManSatSolve( Cec_ManPat_t * pPat, Gia_Man_t * pAig, Cec_ParSat_t * pPars );
205 extern void Cec_ManSatSolveCSat( Cec_ManPat_t * pPat, Gia_Man_t * pAig, Cec_ParSat_t * pPars );
206 extern Vec_Str_t * Cec_ManSatSolveSeq( Vec_Ptr_t * vPatts, Gia_Man_t * pAig, Cec_ParSat_t * pPars, int nRegs, int * pnPats );
207 extern Vec_Int_t * Cec_ManSatSolveMiter( Gia_Man_t * pAig, Cec_ParSat_t * pPars, Vec_Str_t ** pvStatus );
208 extern int Cec_ManSatCheckNode( Cec_ManSat_t * p, Gia_Obj_t * pObj );
209 extern int Cec_ManSatCheckNodeTwo( Cec_ManSat_t * p, Gia_Obj_t * pObj1, Gia_Obj_t * pObj2 );
210 extern void Cec_ManSavePattern( Cec_ManSat_t * p, Gia_Obj_t * pObj1, Gia_Obj_t * pObj2 );
212 /*=== ceFraeep.c ============================================================*/
214 extern int Cec_ManFraClassesUpdate( Cec_ManFra_t * p, Cec_ManSim_t * pSim, Cec_ManPat_t * pPat, Gia_Man_t * pNew );
215 
216 
217 
219 
220 
221 
222 #endif
223 
224 ////////////////////////////////////////////////////////////////////////
225 /// END OF FILE ///
226 ////////////////////////////////////////////////////////////////////////
227 
int timeSatSat
Definition: cecInt.h:105
Abc_Cex_t * pCexComb
Definition: cecInt.h:133
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
int timeTotal
Definition: cecInt.h:107
void Cec_ManPatSavePatternCSat(Cec_ManPat_t *pMan, Vec_Int_t *vPat)
Definition: cecPat.c:402
int * pScores
Definition: cecInt.h:136
void Cec_ManSatPrintStats(Cec_ManSat_t *p)
Definition: cecMan.c:74
int nConfUndec
Definition: cecInt.h:102
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
sat_solver * pSat
Definition: cecInt.h:83
Vec_Int_t * Cec_ManSatSolveMiter(Gia_Man_t *pAig, Cec_ParSat_t *pPars, Vec_Str_t **pvStatus)
Definition: cecSolve.c:1026
int nConfUnsat
Definition: cecInt.h:100
abctime timeSim
Definition: cecInt.h:157
int nSeries
Definition: cecInt.h:61
void Cec_ManSeqDeriveInfoInitRandom(Vec_Ptr_t *vInfo, Gia_Man_t *pAig, Abc_Cex_t *pCex)
Definition: cecSeq.c:104
Cec_ParSat_t * pPars
Definition: cecInt.h:78
int nSatUnsat
Definition: cecInt.h:94
int Cec_ManFraClassesUpdate(Cec_ManFra_t *p, Cec_ManSim_t *pSim, Cec_ManPat_t *pPat, Gia_Man_t *pNew)
Definition: cecSweep.c:188
Vec_Int_t * vVisits
Definition: cecInt.h:92
int Cec_ManSimClassesRefine(Cec_ManSim_t *p)
Definition: cecClass.c:908
void Cec_ManSatSolve(Cec_ManPat_t *pPat, Gia_Man_t *pAig, Cec_ParSat_t *pPars)
Definition: cecSolve.c:676
int nPats
Definition: cecInt.h:55
Gia_Man_t * pAig
Definition: cecInt.h:80
void Cec_ManSimStop(Cec_ManSim_t *p)
Definition: cecMan.c:232
int * pSatVars
Definition: cecInt.h:85
int nAllFailed
Definition: cecInt.h:155
Gia_Man_t * pAig
Definition: cecInt.h:115
Vec_Int_t * vXorNodes
Definition: cecInt.h:152
int Cec_ManSimClassRemoveOne(Cec_ManSim_t *p, int i)
Definition: cecClass.c:308
Vec_Str_t * vStorage
Definition: cecInt.h:53
abctime timePack
Definition: cecInt.h:68
void Cec_ManSatSolveCSat(Cec_ManPat_t *pPat, Gia_Man_t *pAig, Cec_ParSat_t *pPars)
Definition: cecSolve.c:765
int nSatVars
Definition: cecInt.h:84
int nWords
Definition: abcNpn.c:127
int iStart
Definition: cecInt.h:54
Definition: gia.h:75
abctime timeSat
Definition: cecInt.h:159
Cec_ManSim_t * Cec_ManSimStart(Gia_Man_t *pAig, Cec_ParSim_t *pPars)
Definition: cecMan.c:198
int nRecycles
Definition: cecInt.h:87
void Cec_ManSavePattern(Cec_ManSat_t *p, Gia_Obj_t *pObj1, Gia_Obj_t *pObj2)
Definition: cecSolve.c:1005
Vec_Int_t * vPattern2
Definition: cecInt.h:52
int nAllDisproved
Definition: cecInt.h:154
int nSatUndec
Definition: cecInt.h:96
int Cec_ManCheckNonTrivialCands(Gia_Man_t *pAig)
Definition: cecSeq.c:295
abctime timeSort
Definition: cecInt.h:67
Vec_Ptr_t * vFanins
Definition: cecInt.h:89
void Cec_ManPatSavePattern(Cec_ManPat_t *pPat, Cec_ManSat_t *p, Gia_Obj_t *pObj)
Definition: cecPat.c:359
int nWords
Definition: cecInt.h:117
Vec_Int_t * vCex
Definition: cecInt.h:91
int nPatLits
Definition: cecInt.h:57
void Cec_ManPatPrintStats(Cec_ManPat_t *p)
Definition: cecMan.c:150
typedefABC_NAMESPACE_HEADER_START struct Cec_ManPat_t_ Cec_ManPat_t
INCLUDES ///.
Definition: cecInt.h:48
void Cec_ManRefinedClassPrintStats(Gia_Man_t *p, Vec_Str_t *vStatus, int iIter, abctime Time)
MACRO DEFINITIONS ///.
Definition: cecCorr.c:725
int MemFree
Definition: cecInt.h:124
Vec_Ptr_t * vCiSimInfo
Definition: cecInt.h:127
Vec_Int_t * Cec_ManSatReadCex(Cec_ManSat_t *p)
Definition: cecSolve.c:820
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
Definition: abc_global.h:105
int Cec_ManSimClassesPrepare(Cec_ManSim_t *p, int LevelMax)
Definition: cecClass.c:851
void ** pCexes
Definition: cecInt.h:130
abctime timeTotal
Definition: cecInt.h:69
int nMemsMax
Definition: cecInt.h:123
int nWordsOld
Definition: cecInt.h:125
Vec_Int_t * vClassNew
Definition: cecInt.h:139
Vec_Ptr_t * vUsedNodes
Definition: cecInt.h:86
int Cec_ManSimSimulateRound(Cec_ManSim_t *p, Vec_Ptr_t *vInfoCis, Vec_Ptr_t *vInfoCos)
Definition: cecClass.c:652
#define ABC_NAMESPACE_HEADER_END
Definition: abc_global.h:106
int nWordsAlloc
Definition: cecInt.h:121
int Cec_ManCountNonConstOutputs(Gia_Man_t *pAig)
Definition: cecSeq.c:272
Vec_Int_t * vPattern1
Definition: cecInt.h:51
int timeSatUnsat
Definition: cecInt.h:104
int nSatTotal
Definition: cecInt.h:97
int nConfSat
Definition: cecInt.h:101
void Cec_ManSatStop(Cec_ManSat_t *p)
Definition: cecMan.c:104
int nPatLitsMinAll
Definition: cecInt.h:60
int nCallsSince
Definition: cecInt.h:88
int timeSatUndec
Definition: cecInt.h:106
int * pSimInfo
Definition: cecInt.h:119
int Cec_ObjSatVarValue(Cec_ManSat_t *p, Gia_Obj_t *pObj)
FUNCTION DEFINITIONS ///.
Definition: cecSolve.c:48
int nPatsAll
Definition: cecInt.h:56
Vec_Ptr_t * Cec_ManPatCollectPatterns(Cec_ManPat_t *pMan, int nInputs, int nWords)
Definition: cecPat.c:455
Vec_Ptr_t * Cec_ManPatPackPatterns(Vec_Int_t *vCexStore, int nInputs, int nRegs, int nWordsInit)
Definition: cecPat.c:513
int nSatSat
Definition: cecInt.h:95
int Cec_ManSatCheckNodeTwo(Cec_ManSat_t *p, Gia_Obj_t *pObj1, Gia_Obj_t *pObj2)
Definition: cecSolve.c:569
Gia_Man_t * Cec_ManFraSpecReduction(Cec_ManFra_t *p)
DECLARATIONS ///.
Definition: cecSweep.c:45
void Cec_ManFraStop(Cec_ManFra_t *p)
Definition: cecMan.c:284
Definition: gia.h:95
Gia_Man_t * pAig
Definition: cecInt.h:149
Cec_ParSim_t * pPars
Definition: cecInt.h:116
int Cec_ManSatCheckNode(Cec_ManSat_t *p, Gia_Obj_t *pObj)
Definition: cecSolve.c:470
Vec_Str_t * Cec_ManSatSolveSeq(Vec_Ptr_t *vPatts, Gia_Man_t *pAig, Cec_ParSat_t *pPars, int nRegs, int *pnPats)
Definition: cecSolve.c:867
Vec_Ptr_t * vCoSimInfo
Definition: cecInt.h:128
int nPatLitsAll
Definition: cecInt.h:58
Cec_ManFra_t * Cec_ManFraStart(Gia_Man_t *pAig, Cec_ParFra_t *pPars)
Definition: cecMan.c:262
typedefABC_NAMESPACE_HEADER_START struct Cec_ParSat_t_ Cec_ParSat_t
INCLUDES ///.
Definition: cec.h:43
abctime timeFind
Definition: cecInt.h:64
abctime timeShrink
Definition: cecInt.h:65
Vec_Int_t * vRefinedC
Definition: cecInt.h:141
abctime timeTotal
Definition: cecInt.h:160
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition: utilCex.h:39
int fVerbose
Definition: cecInt.h:62
Abc_Cex_t * pBestState
Definition: cecInt.h:134
abctime timePat
Definition: cecInt.h:158
Vec_Int_t * vClassTemp
Definition: cecInt.h:140
int * Cec_ManDetectIsomorphism(Gia_Man_t *p)
Definition: cecIso.c:297
int Cec_ManSeqResimulateInfo(Gia_Man_t *pAig, Vec_Ptr_t *vSimInfo, Abc_Cex_t *pBestState, int fCheckMiter)
Definition: cecSeq.c:184
ABC_INT64_T abctime
Definition: abc_global.h:278
int nAllProved
Definition: cecInt.h:153
void Cec_ManPatStop(Cec_ManPat_t *p)
Definition: cecMan.c:177
unsigned * pMems
Definition: cecInt.h:120
int nPatLitsMin
Definition: cecInt.h:59
int nCexLits
Definition: cecInt.h:98
Cec_ManSat_t * Cec_ManSatCreate(Gia_Man_t *pAig, Cec_ParSat_t *pPars)
DECLARATIONS ///.
Definition: cecMan.c:45
Vec_Int_t * vStatus
Definition: cecInt.h:81
int Cec_ManSeqResimulate(Cec_ManSim_t *p, Vec_Ptr_t *vInfo)
Definition: cecSeq.c:137
abctime timeVerify
Definition: cecInt.h:66
abctime timeTotalSave
Definition: cecInt.h:70
Cec_ParFra_t * pPars
Definition: cecInt.h:150
Cec_ManPat_t * Cec_ManPatStart()
Definition: cecMan.c:129
Vec_Int_t * vClassOld
Definition: cecInt.h:138