abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
absRef.c File Reference
#include "sat/bsat/satSolver2.h"
#include "abs.h"
#include "absRef.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START void Ga2_ManCnfAddStatic (sat_solver2 *pSat, Vec_Int_t *vCnf0, Vec_Int_t *vCnf1, int *pLits, int iLitOut, int ProofId)
 DECLARATIONS ///. More...
 
Vec_Int_tGa2_ManCnfCompute (unsigned uTruth, int nVars, Vec_Int_t *vCover)
 
Rnm_Man_tRnm_ManStart (Gia_Man_t *pGia)
 FUNCTION DEFINITIONS ///. More...
 
void Rnm_ManStop (Rnm_Man_t *p, int fProfile)
 
double Rnm_ManMemoryUsage (Rnm_Man_t *p)
 
void Rnm_ManCollect_rec (Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vObjs, int nAddOn)
 
void Rnm_ManCollect (Rnm_Man_t *p)
 
void Rnm_ManCleanValues (Rnm_Man_t *p)
 
int Rnm_ManSensitize (Rnm_Man_t *p)
 
void Rnm_ManJustifyPropFanout_rec (Rnm_Man_t *p, Gia_Obj_t *pObj, int f, Vec_Int_t *vSelect)
 
void Rnm_ManJustify_rec (Rnm_Man_t *p, Gia_Obj_t *pObj, int f, Vec_Int_t *vSelect)
 
void Rnm_ManVerifyUsingTerSim (Gia_Man_t *p, Abc_Cex_t *pCex, Vec_Int_t *vMap, Vec_Int_t *vObjs, Vec_Int_t *vRes)
 
Vec_Int_tRnm_ManRefine (Rnm_Man_t *p, Abc_Cex_t *pCex, Vec_Int_t *vMap, int fPropFanout, int fNewRefinement, int fVerbose)
 

Function Documentation

ABC_NAMESPACE_IMPL_START void Ga2_ManCnfAddStatic ( sat_solver2 pSat,
Vec_Int_t vCnf0,
Vec_Int_t vCnf1,
int *  pLits,
int  iLitOut,
int  ProofId 
)

DECLARATIONS ///.

CFile****************************************************************

FileName [absRef.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Abstraction package.]

Synopsis [Refinement manager.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
absRef.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

]

Vec_Int_t* Ga2_ManCnfCompute ( unsigned  uTruth,
int  nVars,
Vec_Int_t vCover 
)

Function*************************************************************

Synopsis [Returns CNF of the function.]

Description []

SideEffects []

SeeAlso []

Definition at line 630 of file absGla.c.

631 {
632  int RetValue;
633  assert( nVars <= 5 );
634  // transform truth table into the SOP
635  RetValue = Kit_TruthIsop( &uTruth, nVars, vCover, 0 );
636  assert( RetValue == 0 );
637  // check the case of constant cover
638  return Vec_IntDup( vCover );
639 }
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
int Kit_TruthIsop(unsigned *puTruth, int nVars, Vec_Int_t *vMemory, int fTryBoth)
FUNCTION DEFINITIONS ///.
Definition: kitIsop.c:55
#define assert(ex)
Definition: util_old.h:213
void Rnm_ManCleanValues ( Rnm_Man_t p)

Definition at line 375 of file absRef.c.

376 {
377  Gia_Obj_t * pObj;
378  int i;
379  Gia_ManForEachObjVec( p->vMap, p->pGia, pObj, i )
380  pObj->Value = 0;
381  Gia_ManForEachObjVec( p->vObjs, p->pGia, pObj, i )
382  pObj->Value = 0;
383 }
Gia_Man_t * pGia
Definition: absRef.h:59
Definition: gia.h:75
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
Vec_Int_t * vMap
Definition: absRef.h:61
void Rnm_ManCollect ( Rnm_Man_t p)

Definition at line 351 of file absRef.c.

