Description [The cube contains the set of flop index literals which, when converted into a clause and applied to the combinational outputs, led to a satisfiable SAT run in frame k (values stored in the SAT solver). If the cube is NULL, it is assumed that the first property output was asserted and failed. The resulting array is a set of flop index literals that asserts the COs. Priority contains 0 for i-th entry if the i-th FF is desirable to remove.]
189{
190
191
192 int fVerbose = 0;
197 int i, Lit, LitAux,
Var, Value, RetValue, nCoreLits, * pCoreLits;
198
199
200
201 Vec_IntClear(
p->vCoObjs );
202 if ( pCube == NULL )
203 {
204 pObj = Gia_ManCo(
p->pGia,
p->pMan->iOutCur);
205 Vec_IntPush(
p->vCoObjs, Gia_ObjId(
p->pGia, pObj) );
206 }
207 else
208 {
209 int i;
210 for ( i = 0; i < pCube->
nLits; i++ )
211 {
212 if ( pCube->
Lits[i] == -1 )
213 continue;
214 pObj = Gia_ManCo(
p->pGia, Gia_ManPoNum(
p->pGia) + Abc_Lit2Var(pCube->
Lits[i]));
215 Vec_IntPush(
p->vCoObjs, Gia_ObjId(
p->pGia, pObj) );
216 }
217 }
218if ( 0 )
219{
220Abc_Print( 1, "Trying to justify cube " );
221if ( pCube )
223else
224 Abc_Print( 1, "<prop=fail>" );
225Abc_Print( 1, " in frame %d.\n", k );
226}
227
228
230
233
234
237
238 if ( pCube == NULL )
239 {
240 vLits =
p->pMan->vLits;
241 Lit = Abc_Var2Lit(
Pdr_ObjSatVar(
p->pMan, k, 2, Aig_ManCo(
p->pMan->pAig,
p->pMan->iOutCur)), 1 );
242 Vec_IntFill( vLits, 1, Lit );
243 }
244 else
246
247 Vec_IntPush( vLits, LitAux );
248 RetValue =
sat_solver_addclause( pSat, Vec_IntArray(vLits), Vec_IntArray(vLits) + Vec_IntSize(vLits) );
250 sat_solver_compress( pSat );
251
252
253 Vec_IntClear(
p->vTemp );
254 Vec_IntPush(
p->vTemp, Abc_LitNot(LitAux) );
255
257 {
259
261 assert( Aig_ObjIsCi(pObj) );
262 Vec_IntPush(
p->vTemp, Abc_Var2Lit(iVar, !Value) );
263 }
264 if ( fVerbose )
265 {
266 printf(
"Clause with %d lits on lev %d\n", pCube ? pCube->
nLits : 0, k );
267 Vec_IntPrint(
p->vTemp );
268 }
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293 RetValue =
sat_solver_solve( pSat, Vec_IntArray(
p->vTemp), Vec_IntLimit(
p->vTemp), 0, 0, 0, 0 );
295
296
297 nCoreLits = sat_solver_final(pSat, &pCoreLits);
298
299
300 Vec_IntClear(
p->vTemp );
301 for ( i = 0; i < nCoreLits; i++ )
302 Vec_IntPush(
p->vTemp, Abc_LitNot(pCoreLits[i]) );
303 Vec_IntSelectSort( Vec_IntArray(
p->vTemp), Vec_IntSize(
p->vTemp) );
304
305 if ( fVerbose )
306 Vec_IntPrint(
p->vTemp );
307
308
309 Vec_IntClear(
p->vPiLits );
310 Vec_IntClear(
p->vFfLits );
311 vVar2Ids = (
Vec_Int_t *)Vec_PtrGetEntry( &
p->pMan->vVar2Ids, k );
313 {
314 if ( Lit != Abc_LitNot(LitAux) )
315 {
316 int Id = Vec_IntEntry( vVar2Ids, Abc_Lit2Var(Lit) );
317 Aig_Obj_t * pObj = Aig_ManObj(
p->pMan->pAig, Id );
318 assert( Aig_ObjIsCi(pObj) );
319 if ( Saig_ObjIsPi(
p->pMan->pAig, pObj) )
320 Vec_IntPush(
p->vPiLits, Abc_Var2Lit(Aig_ObjCioId(pObj), Abc_LitIsCompl(Lit)) );
321 else
322 Vec_IntPush(
p->vFfLits, Abc_Var2Lit(Aig_ObjCioId(pObj) - Saig_ManPiNum(
p->pMan->pAig), Abc_LitIsCompl(Lit)) );
323 }
324 }
325 assert( Vec_IntSize(
p->vTemp) == Vec_IntSize(
p->vPiLits) + Vec_IntSize(
p->vFfLits) + 1 );
326
327
328 if (
p->pMan->pPars->fUseAbs &&
p->pMan->vAbsFlops )
329 {
330 int i, iLit, k = 0;
332 {
333 if ( Vec_IntEntry(
p->pMan->vAbsFlops, Abc_Lit2Var(iLit)) )
334 Vec_IntWriteEntry(
p->vFfLits, k++, iLit );
335 else
336 Vec_IntPush(
p->vPiLits, 2*Saig_ManPiNum(
p->pMan->pAig) + iLit );
337 }
338 Vec_IntShrink(
p->vFfLits, k );
339 }
340
341 if ( fVerbose )
342 Vec_IntPrint(
p->vPiLits );
343 if ( fVerbose )
344 Vec_IntPrint(
p->vFfLits );
345 if ( fVerbose )
346 printf( "\n" );
347
348
350
351
353 return pRes;
354}
struct Aig_Obj_t_ Aig_Obj_t
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
#define sat_solver_addclause
int Pdr_ManFreeVar(Pdr_Man_t *p, int k)
int Pdr_ObjSatVar(Pdr_Man_t *p, int k, int Pol, Aig_Obj_t *pObj)
FUNCTION DECLARATIONS ///.
sat_solver * Pdr_ManFetchSolver(Pdr_Man_t *p, int k)
Pdr_Set_t * Pdr_SetCreate(Vec_Int_t *vLits, Vec_Int_t *vPiLits)
struct Pdr_Set_t_ Pdr_Set_t
void Pdr_SetPrint(FILE *pFile, Pdr_Set_t *p, int nRegs, Vec_Int_t *vFlopCounts)
int Pdr_SetIsInit(Pdr_Set_t *p, int iRemove)
Vec_Int_t * Pdr_ManCubeToLits(Pdr_Man_t *p, int k, Pdr_Set_t *pCube, int fCompl, int fNext)
void Pdr_ManCollectValues(Pdr_Man_t *p, int k, Vec_Int_t *vObjIds, Vec_Int_t *vValues)
void Txs3_ManCollectCone(Txs3_Man_t *p, int fVerbose)
#define Vec_IntForEachEntryTwo(vVec1, vVec2, Entry1, Entry2, i)