ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
dchSimSat.c
Go to the documentation of this file.
1
20
21#include "dchInt.h"
22
24
25
29
33
46{
47 Aig_Obj_t * pFanout, * pRepr;
48 int iFanout = -1, i;
49 assert( !Aig_IsComplement(pObj) );
50 if ( Aig_ObjIsTravIdCurrent(p->pAigTotal, pObj) )
51 return;
52 Aig_ObjSetTravIdCurrent(p->pAigTotal, pObj);
53 // traverse the fanouts
54 Aig_ObjForEachFanout( p->pAigTotal, pObj, pFanout, iFanout, i )
55 Dch_ManCollectTfoCands_rec( p, pFanout );
56 // check if the given node has a representative
57 pRepr = Aig_ObjRepr( p->pAigTotal, pObj );
58 if ( pRepr == NULL )
59 return;
60 // pRepr is the constant 1 node
61 if ( pRepr == Aig_ManConst1(p->pAigTotal) )
62 {
63 Vec_PtrPush( p->vSimRoots, pObj );
64 return;
65 }
66 // pRepr is the representative of an equivalence class
67 if ( pRepr->fMarkA )
68 return;
69 pRepr->fMarkA = 1;
70 Vec_PtrPush( p->vSimClasses, pRepr );
71}
72
85{
86 Aig_Obj_t * pObj;
87 int i;
88 Vec_PtrClear( p->vSimRoots );
89 Vec_PtrClear( p->vSimClasses );
90 Aig_ManIncrementTravId( p->pAigTotal );
91 Aig_ObjSetTravIdCurrent( p->pAigTotal, Aig_ManConst1(p->pAigTotal) );
94 Vec_PtrSort( p->vSimRoots, (int (*)(const void *, const void *))Aig_ObjCompareIdIncrease );
95 Vec_PtrSort( p->vSimClasses, (int (*)(const void *, const void *))Aig_ObjCompareIdIncrease );
96 Vec_PtrForEachEntry( Aig_Obj_t *, p->vSimClasses, pObj, i )
97 pObj->fMarkA = 0;
98}
99
112{
113 if ( Aig_ObjIsTravIdCurrent(p->pAigTotal, pObj) )
114 return;
115 Aig_ObjSetTravIdCurrent(p->pAigTotal, pObj);
116 if ( Aig_ObjIsCi(pObj) )
117 {
118 Aig_Obj_t * pObjFraig;
119 int nVarNum;
120 pObjFraig = Dch_ObjFraig( pObj );
121 assert( !Aig_IsComplement(pObjFraig) );
122 nVarNum = Dch_ObjSatNum( p, pObjFraig );
123 // get the value from the SAT solver
124 // (account for the fact that some vars may be minimized away)
125 pObj->fMarkB = !nVarNum? 0 : sat_solver_var_value( p->pSat, nVarNum );
126// pObj->fMarkB = !nVarNum? Aig_ManRandom(0) & 1 : sat_solver_var_value( p->pSat, nVarNum );
127 return;
128 }
129 Dch_ManResimulateSolved_rec( p, Aig_ObjFanin0(pObj) );
130 Dch_ManResimulateSolved_rec( p, Aig_ObjFanin1(pObj) );
131 pObj->fMarkB = ( Aig_ObjFanin0(pObj)->fMarkB ^ Aig_ObjFaninC0(pObj) )
132 & ( Aig_ObjFanin1(pObj)->fMarkB ^ Aig_ObjFaninC1(pObj) );
133 // count the cone size
134 if ( Dch_ObjSatNum( p, Aig_Regular(Dch_ObjFraig(pObj)) ) > 0 )
135 p->nConeThis++;
136}
137
150{
151 if ( Aig_ObjIsTravIdCurrent(p->pAigTotal, pObj) )
152 return;
153 Aig_ObjSetTravIdCurrent(p->pAigTotal, pObj);
154 if ( Aig_ObjIsCi(pObj) )
155 {
156 // set random value
157 pObj->fMarkB = Aig_ManRandom(0) & 1;
158 return;
159 }
160 Dch_ManResimulateOther_rec( p, Aig_ObjFanin0(pObj) );
161 Dch_ManResimulateOther_rec( p, Aig_ObjFanin1(pObj) );
162 pObj->fMarkB = ( Aig_ObjFanin0(pObj)->fMarkB ^ Aig_ObjFaninC0(pObj) )
163 & ( Aig_ObjFanin1(pObj)->fMarkB ^ Aig_ObjFaninC1(pObj) );
164}
165
178{
179 Aig_Obj_t * pRoot, ** ppClass;
180 int i, k, nSize, RetValue1, RetValue2;
181 abctime clk = Abc_Clock();
182 // get the equivalence classes
183 Dch_ManCollectTfoCands( p, pObj, pRepr );
184 // resimulate the cone of influence of the solved nodes
185 p->nConeThis = 0;
186 Aig_ManIncrementTravId( p->pAigTotal );
187 Aig_ObjSetTravIdCurrent( p->pAigTotal, Aig_ManConst1(p->pAigTotal) );
190 p->nConeMax = Abc_MaxInt( p->nConeMax, p->nConeThis );
191 // resimulate the cone of influence of the other nodes
192 Vec_PtrForEachEntry( Aig_Obj_t *, p->vSimRoots, pRoot, i )
194 // refine these nodes
195 RetValue1 = Dch_ClassesRefineConst1Group( p->ppClasses, p->vSimRoots, 0 );
196 // resimulate the cone of influence of the cand classes
197 RetValue2 = 0;
198 Vec_PtrForEachEntry( Aig_Obj_t *, p->vSimClasses, pRoot, i )
199 {
200 ppClass = Dch_ClassesReadClass( p->ppClasses, pRoot, &nSize );
201 for ( k = 0; k < nSize; k++ )
202 Dch_ManResimulateOther_rec( p, ppClass[k] );
203 // refine this class
204 RetValue2 += Dch_ClassesRefineOneClass( p->ppClasses, pRoot, 0 );
205 }
206 // make sure refinement happened
207 if ( Aig_ObjIsConst1(pRepr) )
208 assert( RetValue1 );
209 else
210 assert( RetValue2 );
211p->timeSimSat += Abc_Clock() - clk;
212}
213
226{
227 Aig_Obj_t * pRoot;
228 int i, RetValue;
229 abctime clk = Abc_Clock();
230 // get the equivalence class
231 if ( Dch_ObjIsConst1Cand(p->pAigTotal, pObj) )
232 Dch_ClassesCollectConst1Group( p->ppClasses, pObj, 500, p->vSimRoots );
233 else
234 Dch_ClassesCollectOneClass( p->ppClasses, pRepr, p->vSimRoots );
235 // resimulate the cone of influence of the solved nodes
236 p->nConeThis = 0;
237 Aig_ManIncrementTravId( p->pAigTotal );
238 Aig_ObjSetTravIdCurrent( p->pAigTotal, Aig_ManConst1(p->pAigTotal) );
241 p->nConeMax = Abc_MaxInt( p->nConeMax, p->nConeThis );
242 // resimulate the cone of influence of the other nodes
243 Vec_PtrForEachEntry( Aig_Obj_t *, p->vSimRoots, pRoot, i )
245 // refine this class
246 if ( Dch_ObjIsConst1Cand(p->pAigTotal, pObj) )
247 RetValue = Dch_ClassesRefineConst1Group( p->ppClasses, p->vSimRoots, 0 );
248 else
249 RetValue = Dch_ClassesRefineOneClass( p->ppClasses, pRepr, 0 );
250 assert( RetValue );
251p->timeSimSat += Abc_Clock() - clk;
252}
253
257
258
260
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
#define Aig_ObjForEachFanout(p, pObj, pFanout, iFan, i)
Definition aig.h:427
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition aigUtil.c:44
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
int Aig_ObjCompareIdIncrease(Aig_Obj_t **pp1, Aig_Obj_t **pp2)
Definition aigUtil.c:496
unsigned Aig_ManRandom(int fReset)
Definition aigUtil.c:1170
Aig_Obj_t ** Dch_ClassesReadClass(Dch_Cla_t *p, Aig_Obj_t *pRepr, int *pnSize)
Definition dchClass.c:222
void Dch_ClassesCollectConst1Group(Dch_Cla_t *p, Aig_Obj_t *pObj, int nNodes, Vec_Ptr_t *vRoots)
Definition dchClass.c:546
int Dch_ClassesRefineConst1Group(Dch_Cla_t *p, Vec_Ptr_t *vRoots, int fRecursive)
Definition dchClass.c:570
void Dch_ClassesCollectOneClass(Dch_Cla_t *p, Aig_Obj_t *pRepr, Vec_Ptr_t *vRoots)
Definition dchClass.c:525
int Dch_ClassesRefineOneClass(Dch_Cla_t *p, Aig_Obj_t *pReprOld, int fRecursive)
Definition dchClass.c:443
struct Dch_Man_t_ Dch_Man_t
Definition dchInt.h:50
void Dch_ManResimulateSolved_rec(Dch_Man_t *p, Aig_Obj_t *pObj)
Definition dchSimSat.c:111
void Dch_ManResimulateCex(Dch_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pRepr)
Definition dchSimSat.c:177
void Dch_ManResimulateCex2(Dch_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pRepr)
Definition dchSimSat.c:225
ABC_NAMESPACE_IMPL_START void Dch_ManCollectTfoCands_rec(Dch_Man_t *p, Aig_Obj_t *pObj)
DECLARATIONS ///.
Definition dchSimSat.c:45
void Dch_ManCollectTfoCands(Dch_Man_t *p, Aig_Obj_t *pObj1, Aig_Obj_t *pObj2)
Definition dchSimSat.c:84
void Dch_ManResimulateOther_rec(Dch_Man_t *p, Aig_Obj_t *pObj)
Definition dchSimSat.c:149
Cube * p
Definition exorList.c:222
unsigned int fMarkB
Definition aig.h:80
unsigned int fMarkA
Definition aig.h:79
#define assert(ex)
Definition util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55