352 {
353  Gia_Obj_t * pObj = NULL;
354  int i;
355  // mark const/PIs/PPIs
358  Gia_ManConst0(p->pGia)->Value = 0;
359  Gia_ManForEachObjVec( p->vMap, p->pGia, pObj, i )
360  {
361  assert( Gia_ObjIsCi(pObj) || Gia_ObjIsAnd(pObj) );
362  Gia_ObjSetTravIdCurrent( p->pGia, pObj );
363  pObj->Value = 1 + i;
364  }
365  // collect objects
366  Vec_IntClear( p->vObjs );
367  Rnm_ManCollect_rec( p->pGia, Gia_ManPo(p->pGia, 0), p->vObjs, 1 + Vec_IntSize(p->vMap) );
368  Gia_ManForEachObjVec( p->vObjs, p->pGia, pObj, i )
369  if ( Gia_ObjIsRo(p->pGia, pObj) )
370  Rnm_ManCollect_rec( p->pGia, Gia_ObjRoToRi(p->pGia, pObj), p->vObjs, 1 + Vec_IntSize(p->vMap) );
371  // the last object should be a CO
372  assert( Gia_ObjIsCo(pObj) );
373  assert( (int)pObj->Value == Vec_IntSize(p->vMap) + Vec_IntSize(p->vObjs) );
374 }
void Rnm_ManCollect_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vObjs, int nAddOn)
Definition: absRef.c:334
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
Gia_Man_t * pGia
Definition: absRef.h:59
Definition: gia.h:75
Vec_Int_t * vObjs
Definition: absRef.h:66
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:443
static Gia_Obj_t * Gia_ObjRoToRi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:446
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
if(last==0)
Definition: sparse_int.h:34
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
Vec_Int_t * vMap
Definition: absRef.h:61
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
void Rnm_ManCollect_rec ( Gia_Man_t p,
Gia_Obj_t pObj,
Vec_Int_t vObjs,
int  nAddOn 
)

Function*************************************************************

Synopsis [Collect internal objects to be used in value propagation.]

Description [Resulting array vObjs contains RO, AND, PO/RI in a topo order.]

SideEffects []

SeeAlso []

Definition at line 334 of file absRef.c.

335 {
336  if ( Gia_ObjIsTravIdCurrent(p, pObj) )
337  return;
338  Gia_ObjSetTravIdCurrent(p, pObj);
339  if ( Gia_ObjIsCo(pObj) )
340  Rnm_ManCollect_rec( p, Gia_ObjFanin0(pObj), vObjs, nAddOn );
341  else if ( Gia_ObjIsAnd(pObj) )
342  {
343  Rnm_ManCollect_rec( p, Gia_ObjFanin0(pObj), vObjs, nAddOn );
344  Rnm_ManCollect_rec( p, Gia_ObjFanin1(pObj), vObjs, nAddOn );
345  }
346  else if ( !Gia_ObjIsRo(p, pObj) )
347  assert( 0 );
348  pObj->Value = Vec_IntSize(vObjs) + nAddOn;
349  Vec_IntPush( vObjs, Gia_ObjId(p, pObj) );
350 }
static int Gia_ObjIsTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:533
void Rnm_ManCollect_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vObjs, int nAddOn)
Definition: absRef.c:334
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:443
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
void Rnm_ManJustify_rec ( Rnm_Man_t p,
Gia_Obj_t pObj,
int  f,
Vec_Int_t vSelect 
)

Definition at line 524 of file absRef.c.

