abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
abs.h File Reference
#include "aig/gia/gia.h"
#include "aig/gia/giaAig.h"
#include "aig/saig/saig.h"

Go to the source code of this file.

Data Structures

struct  Abs_Par_t_
 
struct  Gia_ParAbs_t_
 

Typedefs

typedef
typedefABC_NAMESPACE_HEADER_START
struct Abs_Par_t_ 
Abs_Par_t
 INCLUDES ///. More...
 
typedef struct Gia_ParAbs_t_ Gia_ParAbs_t
 

Functions

static int Ga2_ObjOffset (Gia_Man_t *p, Gia_Obj_t *pObj)
 MACRO DEFINITIONS ///. More...
 
static int Ga2_ObjLeaveNum (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static int * Ga2_ObjLeavePtr (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static unsigned Ga2_ObjTruth (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static int Ga2_ObjRefNum (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static Vec_Int_tGa2_ObjLeaves (Gia_Man_t *p, Gia_Obj_t *pObj)
 
Gia_Man_tGia_ManDupAbsFlops (Gia_Man_t *p, Vec_Int_t *vFlopClasses)
 FUNCTION DECLARATIONS ///. More...
 
Gia_Man_tGia_ManDupAbsGates (Gia_Man_t *p, Vec_Int_t *vGateClasses)
 
void Gia_ManGlaCollect (Gia_Man_t *p, Vec_Int_t *vGateClasses, Vec_Int_t **pvPis, Vec_Int_t **pvPPis, Vec_Int_t **pvFlops, Vec_Int_t **pvNodes)
 
void Gia_ManPrintFlopClasses (Gia_Man_t *p)
 
void Gia_ManPrintObjClasses (Gia_Man_t *p)
 
void Gia_ManPrintGateClasses (Gia_Man_t *p)
 
int Gia_ManPerformGla (Gia_Man_t *p, Abs_Par_t *pPars)
 
int Gia_ManPerformGlaOld (Gia_Man_t *p, Abs_Par_t *pPars, int fStartVta)
 
Gia_Man_tGia_ManShrinkGla (Gia_Man_t *p, int nFrameMax, int nTimeOut, int fUsePdr, int fUseSat, int fUseBdd, int fVerbose)
 
void Gia_GlaProveAbsracted (Gia_Man_t *p, int fSimpProver, int fVerbose)
 DECLARATIONS ///. More...
 
void Gia_GlaProveCancel (int fVerbose)
 
int Gia_GlaProveCheck (int fVerbose)
 
int Gia_VtaPerform (Gia_Man_t *pAig, Abs_Par_t *pPars)
 
void Abs_ParSetDefaults (Abs_Par_t *p)
 DECLARATIONS ///. More...
 
Vec_Int_tGia_VtaConvertToGla (Gia_Man_t *p, Vec_Int_t *vVta)
 
Vec_Int_tGia_VtaConvertFromGla (Gia_Man_t *p, Vec_Int_t *vGla, int nFrames)
 
Vec_Int_tGia_FlaConvertToGla (Gia_Man_t *p, Vec_Int_t *vFla)
 
Vec_Int_tGia_GlaConvertToFla (Gia_Man_t *p, Vec_Int_t *vGla)
 
int Gia_GlaCountFlops (Gia_Man_t *p, Vec_Int_t *vGla)
 
int Gia_GlaCountNodes (Gia_Man_t *p, Vec_Int_t *vGla)
 
Gia_Man_tAbs_RpmPerform (Gia_Man_t *p, int nCutMax, int fVerbose, int fVeryVerbose)
 
Gia_Man_tAbs_RpmPerformOld (Gia_Man_t *p, int fVerbose)
 
void Gia_ManAbsSetDefaultParams (Gia_ParAbs_t *p)
 DECLARATIONS ///. More...
 
Vec_Int_tSaig_ManCexAbstractionFlops (Aig_Man_t *p, Gia_ParAbs_t *pPars)
 
Vec_Int_tSaig_ManCbaFilterFlops (Aig_Man_t *pAig, Abc_Cex_t *pAbsCex, Vec_Int_t *vFlopClasses, Vec_Int_t *vAbsFfsToAdd, int nFfsToSelect)
 FUNCTION DEFINITIONS ///. More...
 
Abc_Cex_tSaig_ManCbaFindCexCareBits (Aig_Man_t *pAig, Abc_Cex_t *pCex, int nInputs, int fVerbose)
 
int Gia_ManCexAbstractionRefine (Gia_Man_t *pGia, Abc_Cex_t *pCex, int nFfToAddMax, int fTryFour, int fSensePath, int fVerbose)
 
Vec_Int_tSaig_ManExtendCounterExampleTest3 (Aig_Man_t *pAig, int iFirstFlopPi, Abc_Cex_t *pCex, int fVerbose)
 
Vec_Int_tSaig_ManExtendCounterExampleTest2 (Aig_Man_t *p, int iFirstPi, Abc_Cex_t *pCex, int fVerbose)
 

Typedef Documentation

typedef typedefABC_NAMESPACE_HEADER_START struct Abs_Par_t_ Abs_Par_t

INCLUDES ///.

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

FileName [abs.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Abstraction package.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

Id:
abs.h,v 1.00 2005/06/20 00:00:00 alanmi Exp

]PARAMETERS ///BASIC TYPES ///

Definition at line 46 of file abs.h.

typedef struct Gia_ParAbs_t_ Gia_ParAbs_t

Definition at line 84 of file abs.h.

Function Documentation

void Abs_ParSetDefaults ( Abs_Par_t p)

DECLARATIONS ///.

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

FileName [absUtil.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Abstraction package.]

Synopsis [Interface to pthreads.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [This procedure sets default parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 44 of file absUtil.c.

45 {
46  memset( p, 0, sizeof(Abs_Par_t) );
47  p->nFramesMax = 0; // maximum frames
48  p->nFramesStart = 0; // starting frame
49  p->nFramesPast = 4; // overlap frames
50  p->nConfLimit = 0; // conflict limit
51  p->nLearnedMax = 1000; // max number of learned clauses
52  p->nLearnedStart = 1000; // max number of learned clauses
53  p->nLearnedDelta = 200; // max number of learned clauses
54  p->nLearnedPerce = 70; // max number of learned clauses
55  p->nTimeOut = 0; // timeout in seconds
56  p->nRatioMin = 0; // stop when less than this % of object is abstracted
57  p->nRatioMax = 30; // restart when more than this % of object is abstracted
58  p->fUseTermVars = 0; // use terminal variables
59  p->fUseRollback = 0; // use rollback to the starting number of frames
60  p->fPropFanout = 1; // propagate fanouts during refinement
61  p->fVerbose = 0; // verbose flag
62  p->iFrame = -1; // the number of frames covered
63  p->iFrameProved = -1; // the number of frames proved
64  p->nFramesNoChangeLim = 2; // the number of frames without change to dump abstraction
65 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_HEADER_START struct Abs_Par_t_ Abs_Par_t
INCLUDES ///.
Definition: abs.h:46
Gia_Man_t* Abs_RpmPerform ( Gia_Man_t p,
int  nCutMax,
int  fVerbose,
int  fVeryVerbose 
)

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

Synopsis [Performs structural reparametrization.]

Description []

SideEffects []

SeeAlso []

Definition at line 772 of file absRpm.c.

773 {
774  Gia_Man_t * pNew;
775 // Gia_ManTestDoms( p );
776 // return NULL;
777  // perform structural analysis
778  Gia_ObjComputeTruthTableStart( p, nCutMax );
779  Abs_RpmPerformMark( p, nCutMax, fVerbose, fVeryVerbose );
781  // derive new AIG
782  pNew = Gia_ManDupRpm( p );
783  Gia_ManCleanMark1( p );
784  return pNew;
785 }
void Abs_RpmPerformMark(Gia_Man_t *p, int nCutMax, int fVerbose, int fVeryVerbose)
Definition: absRpm.c:599
void Gia_ObjComputeTruthTableStart(Gia_Man_t *p, int nVarsMax)
Definition: giaTruth.c:282
void Gia_ObjComputeTruthTableStop(Gia_Man_t *p)
Definition: giaTruth.c:293
void Gia_ManCleanMark1(Gia_Man_t *p)
Definition: giaUtil.c:272
Gia_Man_t * Gia_ManDupRpm(Gia_Man_t *p)
Definition: absRpm.c:724
Definition: gia.h:95
Gia_Man_t* Abs_RpmPerformOld ( Gia_Man_t p,
int  fVerbose 
)

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

Synopsis [Reparameterized to get rid of useless primary inputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 141 of file absRpmOld.c.

142 {
143 // extern Aig_Man_t * Saig_ManRetimeMinArea( Aig_Man_t * p, int nMaxIters, int fForwardOnly, int fBackwardOnly, int fInitial, int fVerbose );
144  Aig_Man_t * pMan, * pTemp;
145  Gia_Man_t * pNew, * pTmp;
146  int nFlopsOld = Gia_ManRegNum(p);
147  if ( fVerbose )
148  {
149  printf( "Original AIG:\n" );
150  Gia_ManPrintStats( p, NULL );
151  }
152 
153  // perform input trimming
154  pNew = Gia_ManDupTrimmed( p, 1, 0, 0, -1 );
155  if ( fVerbose )
156  {
157  printf( "After PI trimming:\n" );
158  Gia_ManPrintStats( pNew, NULL );
159  }
160  // transform GIA
161  pNew = Gia_ManDupIn2Ff( pTmp = pNew );
162  Gia_ManStop( pTmp );
163  if ( fVerbose )
164  {
165  printf( "After PI-2-FF transformation:\n" );
166  Gia_ManPrintStats( pNew, NULL );
167  }
168 
169  // derive AIG
170  pMan = Gia_ManToAigSimple( pNew );
171  Gia_ManStop( pNew );
172  // perform min-reg retiming
173  pMan = Saig_ManRetimeMinArea( pTemp = pMan, 10, 0, 0, 1, 0 );
174  Aig_ManStop( pTemp );
175  // derive GIA
176  pNew = Gia_ManFromAigSimple( pMan );
177  Aig_ManStop( pMan );
178  if ( fVerbose )
179  {
180  printf( "After min-area retiming:\n" );
181  Gia_ManPrintStats( pNew, NULL );
182  }
183 
184  // transform back
185  pNew = Gia_ManDupFf2In( pTmp = pNew, nFlopsOld );
186  Gia_ManStop( pTmp );
187  if ( fVerbose )
188  {
189  printf( "After FF-2-PI tranformation:\n" );
190  Gia_ManPrintStats( pNew, NULL );
191  }
192  return pNew;
193 }
Gia_Man_t * Gia_ManDupTrimmed(Gia_Man_t *p, int fTrimCis, int fTrimCos, int fDualOut, int OutValue)
Definition: giaDup.c:1638
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
Aig_Man_t * Gia_ManToAigSimple(Gia_Man_t *p)
Definition: giaAig.c:367
void Gia_ManPrintStats(Gia_Man_t *p, Gps_Par_t *pPars)
Definition: giaMan.c:389
Aig_Man_t * Saig_ManRetimeMinArea(Aig_Man_t *p, int nMaxIters, int fForwardOnly, int fBackwardOnly, int fInitial, int fVerbose)
Definition: saigRetMin.c:623
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
Gia_Man_t * Gia_ManFromAigSimple(Aig_Man_t *p)
Definition: giaAig.c:171
ABC_NAMESPACE_IMPL_START Gia_Man_t * Gia_ManDupIn2Ff(Gia_Man_t *p)
DECLARATIONS ///.
Definition: absRpmOld.c:45
Definition: gia.h:95
Gia_Man_t * Gia_ManDupFf2In(Gia_Man_t *p, int nFlopsOld)
Definition: absRpmOld.c:108
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
static int Ga2_ObjLeaveNum ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 113 of file abs.h.

113 { return Vec_IntEntry(p->vMapping, Ga2_ObjOffset(p, pObj)); }
static int Ga2_ObjOffset(Gia_Man_t *p, Gia_Obj_t *pObj)
MACRO DEFINITIONS ///.
Definition: abs.h:112
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t * vMapping
Definition: gia.h:131
static int* Ga2_ObjLeavePtr ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 114 of file abs.h.

114 { return Vec_IntEntryP(p->vMapping, Ga2_ObjOffset(p, pObj) + 1); }
static int Ga2_ObjOffset(Gia_Man_t *p, Gia_Obj_t *pObj)
MACRO DEFINITIONS ///.
Definition: abs.h:112
static int * Vec_IntEntryP(Vec_Int_t *p, int i)
Definition: vecInt.h:417
Vec_Int_t * vMapping
Definition: gia.h:131
static Vec_Int_t* Ga2_ObjLeaves ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 117 of file abs.h.

117 { static Vec_Int_t v; v.nSize = Ga2_ObjLeaveNum(p, pObj), v.pArray = Ga2_ObjLeavePtr(p, pObj); return &v; }
static int Ga2_ObjLeaveNum(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: abs.h:113
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int * Ga2_ObjLeavePtr(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: abs.h:114
static int Ga2_ObjOffset ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

MACRO DEFINITIONS ///.

Definition at line 112 of file abs.h.

112 { return Vec_IntEntry(p->vMapping, Gia_ObjId(p, pObj)); }
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
Vec_Int_t * vMapping
Definition: gia.h:131
static int Ga2_ObjRefNum ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 116 of file abs.h.

116 { return (unsigned)Vec_IntEntry(p->vMapping, Ga2_ObjOffset(p, pObj) + Ga2_ObjLeaveNum(p, pObj) + 2); }
static int Ga2_ObjOffset(Gia_Man_t *p, Gia_Obj_t *pObj)
MACRO DEFINITIONS ///.
Definition: abs.h:112
static int Ga2_ObjLeaveNum(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: abs.h:113
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t * vMapping
Definition: gia.h:131
static unsigned Ga2_ObjTruth ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 115 of file abs.h.

115 { return (unsigned)Vec_IntEntry(p->vMapping, Ga2_ObjOffset(p, pObj) + Ga2_ObjLeaveNum(p, pObj) + 1); }
static int Ga2_ObjOffset(Gia_Man_t *p, Gia_Obj_t *pObj)
MACRO DEFINITIONS ///.
Definition: abs.h:112
static int Ga2_ObjLeaveNum(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: abs.h:113
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t * vMapping
Definition: gia.h:131
Vec_Int_t* Gia_FlaConvertToGla ( Gia_Man_t p,
Vec_Int_t vFla 
)

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

Synopsis [Converting FLA vector to GLA vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 173 of file absUtil.c.

174 {
175  Vec_Int_t * vGla;
176  Gia_Obj_t * pObj;
177  int i;
178  // mark const0 and relevant CI objects
181  Gia_ManForEachPi( p, pObj, i )
182  Gia_ObjSetTravIdCurrent(p, pObj);
183  Gia_ManForEachRo( p, pObj, i )
184  if ( !Vec_IntEntry(vFla, i) )
185  Gia_ObjSetTravIdCurrent(p, pObj);
186  // label all objects reachable from the PO and selected flops
187  vGla = Vec_IntStart( Gia_ManObjNum(p) );
188  Vec_IntWriteEntry( vGla, 0, 1 );
189  Gia_ManForEachPo( p, pObj, i )
190  Gia_FlaConvertToGla_rec( p, Gia_ObjFanin0(pObj), vGla );
191  Gia_ManForEachRi( p, pObj, i )
192  if ( Vec_IntEntry(vFla, i) )
193  Gia_FlaConvertToGla_rec( p, Gia_ObjFanin0(pObj), vGla );
194  return vGla;
195 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Definition: gia.h:75
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
if(last==0)
Definition: sparse_int.h:34
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
void Gia_FlaConvertToGla_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vGla)
Definition: absUtil.c:149
#define Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
Vec_Int_t* Gia_GlaConvertToFla ( Gia_Man_t p,
Vec_Int_t vGla 
)

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

Synopsis [Converting GLA vector to FLA vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 208 of file absUtil.c.

209 {
210  Vec_Int_t * vFla;
211  Gia_Obj_t * pObj;
212  int i;
213  vFla = Vec_IntStart( Gia_ManRegNum(p) );
214  Gia_ManForEachRo( p, pObj, i )
215  if ( Vec_IntEntry(vGla, Gia_ObjId(p, pObj)) )
216  Vec_IntWriteEntry( vFla, i, 1 );
217  return vFla;
218 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Definition: gia.h:75
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
#define Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
int Gia_GlaCountFlops ( Gia_Man_t p,
Vec_Int_t vGla 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 231 of file absUtil.c.

232 {
233  Gia_Obj_t * pObj;
234  int i, Count = 0;
235  Gia_ManForEachRo( p, pObj, i )
236  if ( Vec_IntEntry(vGla, Gia_ObjId(p, pObj)) )
237  Count++;
238  return Count;
239 }
Definition: gia.h:75
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
#define Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
int Gia_GlaCountNodes ( Gia_Man_t p,
Vec_Int_t vGla 
)

Definition at line 240 of file absUtil.c.

241 {
242  Gia_Obj_t * pObj;
243  int i, Count = 0;
244  Gia_ManForEachAnd( p, pObj, i )
245  if ( Vec_IntEntry(vGla, Gia_ObjId(p, pObj)) )
246  Count++;
247  return Count;
248 }
Definition: gia.h:75
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
void Gia_GlaProveAbsracted ( Gia_Man_t p,
int  fSimpProver,
int  fVerbose 
)

DECLARATIONS ///.

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

FileName [absPth.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Abstraction package.]

Synopsis [Interface to pthreads.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Definition at line 45 of file absPth.c.

45 {}
void Gia_GlaProveCancel ( int  fVerbose)

Definition at line 46 of file absPth.c.

46 {}
int Gia_GlaProveCheck ( int  fVerbose)

Definition at line 47 of file absPth.c.

47 { return 0; }
void Gia_ManAbsSetDefaultParams ( Gia_ParAbs_t p)

DECLARATIONS ///.

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

FileName [saigAbsStart.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Sequential AIG package.]

Synopsis [Counter-example-based abstraction.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [This procedure sets default parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 50 of file absOldRef.c.

51 {
52  memset( p, 0, sizeof(Gia_ParAbs_t) );
53  p->Algo = 0; // algorithm: CBA
54  p->nFramesMax = 10; // timeframes for PBA
55  p->nConfMax = 10000; // conflicts for PBA
56  p->fDynamic = 1; // dynamic unfolding for PBA
57  p->fConstr = 0; // use constraints
58  p->nFramesBmc = 250; // timeframes for BMC
59  p->nConfMaxBmc = 5000; // conflicts for BMC
60  p->nStableMax = 1000000; // the number of stable frames to quit
61  p->nRatio = 10; // ratio of flops to quit
62  p->nBobPar = 1000000; // the number of frames before trying to quit
63  p->fUseBdds = 0; // use BDDs to refine abstraction
64  p->fUseDprove = 0; // use 'dprove' to refine abstraction
65  p->fUseStart = 1; // use starting frame
66  p->fVerbose = 0; // verbose output
67  p->fVeryVerbose= 0; // printing additional information
68  p->Status = -1; // the problem status
69  p->nFramesDone = -1; // the number of rames covered
70 }
char * memset()
int nBobPar
Definition: abs.h:98
int nConfMax
Definition: abs.h:89
int Algo
Definition: abs.h:87
int fConstr
Definition: abs.h:91
int fVeryVerbose
Definition: abs.h:103
int nStableMax
Definition: abs.h:94
int nRatio
Definition: abs.h:95
int Status
Definition: abs.h:104
int nFramesDone
Definition: abs.h:105
int fVerbose
Definition: abs.h:102
int nFramesBmc
Definition: abs.h:92
int fUseStart
Definition: abs.h:101
int nConfMaxBmc
Definition: abs.h:93
int fDynamic
Definition: abs.h:90
int fUseDprove
Definition: abs.h:100
int nFramesMax
Definition: abs.h:88
int fUseBdds
Definition: abs.h:99
int Gia_ManCexAbstractionRefine ( Gia_Man_t pGia,
Abc_Cex_t pCex,
int  nFfToAddMax,
int  fTryFour,
int  fSensePath,
int  fVerbose 
)

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

Synopsis [Refines abstraction using the latch map.]

Description []

SideEffects []

SeeAlso []

Definition at line 372 of file absOldRef.c.

373 {
374  Aig_Man_t * pNew;
375  Vec_Int_t * vFlops;
376  if ( pGia->vFlopClasses == NULL )
377  {
378  printf( "Gia_ManCexAbstractionRefine(): Abstraction latch map is missing.\n" );
379  return -1;
380  }
381  pNew = Gia_ManToAig( pGia, 0 );
382  vFlops = Gia_ManClasses2Flops( pGia->vFlopClasses );
383  if ( !Saig_ManCexRefineStep( pNew, vFlops, pGia->vFlopClasses, pCex, nFfToAddMax, fTryFour, fSensePath, fVerbose ) )
384  {
385  pGia->pCexSeq = pNew->pSeqModel; pNew->pSeqModel = NULL;
386  Vec_IntFree( vFlops );
387  Aig_ManStop( pNew );
388  return 0;
389  }
390  Vec_IntFree( pGia->vFlopClasses );
391  pGia->vFlopClasses = Gia_ManFlops2Classes( pGia, vFlops );
392  Vec_IntFree( vFlops );
393  Aig_ManStop( pNew );
394  return -1;
395 }
int Saig_ManCexRefineStep(Aig_Man_t *p, Vec_Int_t *vFlops, Vec_Int_t *vFlopClasses, Abc_Cex_t *pCex, int nFfToAddMax, int fTryFour, int fSensePath, int fVerbose)
Definition: absOldRef.c:255
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
Vec_Int_t * Gia_ManFlops2Classes(Gia_Man_t *pGia, Vec_Int_t *vFlops)
Definition: absOldRef.c:351
Vec_Int_t * vFlopClasses
Definition: gia.h:140
Vec_Int_t * Gia_ManClasses2Flops(Vec_Int_t *vFlopClasses)
Definition: absOldRef.c:329
Aig_Man_t * Gia_ManToAig(Gia_Man_t *p, int fChoices)
Definition: giaAig.c:277
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Abc_Cex_t * pCexSeq
Definition: gia.h:136
Gia_Man_t* Gia_ManDupAbsFlops ( Gia_Man_t p,
Vec_Int_t vFlopClasses 
)

FUNCTION DECLARATIONS ///.

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

Synopsis [Extractes a flop-level abstraction given a flop map.]

Description []

SideEffects []

SeeAlso []

Definition at line 65 of file absDup.c.

66 {
67  Gia_Man_t * pNew, * pTemp;
68  Gia_Obj_t * pObj;
69  int i, nFlops = 0;
70  Gia_ManFillValue( p );
71  // start the new manager
72  pNew = Gia_ManStart( 5000 );
73  pNew->pName = Abc_UtilStrsav( p->pName );
74  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
75  // create PIs
76  Gia_ManConst0(p)->Value = 0;
77  Gia_ManForEachPi( p, pObj, i )
78  pObj->Value = Gia_ManAppendCi(pNew);
79  // create additional PIs
80  Gia_ManForEachRo( p, pObj, i )
81  if ( !Vec_IntEntry(vFlopClasses, i) )
82  pObj->Value = Gia_ManAppendCi(pNew);
83  // create ROs
84  Gia_ManForEachRo( p, pObj, i )
85  if ( Vec_IntEntry(vFlopClasses, i) )
86  pObj->Value = Gia_ManAppendCi(pNew);
87  // create POs
88  Gia_ManHashAlloc( pNew );
89  Gia_ManForEachPo( p, pObj, i )
90  {
92  Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
93  }
94  // create RIs
95  Gia_ManForEachRi( p, pObj, i )
96  if ( Vec_IntEntry(vFlopClasses, i) )
97  {
99  Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
100  nFlops++;
101  }
102  Gia_ManHashStop( pNew );
103  Gia_ManSetRegNum( pNew, nFlops );
104  // clean up
105  pNew = Gia_ManSeqCleanup( pTemp = pNew );
106  Gia_ManStop( pTemp );
107  return pNew;
108 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
ABC_NAMESPACE_IMPL_START void Gia_ManDupAbsFlops_rec(Gia_Man_t *pNew, Gia_Obj_t *pObj)
DECLARATIONS ///.
Definition: absDup.c:44
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
Gia_Man_t * Gia_ManSeqCleanup(Gia_Man_t *p)
Definition: giaScl.c:183
char * pName
Definition: gia.h:97
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
Gia_Man_t* Gia_ManDupAbsGates ( Gia_Man_t p,
Vec_Int_t vGateClasses 
)

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

Synopsis [Extractes a gate-level abstraction given a gate map.]

Description [The array contains 1 for those objects (const, RO, AND) that are included in the abstraction; 0, otherwise.]

SideEffects []

SeeAlso []

Definition at line 220 of file absDup.c.

221 {
222  Vec_Int_t * vPis, * vPPis, * vFlops, * vNodes;
223  Gia_Man_t * pNew, * pTemp;
224  Gia_Obj_t * pObj, * pCopy;
225  int i;//, nFlops = 0;
226  assert( Gia_ManPoNum(p) == 1 );
227  assert( Vec_IntSize(vGateClasses) == Gia_ManObjNum(p) );
228 
229  // create additional arrays
230  Gia_ManGlaCollect( p, vGateClasses, &vPis, &vPPis, &vFlops, &vNodes );
231 
232  // start the new manager
233  pNew = Gia_ManStart( 5000 );
234  pNew->pName = Abc_UtilStrsav( p->pName );
235  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
236  // create constant
237  Gia_ManFillValue( p );
238  Gia_ManConst0(p)->Value = 0;
239  // create PIs
240  Gia_ManForEachObjVec( vPis, p, pObj, i )
241  pObj->Value = Gia_ManAppendCi(pNew);
242  // create additional PIs
243  Gia_ManForEachObjVec( vPPis, p, pObj, i )
244  pObj->Value = Gia_ManAppendCi(pNew);
245  // create ROs
246  Gia_ManForEachObjVec( vFlops, p, pObj, i )
247  pObj->Value = Gia_ManAppendCi(pNew);
248  // create internal nodes
249  Gia_ManForEachObjVec( vNodes, p, pObj, i )
250  pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
251 // Gia_ManDupAbsGates_rec( pNew, pObj );
252  // create PO
253  Gia_ManForEachPo( p, pObj, i )
254  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
255  // create RIs
256  Gia_ManForEachObjVec( vFlops, p, pObj, i )
257  Gia_ObjRoToRi(p, pObj)->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(Gia_ObjRoToRi(p, pObj)) );
258  Gia_ManSetRegNum( pNew, Vec_IntSize(vFlops) );
259  // clean up
260  pNew = Gia_ManSeqCleanup( pTemp = pNew );
261  // transfer copy values: (p -> pTemp -> pNew) => (p -> pNew)
262  if ( Gia_ManObjNum(pTemp) != Gia_ManObjNum(pNew) )
263  {
264 // printf( "Gia_ManDupAbsGates() Internal error: object mismatch.\n" );
265  Gia_ManForEachObj( p, pObj, i )
266  {
267  if ( !~pObj->Value )
268  continue;
269  assert( !Abc_LitIsCompl(pObj->Value) );
270  pCopy = Gia_ObjCopy( pTemp, pObj );
271  if ( !~pCopy->Value )
272  {
273  Vec_IntWriteEntry( vGateClasses, i, 0 );
274  pObj->Value = ~0;
275  continue;
276  }
277  assert( !Abc_LitIsCompl(pCopy->Value) );
278  pObj->Value = pCopy->Value;
279  }
280  }
281  Gia_ManStop( pTemp );
282 
283  Vec_IntFree( vPis );
284  Vec_IntFree( vPPis );
285  Vec_IntFree( vFlops );
286  Vec_IntFree( vNodes );
287  return pNew;
288 }
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
void Gia_ManGlaCollect(Gia_Man_t *p, Vec_Int_t *vGateClasses, Vec_Int_t **pvPis, Vec_Int_t **pvPPis, Vec_Int_t **pvFlops, Vec_Int_t **pvNodes)
Definition: absDup.c:158
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
Gia_Man_t * Gia_ManSeqCleanup(Gia_Man_t *p)
Definition: giaScl.c:183
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
static Gia_Obj_t * Gia_ObjRoToRi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:446
if(last==0)
Definition: sparse_int.h:34
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static Gia_Obj_t * Gia_ObjCopy(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:478
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Definition: gia.h:95
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
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
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManGlaCollect ( Gia_Man_t p,
Vec_Int_t vGateClasses,
Vec_Int_t **  pvPis,
Vec_Int_t **  pvPPis,
Vec_Int_t **  pvFlops,
Vec_Int_t **  pvNodes 
)

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

Synopsis [Collects PIs and PPIs of the abstraction.]

Description []

SideEffects []

SeeAlso []

Definition at line 158 of file absDup.c.

159 {
160  Vec_Int_t * vAssigned;
161  Gia_Obj_t * pObj;
162  int i;
163  assert( Gia_ManPoNum(p) == 1 );
164  assert( Vec_IntSize(vGateClasses) == Gia_ManObjNum(p) );
165  // create included objects and their fanins
166  vAssigned = Gia_GlaCollectAssigned( p, vGateClasses );
167  // create additional arrays
168  if ( pvPis ) *pvPis = Vec_IntAlloc( 100 );
169  if ( pvPPis ) *pvPPis = Vec_IntAlloc( 100 );
170  if ( pvFlops ) *pvFlops = Vec_IntAlloc( 100 );
171  if ( pvNodes ) *pvNodes = Vec_IntAlloc( 1000 );
172  Gia_ManForEachObjVec( vAssigned, p, pObj, i )
173  {
174  if ( Gia_ObjIsPi(p, pObj) )
175  { if ( pvPis ) Vec_IntPush( *pvPis, Gia_ObjId(p,pObj) ); }
176  else if ( !Vec_IntEntry(vGateClasses, Gia_ObjId(p,pObj)) )
177  { if ( pvPPis ) Vec_IntPush( *pvPPis, Gia_ObjId(p,pObj) ); }
178  else if ( Gia_ObjIsRo(p, pObj) )
179  { if ( pvFlops ) Vec_IntPush( *pvFlops, Gia_ObjId(p,pObj) ); }
180  else if ( Gia_ObjIsAnd(pObj) )
181  { if ( pvNodes ) Vec_IntPush( *pvNodes, Gia_ObjId(p,pObj) ); }
182  else assert( Gia_ObjIsConst0(pObj) );
183  }
184  Vec_IntFree( vAssigned );
185 }
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Vec_Int_t * Gia_GlaCollectAssigned(Gia_Man_t *p, Vec_Int_t *vGateClasses)
Definition: absDup.c:121
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
Definition: gia.h:75
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:443
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
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_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
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ObjIsPi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:441
int Gia_ManPerformGla ( Gia_Man_t pAig,
Abs_Par_t pPars 
)

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

Synopsis [Performs gate-level abstraction.]

Description []

SideEffects []

SeeAlso []

Definition at line 1500 of file absGla.c.

1501 {
1502  int fUseSecondCore = 1;
1503  Ga2_Man_t * p;
1504  Vec_Int_t * vCore, * vPPis;
1505  abctime clk2, clk = Abc_Clock();
1506  int Status = l_Undef, RetValue = -1, iFrameTryToProve = -1, fOneIsSent = 0;
1507  int i, c, f, Lit;
1508  pPars->iFrame = -1;
1509  // check trivial case
1510  assert( Gia_ManPoNum(pAig) == 1 );
1511  ABC_FREE( pAig->pCexSeq );
1512  if ( Gia_ObjIsConst0(Gia_ObjFanin0(Gia_ManPo(pAig,0))) )
1513  {
1514  if ( !Gia_ObjFaninC0(Gia_ManPo(pAig,0)) )
1515  {
1516  Abc_Print( 1, "Sequential miter is trivially UNSAT.\n" );
1517  return 1;
1518  }
1519  pAig->pCexSeq = Abc_CexMakeTriv( Gia_ManRegNum(pAig), Gia_ManPiNum(pAig), 1, 0 );
1520  Abc_Print( 1, "Sequential miter is trivially SAT.\n" );
1521  return 0;
1522  }
1523  // create gate classes if not given
1524  if ( pAig->vGateClasses == NULL )
1525  {
1526  pAig->vGateClasses = Vec_IntStart( Gia_ManObjNum(pAig) );
1527  Vec_IntWriteEntry( pAig->vGateClasses, 0, 1 );
1528  Vec_IntWriteEntry( pAig->vGateClasses, Gia_ObjFaninId0p(pAig, Gia_ManPo(pAig, 0)), 1 );
1529  }
1530  // start the manager
1531  p = Ga2_ManStart( pAig, pPars );
1532  p->timeInit = Abc_Clock() - clk;
1533  // perform initial abstraction
1534  if ( p->pPars->fVerbose )
1535  {
1536  Abc_Print( 1, "Running gate-level abstraction (GLA) with the following parameters:\n" );
1537  Abc_Print( 1, "FrameMax = %d ConfMax = %d Timeout = %d Limit = %d %% Limit2 = %d %% RatioMax = %d %%\n",
1538  pPars->nFramesMax, pPars->nConfLimit, pPars->nTimeOut, pPars->nRatioMin, pPars->nRatioMin2, pPars->nRatioMax );
1539  Abc_Print( 1, "LrnStart = %d LrnDelta = %d LrnRatio = %d %% Skip = %d SimpleCNF = %d Dump = %d\n",
1540  pPars->nLearnedStart, pPars->nLearnedDelta, pPars->nLearnedPerce, pPars->fUseSkip, pPars->fUseSimple, pPars->fDumpVabs|pPars->fDumpMabs );
1541  if ( pPars->fDumpVabs || pPars->fDumpMabs )
1542  Abc_Print( 1, "%s will be dumped into file \"%s\".\n",
1543  pPars->fDumpVabs ? "Abstracted model" : "Miter with abstraction map",
1544  Ga2_GlaGetFileName(p, pPars->fDumpVabs) );
1545  Abc_Print( 1, " Frame %% Abs PPI FF LUT Confl Cex Vars Clas Lrns Time Mem\n" );
1546  }
1547  // iterate unrolling
1548  for ( i = f = 0; !pPars->nFramesMax || f < pPars->nFramesMax; i++ )
1549  {
1550  int nAbsOld;
1551  // remember the timeframe
1552  p->pPars->iFrame = -1;
1553  // create new SAT solver
1554  Ga2_ManRestart( p );
1555  // remember abstraction size after the last restart
1556  nAbsOld = Vec_IntSize(p->vAbs);
1557  // unroll the circuit
1558  for ( f = 0; !pPars->nFramesMax || f < pPars->nFramesMax; f++ )
1559  {
1560  // remember current limits
1561  int nConflsBeg = sat_solver2_nconflicts(p->pSat);
1562  int nAbs = Vec_IntSize(p->vAbs);
1563  int nValues = Vec_IntSize(p->vValues);
1564  int nVarsOld;
1565  // remember the timeframe
1566  p->pPars->iFrame = f;
1567  // extend and clear storage
1568  if ( f == Vec_PtrSize(p->vId2Lit) )
1569  Vec_PtrPush( p->vId2Lit, Vec_IntAlloc(0) );
1571  // add static clauses to this timeframe
1572  Ga2_ManAddAbsClauses( p, f );
1573  // skip checking if skipcheck is enabled (&gla -s)
1574  if ( p->pPars->fUseSkip && f <= p->pPars->iFrameProved )
1575  continue;
1576  // skip checking if we need to skip several starting frames (&gla -S <num>)
1577  if ( p->pPars->nFramesStart && f <= p->pPars->nFramesStart )
1578  continue;
1579  // get the output literal
1580 // Lit = Ga2_ManUnroll_rec( p, Gia_ManPo(pAig,0), f );
1581  Lit = Ga2_ObjFindLit( p, Gia_ObjFanin0(Gia_ManPo(pAig,0)), f );
1582  assert( Lit >= 0 );
1583  Lit = Abc_LitNotCond( Lit, Gia_ObjFaninC0(Gia_ManPo(pAig,0)) );
1584  if ( Lit == 0 )
1585  continue;
1586  assert( Lit > 1 );
1587  // check for counter-examples
1588  if ( p->nSatVars > sat_solver2_nvars(p->pSat) )
1590  nVarsOld = p->nSatVars;
1591  for ( c = 0; ; c++ )
1592  {
1593  // consider the special case when the target literal is implied false
1594  // by implications which happened as a result of previous refinements
1595  // note that incremental UNSAT core cannot be computed because there is no learned clauses
1596  // in this case, we will assume that UNSAT core cannot reduce the problem
1597  if ( var_is_assigned(p->pSat, Abc_Lit2Var(Lit)) )
1598  {
1599  Prf_ManStopP( &p->pSat->pPrf2 );
1600  break;
1601  }
1602  // perform SAT solving
1603  clk2 = Abc_Clock();
1604  Status = sat_solver2_solve( p->pSat, &Lit, &Lit+1, (ABC_INT64_T)pPars->nConfLimit, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
1605  if ( Status == l_True ) // perform refinement
1606  {
1607  p->nCexes++;
1608  p->timeSat += Abc_Clock() - clk2;
1609 
1610  // cancel old one if it was sent
1611  if ( Abc_FrameIsBridgeMode() && fOneIsSent )
1612  {
1613  Gia_Ga2SendCancel( p, pPars->fVerbose );
1614  fOneIsSent = 0;
1615  }
1616  if ( iFrameTryToProve >= 0 )
1617  {
1618  Gia_GlaProveCancel( pPars->fVerbose );
1619  iFrameTryToProve = -1;
1620  }
1621 
1622  // perform refinement
1623  clk2 = Abc_Clock();
1624  Rnm_ManSetRefId( p->pRnm, c );
1625  vPPis = Ga2_ManRefine( p );
1626  p->timeCex += Abc_Clock() - clk2;
1627  if ( vPPis == NULL )
1628  {
1629  if ( pPars->fVerbose )
1630  Ga2_ManAbsPrintFrame( p, f, sat_solver2_nconflicts(p->pSat)-nConflsBeg, c, Abc_Clock() - clk, 1 );
1631  goto finish;
1632  }
1633 
1634  if ( c == 0 )
1635  {
1636 // Ga2_ManRefinePrintPPis( p );
1637  // create bookmark to be used for rollback
1638  assert( nVarsOld == p->pSat->size );
1639  sat_solver2_bookmark( p->pSat );
1640  // start incremental proof manager
1641  assert( p->pSat->pPrf2 == NULL );
1642  p->pSat->pPrf2 = Prf_ManAlloc();
1643  if ( p->pSat->pPrf2 )
1644  {
1645  p->nProofIds = 0;
1646  Vec_IntFill( p->vProofIds, Gia_ManObjNum(p->pGia), -1 );
1648  }
1649  }
1650  else
1651  {
1652  // resize the proof logger
1653  if ( p->pSat->pPrf2 )
1654  Prf_ManGrow( p->pSat->pPrf2, p->nProofIds + Vec_IntSize(vPPis) );
1655  }
1656 
1657  Ga2_ManAddToAbs( p, vPPis );
1658  Vec_IntFree( vPPis );
1659  if ( pPars->fVerbose )
1660  Ga2_ManAbsPrintFrame( p, f, sat_solver2_nconflicts(p->pSat)-nConflsBeg, c+1, Abc_Clock() - clk, 0 );
1661  // check if the number of objects is below limit
1662  if ( pPars->nRatioMin2 && Vec_IntSize(p->vAbs) >= p->nMarked * pPars->nRatioMin2 / 100 )
1663  {
1664  Status = l_Undef;
1665  goto finish;
1666  }
1667  continue;
1668  }
1669  p->timeUnsat += Abc_Clock() - clk2;
1670  if ( Status == l_Undef ) // ran out of resources
1671  goto finish;
1672  if ( p->pSat->nRuntimeLimit && Abc_Clock() > p->pSat->nRuntimeLimit ) // timeout
1673  goto finish;
1674  if ( c == 0 )
1675  {
1676  if ( f > p->pPars->iFrameProved )
1677  p->pPars->nFramesNoChange++;
1678  break;
1679  }
1680  if ( f > p->pPars->iFrameProved )
1681  p->pPars->nFramesNoChange = 0;
1682 
1683  // derive the core
1684  assert( p->pSat->pPrf2 != NULL );
1685  vCore = (Vec_Int_t *)Sat_ProofCore( p->pSat );
1686  Prf_ManStopP( &p->pSat->pPrf2 );
1687  // update the SAT solver
1688  sat_solver2_rollback( p->pSat );
1689  // reduce abstraction
1690  Ga2_ManShrinkAbs( p, nAbs, nValues, nVarsOld );
1691 
1692  // purify UNSAT core
1693  if ( fUseSecondCore )
1694  {
1695 // int nOldCore = Vec_IntSize(vCore);
1696  // reverse the order of objects in the core
1697 // Vec_IntSort( vCore, 0 );
1698 // Vec_IntPrint( vCore );
1699  // create bookmark to be used for rollback
1700  assert( nVarsOld == p->pSat->size );
1701  sat_solver2_bookmark( p->pSat );
1702  // start incremental proof manager
1703  assert( p->pSat->pPrf2 == NULL );
1704  p->pSat->pPrf2 = Prf_ManAlloc();
1705  if ( p->pSat->pPrf2 )
1706  {
1707  p->nProofIds = 0;
1708  Vec_IntFill( p->vProofIds, Gia_ManObjNum(p->pGia), -1 );
1710 
1711  Ga2_ManAddToAbs( p, vCore );
1712  Vec_IntFree( vCore );
1713  }
1714  // run SAT solver
1715  clk2 = Abc_Clock();
1716  Status = sat_solver2_solve( p->pSat, &Lit, &Lit+1, (ABC_INT64_T)pPars->nConfLimit, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
1717  if ( Status == l_Undef )
1718  goto finish;
1719  assert( Status == l_False );
1720  p->timeUnsat += Abc_Clock() - clk2;
1721 
1722  // derive the core
1723  assert( p->pSat->pPrf2 != NULL );
1724  vCore = (Vec_Int_t *)Sat_ProofCore( p->pSat );
1725  Prf_ManStopP( &p->pSat->pPrf2 );
1726  // update the SAT solver
1727  sat_solver2_rollback( p->pSat );
1728  // reduce abstraction
1729  Ga2_ManShrinkAbs( p, nAbs, nValues, nVarsOld );
1730 // printf( "\n%4d -> %4d\n", nOldCore, Vec_IntSize(vCore) );
1731  }
1732 
1733  Ga2_ManAddToAbs( p, vCore );
1734 // Ga2_ManRefinePrint( p, vCore );
1735  Vec_IntFree( vCore );
1736  break;
1737  }
1738  // remember the last proved frame
1739  if ( p->pPars->iFrameProved < f )
1740  p->pPars->iFrameProved = f;
1741  // print statistics
1742  if ( pPars->fVerbose )
1743  Ga2_ManAbsPrintFrame( p, f, sat_solver2_nconflicts(p->pSat)-nConflsBeg, c, Abc_Clock() - clk, 1 );
1744  // check if abstraction was proved
1745  if ( Gia_GlaProveCheck( pPars->fVerbose ) )
1746  {
1747  RetValue = 1;
1748  goto finish;
1749  }
1750  if ( c > 0 )
1751  {
1752  if ( p->pPars->fVeryVerbose )
1753  Abc_Print( 1, "\n" );
1754  // recompute the abstraction
1755  Vec_IntFreeP( &pAig->vGateClasses );
1756  pAig->vGateClasses = Ga2_ManAbsTranslate( p );
1757  // check if the number of objects is below limit
1758  if ( pPars->nRatioMin && Vec_IntSize(p->vAbs) >= p->nMarked * pPars->nRatioMin / 100 )
1759  {
1760  Status = l_Undef;
1761  goto finish;
1762  }
1763  }
1764  // check the number of stable frames
1765  if ( p->pPars->nFramesNoChange == p->pPars->nFramesNoChangeLim )
1766  {
1767  // dump the model into file
1768  if ( p->pPars->fDumpVabs || p->pPars->fDumpMabs )
1769  {
1770  char Command[1000];
1771  Abc_FrameSetStatus( -1 );
1772  Abc_FrameSetCex( NULL );
1773  Abc_FrameSetNFrames( f );
1774  sprintf( Command, "write_status %s", Extra_FileNameGenericAppend((char *)(p->pPars->pFileVabs ? p->pPars->pFileVabs : "glabs.aig"), ".status"));
1776  Ga2_GlaDumpAbsracted( p, pPars->fVerbose );
1777  }
1778  // call the prover
1779  if ( p->pPars->fCallProver )
1780  {
1781  // cancel old one if it is proving
1782  if ( iFrameTryToProve >= 0 )
1783  Gia_GlaProveCancel( pPars->fVerbose );
1784  // prove new one
1785  Gia_GlaProveAbsracted( pAig, pPars->fSimpProver, pPars->fVeryVerbose );
1786  iFrameTryToProve = f;
1787  p->nPdrCalls++;
1788  }
1789  // speak to the bridge
1790  if ( Abc_FrameIsBridgeMode() )
1791  {
1792  // cancel old one if it was sent
1793  if ( fOneIsSent )
1794  Gia_Ga2SendCancel( p, pPars->fVerbose );
1795  // send new one
1796  Gia_Ga2SendAbsracted( p, pPars->fVerbose );
1797  fOneIsSent = 1;
1798  }
1799  }
1800  // if abstraction grew more than a certain percentage, force a restart
1801  if ( pPars->nRatioMax == 0 )
1802  continue;
1803  if ( c > 0 && (f > 20 || Vec_IntSize(p->vAbs) > 100) && Vec_IntSize(p->vAbs) - nAbsOld >= nAbsOld * pPars->nRatioMax / 100 )
1804  {
1805  if ( p->pPars->fVerbose )
1806  Abc_Print( 1, "Forcing restart because abstraction grew from %d to %d (more than %d %%).\n",
1807  nAbsOld, Vec_IntSize(p->vAbs), pPars->nRatioMax );
1808  break;
1809  }
1810  }
1811  }
1812 finish:
1813  Prf_ManStopP( &p->pSat->pPrf2 );
1814  // cancel old one if it is proving
1815  if ( iFrameTryToProve >= 0 )
1816  Gia_GlaProveCancel( pPars->fVerbose );
1817  // analize the results
1818  if ( !p->fUseNewLine )
1819  Abc_Print( 1, "\n" );
1820  if ( RetValue == 1 )
1821  Abc_Print( 1, "GLA completed %d frames and proved abstraction derived in frame %d ", p->pPars->iFrameProved+1, iFrameTryToProve );
1822  else if ( pAig->pCexSeq == NULL )
1823  {
1824  Vec_IntFreeP( &pAig->vGateClasses );
1825  pAig->vGateClasses = Ga2_ManAbsTranslate( p );
1826  if ( p->pPars->nTimeOut && Abc_Clock() >= p->pSat->nRuntimeLimit )
1827  Abc_Print( 1, "GLA reached timeout %d sec in frame %d with a %d-stable abstraction. ", p->pPars->nTimeOut, p->pPars->iFrameProved+1, p->pPars->nFramesNoChange );
1828  else if ( pPars->nConfLimit && sat_solver2_nconflicts(p->pSat) >= pPars->nConfLimit )
1829  Abc_Print( 1, "GLA exceeded %d conflicts in frame %d with a %d-stable abstraction. ", pPars->nConfLimit, p->pPars->iFrameProved+1, p->pPars->nFramesNoChange );
1830  else if ( pPars->nRatioMin2 && Vec_IntSize(p->vAbs) >= p->nMarked * pPars->nRatioMin2 / 100 )
1831  Abc_Print( 1, "GLA found that the size of abstraction exceeds %d %% in frame %d during refinement. ", pPars->nRatioMin2, p->pPars->iFrameProved+1 );
1832  else if ( pPars->nRatioMin && Vec_IntSize(p->vAbs) >= p->nMarked * pPars->nRatioMin / 100 )
1833  Abc_Print( 1, "GLA found that the size of abstraction exceeds %d %% in frame %d. ", pPars->nRatioMin, p->pPars->iFrameProved+1 );
1834  else
1835  Abc_Print( 1, "GLA finished %d frames and produced a %d-stable abstraction. ", p->pPars->iFrameProved+1, p->pPars->nFramesNoChange );
1836  p->pPars->iFrame = p->pPars->iFrameProved;
1837  }
1838  else
1839  {
1840  if ( p->pPars->fVerbose )
1841  Abc_Print( 1, "\n" );
1842  if ( !Gia_ManVerifyCex( pAig, pAig->pCexSeq, 0 ) )
1843  Abc_Print( 1, " Gia_ManPerformGlaOld(): CEX verification has failed!\n" );
1844  Abc_Print( 1, "True counter-example detected in frame %d. ", f );
1845  p->pPars->iFrame = f - 1;
1846  Vec_IntFreeP( &pAig->vGateClasses );
1847  RetValue = 0;
1848  }
1849  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
1850  if ( p->pPars->fVerbose )
1851  {
1852  p->timeOther = (Abc_Clock() - clk) - p->timeUnsat - p->timeSat - p->timeCex - p->timeInit;
1853  ABC_PRTP( "Runtime: Initializing", p->timeInit, Abc_Clock() - clk );
1854  ABC_PRTP( "Runtime: Solver UNSAT", p->timeUnsat, Abc_Clock() - clk );
1855  ABC_PRTP( "Runtime: Solver SAT ", p->timeSat, Abc_Clock() - clk );
1856  ABC_PRTP( "Runtime: Refinement ", p->timeCex, Abc_Clock() - clk );
1857  ABC_PRTP( "Runtime: Other ", p->timeOther, Abc_Clock() - clk );
1858  ABC_PRTP( "Runtime: TOTAL ", Abc_Clock() - clk, Abc_Clock() - clk );
1859  Ga2_ManReportMemory( p );
1860  }
1861 // Ga2_ManDumpStats( p->pGia, p->pPars, p->pSat, p->pPars->iFrameProved, 0 );
1862  Ga2_ManStop( p );
1863  fflush( stdout );
1864  return RetValue;
1865 }
static int sat_solver2_nlearnts(sat_solver2 *s)
Definition: satSolver2.h:200
ABC_DLL int Abc_FrameIsBridgeMode()
Definition: mainFrame.c:94
void Ga2_ManShrinkAbs(Ga2_Man_t *p, int nAbs, int nValues, int nSatVars)
Definition: absGla.c:1009
int nPdrCalls
Definition: absGla.c:64
abctime timeCex
Definition: absGla.c:80
void Gia_GlaProveAbsracted(Gia_Man_t *p, int fSimpProver, int fVerbose)
DECLARATIONS ///.
Definition: absPth.c:45
abctime timeSat
Definition: absGla.c:78
int Gia_ManVerifyCex(Gia_Man_t *pAig, Abc_Cex_t *p, int fDualOut)
DECLARATIONS ///.
Definition: giaCex.c:44
void Gia_GlaProveCancel(int fVerbose)
Definition: absPth.c:46
void * Sat_ProofCore(sat_solver2 *s)
Definition: satSolver2.c:1985
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
void Ga2_ManAddToAbs(Ga2_Man_t *p, Vec_Int_t *vToAdd)
Definition: absGla.c:979
static Vec_Int_t * Ga2_MapFrameMap(Ga2_Man_t *p, int f)
Definition: absGla.c:95
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_IntFillExtra(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:376
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
int Cmd_CommandExecute(void *pAbc, char *pCommandLine)
Vec_Int_t * vValues
Definition: absGla.c:49
#define l_Undef
Definition: SolverTypes.h:86
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
int fUseNewLine
Definition: absGla.c:54
Vec_Int_t * vProofIds
Definition: absGla.c:47
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define l_True
Definition: SolverTypes.h:84
ABC_DLL void Abc_FrameSetStatus(int Status)
Definition: mainFrame.c:88
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int nCexes
Definition: absGla.c:62
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
int var_is_assigned(sat_solver2 *s, int v)
Definition: satSolver2.c:83
void sat_solver2_setnvars(sat_solver2 *s, int n)
Definition: satSolver2.c:1170
static void Rnm_ManSetRefId(Rnm_Man_t *p, int RefId)
Definition: absRef.h:100
Abc_Cex_t * Abc_CexMakeTriv(int nRegs, int nTruePis, int nTruePos, int iFrameOut)
Definition: utilCex.c:85
void Ga2_ManReportMemory(Ga2_Man_t *p)
Definition: absGla.c:432
abctime timeInit
Definition: absGla.c:77
#define ABC_PRTP(a, t, T)
Definition: abc_global.h:223
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
void Ga2_ManAbsPrintFrame(Ga2_Man_t *p, int nFrames, int nConfls, int nCexes, abctime Time, int fFinal)
Definition: absGla.c:1369
Ga2_Man_t * Ga2_ManStart(Gia_Man_t *pGia, Abs_Par_t *pPars)
Definition: absGla.c:372
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
Rnm_Man_t * pRnm
Definition: absGla.c:56
static Prf_Man_t * Prf_ManAlloc()
FUNCTION DECLARATIONS ///.
Definition: satProof2.h:81
void sat_solver2_rollback(sat_solver2 *s)
Definition: satSolver2.c:1586
Vec_Ptr_t * vId2Lit
Definition: absGla.c:59
ABC_DLL void Abc_FrameSetCex(Abc_Cex_t *pCex)
Definition: mainFrame.c:86
int nSatVars
Definition: absGla.c:61
Vec_Int_t * vGateClasses
Definition: gia.h:141
Abs_Par_t * pPars
Definition: absGla.c:42
Gia_Man_t * pGia
Definition: absGla.c:41
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
void * Abc_FrameGetGlobalFrame()
Definition: mainFrame.c:593
char * sprintf()
void Gia_Ga2SendCancel(Ga2_Man_t *p, int fVerbose)
Definition: absGla.c:1480
int nMarked
Definition: absGla.c:53
void Gia_Ga2SendAbsracted(Ga2_Man_t *p, int fVerbose)
Definition: absGla.c:1464
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
void Ga2_ManAddAbsClauses(Ga2_Man_t *p, int f)
Definition: absGla.c:959
static void sat_solver2_bookmark(sat_solver2 *s)
Definition: satSolver2.h:248
static int Ga2_ObjFindLit(Ga2_Man_t *p, Gia_Obj_t *pObj, int f)
Definition: absGla.c:98
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
ABC_INT64_T nConfLimit
Definition: satSolver2.h:173
abctime timeOther
Definition: absGla.c:81
char * Ga2_GlaGetFileName(Ga2_Man_t *p, int fAbs)
Definition: absGla.c:1406
void Ga2_GlaDumpAbsracted(Ga2_Man_t *p, int fVerbose)
Definition: absGla.c:1421
static void Prf_ManRestart(Prf_Man_t *p, Vec_Int_t *vId2Pr, int iFirst, int nWidth)
Definition: satProof2.h:120
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
abctime timeUnsat
Definition: absGla.c:79
static void Prf_ManGrow(Prf_Man_t *p, int nWidth)
Definition: satProof2.h:129
sat_solver2 * pSat
Definition: absGla.c:60
ABC_DLL void Abc_FrameSetNFrames(int nFrames)
Definition: mainFrame.c:87
int nProofIds
Definition: absGla.c:50
Vec_Int_t * Ga2_ManAbsTranslate(Ga2_Man_t *p)
Definition: absGla.c:1077
#define ABC_FREE(obj)
Definition: abc_global.h:232
static int sat_solver2_nvars(sat_solver2 *s)
Definition: satSolver2.h:190
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
Prf_Man_t * pPrf2
Definition: satSolver2.h:166
#define l_False
Definition: SolverTypes.h:85
static int Gia_ObjFaninId0p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:463
int sat_solver2_solve(sat_solver2 *s, lit *begin, lit *end, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, ABC_INT64_T nConfLimitGlobal, ABC_INT64_T nInsLimitGlobal)
Definition: satSolver2.c:1835
static void Prf_ManStopP(Prf_Man_t **p)
Definition: satProof2.h:99
#define assert(ex)
Definition: util_old.h:213
char * Extra_FileNameGenericAppend(char *pBase, char *pSuffix)
Vec_Int_t * Ga2_ManRefine(Ga2_Man_t *p)
Definition: absGla.c:1280
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
ABC_INT64_T abctime
Definition: abc_global.h:278
Vec_Int_t * vAbs
Definition: absGla.c:48
void Ga2_ManRestart(Ga2_Man_t *p)
Definition: absGla.c:1112
abctime nRuntimeLimit
Definition: satSolver2.h:175
static int sat_solver2_nconflicts(sat_solver2 *s)
Definition: satSolver2.h:205
void Ga2_ManStop(Ga2_Man_t *p)
Definition: absGla.c:460
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
int Gia_GlaProveCheck(int fVerbose)
Definition: absPth.c:47
Abc_Cex_t * pCexSeq
Definition: gia.h:136
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
int Gia_ManPerformGlaOld ( Gia_Man_t pAig,
Abs_Par_t pPars,
int  fStartVta 
)

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

Synopsis [Performs gate-level abstraction]

Description []

SideEffects []

SeeAlso []

Definition at line 1638 of file absGlaOld.c.

1639 {
1640  extern int Gia_VtaPerformInt( Gia_Man_t * pAig, Abs_Par_t * pPars );
1641  extern void Ga2_ManDumpStats( Gia_Man_t * pGia, Abs_Par_t * pPars, sat_solver2 * pSat, int iFrame, int fUseN );
1642  Gla_Man_t * p;
1643  Vec_Int_t * vPPis, * vCore;//, * vCore2 = NULL;
1644  Abc_Cex_t * pCex = NULL;
1645  int f, i, iPrev, nConfls, Status, nVarsOld = 0, nCoreSize, fOneIsSent = 0, RetValue = -1;
1646  abctime clk2, clk = Abc_Clock();
1647  // preconditions
1648  assert( Gia_ManPoNum(pAig) == 1 );
1649  assert( pPars->nFramesMax == 0 || pPars->nFramesStart <= pPars->nFramesMax );
1650  if ( Gia_ObjIsConst0(Gia_ObjFanin0(Gia_ManPo(pAig,0))) )
1651  {
1652  if ( !Gia_ObjFaninC0(Gia_ManPo(pAig,0)) )
1653  {
1654  printf( "Sequential miter is trivially UNSAT.\n" );
1655  return 1;
1656  }
1657  ABC_FREE( pAig->pCexSeq );
1658  pAig->pCexSeq = Abc_CexMakeTriv( Gia_ManRegNum(pAig), Gia_ManPiNum(pAig), 1, 0 );
1659  printf( "Sequential miter is trivially SAT.\n" );
1660  return 0;
1661  }
1662 
1663  // compute intial abstraction
1664  if ( pAig->vGateClasses == NULL )
1665  {
1666  if ( fStartVta )
1667  {
1668  int nFramesMaxOld = pPars->nFramesMax;
1669  int nFramesStartOld = pPars->nFramesStart;
1670  int nTimeOutOld = pPars->nTimeOut;
1671  int nDumpOld = pPars->fDumpVabs;
1672  pPars->nFramesMax = pPars->nFramesStart;
1673  pPars->nFramesStart = Abc_MinInt( pPars->nFramesStart/2 + 1, 3 );
1674  pPars->nTimeOut = 20;
1675  pPars->fDumpVabs = 0;
1676  RetValue = Gia_VtaPerformInt( pAig, pPars );
1677  pPars->nFramesMax = nFramesMaxOld;
1678  pPars->nFramesStart = nFramesStartOld;
1679  pPars->nTimeOut = nTimeOutOld;
1680  pPars->fDumpVabs = nDumpOld;
1681  // create gate classes
1682  Vec_IntFreeP( &pAig->vGateClasses );
1683  if ( pAig->vObjClasses )
1684  pAig->vGateClasses = Gia_VtaConvertToGla( pAig, pAig->vObjClasses );
1685  Vec_IntFreeP( &pAig->vObjClasses );
1686  // return if VTA solve the problem if could not start
1687  if ( RetValue == 0 || pAig->vGateClasses == NULL )
1688  return RetValue;
1689  }
1690  else
1691  {
1692  pAig->vGateClasses = Vec_IntStart( Gia_ManObjNum(pAig) );
1693  Vec_IntWriteEntry( pAig->vGateClasses, 0, 1 );
1694  Vec_IntWriteEntry( pAig->vGateClasses, Gia_ObjFaninId0p(pAig, Gia_ManPo(pAig, 0)), 1 );
1695  }
1696  }
1697  // start the manager
1698  p = Gla_ManStart( pAig, pPars );
1699  p->timeInit = Abc_Clock() - clk;
1700  // set runtime limit
1701  if ( p->pPars->nTimeOut )
1702  sat_solver2_set_runtime_limit( p->pSat, p->pPars->nTimeOut * CLOCKS_PER_SEC + Abc_Clock() );
1703  // perform initial abstraction
1704  if ( p->pPars->fVerbose )
1705  {
1706  Abc_Print( 1, "Running gate-level abstraction (GLA) with the following parameters:\n" );
1707  Abc_Print( 1, "FrameMax = %d ConfMax = %d Timeout = %d RatioMin = %d %%.\n",
1708  pPars->nFramesMax, pPars->nConfLimit, pPars->nTimeOut, pPars->nRatioMin );
1709  Abc_Print( 1, "LearnStart = %d LearnDelta = %d LearnRatio = %d %%.\n",
1710  pPars->nLearnedStart, pPars->nLearnedDelta, pPars->nLearnedPerce );
1711  Abc_Print( 1, " Frame %% Abs PPI FF LUT Confl Cex Vars Clas Lrns Time Mem\n" );
1712  }
1713  for ( f = i = iPrev = 0; !p->pPars->nFramesMax || f < p->pPars->nFramesMax; f++, iPrev = i )
1714  {
1715  int nConflsBeg = sat_solver2_nconflicts(p->pSat);
1716  p->pPars->iFrame = f;
1717 
1718  // load timeframe
1719  Gia_GlaAddTimeFrame( p, f );
1720 
1721  // iterate as long as there are counter-examples
1722  for ( i = 0; ; i++ )
1723  {
1724  clk2 = Abc_Clock();
1725  vCore = Gla_ManUnsatCore( p, f, p->pSat, pPars->nConfLimit, pPars->fVerbose, &Status, &nConfls );
1726 // assert( (vCore != NULL) == (Status == 1) );
1727  if ( Status == -1 || (p->pSat->nRuntimeLimit && Abc_Clock() > p->pSat->nRuntimeLimit) ) // resource limit is reached
1728  {
1729  Prf_ManStopP( &p->pSat->pPrf2 );
1730 // if ( Gia_ManRegNum(p->pGia) > 1 ) // for comb cases, return the abstraction
1731 // Vec_IntShrink( p->vAbs, p->nAbsOld );
1732  goto finish;
1733  }
1734  if ( Status == 1 )
1735  {
1736  Prf_ManStopP( &p->pSat->pPrf2 );
1737  p->timeUnsat += Abc_Clock() - clk2;
1738  break;
1739  }
1740  p->timeSat += Abc_Clock() - clk2;
1741  assert( Status == 0 );
1742  p->nCexes++;
1743 
1744  // cancel old one if it was sent
1745  if ( Abc_FrameIsBridgeMode() && fOneIsSent )
1746  {
1747  Gia_GlaSendCancel( p, pPars->fVerbose );
1748  fOneIsSent = 0;
1749  }
1750 
1751  // perform the refinement
1752  clk2 = Abc_Clock();
1753  if ( pPars->fAddLayer )
1754  {
1755  vPPis = Gla_ManCollectPPis( p, NULL );
1756 // Gla_ManExplorePPis( p, vPPis );
1757  }
1758  else
1759  {
1760  vPPis = Gla_ManRefinement( p );
1761  if ( vPPis == NULL )
1762  {
1763  Prf_ManStopP( &p->pSat->pPrf2 );
1764  pCex = p->pGia->pCexSeq; p->pGia->pCexSeq = NULL;
1765  break;
1766  }
1767  }
1768  assert( pCex == NULL );
1769 
1770  // start proof logging
1771  if ( i == 0 )
1772  {
1773  // create bookmark to be used for rollback
1774  sat_solver2_bookmark( p->pSat );
1775  Vec_IntClear( p->vAddedNew );
1776  p->nAbsOld = Vec_IntSize( p->vAbs );
1777  nVarsOld = p->nSatVars;
1778 // p->nLrnOld = sat_solver2_nlearnts( p->pSat );
1779 // p->nAbsNew = 0;
1780 // p->nLrnNew = 0;
1781 
1782  // start incremental proof manager
1783  assert( p->pSat->pPrf2 == NULL );
1784  if ( p->pSat->pPrf1 == NULL )
1785  p->pSat->pPrf2 = Prf_ManAlloc();
1786  if ( p->pSat->pPrf2 )
1787  {
1788  p->nProofIds = 0;
1789  Vec_IntFill( p->vProofIds, Gia_ManObjNum(p->pGia), -1 );
1791  }
1792  }
1793  else
1794  {
1795  // resize the proof logger
1796  if ( p->pSat->pPrf2 )
1797  Prf_ManGrow( p->pSat->pPrf2, p->nProofIds + Vec_IntSize(vPPis) );
1798  }
1799 
1800  Gia_GlaAddToAbs( p, vPPis, 1 );
1801  Gia_GlaAddOneSlice( p, f, vPPis );
1802  Vec_IntFree( vPPis );
1803 
1804  // print the result (do not count it towards change)
1805  if ( p->pPars->fVerbose )
1806  Gla_ManAbsPrintFrame( p, -1, f+1, sat_solver2_nconflicts(p->pSat)-nConflsBeg, i, Abc_Clock() - clk );
1807  }
1808  if ( pCex != NULL )
1809  break;
1810  assert( Status == 1 );
1811 
1812  // valid core is obtained
1813  nCoreSize = 1;
1814  if ( vCore )
1815  {
1816  nCoreSize += Vec_IntSize( vCore );
1817  Gia_GlaAddToCounters( p, vCore );
1818  }
1819  if ( i == 0 )
1820  {
1821  p->pPars->nFramesNoChange++;
1822  Vec_IntFreeP( &vCore );
1823  }
1824  else
1825  {
1826  p->pPars->nFramesNoChange = 0;
1827 // p->nAbsNew = Vec_IntSize( p->vAbs ) - p->nAbsOld;
1828 // p->nLrnNew = Abc_AbsInt( sat_solver2_nlearnts( p->pSat ) - p->nLrnOld );
1829  // update the SAT solver
1830  sat_solver2_rollback( p->pSat );
1831  // update storage
1832  Gla_ManRollBack( p );
1833  p->nSatVars = nVarsOld;
1834  // load this timeframe
1835  Gia_GlaAddToAbs( p, vCore, 0 );
1836  Gia_GlaAddOneSlice( p, f, vCore );
1837  Vec_IntFree( vCore );
1838  // run SAT solver
1839  clk2 = Abc_Clock();
1840  vCore = Gla_ManUnsatCore( p, f, p->pSat, pPars->nConfLimit, p->pPars->fVerbose, &Status, &nConfls );
1841  p->timeUnsat += Abc_Clock() - clk2;
1842 // assert( (vCore != NULL) == (Status == 1) );
1843  Vec_IntFreeP( &vCore );
1844  if ( Status == -1 ) // resource limit is reached
1845  break;
1846  if ( Status == 0 )
1847  {
1848  assert( 0 );
1849  // Vta_ManSatVerify( p );
1850  // make sure, there was no initial abstraction (otherwise, it was invalid)
1851  assert( pAig->vObjClasses == NULL && f < p->pPars->nFramesStart );
1852  // pCex = Vga_ManDeriveCex( p );
1853  break;
1854  }
1855  }
1856  // print the result
1857  if ( p->pPars->fVerbose )
1858  Gla_ManAbsPrintFrame( p, nCoreSize, f+1, sat_solver2_nconflicts(p->pSat)-nConflsBeg, i, Abc_Clock() - clk );
1859 
1860  if ( f > 2 && iPrev > 0 && i == 0 ) // change has happened
1861  {
1862  if ( Abc_FrameIsBridgeMode() )
1863  {
1864  // cancel old one if it was sent
1865  if ( fOneIsSent )
1866  Gia_GlaSendCancel( p, pPars->fVerbose );
1867  // send new one
1868  Gia_GlaSendAbsracted( p, pPars->fVerbose );
1869  fOneIsSent = 1;
1870  }
1871 
1872  // dump the model into file
1873  if ( p->pPars->fDumpVabs )
1874  {
1875  char Command[1000];
1876  Abc_FrameSetStatus( -1 );
1877  Abc_FrameSetCex( NULL );
1878  Abc_FrameSetNFrames( f+1 );
1879  sprintf( Command, "write_status %s", Extra_FileNameGenericAppend((char *)(p->pPars->pFileVabs ? p->pPars->pFileVabs : "glabs.aig"), ".status") );
1881  Gia_GlaDumpAbsracted( p, pPars->fVerbose );
1882  }
1883  }
1884 
1885  // check if the number of objects is below limit
1886  if ( Gia_GlaAbsCount(p,0,0) >= (p->nObjs - 1) * (100 - pPars->nRatioMin) / 100 )
1887  {
1888  Status = -1;
1889  break;
1890  }
1891  }
1892 finish:
1893  // analize the results
1894  if ( pCex == NULL )
1895  {
1896  if ( p->pPars->fVerbose && Status == -1 )
1897  printf( "\n" );
1898 // if ( pAig->vGateClasses != NULL )
1899 // Abc_Print( 1, "Replacing the old abstraction by a new one.\n" );
1900  Vec_IntFreeP( &pAig->vGateClasses );
1901  pAig->vGateClasses = Gla_ManTranslate( p );
1902  if ( Status == -1 )
1903  {
1904  if ( p->pPars->nTimeOut && Abc_Clock() >= p->pSat->nRuntimeLimit )
1905  Abc_Print( 1, "Timeout %d sec in frame %d with a %d-stable abstraction. ", p->pPars->nTimeOut, f, p->pPars->nFramesNoChange );
1906  else if ( pPars->nConfLimit && sat_solver2_nconflicts(p->pSat) >= pPars->nConfLimit )
1907  Abc_Print( 1, "Exceeded %d conflicts in frame %d with a %d-stable abstraction. ", pPars->nConfLimit, f, p->pPars->nFramesNoChange );
1908  else if ( Gia_GlaAbsCount(p,0,0) >= (p->nObjs - 1) * (100 - pPars->nRatioMin) / 100 )
1909  Abc_Print( 1, "The ratio of abstracted objects is less than %d %% in frame %d. ", pPars->nRatioMin, f );
1910  else
1911  Abc_Print( 1, "Abstraction stopped for unknown reason in frame %d. ", f );
1912  }
1913  else
1914  {
1915  p->pPars->iFrame++;
1916  Abc_Print( 1, "GLA completed %d frames with a %d-stable abstraction. ", f, p->pPars->nFramesNoChange );
1917  }
1918  }
1919  else
1920  {
1921  if ( p->pPars->fVerbose )
1922  printf( "\n" );
1923  ABC_FREE( pAig->pCexSeq );
1924  pAig->pCexSeq = pCex;
1925  if ( !Gia_ManVerifyCex( pAig, pCex, 0 ) )
1926  Abc_Print( 1, " Gia_ManPerformGlaOld(): CEX verification has failed!\n" );
1927  Abc_Print( 1, "Counter-example detected in frame %d. ", f );
1928  p->pPars->iFrame = pCex->iFrame - 1;
1929  Vec_IntFreeP( &pAig->vGateClasses );
1930  RetValue = 0;
1931  }
1932  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
1933  if ( p->pPars->fVerbose )
1934  {
1935  p->timeOther = (Abc_Clock() - clk) - p->timeUnsat - p->timeSat - p->timeCex - p->timeInit;
1936  ABC_PRTP( "Runtime: Initializing", p->timeInit, Abc_Clock() - clk );
1937  ABC_PRTP( "Runtime: Solver UNSAT", p->timeUnsat, Abc_Clock() - clk );
1938  ABC_PRTP( "Runtime: Solver SAT ", p->timeSat, Abc_Clock() - clk );
1939  ABC_PRTP( "Runtime: Refinement ", p->timeCex, Abc_Clock() - clk );
1940  ABC_PRTP( "Runtime: Other ", p->timeOther, Abc_Clock() - clk );
1941  ABC_PRTP( "Runtime: TOTAL ", Abc_Clock() - clk, Abc_Clock() - clk );
1942  Gla_ManReportMemory( p );
1943  }
1944 // Ga2_ManDumpStats( pAig, p->pPars, p->pSat, p->pPars->iFrame, 1 );
1945  Gla_ManStop( p );
1946  fflush( stdout );
1947  return RetValue;
1948 }
static int sat_solver2_nlearnts(sat_solver2 *s)
Definition: satSolver2.h:200
void Gia_GlaSendAbsracted(Gla_Man_t *p, int fVerbose)
Definition: absGlaOld.c:1574
Vec_Int_t * vAbs
Definition: absGlaOld.c:69
abctime timeCex
Definition: absGlaOld.c:99
void Gia_GlaAddTimeFrame(Gla_Man_t *p, int f)
Definition: absGlaOld.c:1389
ABC_DLL int Abc_FrameIsBridgeMode()
Definition: mainFrame.c:94
void Gia_GlaAddToAbs(Gla_Man_t *p, Vec_Int_t *vAbsAdd, int fCheck)
Definition: absGlaOld.c:1368
sat_solver2 * pSat
Definition: absGlaOld.c:83
Vec_Int_t * Gla_ManRefinement(Gla_Man_t *p)
Definition: absGlaOld.c:499
int Gia_ManVerifyCex(Gia_Man_t *pAig, Abc_Cex_t *p, int fDualOut)
DECLARATIONS ///.
Definition: giaCex.c:44
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
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
int Cmd_CommandExecute(void *pAbc, char *pCommandLine)
static Vec_Int_t * Gla_ManCollectPPis(Gla_Man_t *p, Vec_Int_t *vPis)
Definition: absGlaOld.c:1234
Vec_Int_t * vObjClasses
Definition: gia.h:142
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
void Ga2_ManDumpStats(Gia_Man_t *pGia, Abs_Par_t *pPars, sat_solver2 *pSat, int iFrame, int fUseN)
Definition: absGla.c:410
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
Vec_Int_t * Gla_ManUnsatCore(Gla_Man_t *p, int f, sat_solver2 *pSat, int nConfMax, int fVerbose, int *piRetValue, int *pnConfls)
Definition: absGlaOld.c:1445
Vec_Int_t * Gia_VtaConvertToGla(Gia_Man_t *p, Vec_Int_t *vVta)
Definition: absUtil.c:78
ABC_DLL void Abc_FrameSetStatus(int Status)
Definition: mainFrame.c:88
static abctime Abc_Clock()
Definition: abc_global.h:279
void Gla_ManStop(Gla_Man_t *p)
Definition: absGlaOld.c:1094
abctime timeInit
Definition: absGlaOld.c:96
abctime timeOther
Definition: absGlaOld.c:100
Abs_Par_t * pPars
Definition: absGlaOld.c:67
Gia_Man_t * pGia
Definition: absGlaOld.c:66
Abc_Cex_t * Abc_CexMakeTriv(int nRegs, int nTruePis, int nTruePos, int iFrameOut)
Definition: utilCex.c:85
#define ABC_PRTP(a, t, T)
Definition: abc_global.h:223
int Gia_GlaAbsCount(Gla_Man_t *p, int fRo, int fAnd)
Definition: absGlaOld.c:1141
int Gia_VtaPerformInt(Gia_Man_t *pAig, Abs_Par_t *pPars)
Definition: absVta.c:1492
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Abc_MinInt(int a, int b)
Definition: abc_global.h:239
Vec_Int_t * vAddedNew
Definition: absGlaOld.c:85
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static Prf_Man_t * Prf_ManAlloc()
FUNCTION DECLARATIONS ///.
Definition: satProof2.h:81
void sat_solver2_rollback(sat_solver2 *s)
Definition: satSolver2.c:1586
ABC_DLL void Abc_FrameSetCex(Abc_Cex_t *pCex)
Definition: mainFrame.c:86
Vec_Int_t * vGateClasses
Definition: gia.h:141
void Gia_GlaAddToCounters(Gla_Man_t *p, Vec_Int_t *vCore)
Definition: absGlaOld.c:1361
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
void * Abc_FrameGetGlobalFrame()
Definition: mainFrame.c:593
char * sprintf()
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
static void sat_solver2_bookmark(sat_solver2 *s)
Definition: satSolver2.h:248
void Gia_GlaSendCancel(Gla_Man_t *p, int fVerbose)
Definition: absGlaOld.c:1589
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
ABC_INT64_T nConfLimit
Definition: satSolver2.h:173
int nSatVars
Definition: absGlaOld.c:81
static void Prf_ManRestart(Prf_Man_t *p, Vec_Int_t *vId2Pr, int iFirst, int nWidth)
Definition: satProof2.h:120
int nAbsOld
Definition: absGlaOld.c:74
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static void Prf_ManGrow(Prf_Man_t *p, int nWidth)
Definition: satProof2.h:129
void Gla_ManAbsPrintFrame(Gla_Man_t *p, int nCoreSize, int nFrames, int nConfls, int nCexes, abctime Time)
Definition: absGlaOld.c:1509
ABC_DLL void Abc_FrameSetNFrames(int nFrames)
Definition: mainFrame.c:87
abctime timeSat
Definition: absGlaOld.c:97
void Gia_GlaDumpAbsracted(Gla_Man_t *p, int fVerbose)
Definition: absGlaOld.c:1609
Vec_Set_t * pPrf1
Definition: satSolver2.h:162
void Gia_GlaAddOneSlice(Gla_Man_t *p, int fCur, Vec_Int_t *vCore)
Definition: absGlaOld.c:1397
#define ABC_FREE(obj)
Definition: abc_global.h:232
Definition: gia.h:95
abctime timeUnsat
Definition: absGlaOld.c:98
Prf_Man_t * pPrf2
Definition: satSolver2.h:166
int nCexes
Definition: absGlaOld.c:79
static int Gia_ObjFaninId0p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:463
int nObjs
Definition: absGlaOld.c:73
static void Prf_ManStopP(Prf_Man_t **p)
Definition: satProof2.h:99
Vec_Int_t * Gla_ManTranslate(Gla_Man_t *p)
Definition: absGlaOld.c:1184
void Gla_ManRollBack(Gla_Man_t *p)
Definition: absGlaOld.c:1405
#define assert(ex)
Definition: util_old.h:213
char * Extra_FileNameGenericAppend(char *pBase, char *pSuffix)
int nProofIds
Definition: absGlaOld.c:89
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition: utilCex.h:39
Gla_Man_t * Gla_ManStart(Gia_Man_t *pGia0, Abs_Par_t *pPars)
Definition: absGlaOld.c:825
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
ABC_INT64_T abctime
Definition: abc_global.h:278
abctime nRuntimeLimit
Definition: satSolver2.h:175
static int sat_solver2_nconflicts(sat_solver2 *s)
Definition: satSolver2.h:205
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
typedefABC_NAMESPACE_HEADER_START struct Abs_Par_t_ Abs_Par_t
INCLUDES ///.
Definition: abs.h:46
Vec_Int_t * vProofIds
Definition: absGlaOld.c:88
static abctime sat_solver2_set_runtime_limit(sat_solver2 *s, abctime Limit)
Definition: satSolver2.h:234
Abc_Cex_t * pCexSeq
Definition: gia.h:136
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
void Gla_ManReportMemory(Gla_Man_t *p)
Definition: absGlaOld.c:1537
void Gia_ManPrintFlopClasses ( Gia_Man_t p)

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

Synopsis [Prints stats for the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 301 of file absDup.c.

302 {
303  int Counter0, Counter1;
304  if ( p->vFlopClasses == NULL )
305  return;
306  if ( Vec_IntSize(p->vFlopClasses) != Gia_ManRegNum(p) )
307  {
308  printf( "Gia_ManPrintFlopClasses(): The number of flop map entries differs from the number of flops.\n" );
309  return;
310  }
311  Counter0 = Vec_IntCountEntry( p->vFlopClasses, 0 );
312  Counter1 = Vec_IntCountEntry( p->vFlopClasses, 1 );
313  printf( "Flop-level abstraction: Excluded FFs = %d Included FFs = %d (%.2f %%) ",
314  Counter0, Counter1, 100.0*Counter1/(Counter0 + Counter1 + 1) );
315  if ( Counter0 + Counter1 < Gia_ManRegNum(p) )
316  printf( "and there are other FF classes..." );
317  printf( "\n" );
318 }
static int Vec_IntCountEntry(Vec_Int_t *p, int Entry)
Definition: vecInt.h:1156
Vec_Int_t * vFlopClasses
Definition: gia.h:140
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
void Gia_ManPrintGateClasses ( Gia_Man_t p)

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

Synopsis [Prints stats for the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 331 of file absDup.c.

332 {
333  Vec_Int_t * vPis, * vPPis, * vFlops, * vNodes;
334  int nTotal;
335  if ( p->vGateClasses == NULL )
336  return;
337  if ( Vec_IntSize(p->vGateClasses) != Gia_ManObjNum(p) )
338  {
339  printf( "Gia_ManPrintGateClasses(): The number of flop map entries differs from the number of flops.\n" );
340  return;
341  }
342  // create additional arrays
343  Gia_ManGlaCollect( p, p->vGateClasses, &vPis, &vPPis, &vFlops, &vNodes );
344  nTotal = 1 + Vec_IntSize(vFlops) + Vec_IntSize(vNodes);
345  printf( "Gate-level abstraction: PI = %d PPI = %d FF = %d (%.2f %%) AND = %d (%.2f %%) Obj = %d (%.2f %%)\n",
346  Vec_IntSize(vPis), Vec_IntSize(vPPis),
347  Vec_IntSize(vFlops), 100.0*Vec_IntSize(vFlops)/(Gia_ManRegNum(p)+1),
348  Vec_IntSize(vNodes), 100.0*Vec_IntSize(vNodes)/(Gia_ManAndNum(p)+1),
349  nTotal, 100.0*nTotal /(Gia_ManRegNum(p)+Gia_ManAndNum(p)+1) );
350  Vec_IntFree( vPis );
351  Vec_IntFree( vPPis );
352  Vec_IntFree( vFlops );
353  Vec_IntFree( vNodes );
354 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void Gia_ManGlaCollect(Gia_Man_t *p, Vec_Int_t *vGateClasses, Vec_Int_t **pvPis, Vec_Int_t **pvPPis, Vec_Int_t **pvFlops, Vec_Int_t **pvNodes)
Definition: absDup.c:158
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
Vec_Int_t * vGateClasses
Definition: gia.h:141
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
int nTotal
DECLARATIONS ///.
Definition: cutTruth.c:37
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
void Gia_ManPrintObjClasses ( Gia_Man_t p)

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

Synopsis [Prints stats for the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 367 of file absDup.c.

368 {
369  Vec_Int_t * vSeens; // objects seen so far
370  Vec_Int_t * vAbs = p->vObjClasses;
371  int i, k, Entry, iStart, iStop = -1, nFrames;
372  int nObjBits, nObjMask, iObj, iFrame, nWords;
373  unsigned * pInfo;
374  int * pCountAll, * pCountUni;
375  if ( vAbs == NULL )
376  return;
377  nFrames = Vec_IntEntry( vAbs, 0 );
378  assert( Vec_IntEntry(vAbs, nFrames+1) == Vec_IntSize(vAbs) );
379  pCountAll = ABC_ALLOC( int, nFrames + 1 );
380  pCountUni = ABC_ALLOC( int, nFrames + 1 );
381  // start storage for seen objects
382  nWords = Abc_BitWordNum( nFrames );
383  vSeens = Vec_IntStart( Gia_ManObjNum(p) * nWords );
384  // get the bitmasks
385  nObjBits = Abc_Base2Log( Gia_ManObjNum(p) );
386  nObjMask = (1 << nObjBits) - 1;
387  assert( Gia_ManObjNum(p) <= nObjMask );
388  // print info about frames
389  printf( "Frame Core F0 F1 F2 F3 ...\n" );
390  for ( i = 0; i < nFrames; i++ )
391  {
392  iStart = Vec_IntEntry( vAbs, i+1 );
393  iStop = Vec_IntEntry( vAbs, i+2 );
394  memset( pCountAll, 0, sizeof(int) * (nFrames + 1) );
395  memset( pCountUni, 0, sizeof(int) * (nFrames + 1) );
396  Vec_IntForEachEntryStartStop( vAbs, Entry, k, iStart, iStop )
397  {
398  iObj = (Entry & nObjMask);
399  iFrame = (Entry >> nObjBits);
400  pInfo = (unsigned *)Vec_IntEntryP( vSeens, nWords * iObj );
401  if ( Abc_InfoHasBit(pInfo, iFrame) == 0 )
402  {
403  Abc_InfoSetBit( pInfo, iFrame );
404  pCountUni[iFrame+1]++;
405  pCountUni[0]++;
406  }
407  pCountAll[iFrame+1]++;
408  pCountAll[0]++;
409  }
410  assert( pCountAll[0] == (iStop - iStart) );
411 // printf( "%5d%5d ", pCountAll[0], pCountUni[0] );
412  printf( "%3d :", i );
413  printf( "%7d", pCountAll[0] );
414  if ( i >= 10 )
415  {
416  for ( k = 0; k < 4; k++ )
417  printf( "%5d", pCountAll[k+1] );
418  printf( " ..." );
419  for ( k = i-4; k <= i; k++ )
420  printf( "%5d", pCountAll[k+1] );
421  }
422  else
423  {
424  for ( k = 0; k <= i; k++ )
425  if ( k <= i )
426  printf( "%5d", pCountAll[k+1] );
427  }
428 // for ( k = 0; k < nFrames; k++ )
429 // if ( k <= i )
430 // printf( "%5d", pCountAll[k+1] );
431  printf( "\n" );
432  }
433  assert( iStop == Vec_IntSize(vAbs) );
434  Vec_IntFree( vSeens );
435  ABC_FREE( pCountAll );
436  ABC_FREE( pCountUni );
437 }
char * memset()
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
Vec_Int_t * vObjClasses
Definition: gia.h:142
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int nWords
Definition: abcNpn.c:127
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static void Abc_InfoSetBit(unsigned *p, int i)
Definition: abc_global.h:259
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define ABC_FREE(obj)
Definition: abc_global.h:232
static int Abc_Base2Log(unsigned n)
Definition: abc_global.h:251
static int Abc_BitWordNum(int nBits)
Definition: abc_global.h:255
#define assert(ex)
Definition: util_old.h:213
static int * Vec_IntEntryP(Vec_Int_t *p, int i)
Definition: vecInt.h:417
#define Vec_IntForEachEntryStartStop(vVec, Entry, i, Start, Stop)
Definition: vecInt.h:60
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
Gia_Man_t* Gia_ManShrinkGla ( Gia_Man_t p,
int  nFrameMax,
int  nTimeOut,
int  fUsePdr,
int  fUseSat,
int  fUseBdd,
int  fVerbose 
)

Definition at line 67 of file absIter.c.

68 {
69  Gia_Obj_t * pObj;
70  int i, iFrame0, iFrame;
71  int nTotal = 0, nRemoved = 0;
72  Vec_Int_t * vGScopy;
73  abctime clk, clkTotal = Abc_Clock();
74  assert( Gia_ManPoNum(p) == 1 );
75  assert( p->vGateClasses != NULL );
76  vGScopy = Vec_IntDup( p->vGateClasses );
77  if ( nFrameMax == 0 )
78  iFrame0 = Gia_IterTryImprove( p, 0, 0 );
79  else
80  iFrame0 = nFrameMax - 1;
81  while ( 1 )
82  {
83  int fChanges = 0;
84  Gia_ManForEachObj1( p, pObj, i )
85  {
86  if ( pObj->fMark0 )
87  continue;
88  if ( !Gia_ObjIsInGla(p, pObj) )
89  continue;
90  if ( pObj == Gia_ObjFanin0( Gia_ManPo(p, 0) ) )
91  continue;
92  if ( Gia_ObjIsAnd(pObj) )
93  {
94  if ( Gia_ObjIsInGla(p, Gia_ObjFanin0(pObj)) && Gia_ObjIsInGla(p, Gia_ObjFanin1(pObj)) )
95  continue;
96  }
97  if ( Gia_ObjIsRo(p, pObj) )
98  {
99  if ( Gia_ObjIsInGla(p, Gia_ObjFanin0(Gia_ObjRoToRi(p, pObj))) )
100  continue;
101  }
102  clk = Abc_Clock();
103  printf( "%5d : ", nTotal );
104  printf( "Obj =%7d ", i );
105  Gia_ObjRemFromGla( p, pObj );
106  iFrame = Gia_IterTryImprove( p, nTimeOut, iFrame0 );
107  if ( nFrameMax )
108  assert( iFrame <= nFrameMax );
109  else
110  assert( iFrame <= iFrame0 );
111  printf( "Frame =%6d ", iFrame );
112  if ( iFrame < iFrame0 )
113  {
114  pObj->fMark0 = 1;
115  Gia_ObjAddToGla( p, pObj );
116  printf( " " );
117  }
118  else
119  {
120  fChanges = 1;
121  nRemoved++;
122  printf( "Removing " );
123  Vec_IntWriteEntry( vGScopy, Gia_ObjId(p, pObj), 0 );
124  }
125  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
126  nTotal++;
127  // update the classes
128  Vec_IntFreeP( &p->vGateClasses );
129  p->vGateClasses = Vec_IntDup(vGScopy);
130  }
131  if ( !fChanges )
132  break;
133  }
135  Vec_IntFree( vGScopy );
136  printf( "Tried = %d. ", nTotal );
137  printf( "Removed = %d. (%.2f %%) ", nRemoved, 100.0 * nRemoved / Vec_IntCountPositive(p->vGateClasses) );
138  Abc_PrintTime( 1, "Time", Abc_Clock() - clkTotal );
139  return NULL;
140 }
static int Vec_IntCountPositive(Vec_Int_t *p)
Definition: vecInt.h:1175
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static void Gia_ObjAddToGla(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: absIter.c:32
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition: giaUtil.c:215
static abctime Abc_Clock()
Definition: abc_global.h:279
Definition: gia.h:75
int Gia_IterTryImprove(Gia_Man_t *p, int nTimeOut, int iFrame0)
FUNCTION DEFINITIONS ///.
Definition: absIter.c:50
static ABC_NAMESPACE_IMPL_START int Gia_ObjIsInGla(Gia_Man_t *p, Gia_Obj_t *pObj)
DECLARATIONS ///.
Definition: absIter.c:31
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
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
Vec_Int_t * vGateClasses
Definition: gia.h:141
static Gia_Obj_t * Gia_ObjRoToRi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:446
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
static void Gia_ObjRemFromGla(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: absIter.c:33
unsigned fMark0
Definition: gia.h:79
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
#define Gia_ManForEachObj1(p, pObj, i)
Definition: gia.h:986
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
ABC_INT64_T abctime
Definition: abc_global.h:278
int nTotal
DECLARATIONS ///.
Definition: cutTruth.c:37
Vec_Int_t* Gia_VtaConvertFromGla ( Gia_Man_t p,
Vec_Int_t vGla,
int  nFrames 
)

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

Synopsis [Converting GLA vector to VTA vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 111 of file absUtil.c.

112 {
113  Vec_Int_t * vVta;
114  int nObjBits, nObjMask, nObjs = Gia_ManObjNum(p);
115  int i, k, j, Entry, Counter, nGlaSize;
116  //. get the GLA size
117  nGlaSize = Vec_IntSum(vGla);
118  // get the bitmask
119  nObjBits = Abc_Base2Log(nObjs);
120  nObjMask = (1 << Abc_Base2Log(nObjs)) - 1;
121  assert( nObjs <= nObjMask );
122  // go through objects
123  vVta = Vec_IntAlloc( 1000 );
124  Vec_IntPush( vVta, nFrames );
125  Counter = nFrames + 2;
126  for ( i = 0; i <= nFrames; i++, Counter += i * nGlaSize )
127  Vec_IntPush( vVta, Counter );
128  for ( i = 0; i < nFrames; i++ )
129  for ( k = 0; k <= i; k++ )
130  Vec_IntForEachEntry( vGla, Entry, j )
131  if ( Entry )
132  Vec_IntPush( vVta, (k << nObjBits) | j );
133  Counter = Vec_IntEntry(vVta, nFrames+1);
134  assert( Vec_IntEntry(vVta, nFrames+1) == Vec_IntSize(vVta) );
135  return vVta;
136 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Counter
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Vec_IntSum(Vec_Int_t *p)
Definition: vecInt.h:1137
static int Abc_Base2Log(unsigned n)
Definition: abc_global.h:251
#define assert(ex)
Definition: util_old.h:213
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
Vec_Int_t* Gia_VtaConvertToGla ( Gia_Man_t p,
Vec_Int_t vVta 
)

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

Synopsis [Converting VTA vector to GLA vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 78 of file absUtil.c.

79 {
80  Gia_Obj_t * pObj;
81  Vec_Int_t * vGla;
82  int nObjMask, nObjs = Gia_ManObjNum(p);
83  int i, Entry, nFrames = Vec_IntEntry( vVta, 0 );
84  assert( Vec_IntEntry(vVta, nFrames+1) == Vec_IntSize(vVta) );
85  // get the bitmask
86  nObjMask = (1 << Abc_Base2Log(nObjs)) - 1;
87  assert( nObjs <= nObjMask );
88  // go through objects
89  vGla = Vec_IntStart( nObjs );
90  Vec_IntForEachEntryStart( vVta, Entry, i, nFrames+2 )
91  {
92  pObj = Gia_ManObj( p, (Entry & nObjMask) );
93  assert( Gia_ObjIsRo(p, pObj) || Gia_ObjIsAnd(pObj) || Gia_ObjIsConst0(pObj) );
94  Vec_IntAddToEntry( vGla, (Entry & nObjMask), 1 );
95  }
96  Vec_IntWriteEntry( vGla, 0, nFrames );
97  return vGla;
98 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static void Vec_IntAddToEntry(Vec_Int_t *p, int i, int Addition)
Definition: bblif.c:302
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:443
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
Definition: vecInt.h:56
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Abc_Base2Log(unsigned n)
Definition: abc_global.h:251
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define assert(ex)
Definition: util_old.h:213
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
int Gia_VtaPerform ( Gia_Man_t pAig,
Abs_Par_t pPars 
)

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

Synopsis [Collect nodes/flops involved in different timeframes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1743 of file absVta.c.

1744 {
1745  int RetValue = -1;
1746  if ( pAig->vObjClasses == NULL && pPars->fUseRollback )
1747  {
1748  int nFramesMaxOld = pPars->nFramesMax;
1749  pPars->nFramesMax = pPars->nFramesStart;
1750  RetValue = Gia_VtaPerformInt( pAig, pPars );
1751  pPars->nFramesMax = nFramesMaxOld;
1752  }
1753  if ( RetValue == 0 )
1754  return RetValue;
1755  return Gia_VtaPerformInt( pAig, pPars );
1756 }
Vec_Int_t * vObjClasses
Definition: gia.h:142
int Gia_VtaPerformInt(Gia_Man_t *pAig, Abs_Par_t *pPars)
Definition: absVta.c:1492
Vec_Int_t* Saig_ManCbaFilterFlops ( Aig_Man_t pAig,
Abc_Cex_t pAbsCex,
Vec_Int_t vFlopClasses,
Vec_Int_t vAbsFfsToAdd,
int  nFfsToSelect 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Selects the best flops from the given array.]

Description [Selects the best 'nFfsToSelect' flops among the array 'vAbsFfsToAdd' of flops that should be added to the abstraction. To this end, this procedure simulates the original AIG (pAig) using the given CEX (pAbsCex), which was detected for the abstraction.]

SideEffects []

SeeAlso []

Definition at line 66 of file absOldCex.c.

67 {
68  Aig_Obj_t * pObj, * pObjRi, * pObjRo;
69  Vec_Int_t * vMapEntries, * vFlopCosts, * vFlopAddCosts, * vFfsToAddBest;
70  int i, k, f, Entry, iBit, * pPerm;
71  assert( Aig_ManRegNum(pAig) == Vec_IntSize(vFlopClasses) );
72  assert( Vec_IntSize(vAbsFfsToAdd) > nFfsToSelect );
73  // map previously abstracted flops into their original numbers
74  vMapEntries = Vec_IntAlloc( Vec_IntSize(vFlopClasses) );
75  Vec_IntForEachEntry( vFlopClasses, Entry, i )
76  if ( Entry == 0 )
77  Vec_IntPush( vMapEntries, i );
78  // simulate one frame at a time
79  assert( Saig_ManPiNum(pAig) + Vec_IntSize(vMapEntries) == pAbsCex->nPis );
80  vFlopCosts = Vec_IntStart( Vec_IntSize(vMapEntries) );
81  // initialize the flops
82  Aig_ManCleanMarkB(pAig);
83  Aig_ManConst1(pAig)->fMarkB = 1;
84  Saig_ManForEachLo( pAig, pObj, i )
85  pObj->fMarkB = 0;
86  for ( f = 0; f < pAbsCex->iFrame; f++ )
87  {
88  // override the flop values according to the cex
89  iBit = pAbsCex->nRegs + f * pAbsCex->nPis + Saig_ManPiNum(pAig);
90  Vec_IntForEachEntry( vMapEntries, Entry, k )
91  Saig_ManLo(pAig, Entry)->fMarkB = Abc_InfoHasBit(pAbsCex->pData, iBit + k);
92  // simulate
93  Aig_ManForEachNode( pAig, pObj, k )
94  pObj->fMarkB = (Aig_ObjFanin0(pObj)->fMarkB ^ Aig_ObjFaninC0(pObj)) &
95  (Aig_ObjFanin1(pObj)->fMarkB ^ Aig_ObjFaninC1(pObj));
96  Aig_ManForEachCo( pAig, pObj, k )
97  pObj->fMarkB = Aig_ObjFanin0(pObj)->fMarkB ^ Aig_ObjFaninC0(pObj);
98  // transfer
99  Saig_ManForEachLiLo( pAig, pObjRi, pObjRo, k )
100  pObjRo->fMarkB = pObjRi->fMarkB;
101  // compare
102  iBit = pAbsCex->nRegs + (f + 1) * pAbsCex->nPis + Saig_ManPiNum(pAig);
103  Vec_IntForEachEntry( vMapEntries, Entry, k )
104  if ( Saig_ManLi(pAig, Entry)->fMarkB != (unsigned)Abc_InfoHasBit(pAbsCex->pData, iBit + k) )
105  Vec_IntAddToEntry( vFlopCosts, k, 1 );
106  }
107 // Vec_IntForEachEntry( vFlopCosts, Entry, i )
108 // printf( "%d ", Entry );
109 // printf( "\n" );
110  // remap the cost
111  vFlopAddCosts = Vec_IntAlloc( Vec_IntSize(vAbsFfsToAdd) );
112  Vec_IntForEachEntry( vAbsFfsToAdd, Entry, i )
113  Vec_IntPush( vFlopAddCosts, -Vec_IntEntry(vFlopCosts, Entry) );
114  // sort the flops
115  pPerm = Abc_MergeSortCost( Vec_IntArray(vFlopAddCosts), Vec_IntSize(vFlopAddCosts) );
116  // shrink the array
117  vFfsToAddBest = Vec_IntAlloc( nFfsToSelect );
118  for ( i = 0; i < nFfsToSelect; i++ )
119  {
120 // printf( "%d ", Vec_IntEntry(vFlopAddCosts, pPerm[i]) );
121  Vec_IntPush( vFfsToAddBest, Vec_IntEntry(vAbsFfsToAdd, pPerm[i]) );
122  }
123 // printf( "\n" );
124  // cleanup
125  ABC_FREE( pPerm );
126  Vec_IntFree( vMapEntries );
127  Vec_IntFree( vFlopCosts );
128  Vec_IntFree( vFlopAddCosts );
129  Aig_ManCleanMarkB(pAig);
130  // return the computed flops
131  return vFfsToAddBest;
132 }
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
Definition: saig.h:101
static Aig_Obj_t * Saig_ManLo(Aig_Man_t *p, int i)
Definition: saig.h:79
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
void Aig_ManCleanMarkB(Aig_Man_t *p)
Definition: aigUtil.c:167
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
for(p=first;p->value< newval;p=p->next)
int * Abc_MergeSortCost(int *pCosts, int nSize)
Definition: utilSort.c:238
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntAddToEntry(Vec_Int_t *p, int i, int Addition)
Definition: bblif.c:302
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
static Aig_Obj_t * Saig_ManLi(Aig_Man_t *p, int i)
Definition: saig.h:80
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
#define Saig_ManForEachLo(p, pObj, i)
Definition: saig.h:96
static int pPerm[13719]
Definition: rwrTemp.c:32
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
#define ABC_FREE(obj)
Definition: abc_global.h:232
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
Abc_Cex_t* Saig_ManCbaFindCexCareBits ( Aig_Man_t pAig,
Abc_Cex_t pCex,
int  nInputs,
int  fVerbose 
)

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

Synopsis [SAT-based refinement of the counter-example.]

Description [The first parameter (nInputs) indicates how many first primary inputs to skip without considering as care candidates.]

SideEffects []

SeeAlso []

Definition at line 718 of file absOldCex.c.

719 {
720  Saig_ManCba_t * p;
721  Vec_Int_t * vReasons;
722  Abc_Cex_t * pCare;
723  abctime clk = Abc_Clock();
724 
725  clk = Abc_Clock();
726  p = Saig_ManCbaStart( pAig, pCex, nInputs, fVerbose );
727 
728 // p->vReg2Frame = Vec_VecStart( pCex->iFrame );
729 // p->vReg2Value = Vec_VecStart( pCex->iFrame );
730  p->pFrames = Saig_ManCbaUnrollWithCex( pAig, pCex, nInputs, &p->vMapPiF2A, &p->vReg2Frame );
731  vReasons = Saig_ManCbaFindReason( p );
732  if ( p->vReg2Frame )
733  Saig_ManCbaShrink( p );
734 
735 
736 //if ( fVerbose )
737 //Aig_ManPrintStats( p->pFrames );
738 
739  if ( fVerbose )
740  {
741  Vec_Int_t * vRes = Saig_ManCbaReason2Inputs( p, vReasons );
742  printf( "Frame PIs = %4d (essential = %4d) AIG PIs = %4d (essential = %4d) ",
743  Aig_ManCiNum(p->pFrames), Vec_IntSize(vReasons),
744  Saig_ManPiNum(p->pAig) - p->nInputs, Vec_IntSize(vRes) );
745  Vec_IntFree( vRes );
746 ABC_PRT( "Time", Abc_Clock() - clk );
747  }
748 
749  pCare = Saig_ManCbaReason2Cex( p, vReasons );
750  Vec_IntFree( vReasons );
751  Saig_ManCbaStop( p );
752 
753 if ( fVerbose )
754 {
755 printf( "Real " );
756 Abc_CexPrintStats( pCex );
757 }
758 if ( fVerbose )
759 {
760 printf( "Care " );
761 Abc_CexPrintStats( pCare );
762 }
763 /*
764  // verify the reduced counter-example using ternary simulation
765  if ( !Saig_ManCexVerifyUsingTernary( pAig, pCex, pCare ) )
766  printf( "Saig_ManCbaFindCexCareBits(): Minimized counter-example verification has failed!!!\n" );
767  else if ( fVerbose )
768  printf( "Saig_ManCbaFindCexCareBits(): Minimized counter-example verification is successful.\n" );
769 */
770  Aig_ManCleanMarkAB( pAig );
771  return pCare;
772 }
Saig_ManCba_t * Saig_ManCbaStart(Aig_Man_t *pAig, Abc_Cex_t *pCex, int nInputs, int fVerbose)
Definition: absOldCex.c:513
Aig_Man_t * Saig_ManCbaUnrollWithCex(Aig_Man_t *pAig, Abc_Cex_t *pCex, int nInputs, Vec_Int_t **pvMapPiF2A, Vec_Vec_t **pvReg2Frame)
Definition: absOldCex.c:399
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
void Saig_ManCbaStop(Saig_ManCba_t *p)
Definition: absOldCex.c:535
static abctime Abc_Clock()
Definition: abc_global.h:279
Abc_Cex_t * Saig_ManCbaReason2Cex(Saig_ManCba_t *p, Vec_Int_t *vReasons)
Definition: absOldCex.c:224
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
void Abc_CexPrintStats(Abc_Cex_t *p)
Definition: utilCex.c:256
typedefABC_NAMESPACE_IMPL_START struct Saig_ManCba_t_ Saig_ManCba_t
DECLARATIONS ///.
Definition: absOldCex.c:31
void Saig_ManCbaShrink(Saig_ManCba_t *p)
Definition: absOldCex.c:555
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
void Aig_ManCleanMarkAB(Aig_Man_t *p)
Definition: aigUtil.c:186
#define ABC_PRT(a, t)
Definition: abc_global.h:220
Vec_Int_t * Saig_ManCbaFindReason(Saig_ManCba_t *p)
Definition: absOldCex.c:311
Vec_Int_t * Saig_ManCbaReason2Inputs(Saig_ManCba_t *p, Vec_Int_t *vReasons)
Definition: absOldCex.c:195
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition: utilCex.h:39
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
ABC_INT64_T abctime
Definition: abc_global.h:278
Vec_Int_t* Saig_ManCexAbstractionFlops ( Aig_Man_t p,
Gia_ParAbs_t pPars 
)

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

Synopsis [Computes the flops to remain after abstraction.]

Description []

SideEffects []

SeeAlso []

Definition at line 409 of file absOldRef.c.

410 {
411  int nUseStart = 0;
412  Aig_Man_t * pAbs, * pTemp;
413  Vec_Int_t * vFlops;
414  int Iter;//, clk = Abc_Clock(), clk2 = Abc_Clock();//, iFlop;
415  assert( Aig_ManRegNum(p) > 0 );
416  if ( pPars->fVerbose )
417  printf( "Performing counter-example-based refinement.\n" );
418  Aig_ManSetCioIds( p );
419  vFlops = Vec_IntStartNatural( 1 );
420 /*
421  iFlop = Saig_ManFindFirstFlop( p );
422  assert( iFlop >= 0 );
423  vFlops = Vec_IntAlloc( 1 );
424  Vec_IntPush( vFlops, iFlop );
425 */
426  // create the resulting AIG
427  pAbs = Saig_ManDupAbstraction( p, vFlops );
428  if ( !pPars->fVerbose )
429  {
430  printf( "Init : " );
431  Aig_ManPrintStats( pAbs );
432  }
433  printf( "Refining abstraction...\n" );
434  for ( Iter = 0; ; Iter++ )
435  {
436  pTemp = Saig_ManCexRefine( p, pAbs, vFlops, pPars->nFramesBmc, pPars->nConfMaxBmc, pPars->fUseBdds, pPars->fUseDprove, pPars->fVerbose, pPars->fUseStart?&nUseStart:NULL, &pPars->Status, &pPars->nFramesDone );
437  if ( pTemp == NULL )
438  {
439  ABC_FREE( p->pSeqModel );
440  p->pSeqModel = pAbs->pSeqModel;
441  pAbs->pSeqModel = NULL;
442  Aig_ManStop( pAbs );
443  break;
444  }
445  Aig_ManStop( pAbs );
446  pAbs = pTemp;
447  printf( "ITER %4d : ", Iter );
448  if ( !pPars->fVerbose )
449  Aig_ManPrintStats( pAbs );
450  // output the intermediate result of abstraction
451  Ioa_WriteAiger( pAbs, "gabs.aig", 0, 0 );
452 // printf( "Intermediate abstracted model was written into file \"%s\".\n", "gabs.aig" );
453  // check if the ratio is reached
454  if ( 100.0*(Aig_ManRegNum(p)-Aig_ManRegNum(pAbs))/Aig_ManRegNum(p) < 1.0*pPars->nRatio )
455  {
456  printf( "Refinements is stopped because flop reduction is less than %d%%\n", pPars->nRatio );
457  Aig_ManStop( pAbs );
458  pAbs = NULL;
459  Vec_IntFree( vFlops );
460  vFlops = NULL;
461  break;
462  }
463  }
464  return vFlops;
465 }
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
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
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
Aig_Man_t * Saig_ManDupAbstraction(Aig_Man_t *pAig, Vec_Int_t *vFlops)
Definition: saigDup.c:205
void Aig_ManPrintStats(Aig_Man_t *p)
Definition: aigMan.c:379
Aig_Man_t * Saig_ManCexRefine(Aig_Man_t *p, Aig_Man_t *pAbs, Vec_Int_t *vFlops, int nFrames, int nConfMaxOne, int fUseBdds, int fUseDprove, int fVerbose, int *pnUseStart, int *piRetValue, int *pnFrames)
Definition: absOldRef.c:158
static Vec_Int_t * Vec_IntStartNatural(int nSize)
Definition: bblif.c:192
int nRatio
Definition: abs.h:95
int Status
Definition: abs.h:104
int nFramesDone
Definition: abs.h:105
int fVerbose
Definition: abs.h:102
int nFramesBmc
Definition: abs.h:92
void Aig_ManSetCioIds(Aig_Man_t *p)
Definition: aigUtil.c:965
void Ioa_WriteAiger(Aig_Man_t *pMan, char *pFileName, int fWriteSymbols, int fCompact)
Definition: ioaWriteAig.c:446
int fUseStart
Definition: abs.h:101
int nConfMaxBmc
Definition: abs.h:93
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define assert(ex)
Definition: util_old.h:213
int fUseDprove
Definition: abs.h:100
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
int fUseBdds
Definition: abs.h:99
Vec_Int_t* Saig_ManExtendCounterExampleTest2 ( Aig_Man_t p,
int  iFirstFlopPi,
Abc_Cex_t pCex,
int  fVerbose 
)

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

Synopsis [Returns the array of PIs for flops that should not be absracted.]

Description []

SideEffects []

SeeAlso []

Definition at line 443 of file absOldSim.c.

444 {
445  Vec_Int_t * vRes;
446  Vec_Ptr_t * vSimInfo;
447  abctime clk;
448  if ( Saig_ManPiNum(p) != pCex->nPis )
449  {
450  printf( "Saig_ManExtendCounterExampleTest2(): The PI count of AIG (%d) does not match that of cex (%d).\n",
451  Aig_ManCiNum(p), pCex->nPis );
452  return NULL;
453  }
455  vSimInfo = Vec_PtrAllocSimInfo( Aig_ManObjNumMax(p), Abc_BitWordNum(2*(pCex->iFrame+1)) );
456  Vec_PtrCleanSimInfo( vSimInfo, 0, Abc_BitWordNum(2*(pCex->iFrame+1)) );
457 
458 clk = Abc_Clock();
459  vRes = Saig_ManProcessCex( p, iFirstFlopPi, pCex, vSimInfo, fVerbose );
460  if ( fVerbose )
461  {
462  printf( "Total new PIs = %3d. Non-removable PIs = %3d. ", Saig_ManPiNum(p)-iFirstFlopPi, Vec_IntSize(vRes) );
463 ABC_PRT( "Time", Abc_Clock() - clk );
464  }
465  Vec_PtrFree( vSimInfo );
466  Aig_ManFanoutStop( p );
467  return vRes;
468 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
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
static void Vec_PtrCleanSimInfo(Vec_Ptr_t *vInfo, int iWord, int nWords)
Definition: vecPtr.h:968
static abctime Abc_Clock()
Definition: abc_global.h:279
Vec_Int_t * Saig_ManProcessCex(Aig_Man_t *p, int iFirstFlopPi, Abc_Cex_t *pCex, Vec_Ptr_t *vSimInfo, int fVerbose)
Definition: absOldSim.c:388
void Aig_ManFanoutStart(Aig_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition: aigFanout.c:56
void Aig_ManFanoutStop(Aig_Man_t *p)
Definition: aigFanout.c:89
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
#define ABC_PRT(a, t)
Definition: abc_global.h:220
static int Abc_BitWordNum(int nBits)
Definition: abc_global.h:255
ABC_INT64_T abctime
Definition: abc_global.h:278
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
Vec_Int_t* Saig_ManExtendCounterExampleTest3 ( Aig_Man_t pAig,
int  iFirstFlopPi,
Abc_Cex_t pCex,
int  fVerbose 
)

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

Synopsis [Returns the array of PIs for flops that should not be absracted.]

Description []

SideEffects []

SeeAlso []

Definition at line 930 of file saigRefSat.c.

931 {
932  Saig_RefMan_t * p;
933  Vec_Int_t * vRes, * vReasons;
934  clock_t clk;
935  if ( Saig_ManPiNum(pAig) != pCex->nPis )
936  {
937  printf( "Saig_ManExtendCounterExampleTest3(): The PI count of AIG (%d) does not match that of cex (%d).\n",
938  Aig_ManCiNum(pAig), pCex->nPis );
939  return NULL;
940  }
941 
942 clk = clock();
943 
944  p = Saig_RefManStart( pAig, pCex, iFirstFlopPi, fVerbose );
945  vReasons = Saig_RefManFindReason( p );
946  vRes = Saig_RefManReason2Inputs( p, vReasons );
947 
948 // if ( fVerbose )
949  {
950  printf( "Frame PIs = %4d (essential = %4d) AIG PIs = %4d (essential = %4d) ",
951  Aig_ManCiNum(p->pFrames), Vec_IntSize(vReasons),
952  Saig_ManPiNum(p->pAig) - p->nInputs, Vec_IntSize(vRes) );
953 ABC_PRT( "Time", clock() - clk );
954  }
955 
956 /*
957  ////////////////////////////////////
958  Vec_IntFree( vReasons );
959  vReasons = Saig_RefManRefineWithSat( p, vRes );
960  ////////////////////////////////////
961 
962  // derive new result
963  Vec_IntFree( vRes );
964  vRes = Saig_RefManReason2Inputs( p, vReasons );
965 // if ( fVerbose )
966  {
967  printf( "Frame PIs = %4d (essential = %4d) AIG PIs = %4d (essential = %4d) ",
968  Aig_ManCiNum(p->pFrames), Vec_IntSize(vReasons),
969  Saig_ManPiNum(p->pAig) - p->nInputs, Vec_IntSize(vRes) );
970 ABC_PRT( "Time", clock() - clk );
971  }
972 */
973 
974  Vec_IntFree( vReasons );
975  Saig_RefManStop( p );
976  return vRes;
977 }
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
Vec_Int_t * Saig_RefManFindReason(Saig_RefMan_t *p)
Definition: saigRefSat.c:168
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
Saig_RefMan_t * Saig_RefManStart(Aig_Man_t *pAig, Abc_Cex_t *pCex, int nInputs, int fVerbose)
Definition: saigRefSat.c:363
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
#define ABC_PRT(a, t)
Definition: abc_global.h:220
Vec_Int_t * Saig_RefManReason2Inputs(Saig_RefMan_t *p, Vec_Int_t *vReasons)
FUNCTION DEFINITIONS ///.
Definition: saigRefSat.c:64
void Saig_RefManStop(Saig_RefMan_t *p)
Definition: saigRefSat.c:386
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
typedefABC_NAMESPACE_IMPL_START struct Saig_RefMan_t_ Saig_RefMan_t
DECLARATIONS ///.
Definition: saigRefSat.c:33