525 {
526  Rnm_Obj_t * pRnm = Rnm_ManObj( p, pObj, f );
527  int i;//, Id = Gia_ObjId(p->pGia, pObj);
528  if ( pRnm->fVisit )
529  return;
530  if ( p->fPropFanout )
531  Rnm_ManJustifyPropFanout_rec( p, pObj, f, vSelect );
532  else
533  {
534  pRnm->fVisit = 1;
535  if ( Rnm_ManObj( p, pObj, 0 )->fVisitJ == 0 )
536  {
537  Rnm_ManObj( p, pObj, 0 )->fVisitJ = 1;
538  p->nVisited++;
539  }
540  }
541  if ( pRnm->fPPi )
542  {
543  assert( (int)pRnm->Prio > 0 );
544  if ( p->fPropFanout )
545  {
546  for ( i = p->pCex->iFrame; i >= 0; i-- )
547  if ( !Rnm_ManObj(p, pObj, i)->fVisit )
548  Rnm_ManJustifyPropFanout_rec( p, pObj, i, vSelect );
549  }
550  else
551  {
552  Vec_IntPush( vSelect, Gia_ObjId(p->pGia, pObj) );
553 // for ( i = p->pCex->iFrame; i >= 0; i-- )
554 // Rnm_ManObj(p, pObj, i)->fVisit = 1;
555  }
556  return;
557  }
558  if ( Gia_ObjIsPi(p->pGia, pObj) || Gia_ObjIsConst0(pObj) )
559  return;
560  if ( Gia_ObjIsRo(p->pGia, pObj) )
561  {
562  if ( f > 0 )
563  Rnm_ManJustify_rec( p, Gia_ObjFanin0(Gia_ObjRoToRi(p->pGia, pObj)), f-1, vSelect );
564  return;
565  }
566  if ( Gia_ObjIsAnd(pObj) )
567  {
568  Rnm_Obj_t * pRnm0 = Rnm_ManObj( p, Gia_ObjFanin0(pObj), f );
569  Rnm_Obj_t * pRnm1 = Rnm_ManObj( p, Gia_ObjFanin1(pObj), f );
570  if ( pRnm->Value == 1 )
571  {
572  if ( pRnm0->Prio > 0 )
573  Rnm_ManJustify_rec( p, Gia_ObjFanin0(pObj), f, vSelect );
574  if ( pRnm1->Prio > 0 )
575  Rnm_ManJustify_rec( p, Gia_ObjFanin1(pObj), f, vSelect );
576  }
577  else // select one value
578  {
579  if ( (pRnm0->Value ^ Gia_ObjFaninC0(pObj)) == 0 && (pRnm1->Value ^ Gia_ObjFaninC1(pObj)) == 0 )
580  {
581  if ( pRnm0->Prio <= pRnm1->Prio ) // choice
582  {
583  if ( pRnm0->Prio > 0 )
584  Rnm_ManJustify_rec( p, Gia_ObjFanin0(pObj), f, vSelect );
585  }
586  else
587  {
588  if ( pRnm1->Prio > 0 )
589  Rnm_ManJustify_rec( p, Gia_ObjFanin1(pObj), f, vSelect );
590  }
591  }
592  else if ( (pRnm0->Value ^ Gia_ObjFaninC0(pObj)) == 0 )
593  {
594  if ( pRnm0->Prio > 0 )
595  Rnm_ManJustify_rec( p, Gia_ObjFanin0(pObj), f, vSelect );
596  }
597  else if ( (pRnm1->Value ^ Gia_ObjFaninC1(pObj)) == 0 )
598  {
599  if ( pRnm1->Prio > 0 )
600  Rnm_ManJustify_rec( p, Gia_ObjFanin1(pObj), f, vSelect );
601  }
602  else assert( 0 );
603  }
604  }
605  else assert( 0 );
606 }
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
void Rnm_ManJustifyPropFanout_rec(Rnm_Man_t *p, Gia_Obj_t *pObj, int f, Vec_Int_t *vSelect)
Definition: absRef.c:470
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
Gia_Man_t * pGia
Definition: absRef.h:59
int fPropFanout
Definition: absRef.h:62
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
int nVisited
Definition: absRef.h:84
void Rnm_ManJustify_rec(Rnm_Man_t *p, Gia_Obj_t *pObj, int f, Vec_Int_t *vSelect)
Definition: absRef.c:524
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:443
static Gia_Obj_t * Gia_ObjRoToRi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:446
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
Abc_Cex_t * pCex
Definition: absRef.h:60
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static Rnm_Obj_t * Rnm_ManObj(Rnm_Man_t *p, Gia_Obj_t *pObj, int f)
Definition: absRef.h:93
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
typedefABC_NAMESPACE_HEADER_START struct Rnm_Obj_t_ Rnm_Obj_t
INCLUDES ///.
Definition: absRef.h:45
static int Gia_ObjIsPi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:441
void Rnm_ManJustifyPropFanout_rec ( Rnm_Man_t p,
Gia_Obj_t pObj,
int  f,
Vec_Int_t vSelect 
)

Function*************************************************************

Synopsis [Drive implications of the given node towards primary outputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 470 of file absRef.c.

471 {
472  Rnm_Obj_t * pRnm0, * pRnm1, * pRnm = Rnm_ManObj( p, pObj, f );
473  Gia_Obj_t * pFanout = NULL;
474  int i, k;//, Id = Gia_ObjId(p->pGia, pObj);
475  assert( pRnm->fVisit == 0 );
476  pRnm->fVisit = 1;
477  if ( Rnm_ManObj( p, pObj, 0 )->fVisitJ == 0 )
478  {
479  Rnm_ManObj( p, pObj, 0 )->fVisitJ = 1;
480  p->nVisited++;
481  }
482  if ( pRnm->fPPi )
483  {
484  assert( (int)pRnm->Prio > 0 );
485  for ( i = p->pCex->iFrame; i >= 0; i-- )
486  if ( !Rnm_ManObj(p, pObj, i)->fVisit )
487  Rnm_ManJustifyPropFanout_rec( p, pObj, i, vSelect );
488  Vec_IntPush( vSelect, Gia_ObjId(p->pGia, pObj) );
489  return;
490  }
491  if ( (Gia_ObjIsCo(pObj) && f == p->pCex->iFrame) || Gia_ObjIsPo(p->pGia, pObj) )
492  return;
493  if ( Gia_ObjIsRi(p->pGia, pObj) )
494  {
495  pFanout = Gia_ObjRiToRo(p->pGia, pObj);
496  if ( !Rnm_ManObj(p, pFanout, f+1)->fVisit )
497  Rnm_ManJustifyPropFanout_rec( p, pFanout, f+1, vSelect );
498  return;
499  }
500  assert( Gia_ObjIsRo(p->pGia, pObj) || Gia_ObjIsAnd(pObj) );
501  Gia_ObjForEachFanoutStatic( p->pGia, pObj, pFanout, k )
502  {
503  Rnm_Obj_t * pRnmF;
504  if ( pFanout->Value == 0 )
505  continue;
506  pRnmF = Rnm_ManObj(p, pFanout, f);
507  if ( pRnmF->fPPi || pRnmF->fVisit )
508  continue;
509  if ( Gia_ObjIsCo(pFanout) )
510  {
511  Rnm_ManJustifyPropFanout_rec( p, pFanout, f, vSelect );
512  continue;
513  }
514  assert( Gia_ObjIsAnd(pFanout) );
515  pRnm0 = Rnm_ManObj( p, Gia_ObjFanin0(pFanout), f );
516  pRnm1 = Rnm_ManObj( p, Gia_ObjFanin1(pFanout), f );
517  if ( ((pRnm0->Value ^ Gia_ObjFaninC0(pFanout)) == 0 && pRnm0->fVisit) ||
518  ((pRnm1->Value ^ Gia_ObjFaninC1(pFanout)) == 0 && pRnm1->fVisit) ||
519  ( ((pRnm0->Value ^ Gia_ObjFaninC0(pFanout)) == 1 && pRnm0->fVisit) &&
520  ((pRnm1->Value ^ Gia_ObjFaninC1(pFanout)) == 1 && pRnm1->fVisit) ) )
521  Rnm_ManJustifyPropFanout_rec( p, pFanout, f, vSelect );
522  }
523 }
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
void Rnm_ManJustifyPropFanout_rec(Rnm_Man_t *p, Gia_Obj_t *pObj, int f, Vec_Int_t *vSelect)
Definition: absRef.c:470
Gia_Man_t * pGia
Definition: absRef.h:59
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
int nVisited
Definition: absRef.h:84
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:443
static int Gia_ObjIsRi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:444
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
#define Gia_ObjForEachFanoutStatic(p, pObj, pFanout, i)
Definition: gia.h:946
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
Abc_Cex_t * pCex
Definition: absRef.h:60
static Gia_Obj_t * Gia_ObjRiToRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:447
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static int Gia_ObjIsPo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:442
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
static Rnm_Obj_t * Rnm_ManObj(Rnm_Man_t *p, Gia_Obj_t *pObj, int f)
Definition: absRef.h:93
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
typedefABC_NAMESPACE_HEADER_START struct Rnm_Obj_t_ Rnm_Obj_t
INCLUDES ///.
Definition: absRef.h:45
double Rnm_ManMemoryUsage ( Rnm_Man_t p)

Definition at line 317 of file absRef.c.

318 {
319  return (double)(sizeof(Rnm_Man_t) + sizeof(Rnm_Obj_t) * p->nObjsAlloc + sizeof(int) * Vec_IntCap(p->vObjs));
320 }
Vec_Int_t * vObjs
Definition: absRef.h:66
struct Rnm_Man_t_ Rnm_Man_t
Definition: absRef.h:55
static int Vec_IntCap(Vec_Int_t *p)
Definition: vecInt.h:368
int nObjsAlloc
Definition: absRef.h:80
typedefABC_NAMESPACE_HEADER_START struct Rnm_Obj_t_ Rnm_Obj_t
INCLUDES ///.
Definition: absRef.h:45
Vec_Int_t* Rnm_ManRefine ( Rnm_Man_t p,
Abc_Cex_t pCex,
Vec_Int_t vMap,
int  fPropFanout,
int  fNewRefinement,
int  fVerbose 
)

Function*************************************************************

Synopsis [Computes the refinement for a given counter-example.]

Description []

SideEffects []

SeeAlso []

Definition at line 673 of file absRef.c.

674 {
675  int fVerify = 1;
676  Vec_Int_t * vGoodPPis, * vNewPPis;
677  abctime clk, clk2 = Abc_Clock();
678  int RetValue;
679  p->nCalls++;
680 // Gia_ManCleanValue( p->pGia );
681  // initialize
682  p->pCex = pCex;
683  p->vMap = vMap;
684  p->fPropFanout = fPropFanout;
685  p->fVerbose = fVerbose;
686  // collects used objects
687  Rnm_ManCollect( p );
688  // initialize datastructure
689  p->nObjsFrame = 1 + Vec_IntSize(vMap) + Vec_IntSize(p->vObjs);
690  p->nObjs = p->nObjsFrame * (pCex->iFrame + 1);
691  if ( p->nObjs > p->nObjsAlloc )
692  p->pObjs = ABC_REALLOC( Rnm_Obj_t, p->pObjs, (p->nObjsAlloc = p->nObjs + 10000) );
693  memset( p->pObjs, 0, sizeof(Rnm_Obj_t) * p->nObjs );
694  // propagate priorities
695  clk = Abc_Clock();
696  vGoodPPis = Vec_IntAlloc( 100 );
697  if ( Rnm_ManSensitize( p ) ) // the CEX is not a true CEX
698  {
699  p->timeFwd += Abc_Clock() - clk;
700  // select refinement
701  clk = Abc_Clock();
702  p->nVisited = 0;
703  Rnm_ManJustify_rec( p, Gia_ObjFanin0(Gia_ManPo(p->pGia, 0)), pCex->iFrame, vGoodPPis );
704  RetValue = Vec_IntUniqify( vGoodPPis );
705 // assert( RetValue == 0 );
706  p->timeBwd += Abc_Clock() - clk;
707  }
708 
709  // verify (empty) refinement
710  // (only works when post-processing is not applied)
711  if ( fVerify )
712  {
713  clk = Abc_Clock();
714  Rnm_ManVerifyUsingTerSim( p->pGia, p->pCex, p->vMap, p->vObjs, vGoodPPis );
715  p->timeVer += Abc_Clock() - clk;
716  }
717 
718  // at this point array vGoodPPis contains the set of important PPIs
719  if ( Vec_IntSize(vGoodPPis) > 0 ) // spurious CEX resulting in a non-trivial refinement
720  {
721  // filter selected set
722  if ( !fNewRefinement ) // default
723  vNewPPis = Rnm_ManFilterSelected( p, vGoodPPis );
724  else // this is enabled when &gla is called with -r (&gla -r)
725  vNewPPis = Rnm_ManFilterSelectedNew( p, vGoodPPis );
726 
727  // replace the PPI array if necessary
728  if ( Vec_IntSize(vNewPPis) > 0 ) // something to select, replace current refinement
729  Vec_IntFree( vGoodPPis ), vGoodPPis = vNewPPis;
730  else // if there is nothing to select, do not change the current refinement array
731  Vec_IntFree( vNewPPis );
732  }
733 
734  // clean values
735  // we cannot do this before, because we need to remember what objects
736  // belong to the abstraction when we do Rnm_ManFilterSelected()
737  Rnm_ManCleanValues( p );
738 
739 // Vec_IntReverseOrder( vGoodPPis );
740  p->timeTotal += Abc_Clock() - clk2;
741  p->nRefines += Vec_IntSize(vGoodPPis);
742  return vGoodPPis;
743 }
char * memset()
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
abctime timeFwd
Definition: absRef.h:86
void Rnm_ManCleanValues(Rnm_Man_t *p)
Definition: absRef.c:375
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
Vec_Int_t * Rnm_ManFilterSelectedNew(Rnm_Man_t *p, Vec_Int_t *vOldPPis)
Definition: absRefSelect.c:207
Gia_Man_t * pGia
Definition: absRef.h:59
int fPropFanout
Definition: absRef.h:62
static abctime Abc_Clock()
Definition: abc_global.h:279
abctime timeTotal
Definition: absRef.h:89
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
int nVisited
Definition: absRef.h:84
void Rnm_ManCollect(Rnm_Man_t *p)
Definition: absRef.c:351
Vec_Int_t * vObjs
Definition: absRef.h:66
void Rnm_ManJustify_rec(Rnm_Man_t *p, Gia_Obj_t *pObj, int f, Vec_Int_t *vSelect)
Definition: absRef.c:524
int nObjs
Definition: absRef.h:79
static int Vec_IntUniqify(Vec_Int_t *p)
Definition: vecInt.h:1314
abctime timeBwd
Definition: absRef.h:87
int nObjsFrame
Definition: absRef.h:81
Rnm_Obj_t * pObjs
Definition: absRef.h:78
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
abctime timeVer
Definition: absRef.h:88
int Rnm_ManSensitize(Rnm_Man_t *p)
Definition: absRef.c:396
Abc_Cex_t * pCex
Definition: absRef.h:60
Vec_Int_t * Rnm_ManFilterSelected(Rnm_Man_t *p, Vec_Int_t *vOldPPis)
Definition: absRefSelect.c:126
int nObjsAlloc
Definition: absRef.h:80
int nCalls
Definition: absRef.h:82
void Rnm_ManVerifyUsingTerSim(Gia_Man_t *p, Abc_Cex_t *pCex, Vec_Int_t *vMap, Vec_Int_t *vObjs, Vec_Int_t *vRes)
Definition: absRef.c:619
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
typedefABC_NAMESPACE_HEADER_START struct Rnm_Obj_t_ Rnm_Obj_t
INCLUDES ///.
Definition: absRef.h:45
Vec_Int_t * vMap
Definition: absRef.h:61
ABC_INT64_T abctime
Definition: abc_global.h:278
int fVerbose
Definition: absRef.h:63
int nRefines
Definition: absRef.h:83
int Rnm_ManSensitize ( Rnm_Man_t p)

Function*************************************************************

Synopsis [Performs sensitization analysis.]

Description []

SideEffects []

SeeAlso []

Definition at line 396 of file absRef.c.

397 {
398  Rnm_Obj_t * pRnm, * pRnm0, * pRnm1;
399  Gia_Obj_t * pObj;
400  int f, i, iBit = p->pCex->nRegs;
401  // const0 is initialized automatically in all timeframes
402  for ( f = 0; f <= p->pCex->iFrame; f++, iBit += p->pCex->nPis )
403  {
404  Gia_ManForEachObjVec( p->vMap, p->pGia, pObj, i )
405  {
406  assert( Gia_ObjIsCi(pObj) || Gia_ObjIsAnd(pObj) );
407  pRnm = Rnm_ManObj( p, pObj, f );
408  pRnm->Value = Abc_InfoHasBit( p->pCex->pData, iBit + i );
409  if ( !Gia_ObjIsPi(p->pGia, pObj) ) // this is PPI
410  {
411  assert( pObj->Value > 0 );
412  pRnm->Prio = pObj->Value;
413  pRnm->fPPi = 1;
414  }
415  }
416  Gia_ManForEachObjVec( p->vObjs, p->pGia, pObj, i )
417  {
418  assert( Gia_ObjIsRo(p->pGia, pObj) || Gia_ObjIsAnd(pObj) || Gia_ObjIsCo(pObj) );
419  pRnm = Rnm_ManObj( p, pObj, f );
420  assert( !pRnm->fPPi );
421  if ( Gia_ObjIsRo(p->pGia, pObj) )
422  {
423  if ( f == 0 )
424  continue;
425  pRnm0 = Rnm_ManObj( p, Gia_ObjRoToRi(p->pGia, pObj), f-1 );
426  pRnm->Value = pRnm0->Value;
427  pRnm->Prio = pRnm0->Prio;
428  continue;
429  }
430  if ( Gia_ObjIsCo(pObj) )
431  {
432  pRnm0 = Rnm_ManObj( p, Gia_ObjFanin0(pObj), f );
433  pRnm->Value = (pRnm0->Value ^ Gia_ObjFaninC0(pObj));
434  pRnm->Prio = pRnm0->Prio;
435  continue;
436  }
437  assert( Gia_ObjIsAnd(pObj) );
438  pRnm0 = Rnm_ManObj( p, Gia_ObjFanin0(pObj), f );
439  pRnm1 = Rnm_ManObj( p, Gia_ObjFanin1(pObj), f );
440  pRnm->Value = (pRnm0->Value ^ Gia_ObjFaninC0(pObj)) & (pRnm1->Value ^ Gia_ObjFaninC1(pObj));
441  if ( pRnm->Value == 1 )
442  pRnm->Prio = Abc_MaxInt( pRnm0->Prio, pRnm1->Prio );
443  else if ( (pRnm0->Value ^ Gia_ObjFaninC0(pObj)) == 0 && (pRnm1->Value ^ Gia_ObjFaninC1(pObj)) == 0 )
444  pRnm->Prio = Abc_MinInt( pRnm0->Prio, pRnm1->Prio ); // choice
445  else if ( (pRnm0->Value ^ Gia_ObjFaninC0(pObj)) == 0 )
446  pRnm->Prio = pRnm0->Prio;
447  else
448  pRnm->Prio = pRnm1->Prio;
449  }
450  }
451  assert( iBit == p->pCex->nBits );
452  pRnm = Rnm_ManObj( p, Gia_ManPo(p->pGia, 0), p->pCex->iFrame );
453  if ( pRnm->Value != 1 )
454  printf( "Output value is incorrect.\n" );
455  return pRnm->Prio;
456 }
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
Gia_Man_t * pGia
Definition: absRef.h:59
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
Definition: gia.h:75
static int Abc_MinInt(int a, int b)
Definition: abc_global.h:239
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
Vec_Int_t * vObjs
Definition: absRef.h:66
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:443
static Gia_Obj_t * Gia_ObjRoToRi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:446
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
Abc_Cex_t * pCex
Definition: absRef.h:60
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
static Rnm_Obj_t * Rnm_ManObj(Rnm_Man_t *p, Gia_Obj_t *pObj, int f)
Definition: absRef.h:93
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
typedefABC_NAMESPACE_HEADER_START struct Rnm_Obj_t_ Rnm_Obj_t
INCLUDES ///.
Definition: absRef.h:45
Vec_Int_t * vMap
Definition: absRef.h:61
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
static int Gia_ObjIsPi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:441
Rnm_Man_t* Rnm_ManStart ( Gia_Man_t pGia)

FUNCTION DEFINITIONS ///.

FUNCTION DECLARATIONS ///.

Function*************************************************************

Synopsis [Creates a new manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 264 of file absRef.c.

265 {
266  Rnm_Man_t * p;
267  assert( Gia_ManPoNum(pGia) == 1 );
268  p = ABC_CALLOC( Rnm_Man_t, 1 );
269  p->pGia = pGia;
270  p->vObjs = Vec_IntAlloc( 100 );
271  p->vCounts = Vec_StrStart( Gia_ManObjNum(pGia) );
272  p->vFanins = Vec_IntAlloc( 1000 );
273 // p->vSatVars = Vec_IntAlloc( 0 );
274 // p->vSat2Ids = Vec_IntAlloc( 1000 );
275 // p->vIsopMem = Vec_IntAlloc( 0 );
276  p->nObjsAlloc = 10000;
277  p->pObjs = ABC_ALLOC( Rnm_Obj_t, p->nObjsAlloc );
278  if ( p->pGia->vFanout == NULL )
280  Gia_ManCleanValue(pGia);
281  Gia_ManCleanMark0(pGia);
282  Gia_ManCleanMark1(pGia);
283  return p;
284 }
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Vec_Int_t * vFanins
Definition: absRef.h:69
void Gia_ManCleanValue(Gia_Man_t *p)
Definition: giaUtil.c:310
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition: giaUtil.c:215
Gia_Man_t * pGia
Definition: absRef.h:59
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
void Gia_ManCleanMark1(Gia_Man_t *p)
Definition: giaUtil.c:272
Vec_Int_t * vFanout
Definition: gia.h:130
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
Vec_Int_t * vObjs
Definition: absRef.h:66
void Gia_ManStaticFanoutStart(Gia_Man_t *p)
Definition: giaFanout.c:238
static Vec_Str_t * Vec_StrStart(int nSize)
Definition: vecStr.h:95
Vec_Str_t * vCounts
Definition: absRef.h:68
Rnm_Obj_t * pObjs
Definition: absRef.h:78
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
int nObjsAlloc
Definition: absRef.h:80
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Rnm_Obj_t_ Rnm_Obj_t
INCLUDES ///.
Definition: absRef.h:45
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Rnm_ManStop ( Rnm_Man_t p,
int  fProfile 
)

Definition at line 285 of file absRef.c.

286 {
287  if ( !p ) return;
288  // print runtime statistics
289  if ( fProfile && p->nCalls )
290  {
291  double MemGia = sizeof(Gia_Man_t) + sizeof(Gia_Obj_t) * p->pGia->nObjsAlloc + sizeof(int) * p->pGia->nTravIdsAlloc;
292  double MemOther = sizeof(Rnm_Man_t) + sizeof(Rnm_Obj_t) * p->nObjsAlloc + sizeof(int) * Vec_IntCap(p->vObjs);
293  abctime timeOther = p->timeTotal - p->timeFwd - p->timeBwd - p->timeVer;
294  printf( "Abstraction refinement runtime statistics:\n" );
295  ABC_PRTP( "Sensetization", p->timeFwd, p->timeTotal );
296  ABC_PRTP( "Justification", p->timeBwd, p->timeTotal );
297  ABC_PRTP( "Verification ", p->timeVer, p->timeTotal );
298  ABC_PRTP( "Other ", timeOther, p->timeTotal );
299  ABC_PRTP( "TOTAL ", p->timeTotal, p->timeTotal );
300  printf( "Total calls = %d. Average refine = %.1f. GIA mem = %.3f MB. Other mem = %.3f MB.\n",
301  p->nCalls, 1.0*p->nRefines/p->nCalls, MemGia/(1<<20), MemOther/(1<<20) );
302  }
303 
307 // Gia_ManSetPhase(p->pGia);
308 // Vec_IntFree( p->vIsopMem );
309 // Vec_IntFree( p->vSatVars );
310 // Vec_IntFree( p->vSat2Ids );
311  Vec_StrFree( p->vCounts );
312  Vec_IntFree( p->vFanins );
313  Vec_IntFree( p->vObjs );
314  ABC_FREE( p->pObjs );
315  ABC_FREE( p );
316 }
int nObjsAlloc
Definition: gia.h:102
Vec_Int_t * vFanins
Definition: absRef.h:69
abctime timeFwd
Definition: absRef.h:86
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition: giaUtil.c:215
Gia_Man_t * pGia
Definition: absRef.h:59
abctime timeOther
Definition: llb3Image.c:82
Definition: gia.h:75
void Gia_ManCleanMark1(Gia_Man_t *p)
Definition: giaUtil.c:272
abctime timeTotal
Definition: absRef.h:89
#define ABC_PRTP(a, t, T)
Definition: abc_global.h:223
Vec_Int_t * vObjs
Definition: absRef.h:66
static void Vec_StrFree(Vec_Str_t *p)
Definition: bblif.c:616
void Gia_ManStaticFanoutStop(Gia_Man_t *p)
Definition: giaFanout.c:290
abctime timeBwd
Definition: absRef.h:87
Vec_Str_t * vCounts
Definition: absRef.h:68
static int Vec_IntCap(Vec_Int_t *p)
Definition: vecInt.h:368
Rnm_Obj_t * pObjs
Definition: absRef.h:78
abctime timeVer
Definition: absRef.h:88
#define ABC_FREE(obj)
Definition: abc_global.h:232
int nObjsAlloc
Definition: absRef.h:80
int nTravIdsAlloc
Definition: gia.h:154
int nCalls
Definition: absRef.h:82
struct Gia_Man_t_ Gia_Man_t
Definition: gia.h:94
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
typedefABC_NAMESPACE_HEADER_START struct Rnm_Obj_t_ Rnm_Obj_t
INCLUDES ///.
Definition: absRef.h:45
ABC_INT64_T abctime
Definition: abc_global.h:278
int nRefines
Definition: absRef.h:83
void Rnm_ManVerifyUsingTerSim ( Gia_Man_t p,
Abc_Cex_t pCex,
Vec_Int_t vMap,
Vec_Int_t vObjs,
Vec_Int_t vRes 
)

Function*************************************************************

Synopsis [Performs refinement.]

Description []

SideEffects []

SeeAlso []

Definition at line 619 of file absRef.c.

620 {
621  Gia_Obj_t * pObj;
622  int i, f, iBit = pCex->nRegs;
624  for ( f = 0; f <= pCex->iFrame; f++, iBit += pCex->nPis )
625  {
626  Gia_ManForEachObjVec( vMap, p, pObj, i )
627  {
628  pObj->Value = Abc_InfoHasBit( pCex->pData, iBit + i );
629  if ( !Gia_ObjIsPi(p, pObj) )
630  Gia_ObjTerSimSetX( pObj );
631  else if ( pObj->Value )
632  Gia_ObjTerSimSet1( pObj );
633  else
634  Gia_ObjTerSimSet0( pObj );
635  }
636  Gia_ManForEachObjVec( vRes, p, pObj, i ) // vRes is subset of vMap
637  {
638  if ( pObj->Value )
639  Gia_ObjTerSimSet1( pObj );
640  else
641  Gia_ObjTerSimSet0( pObj );
642  }
643  Gia_ManForEachObjVec( vObjs, p, pObj, i )
644  {
645  if ( Gia_ObjIsCo(pObj) )
646  Gia_ObjTerSimCo( pObj );
647  else if ( Gia_ObjIsAnd(pObj) )
648  Gia_ObjTerSimAnd( pObj );
649  else if ( f == 0 )
650  Gia_ObjTerSimSet0( pObj );
651  else
652  Gia_ObjTerSimRo( p, pObj );
653  }
654  }
655  Gia_ManForEachObjVec( vMap, p, pObj, i )
656  pObj->Value = 0;
657  pObj = Gia_ManPo( p, 0 );
658  if ( !Gia_ObjTerSimGet1(pObj) )
659  Abc_Print( 1, "\nRefinement verification has failed!!!\n" );
660 }
static void Gia_ObjTerSimCo(Gia_Obj_t *pObj)
Definition: gia.h:797
static void Gia_ObjTerSimRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:808
static void Gia_ObjTerSimSet0(Gia_Obj_t *pObj)
Definition: gia.h:770
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
Definition: gia.h:75
if(last==0)
Definition: sparse_int.h:34
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
static int Gia_ObjTerSimGet1(Gia_Obj_t *pObj)
Definition: gia.h:776
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
static void Gia_ObjTerSimSet1(Gia_Obj_t *pObj)
Definition: gia.h:771
unsigned Value
Definition: gia.h:87
static void Gia_ObjTerSimSetX(Gia_Obj_t *pObj)
Definition: gia.h:772
static void Gia_ObjTerSimAnd(Gia_Obj_t *pObj)
Definition: gia.h:785
static int Gia_ObjIsPi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:441