abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cec.h File Reference

Go to the source code of this file.

Data Structures

struct  Cec_ParSat_t_
 
struct  Cec_ParSim_t_
 
struct  Cec_ParSmf_t_
 
struct  Cec_ParFra_t_
 
struct  Cec_ParCec_t_
 
struct  Cec_ParCor_t_
 
struct  Cec_ParChc_t_
 
struct  Cec_ParSeq_t_
 

Typedefs

typedef
typedefABC_NAMESPACE_HEADER_START
struct Cec_ParSat_t_ 
Cec_ParSat_t
 INCLUDES ///. More...
 
typedef struct Cec_ParSim_t_ Cec_ParSim_t
 
typedef struct Cec_ParSmf_t_ Cec_ParSmf_t
 
typedef struct Cec_ParFra_t_ Cec_ParFra_t
 
typedef struct Cec_ParCec_t_ Cec_ParCec_t
 
typedef struct Cec_ParCor_t_ Cec_ParCor_t
 
typedef struct Cec_ParChc_t_ Cec_ParChc_t
 
typedef struct Cec_ParSeq_t_ Cec_ParSeq_t
 

Functions

int Cec_ManVerify (Gia_Man_t *p, Cec_ParCec_t *pPars)
 MACRO DEFINITIONS ///. More...
 
int Cec_ManVerifyTwo (Gia_Man_t *p0, Gia_Man_t *p1, int fVerbose)
 
Gia_Man_tCec_ManChoiceComputation (Gia_Man_t *pAig, Cec_ParChc_t *pPars)
 
int Cec_ManLSCorrespondenceClasses (Gia_Man_t *pAig, Cec_ParCor_t *pPars)
 
Gia_Man_tCec_ManLSCorrespondence (Gia_Man_t *pAig, Cec_ParCor_t *pPars)
 
void Cec_ManSatSetDefaultParams (Cec_ParSat_t *p)
 DECLARATIONS ///. More...
 
void Cec_ManSimSetDefaultParams (Cec_ParSim_t *p)
 
void Cec_ManSmfSetDefaultParams (Cec_ParSmf_t *p)
 
void Cec_ManFraSetDefaultParams (Cec_ParFra_t *p)
 
void Cec_ManCecSetDefaultParams (Cec_ParCec_t *p)
 
void Cec_ManCorSetDefaultParams (Cec_ParCor_t *p)
 
void Cec_ManChcSetDefaultParams (Cec_ParChc_t *p)
 
Gia_Man_tCec_ManSatSweeping (Gia_Man_t *pAig, Cec_ParFra_t *pPars)
 
Gia_Man_tCec_ManSatSolving (Gia_Man_t *pAig, Cec_ParSat_t *pPars)
 
void Cec_ManSimulation (Gia_Man_t *pAig, Cec_ParSim_t *pPars)
 
int Cec_ManSeqResimulateCounter (Gia_Man_t *pAig, Cec_ParSim_t *pPars, Abc_Cex_t *pCex)
 
int Cec_ManSeqSemiformal (Gia_Man_t *pAig, Cec_ParSmf_t *pPars)
 
int Cec_ManCheckNonTrivialCands (Gia_Man_t *pAig)
 
int Cec_SeqReadMinDomSize (Cec_ParSeq_t *p)
 
int Cec_SeqReadVerbose (Cec_ParSeq_t *p)
 
void Cec_SeqSynthesisSetDefaultParams (Cec_ParSeq_t *pPars)
 DECLARATIONS ///. More...
 
int Cec_SequentialSynthesisPart (Gia_Man_t *p, Cec_ParSeq_t *pPars)
 

Typedef Documentation

typedef struct Cec_ParCec_t_ Cec_ParCec_t

Definition at line 117 of file cec.h.

typedef struct Cec_ParChc_t_ Cec_ParChc_t

Definition at line 159 of file cec.h.

typedef struct Cec_ParCor_t_ Cec_ParCor_t

Definition at line 132 of file cec.h.

typedef struct Cec_ParFra_t_ Cec_ParFra_t

Definition at line 94 of file cec.h.

typedef typedefABC_NAMESPACE_HEADER_START struct Cec_ParSat_t_ Cec_ParSat_t

INCLUDES ///.

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

FileName [cec.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Combinational equivalence checking.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]PARAMETERS ///BASIC TYPES ///

Definition at line 43 of file cec.h.

typedef struct Cec_ParSeq_t_ Cec_ParSeq_t

Definition at line 172 of file cec.h.

typedef struct Cec_ParSim_t_ Cec_ParSim_t

Definition at line 58 of file cec.h.

typedef struct Cec_ParSmf_t_ Cec_ParSmf_t

Definition at line 77 of file cec.h.

Function Documentation

void Cec_ManCecSetDefaultParams ( Cec_ParCec_t p)

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

Synopsis [This procedure sets default parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 157 of file cecCore.c.

158 {
159  memset( p, 0, sizeof(Cec_ParCec_t) );
160  p->nBTLimit = 1000; // conflict limit at a node
161  p->TimeLimit = 0; // the runtime limit in seconds
162 // p->fFirstStop = 0; // stop on the first sat output
163  p->fUseSmartCnf = 0; // use smart CNF computation
164  p->fRewriting = 0; // enables AIG rewriting
165  p->fVeryVerbose = 0; // verbose stats
166  p->fVerbose = 0; // verbose stats
167  p->iOutFail = -1; // the number of failed output
168 }
char * memset()
int nBTLimit
Definition: cec.h:120
int fUseSmartCnf
Definition: cec.h:123
int fVeryVerbose
Definition: cec.h:126
int fRewriting
Definition: cec.h:124
int TimeLimit
Definition: cec.h:121
int iOutFail
Definition: cec.h:128
int fVerbose
Definition: cec.h:127
void Cec_ManChcSetDefaultParams ( Cec_ParChc_t p)

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

Synopsis [This procedure sets default parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 211 of file cecCore.c.

212 {
213  memset( p, 0, sizeof(Cec_ParChc_t) );
214  p->nWords = 15; // the number of simulation words
215  p->nRounds = 15; // the number of simulation rounds
216  p->nBTLimit = 1000; // conflict limit at a node
217  p->fUseRings = 1; // use rings
218  p->fUseCSat = 0; // use circuit-based solver
219  p->fVeryVerbose = 0; // verbose stats
220  p->fVerbose = 0; // verbose stats
221 }
char * memset()
int fUseCSat
Definition: cec.h:166
int fUseRings
Definition: cec.h:165
int nRounds
Definition: cec.h:163
int nWords
Definition: cec.h:162
int nBTLimit
Definition: cec.h:164
int fVeryVerbose
Definition: cec.h:167
int fVerbose
Definition: cec.h:168
int Cec_ManCheckNonTrivialCands ( Gia_Man_t pAig)

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

Synopsis [Returns the number of POs that are not const0 cands.]

Description []

SideEffects []

SeeAlso []

Definition at line 295 of file cecSeq.c.

296 {
297  Gia_Obj_t * pObj;
298  int i, RetValue = 0;
299  if ( pAig->pReprs == NULL )
300  return 0;
301  // label internal nodes driving POs
302  Gia_ManForEachPo( pAig, pObj, i )
303  Gia_ObjFanin0(pObj)->fMark0 = 1;
304  // check if there are non-labled equivs
305  Gia_ManForEachObj( pAig, pObj, i )
306  if ( Gia_ObjIsCand(pObj) && !pObj->fMark0 && Gia_ObjRepr(pAig, i) != GIA_VOID )
307  {
308  RetValue = 1;
309  break;
310  }
311  // clean internal nodes driving POs
312  Gia_ManForEachPo( pAig, pObj, i )
313  Gia_ObjFanin0(pObj)->fMark0 = 0;
314  return RetValue;
315 }
static int Gia_ObjIsCand(Gia_Obj_t *pObj)
Definition: gia.h:429
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
if(last==0)
Definition: sparse_int.h:34
#define GIA_VOID
Definition: gia.h:45
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
Gia_Rpr_t * pReprs
Definition: gia.h:121
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
static int Gia_ObjRepr(Gia_Man_t *p, int Id)
Definition: gia.h:887
Gia_Man_t* Cec_ManChoiceComputation ( Gia_Man_t pAig,
Cec_ParChc_t pParsChc 
)

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

Synopsis [Computes choices for one AIGs.]

Description []

SideEffects []

SeeAlso []

Definition at line 348 of file cecChoice.c.

349 {
350 // extern Aig_Man_t * Dar_ManChoiceNew( Aig_Man_t * pAig, Dch_Pars_t * pPars );
351  Dch_Pars_t Pars, * pPars = &Pars;
352  Aig_Man_t * pMan, * pManNew;
353  Gia_Man_t * pGia;
354  if ( 0 )
355  {
356  pGia = Cec_ManChoiceComputationVec( pAig, 3, pParsChc );
357  }
358  else
359  {
360  pMan = Gia_ManToAig( pAig, 0 );
361  Dch_ManSetDefaultParams( pPars );
362  pPars->fUseGia = 1;
363  pPars->nBTLimit = pParsChc->nBTLimit;
364  pPars->fUseCSat = pParsChc->fUseCSat;
365  pPars->fVerbose = pParsChc->fVerbose;
366  pManNew = Dar_ManChoiceNew( pMan, pPars );
367  pGia = Gia_ManFromAig( pManNew );
368  Aig_ManStop( pManNew );
369 // Aig_ManStop( pMan );
370  }
371  return pGia;
372 }
int fUseCSat
Definition: cec.h:166
Aig_Man_t * Dar_ManChoiceNew(Aig_Man_t *pAig, Dch_Pars_t *pPars)
Definition: darScript.c:849
void Dch_ManSetDefaultParams(Dch_Pars_t *p)
DECLARATIONS ///.
Definition: dchCore.c:45
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
typedefABC_NAMESPACE_HEADER_START struct Dch_Pars_t_ Dch_Pars_t
INCLUDES ///.
Definition: dch.h:43
Gia_Man_t * Gia_ManFromAig(Aig_Man_t *p)
INCLUDES ///.
Definition: giaAig.c:73
int nBTLimit
Definition: cec.h:164
Aig_Man_t * Gia_ManToAig(Gia_Man_t *p, int fChoices)
Definition: giaAig.c:277
Definition: gia.h:95
int fVerbose
Definition: cec.h:168
Gia_Man_t * Cec_ManChoiceComputationVec(Gia_Man_t *pGia, int nGias, Cec_ParChc_t *pPars)
Definition: cecChoice.c:313
void Cec_ManCorSetDefaultParams ( Cec_ParCor_t p)

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

Synopsis [This procedure sets default parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 181 of file cecCore.c.

182 {
183  memset( p, 0, sizeof(Cec_ParCor_t) );
184  p->nWords = 15; // the number of simulation words
185  p->nRounds = 15; // the number of simulation rounds
186  p->nFrames = 1; // the number of time frames
187  p->nBTLimit = 100; // conflict limit at a node
188  p->nLevelMax = -1; // (scorr only) the max number of levels
189  p->nStepsMax = -1; // (scorr only) the max number of induction steps
190  p->fLatchCorr = 0; // consider only latch outputs
191  p->fConstCorr = 0; // consider only constants
192  p->fUseRings = 1; // combine classes into rings
193  p->fUseCSat = 1; // use circuit-based solver
194 // p->fFirstStop = 0; // stop on the first sat output
195  p->fUseSmartCnf = 0; // use smart CNF computation
196  p->fVeryVerbose = 0; // verbose stats
197  p->fVerbose = 0; // verbose stats
198 }
char * memset()
int nRounds
Definition: cec.h:136
int fUseCSat
Definition: cec.h:146
int fVeryVerbose
Definition: cec.h:151
int fUseRings
Definition: cec.h:144
int fConstCorr
Definition: cec.h:143
int fLatchCorr
Definition: cec.h:142
int fVerbose
Definition: cec.h:152
int nFrames
Definition: cec.h:137
int nLevelMax
Definition: cec.h:140
int nWords
Definition: cec.h:135
int fUseSmartCnf
Definition: cec.h:148
int nBTLimit
Definition: cec.h:139
int nStepsMax
Definition: cec.h:141
void Cec_ManFraSetDefaultParams ( Cec_ParFra_t p)

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

Synopsis [This procedure sets default parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 125 of file cecCore.c.

126 {
127  memset( p, 0, sizeof(Cec_ParFra_t) );
128  p->nWords = 15; // the number of simulation words
129  p->nRounds = 15; // the number of simulation rounds
130  p->TimeLimit = 0; // the runtime limit in seconds
131  p->nItersMax = 10; // the maximum number of iterations of SAT sweeping
132  p->nBTLimit = 100; // conflict limit at a node
133  p->nLevelMax = 0; // restriction on the level of nodes to be swept
134  p->nDepthMax = 1; // the depth in terms of steps of speculative reduction
135  p->fRewriting = 0; // enables AIG rewriting
136  p->fCheckMiter = 0; // the circuit is the miter
137 // p->fFirstStop = 0; // stop on the first sat output
138  p->fDualOut = 0; // miter with separate outputs
139  p->fColorDiff = 0; // miter with separate outputs
140  p->fSatSweeping = 0; // enable SAT sweeping
141  p->fVeryVerbose = 0; // verbose stats
142  p->fVerbose = 0; // verbose stats
143  p->iOutFail = -1; // the failed output
144 }
char * memset()
int TimeLimit
Definition: cec.h:101
int fVerbose
Definition: cec.h:112
int fDualOut
Definition: cec.h:107
int fColorDiff
Definition: cec.h:108
int nWords
Definition: cec.h:97
int nRounds
Definition: cec.h:98
int nBTLimit
Definition: cec.h:100
int nItersMax
Definition: cec.h:99
int fCheckMiter
Definition: cec.h:105
int nDepthMax
Definition: cec.h:103
int nLevelMax
Definition: cec.h:102
int fSatSweeping
Definition: cec.h:109
int fRewriting
Definition: cec.h:104
int fVeryVerbose
Definition: cec.h:111
int iOutFail
Definition: cec.h:113
Gia_Man_t* Cec_ManLSCorrespondence ( Gia_Man_t pAig,
Cec_ParCor_t pPars 
)

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

Synopsis [Top-level procedure for register correspondence.]

Description []

SideEffects []

SeeAlso []

Definition at line 1147 of file cecCorr.c.

1148 {
1149  Gia_Man_t * pNew, * pTemp;
1150  unsigned * pInitState;
1151  int RetValue;
1152  ABC_FREE( pAig->pReprs );
1153  ABC_FREE( pAig->pNexts );
1154  if ( pPars->nPrefix == 0 )
1155  {
1156  RetValue = Cec_ManLSCorrespondenceClasses( pAig, pPars );
1157  if ( RetValue == 0 )
1158  return Gia_ManDup( pAig );
1159  }
1160  else
1161  {
1162  // compute the cycles AIG
1163  pInitState = Cec_ManComputeInitState( pAig, pPars->nPrefix );
1164  pTemp = Gia_ManDupFlip( pAig, (int *)pInitState );
1165  ABC_FREE( pInitState );
1166  // compute classes of this AIG
1167  RetValue = Cec_ManLSCorrespondenceClasses( pTemp, pPars );
1168  // transfer the class info
1169  pAig->pReprs = pTemp->pReprs; pTemp->pReprs = NULL;
1170  pAig->pNexts = pTemp->pNexts; pTemp->pNexts = NULL;
1171  // perform additional BMC
1172  pPars->fUseCSat = 0;
1173  pPars->nBTLimit = Abc_MaxInt( pPars->nBTLimit, 1000 );
1174  Cec_ManLSCorrespondenceBmc( pAig, pPars, pPars->nPrefix );
1175 /*
1176  // transfer the class info back
1177  pTemp->pReprs = pAig->pReprs; pAig->pReprs = NULL;
1178  pTemp->pNexts = pAig->pNexts; pAig->pNexts = NULL;
1179  // continue refining
1180  RetValue = Cec_ManLSCorrespondenceClasses( pTemp, pPars );
1181  // transfer the class info
1182  pAig->pReprs = pTemp->pReprs; pTemp->pReprs = NULL;
1183  pAig->pNexts = pTemp->pNexts; pTemp->pNexts = NULL;
1184 */
1185  Gia_ManStop( pTemp );
1186  }
1187  // derive reduced AIG
1188  if ( pPars->fMakeChoices )
1189  {
1190  pNew = Gia_ManEquivToChoices( pAig, 1 );
1191 // Gia_ManHasChoices_very_old( pNew );
1192  }
1193  else
1194  {
1195 // Gia_ManEquivImprove( pAig );
1196  pNew = Gia_ManCorrReduce( pAig );
1197  pNew = Gia_ManSeqCleanup( pTemp = pNew );
1198  Gia_ManStop( pTemp );
1199  //Gia_AigerWrite( pNew, "reduced.aig", 0, 0 );
1200  }
1201  // report the results
1202  if ( pPars->fVerbose )
1203  {
1204  Abc_Print( 1, "NBeg = %d. NEnd = %d. (Gain = %6.2f %%). RBeg = %d. REnd = %d. (Gain = %6.2f %%).\n",
1205  Gia_ManAndNum(pAig), Gia_ManAndNum(pNew),
1206  100.0*(Gia_ManAndNum(pAig)-Gia_ManAndNum(pNew))/(Gia_ManAndNum(pAig)?Gia_ManAndNum(pAig):1),
1207  Gia_ManRegNum(pAig), Gia_ManRegNum(pNew),
1208  100.0*(Gia_ManRegNum(pAig)-Gia_ManRegNum(pNew))/(Gia_ManRegNum(pAig)?Gia_ManRegNum(pAig):1) );
1209  }
1210  if ( pPars->nPrefix && (Gia_ManAndNum(pNew) < Gia_ManAndNum(pAig) || Gia_ManRegNum(pNew) < Gia_ManRegNum(pAig)) )
1211  Abc_Print( 1, "The reduced AIG was produced using %d-th invariants and will not verify.\n", pPars->nPrefix );
1212  // print verbose info about equivalences
1213  if ( pPars->fVerboseFlops )
1214  {
1215  if ( pAig->vNamesIn == NULL )
1216  Abc_Print( 1, "Flop output names are not available. Use command \"&get -n\".\n" );
1217  else
1218  Cec_ManPrintFlopEquivs( pAig );
1219  }
1220  return pNew;
1221 }
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition: giaDup.c:552
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
int * pNexts
Definition: gia.h:122
int fUseCSat
Definition: cec.h:146
int nPrefix
Definition: cec.h:138
int Cec_ManLSCorrespondenceClasses(Gia_Man_t *pAig, Cec_ParCor_t *pPars)
Definition: cecCorr.c:909
Gia_Man_t * Gia_ManCorrReduce(Gia_Man_t *p)
Definition: cecCorr.c:690
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
int fVerboseFlops
Definition: cec.h:150
int fVerbose
Definition: cec.h:152
Gia_Man_t * Gia_ManEquivToChoices(Gia_Man_t *p, int nSnapshots)
Definition: giaEquiv.c:1629
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
Gia_Man_t * Gia_ManSeqCleanup(Gia_Man_t *p)
Definition: giaScl.c:183
void Cec_ManLSCorrespondenceBmc(Gia_Man_t *pAig, Cec_ParCor_t *pPars, int nPrefs)
Definition: cecCorr.c:771
unsigned * Cec_ManComputeInitState(Gia_Man_t *pAig, int nFrames)
Definition: cecCorr.c:1068
int fMakeChoices
Definition: cec.h:145
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
void Cec_ManPrintFlopEquivs(Gia_Man_t *p)
Definition: cecCorr.c:1113
Gia_Man_t * Gia_ManDupFlip(Gia_Man_t *p, int *pInitState)
Definition: giaDup.c:460
#define ABC_FREE(obj)
Definition: abc_global.h:232
int nBTLimit
Definition: cec.h:139
Definition: gia.h:95
Gia_Rpr_t * pReprs
Definition: gia.h:121
Vec_Ptr_t * vNamesIn
Definition: gia.h:155
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
int Cec_ManLSCorrespondenceClasses ( Gia_Man_t pAig,
Cec_ParCor_t pPars 
)

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

Synopsis [Internal procedure for register correspondence.]

Description []

SideEffects []

SeeAlso []

Definition at line 909 of file cecCorr.c.

910 {
911  int nIterMax = 100000;
912  int nAddFrames = 1; // additional timeframes to simulate
913  int fRunBmcFirst = 1;
914  Vec_Str_t * vStatus;
915  Vec_Int_t * vOutputs;
916  Vec_Int_t * vCexStore;
917  Cec_ParSim_t ParsSim, * pParsSim = &ParsSim;
918  Cec_ParSat_t ParsSat, * pParsSat = &ParsSat;
919  Cec_ManSim_t * pSim;
920  Gia_Man_t * pSrm;
921  int r, RetValue;
922  abctime clkTotal = Abc_Clock();
923  abctime clkSat = 0, clkSim = 0, clkSrm = 0;
924  abctime clk2, clk = Abc_Clock();
925  if ( Gia_ManRegNum(pAig) == 0 )
926  {
927  Abc_Print( 1, "Cec_ManLatchCorrespondence(): Not a sequential AIG.\n" );
928  return 0;
929  }
930  Gia_ManRandom( 1 );
931  // prepare simulation manager
932  Cec_ManSimSetDefaultParams( pParsSim );
933  pParsSim->nWords = pPars->nWords;
934  pParsSim->nFrames = pPars->nFrames;
935  pParsSim->fVerbose = pPars->fVerbose;
936  pParsSim->fLatchCorr = pPars->fLatchCorr;
937  pParsSim->fConstCorr = pPars->fConstCorr;
938  pParsSim->fSeqSimulate = 1;
939  // create equivalence classes of registers
940  pSim = Cec_ManSimStart( pAig, pParsSim );
941  if ( pAig->pReprs == NULL )
942  {
943  Cec_ManSimClassesPrepare( pSim, pPars->nLevelMax );
944  Cec_ManSimClassesRefine( pSim );
945  }
946  // prepare SAT solving
947  Cec_ManSatSetDefaultParams( pParsSat );
948  pParsSat->nBTLimit = pPars->nBTLimit;
949  pParsSat->fVerbose = pPars->fVerbose;
950  // limit the number of conflicts in the circuit-based solver
951  if ( pPars->fUseCSat )
952  pParsSat->nBTLimit = Abc_MinInt( pParsSat->nBTLimit, 1000 );
953  if ( pPars->fVerbose )
954  {
955  Abc_Print( 1, "Obj = %7d. And = %7d. Conf = %5d. Fr = %d. Lcorr = %d. Ring = %d. CSat = %d.\n",
956  Gia_ManObjNum(pAig), Gia_ManAndNum(pAig),
957  pPars->nBTLimit, pPars->nFrames, pPars->fLatchCorr, pPars->fUseRings, pPars->fUseCSat );
958  Cec_ManRefinedClassPrintStats( pAig, NULL, 0, Abc_Clock() - clk );
959  }
960  // check the base case
961  if ( fRunBmcFirst && (!pPars->fLatchCorr || pPars->nFrames > 1) )
962  Cec_ManLSCorrespondenceBmc( pAig, pPars, 0 );
963  if ( pPars->pFunc )
964  {
965  ((int (*)(void *))pPars->pFunc)( pPars->pData );
966  ((int (*)(void *))pPars->pFunc)( pPars->pData );
967  }
968  if ( pPars->nStepsMax == 0 )
969  {
970  Abc_Print( 1, "Stopped signal correspondence after BMC.\n" );
971  Cec_ManSimStop( pSim );
972  return 1;
973  }
974  // perform refinement of equivalence classes
975  for ( r = 0; r < nIterMax; r++ )
976  {
977  if ( pPars->nStepsMax == r )
978  {
979  Cec_ManSimStop( pSim );
980  Abc_Print( 1, "Stopped signal correspondence after %d refiment iterations.\n", r );
981  return 1;
982  }
983  clk = Abc_Clock();
984  // perform speculative reduction
985  clk2 = Abc_Clock();
986  pSrm = Gia_ManCorrSpecReduce( pAig, pPars->nFrames, !pPars->fLatchCorr, &vOutputs, pPars->fUseRings );
987  assert( Gia_ManRegNum(pSrm) == 0 && Gia_ManPiNum(pSrm) == Gia_ManRegNum(pAig)+(pPars->nFrames+!pPars->fLatchCorr)*Gia_ManPiNum(pAig) );
988  clkSrm += Abc_Clock() - clk2;
989  if ( Gia_ManCoNum(pSrm) == 0 )
990  {
991  Vec_IntFree( vOutputs );
992  Gia_ManStop( pSrm );
993  break;
994  }
995 //Gia_DumpAiger( pSrm, "corrsrm", r, 2 );
996  // found counter-examples to speculation
997  clk2 = Abc_Clock();
998  if ( pPars->fUseCSat )
999  vCexStore = Cbs_ManSolveMiterNc( pSrm, pPars->nBTLimit, &vStatus, 0 );
1000  else
1001  vCexStore = Cec_ManSatSolveMiter( pSrm, pParsSat, &vStatus );
1002  Gia_ManStop( pSrm );
1003  clkSat += Abc_Clock() - clk2;
1004  if ( Vec_IntSize(vCexStore) == 0 )
1005  {
1006  Vec_IntFree( vCexStore );
1007  Vec_StrFree( vStatus );
1008  Vec_IntFree( vOutputs );
1009  break;
1010  }
1011 // Cec_ManLSCorrAnalyzeDependence( pAig, vOutputs, vStatus );
1012 
1013  // refine classes with these counter-examples
1014  clk2 = Abc_Clock();
1015  RetValue = Cec_ManResimulateCounterExamples( pSim, vCexStore, pPars->nFrames + 1 + nAddFrames );
1016  Vec_IntFree( vCexStore );
1017  clkSim += Abc_Clock() - clk2;
1018  Gia_ManCheckRefinements( pAig, vStatus, vOutputs, pSim, pPars->fUseRings );
1019  if ( pPars->fVerbose )
1020  Cec_ManRefinedClassPrintStats( pAig, vStatus, r+1, Abc_Clock() - clk );
1021  Vec_StrFree( vStatus );
1022  Vec_IntFree( vOutputs );
1023 //Gia_ManEquivPrintClasses( pAig, 1, 0 );
1024  if ( pPars->pFunc )
1025  ((int (*)(void *))pPars->pFunc)( pPars->pData );
1026  // quit if const is no longer there
1027  if ( pPars->fStopWhenGone && Gia_ManPoNum(pAig) == 1 && !Gia_ObjIsConst( pAig, Gia_ObjFaninId0p(pAig, Gia_ManPo(pAig, 0)) ) )
1028  {
1029  printf( "Iterative refinement is stopped after iteration %d\n", r );
1030  printf( "because the property output is no longer a candidate constant.\n" );
1031  Cec_ManSimStop( pSim );
1032  return 0;
1033  }
1034  }
1035  if ( pPars->fVerbose )
1036  Cec_ManRefinedClassPrintStats( pAig, NULL, r+1, Abc_Clock() - clk );
1037  // check the overflow
1038  if ( r == nIterMax )
1039  Abc_Print( 1, "The refinement was not finished. The result may be incorrect.\n" );
1040  Cec_ManSimStop( pSim );
1041  // check the base case
1042  if ( !fRunBmcFirst && (!pPars->fLatchCorr || pPars->nFrames > 1) )
1043  Cec_ManLSCorrespondenceBmc( pAig, pPars, 0 );
1044  clkTotal = Abc_Clock() - clkTotal;
1045  // report the results
1046  if ( pPars->fVerbose )
1047  {
1048  ABC_PRTP( "Srm ", clkSrm, clkTotal );
1049  ABC_PRTP( "Sat ", clkSat, clkTotal );
1050  ABC_PRTP( "Sim ", clkSim, clkTotal );
1051  ABC_PRTP( "Other", clkTotal-clkSat-clkSrm-clkSim, clkTotal );
1052  Abc_PrintTime( 1, "TOTAL", clkTotal );
1053  }
1054  return 1;
1055 }
int fVerbose
Definition: cec.h:73
Gia_Man_t * Gia_ManCorrSpecReduce(Gia_Man_t *p, int nFrames, int fScorr, Vec_Int_t **pvOutputs, int fRings)
Definition: cecCorr.c:106
int Cec_ManSimClassesPrepare(Cec_ManSim_t *p, int LevelMax)
Definition: cecClass.c:851
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
int fLatchCorr
Definition: cec.h:70
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
int fUseCSat
Definition: cec.h:146
int fSeqSimulate
Definition: cec.h:69
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Vec_Int_t * Cec_ManSatSolveMiter(Gia_Man_t *pAig, Cec_ParSat_t *pPars, Vec_Str_t **pvStatus)
Definition: cecSolve.c:1026
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
void * pData
Definition: cec.h:154
void Cec_ManRefinedClassPrintStats(Gia_Man_t *p, Vec_Str_t *vStatus, int iIter, abctime Time)
MACRO DEFINITIONS ///.
Definition: cecCorr.c:725
int fUseRings
Definition: cec.h:144
int fConstCorr
Definition: cec.h:143
void Cec_ManSimStop(Cec_ManSim_t *p)
Definition: cecMan.c:232
static abctime Abc_Clock()
Definition: abc_global.h:279
int fLatchCorr
Definition: cec.h:142
int fVerbose
Definition: cec.h:152
int Gia_ManCheckRefinements(Gia_Man_t *p, Vec_Str_t *vStatus, Vec_Int_t *vOutputs, Cec_ManSim_t *pSim, int fRings)
Definition: cecCorr.c:612
Cec_ManSim_t * Cec_ManSimStart(Gia_Man_t *pAig, Cec_ParSim_t *pPars)
Definition: cecMan.c:198
Vec_Int_t * Cbs_ManSolveMiterNc(Gia_Man_t *pGia, int nConfs, Vec_Str_t **pvStatus, int fVerbose)
Definition: giaCSat.c:998
unsigned Gia_ManRandom(int fReset)
FUNCTION DEFINITIONS ///.
Definition: giaUtil.c:49
#define ABC_PRTP(a, t, T)
Definition: abc_global.h:223
void Cec_ManSimSetDefaultParams(Cec_ParSim_t *p)
Definition: cecCore.c:70
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
static int Abc_MinInt(int a, int b)
Definition: abc_global.h:239
int fConstCorr
Definition: cec.h:71
void Cec_ManLSCorrespondenceBmc(Gia_Man_t *pAig, Cec_ParCor_t *pPars, int nPrefs)
Definition: cecCorr.c:771
static void Vec_StrFree(Vec_Str_t *p)
Definition: bblif.c:616
int nFrames
Definition: cec.h:137
static int Gia_ObjIsConst(Gia_Man_t *p, int Id)
Definition: gia.h:915
int nLevelMax
Definition: cec.h:140
int fStopWhenGone
Definition: cec.h:149
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
int nWords
Definition: cec.h:135
void * pFunc
Definition: cec.h:155
int Cec_ManSimClassesRefine(Cec_ManSim_t *p)
Definition: cecClass.c:908
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
int nFrames
Definition: cec.h:62
int nBTLimit
Definition: cec.h:139
Definition: gia.h:95
static int Gia_ObjFaninId0p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:463
typedefABC_NAMESPACE_HEADER_START struct Cec_ParSat_t_ Cec_ParSat_t
INCLUDES ///.
Definition: cec.h:43
Gia_Rpr_t * pReprs
Definition: gia.h:121
#define assert(ex)
Definition: util_old.h:213
int nWords
Definition: cec.h:61
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
int nStepsMax
Definition: cec.h:141
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
int Cec_ManResimulateCounterExamples(Cec_ManSim_t *pSim, Vec_Int_t *vCexStore, int nFrames)
Definition: cecCorr.c:545
ABC_INT64_T abctime
Definition: abc_global.h:278
void Cec_ManSatSetDefaultParams(Cec_ParSat_t *p)
DECLARATIONS ///.
Definition: cecCore.c:45
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
void Cec_ManSatSetDefaultParams ( Cec_ParSat_t p)

DECLARATIONS ///.

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

FileName [cecCore.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Combinational equivalence checking.]

Synopsis [Core procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

Id:
cecCore.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 45 of file cecCore.c.

46 {
47  memset( p, 0, sizeof(Cec_ParSat_t) );
48  p->nBTLimit = 100; // conflict limit at a node
49  p->nSatVarMax = 2000; // the max number of SAT variables
50  p->nCallsRecycle = 200; // calls to perform before recycling SAT solver
51  p->fNonChrono = 0; // use non-chronological backtracling (for circuit SAT only)
52  p->fPolarFlip = 1; // flops polarity of variables
53  p->fCheckMiter = 0; // the circuit is the miter
54 // p->fFirstStop = 0; // stop on the first sat output
55  p->fLearnCls = 0; // perform clause learning
56  p->fVerbose = 0; // verbose stats
57 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_HEADER_START struct Cec_ParSat_t_ Cec_ParSat_t
INCLUDES ///.
Definition: cec.h:43
Gia_Man_t* Cec_ManSatSolving ( Gia_Man_t pAig,
Cec_ParSat_t pPars 
)

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

Synopsis [Core procedure for SAT sweeping.]

Description []

SideEffects []

SeeAlso []

Definition at line 234 of file cecCore.c.

235 {
236  Gia_Man_t * pNew;
237  Cec_ManPat_t * pPat;
238  pPat = Cec_ManPatStart();
239  Cec_ManSatSolve( pPat, pAig, pPars );
240 // pNew = Gia_ManDupDfsSkip( pAig );
241  pNew = Gia_ManDup( pAig );
242  Cec_ManPatStop( pPat );
243  return pNew;
244 }
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition: giaDup.c:552
void Cec_ManSatSolve(Cec_ManPat_t *pPat, Gia_Man_t *pAig, Cec_ParSat_t *pPars)
Definition: cecSolve.c:676
typedefABC_NAMESPACE_HEADER_START struct Cec_ManPat_t_ Cec_ManPat_t
INCLUDES ///.
Definition: cecInt.h:48
Definition: gia.h:95
void Cec_ManPatStop(Cec_ManPat_t *p)
Definition: cecMan.c:177
Cec_ManPat_t * Cec_ManPatStart()
Definition: cecMan.c:129
Gia_Man_t* Cec_ManSatSweeping ( Gia_Man_t pAig,
Cec_ParFra_t pPars 
)

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

Synopsis [Core procedure for SAT sweeping.]

Description []

SideEffects []

SeeAlso []

Definition at line 337 of file cecCore.c.

338 {
339  int fOutputResult = 0;
340  Cec_ParSat_t ParsSat, * pParsSat = &ParsSat;
341  Cec_ParSim_t ParsSim, * pParsSim = &ParsSim;
342  Gia_Man_t * pIni, * pSrm, * pTemp;
343  Cec_ManFra_t * p;
344  Cec_ManSim_t * pSim;
345  Cec_ManPat_t * pPat;
346  int i, fTimeOut = 0, nMatches = 0;
347  abctime clk, clk2, clkTotal = Abc_Clock();
348 
349  // duplicate AIG and transfer equivalence classes
350  Gia_ManRandom( 1 );
351  pIni = Gia_ManDup(pAig);
352  pIni->pReprs = pAig->pReprs; pAig->pReprs = NULL;
353  pIni->pNexts = pAig->pNexts; pAig->pNexts = NULL;
354 
355  // prepare the managers
356  // SAT sweeping
357  p = Cec_ManFraStart( pIni, pPars );
358  if ( pPars->fDualOut )
359  pPars->fColorDiff = 1;
360  // simulation
361  Cec_ManSimSetDefaultParams( pParsSim );
362  pParsSim->nWords = pPars->nWords;
363  pParsSim->nFrames = pPars->nRounds;
364  pParsSim->fCheckMiter = pPars->fCheckMiter;
365  pParsSim->fDualOut = pPars->fDualOut;
366  pParsSim->fVerbose = pPars->fVerbose;
367  pSim = Cec_ManSimStart( p->pAig, pParsSim );
368  // SAT solving
369  Cec_ManSatSetDefaultParams( pParsSat );
370  pParsSat->nBTLimit = pPars->nBTLimit;
371  pParsSat->fVerbose = pPars->fVeryVerbose;
372  // simulation patterns
373  pPat = Cec_ManPatStart();
374  pPat->fVerbose = pPars->fVeryVerbose;
375 
376  // start equivalence classes
377 clk = Abc_Clock();
378  if ( p->pAig->pReprs == NULL )
379  {
380  if ( Cec_ManSimClassesPrepare(pSim, -1) || Cec_ManSimClassesRefine(pSim) )
381  {
382  Gia_ManStop( p->pAig );
383  p->pAig = NULL;
384  goto finalize;
385  }
386  }
387 p->timeSim += Abc_Clock() - clk;
388  // perform solving
389  for ( i = 1; i <= pPars->nItersMax; i++ )
390  {
391  clk2 = Abc_Clock();
392  nMatches = 0;
393  if ( pPars->fDualOut )
394  {
395  nMatches = Gia_ManEquivSetColors( p->pAig, pPars->fVeryVerbose );
396 // p->pAig->pIso = Cec_ManDetectIsomorphism( p->pAig );
397 // Gia_ManEquivTransform( p->pAig, 1 );
398  }
399  pSrm = Cec_ManFraSpecReduction( p );
400 
401 // Gia_AigerWrite( pSrm, "gia_srm.aig", 0, 0 );
402 
403  if ( pPars->fVeryVerbose )
404  Gia_ManPrintStats( pSrm, NULL );
405  if ( Gia_ManCoNum(pSrm) == 0 )
406  {
407  Gia_ManStop( pSrm );
408  if ( p->pPars->fVerbose )
409  Abc_Print( 1, "Considered all available candidate equivalences.\n" );
410  if ( pPars->fDualOut && Gia_ManAndNum(p->pAig) > 0 )
411  {
412  if ( pPars->fColorDiff )
413  {
414  if ( p->pPars->fVerbose )
415  Abc_Print( 1, "Switching into reduced mode.\n" );
416  pPars->fColorDiff = 0;
417  }
418  else
419  {
420  if ( p->pPars->fVerbose )
421  Abc_Print( 1, "Switching into normal mode.\n" );
422  pPars->fDualOut = 0;
423  }
424  continue;
425  }
426  break;
427  }
428 clk = Abc_Clock();
429  if ( pPars->fRunCSat )
430  Cec_ManSatSolveCSat( pPat, pSrm, pParsSat );
431  else
432  Cec_ManSatSolve( pPat, pSrm, pParsSat );
433 p->timeSat += Abc_Clock() - clk;
434  if ( Cec_ManFraClassesUpdate( p, pSim, pPat, pSrm ) )
435  {
436  Gia_ManStop( pSrm );
437  Gia_ManStop( p->pAig );
438  p->pAig = NULL;
439  goto finalize;
440  }
441  Gia_ManStop( pSrm );
442 
443  // update the manager
444  pSim->pAig = p->pAig = Gia_ManEquivReduceAndRemap( pTemp = p->pAig, 0, pParsSim->fDualOut );
445  if ( p->pAig == NULL )
446  {
447  p->pAig = pTemp;
448  break;
449  }
450  Gia_ManStop( pTemp );
451  if ( p->pPars->fVerbose )
452  {
453  Abc_Print( 1, "%3d : P =%7d. D =%7d. F =%6d. M = %7d. And =%8d. ",
454  i, p->nAllProved, p->nAllDisproved, p->nAllFailed, nMatches, Gia_ManAndNum(p->pAig) );
455  Abc_PrintTime( 1, "Time", Abc_Clock() - clk2 );
456  }
457  if ( Gia_ManAndNum(p->pAig) == 0 )
458  {
459  if ( p->pPars->fVerbose )
460  Abc_Print( 1, "Network after reduction is empty.\n" );
461  break;
462  }
463  // check resource limits
464  if ( p->pPars->TimeLimit && (Abc_Clock() - clkTotal)/CLOCKS_PER_SEC >= p->pPars->TimeLimit )
465  {
466  fTimeOut = 1;
467  break;
468  }
469 // if ( p->nAllFailed && !p->nAllProved && !p->nAllDisproved )
470  if ( p->nAllFailed > p->nAllProved + p->nAllDisproved )
471  {
472  if ( pParsSat->nBTLimit >= 10001 )
473  break;
474  if ( pPars->fSatSweeping )
475  {
476  if ( p->pPars->fVerbose )
477  Abc_Print( 1, "Exceeded the limit on the number of conflicts (%d).\n", pParsSat->nBTLimit );
478  break;
479  }
480  pParsSat->nBTLimit *= 10;
481  if ( p->pPars->fVerbose )
482  {
483  if ( p->pPars->fVerbose )
484  Abc_Print( 1, "Increasing conflict limit to %d.\n", pParsSat->nBTLimit );
485  if ( fOutputResult )
486  {
487  Gia_AigerWrite( p->pAig, "gia_cec_temp.aig", 0, 0 );
488  Abc_Print( 1,"The result is written into file \"%s\".\n", "gia_cec_temp.aig" );
489  }
490  }
491  }
492  if ( pPars->fDualOut && pPars->fColorDiff && (Gia_ManAndNum(p->pAig) < 100000 || p->nAllProved + p->nAllDisproved < 10) )
493  {
494  if ( p->pPars->fVerbose )
495  Abc_Print( 1, "Switching into reduced mode.\n" );
496  pPars->fColorDiff = 0;
497  }
498 // if ( pPars->fDualOut && Gia_ManAndNum(p->pAig) < 20000 )
499  else if ( pPars->fDualOut && (Gia_ManAndNum(p->pAig) < 20000 || p->nAllProved + p->nAllDisproved < 10) )
500  {
501  if ( p->pPars->fVerbose )
502  Abc_Print( 1, "Switching into normal mode.\n" );
503  pPars->fColorDiff = 0;
504  pPars->fDualOut = 0;
505  }
506  }
507 finalize:
508  if ( p->pPars->fVerbose && p->pAig )
509  {
510  Abc_Print( 1, "NBeg = %d. NEnd = %d. (Gain = %6.2f %%). RBeg = %d. REnd = %d. (Gain = %6.2f %%).\n",
511  Gia_ManAndNum(pAig), Gia_ManAndNum(p->pAig),
512  100.0*(Gia_ManAndNum(pAig)-Gia_ManAndNum(p->pAig))/(Gia_ManAndNum(pAig)?Gia_ManAndNum(pAig):1),
513  Gia_ManRegNum(pAig), Gia_ManRegNum(p->pAig),
514  100.0*(Gia_ManRegNum(pAig)-Gia_ManRegNum(p->pAig))/(Gia_ManRegNum(pAig)?Gia_ManRegNum(pAig):1) );
515  Abc_PrintTimeP( 1, "Sim ", p->timeSim, Abc_Clock() - (int)clkTotal );
516  Abc_PrintTimeP( 1, "Sat ", p->timeSat-pPat->timeTotalSave, Abc_Clock() - (int)clkTotal );
517  Abc_PrintTimeP( 1, "Pat ", p->timePat+pPat->timeTotalSave, Abc_Clock() - (int)clkTotal );
518  Abc_PrintTime( 1, "Time", (int)(Abc_Clock() - clkTotal) );
519  }
520 
521  pTemp = p->pAig; p->pAig = NULL;
522  if ( pTemp == NULL && pSim->iOut >= 0 )
523  {
524  Abc_Print( 1, "Disproved at least one output of the miter (zero-based number %d).\n", pSim->iOut );
525  pPars->iOutFail = pSim->iOut;
526  }
527  else if ( pSim->pCexes )
528  Abc_Print( 1, "Disproved %d outputs of the miter.\n", pSim->nOuts );
529  if ( fTimeOut )
530  Abc_Print( 1, "Timed out after %d seconds.\n", (int)((double)Abc_Clock() - clkTotal)/CLOCKS_PER_SEC );
531 
532  pAig->pCexComb = pSim->pCexComb; pSim->pCexComb = NULL;
533  Cec_ManSimStop( pSim );
534  Cec_ManPatStop( pPat );
535  Cec_ManFraStop( p );
536  return pTemp;
537 }
Abc_Cex_t * pCexComb
Definition: cecInt.h:133
int fVerbose
Definition: cec.h:73
int Cec_ManSimClassesPrepare(Cec_ManSim_t *p, int LevelMax)
Definition: cecClass.c:851
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition: giaDup.c:552
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
Gia_Man_t * Gia_ManEquivReduceAndRemap(Gia_Man_t *p, int fSeq, int fMiterPairs)
Definition: giaEquiv.c:638
void Gia_ManPrintStats(Gia_Man_t *p, Gps_Par_t *pPars)
Definition: giaMan.c:389
int * pNexts
Definition: gia.h:122
static Llb_Mgr_t * p
Definition: llb3Image.c:950
abctime timeSim
Definition: cecInt.h:157
int Cec_ManFraClassesUpdate(Cec_ManFra_t *p, Cec_ManSim_t *pSim, Cec_ManPat_t *pPat, Gia_Man_t *pNew)
Definition: cecSweep.c:188
void Cec_ManSatSolve(Cec_ManPat_t *pPat, Gia_Man_t *pAig, Cec_ParSat_t *pPars)
Definition: cecSolve.c:676
int TimeLimit
Definition: cec.h:101
Abc_Cex_t * pCexComb
Definition: gia.h:135
void Cec_ManSimStop(Cec_ManSim_t *p)
Definition: cecMan.c:232
int nAllFailed
Definition: cecInt.h:155
Gia_Man_t * pAig
Definition: cecInt.h:115
static abctime Abc_Clock()
Definition: abc_global.h:279
static void Abc_PrintTimeP(int level, const char *pStr, abctime time, abctime Time)
Definition: abc_global.h:372
void Cec_ManSatSolveCSat(Cec_ManPat_t *pPat, Gia_Man_t *pAig, Cec_ParSat_t *pPars)
Definition: cecSolve.c:765
int fRunCSat
Definition: cec.h:110
int fCheckMiter
Definition: cec.h:67
abctime timeSat
Definition: cecInt.h:159
int fVerbose
Definition: cec.h:112
Cec_ManSim_t * Cec_ManSimStart(Gia_Man_t *pAig, Cec_ParSim_t *pPars)
Definition: cecMan.c:198
unsigned Gia_ManRandom(int fReset)
FUNCTION DEFINITIONS ///.
Definition: giaUtil.c:49
ABC_NAMESPACE_IMPL_START void Cec_ManSatSetDefaultParams(Cec_ParSat_t *p)
DECLARATIONS ///.
Definition: cecCore.c:45
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
int nAllDisproved
Definition: cecInt.h:154
int fDualOut
Definition: cec.h:107
void Cec_ManSimSetDefaultParams(Cec_ParSim_t *p)
Definition: cecCore.c:70
int fColorDiff
Definition: cec.h:108
typedefABC_NAMESPACE_HEADER_START struct Cec_ManPat_t_ Cec_ManPat_t
INCLUDES ///.
Definition: cecInt.h:48
void ** pCexes
Definition: cecInt.h:130
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact)
Definition: giaAiger.c:1024
int nWords
Definition: cec.h:97
int Cec_ManSimClassesRefine(Cec_ManSim_t *p)
Definition: cecClass.c:908
int nRounds
Definition: cec.h:98
Gia_Man_t * Cec_ManFraSpecReduction(Cec_ManFra_t *p)
DECLARATIONS ///.
Definition: cecSweep.c:45
int nFrames
Definition: cec.h:62
int nBTLimit
Definition: cec.h:100
void Cec_ManFraStop(Cec_ManFra_t *p)
Definition: cecMan.c:284
int nItersMax
Definition: cec.h:99
Definition: gia.h:95
int fCheckMiter
Definition: cec.h:105
Gia_Man_t * pAig
Definition: cecInt.h:149
int fDualOut
Definition: cec.h:66
Cec_ManFra_t * Cec_ManFraStart(Gia_Man_t *pAig, Cec_ParFra_t *pPars)
Definition: cecMan.c:262
typedefABC_NAMESPACE_HEADER_START struct Cec_ParSat_t_ Cec_ParSat_t
INCLUDES ///.
Definition: cec.h:43
Gia_Rpr_t * pReprs
Definition: gia.h:121
int Gia_ManEquivSetColors(Gia_Man_t *p, int fVerbose)
Definition: giaEquiv.c:692
abctime timePat
Definition: cecInt.h:158
int nWords
Definition: cec.h:61
int fSatSweeping
Definition: cec.h:109
ABC_INT64_T abctime
Definition: abc_global.h:278
int nAllProved
Definition: cecInt.h:153
void Cec_ManPatStop(Cec_ManPat_t *p)
Definition: cecMan.c:177
int fVeryVerbose
Definition: cec.h:111
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
int iOutFail
Definition: cec.h:113
Cec_ParFra_t * pPars
Definition: cecInt.h:150
Cec_ManPat_t * Cec_ManPatStart()
Definition: cecMan.c:129
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
int Cec_ManSeqResimulateCounter ( Gia_Man_t pAig,
Cec_ParSim_t pPars,
Abc_Cex_t pCex 
)

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

Synopsis [Resimuates one counter-example to refine equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 215 of file cecSeq.c.

216 {
217  Vec_Ptr_t * vSimInfo;
218  int RetValue;
219  abctime clkTotal = Abc_Clock();
220  if ( pCex == NULL )
221  {
222  Abc_Print( 1, "Cec_ManSeqResimulateCounter(): Counter-example is not available.\n" );
223  return -1;
224  }
225  if ( pAig->pReprs == NULL )
226  {
227  Abc_Print( 1, "Cec_ManSeqResimulateCounter(): Equivalence classes are not available.\n" );
228  return -1;
229  }
230  if ( Gia_ManRegNum(pAig) == 0 )
231  {
232  Abc_Print( 1, "Cec_ManSeqResimulateCounter(): Not a sequential AIG.\n" );
233  return -1;
234  }
235 // if ( Gia_ManRegNum(pAig) != pCex->nRegs || Gia_ManPiNum(pAig) != pCex->nPis )
236  if ( Gia_ManPiNum(pAig) != pCex->nPis )
237  {
238  Abc_Print( 1, "Cec_ManSeqResimulateCounter(): The number of PIs in the AIG and the counter-example differ.\n" );
239  return -1;
240  }
241  if ( pPars->fVerbose )
242  Abc_Print( 1, "Resimulating %d timeframes.\n", pPars->nFrames + pCex->iFrame + 1 );
243  Gia_ManRandom( 1 );
244  vSimInfo = Vec_PtrAllocSimInfo( Gia_ManRegNum(pAig) +
245  Gia_ManPiNum(pAig) * (pPars->nFrames + pCex->iFrame + 1), 1 );
246  Cec_ManSeqDeriveInfoFromCex( vSimInfo, pAig, pCex );
247  if ( pPars->fVerbose )
248  Gia_ManEquivPrintClasses( pAig, 0, 0 );
249  RetValue = Cec_ManSeqResimulateInfo( pAig, vSimInfo, NULL, pPars->fCheckMiter );
250  if ( pPars->fVerbose )
251  Gia_ManEquivPrintClasses( pAig, 0, 0 );
252  Vec_PtrFree( vSimInfo );
253  if ( pPars->fVerbose )
254  ABC_PRT( "Time", Abc_Clock() - clkTotal );
255 // if ( RetValue && pPars->fCheckMiter )
256 // Abc_Print( 1, "Cec_ManSeqResimulateCounter(): An output of the miter is asserted!\n" );
257  return RetValue;
258 }
int fVerbose
Definition: cec.h:73
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_NAMESPACE_IMPL_START void Cec_ManSeqDeriveInfoFromCex(Vec_Ptr_t *vInfo, Gia_Man_t *pAig, Abc_Cex_t *pCex)
DECLARATIONS ///.
Definition: cecSeq.c:45
static abctime Abc_Clock()
Definition: abc_global.h:279
int fCheckMiter
Definition: cec.h:67
void Gia_ManEquivPrintClasses(Gia_Man_t *p, int fVerbose, float Mem)
Definition: giaEquiv.c:304
unsigned Gia_ManRandom(int fReset)
FUNCTION DEFINITIONS ///.
Definition: giaUtil.c:49
int Cec_ManSeqResimulateInfo(Gia_Man_t *pAig, Vec_Ptr_t *vSimInfo, Abc_Cex_t *pBestState, int fCheckMiter)
Definition: cecSeq.c:184
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
int nFrames
Definition: cec.h:62
#define ABC_PRT(a, t)
Definition: abc_global.h:220
Gia_Rpr_t * pReprs
Definition: gia.h:121
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
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
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
int Cec_ManSeqSemiformal ( Gia_Man_t pAig,
Cec_ParSmf_t pPars 
)

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

Synopsis [Performs semiformal refinement of equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 328 of file cecSeq.c.

329 {
330  int nAddFrames = 16; // additional timeframes to simulate
331  int nCountNoRef = 0;
332  int nFramesReal;
333  Cec_ParSat_t ParsSat, * pParsSat = &ParsSat;
334  Vec_Ptr_t * vSimInfo;
335  Vec_Str_t * vStatus;
336  Abc_Cex_t * pState;
337  Gia_Man_t * pSrm, * pReduce, * pAux;
338  int r, nPats, RetValue = 0;
339  if ( pAig->pReprs == NULL )
340  {
341  Abc_Print( 1, "Cec_ManSeqSemiformal(): Equivalence classes are not available.\n" );
342  return -1;
343  }
344  if ( Gia_ManRegNum(pAig) == 0 )
345  {
346  Abc_Print( 1, "Cec_ManSeqSemiformal(): Not a sequential AIG.\n" );
347  return -1;
348  }
349  Gia_ManRandom( 1 );
350  // prepare starting pattern
351  pState = Abc_CexAlloc( Gia_ManRegNum(pAig), 0, 0 );
352  pState->iFrame = -1;
353  pState->iPo = -1;
354  // prepare SAT solving
355  Cec_ManSatSetDefaultParams( pParsSat );
356  pParsSat->nBTLimit = pPars->nBTLimit;
357  pParsSat->fVerbose = pPars->fVerbose;
358  if ( pParsSat->fVerbose )
359  {
360  Abc_Print( 1, "Starting: " );
361  Gia_ManEquivPrintClasses( pAig, 0, 0 );
362  }
363  // perform the given number of BMC rounds
364  Gia_ManCleanMark0( pAig );
365  for ( r = 0; r < pPars->nRounds; r++ )
366  {
367  if ( !Cec_ManCheckNonTrivialCands(pAig) )
368  {
369  Abc_Print( 1, "Cec_ManSeqSemiformal: There are only trivial equiv candidates left (PO drivers). Quitting.\n" );
370  break;
371  }
372 // Abc_CexPrint( pState );
373  // derive speculatively reduced model
374 // pSrm = Gia_ManSpecReduceInit( pAig, pState, pPars->nFrames, pPars->fDualOut );
375  pSrm = Gia_ManSpecReduceInitFrames( pAig, pState, pPars->nFrames, &nFramesReal, pPars->fDualOut, pPars->nMinOutputs );
376  if ( pSrm == NULL )
377  {
378  Abc_Print( 1, "Quitting refinement because miter could not be unrolled.\n" );
379  break;
380  }
381  assert( Gia_ManRegNum(pSrm) == 0 && Gia_ManPiNum(pSrm) == (Gia_ManPiNum(pAig) * nFramesReal) );
382  if ( pPars->fVerbose )
383  Abc_Print( 1, "Unrolled for %d frames.\n", nFramesReal );
384  // allocate room for simulation info
385  vSimInfo = Vec_PtrAllocSimInfo( Gia_ManRegNum(pAig) +
386  Gia_ManPiNum(pAig) * (nFramesReal + nAddFrames), pPars->nWords );
387  Cec_ManSeqDeriveInfoInitRandom( vSimInfo, pAig, pState );
388  // fill in simulation info with counter-examples
389  vStatus = Cec_ManSatSolveSeq( vSimInfo, pSrm, pParsSat, Gia_ManRegNum(pAig), &nPats );
390  Vec_StrFree( vStatus );
391  Gia_ManStop( pSrm );
392  // resimulate and refine the classes
393  RetValue = Cec_ManSeqResimulateInfo( pAig, vSimInfo, pState, pPars->fCheckMiter );
394  Vec_PtrFree( vSimInfo );
395  assert( pState->iPo >= 0 ); // hit counter
396  pState->iPo = -1;
397  if ( pPars->fVerbose )
398  {
399  Abc_Print( 1, "BMC = %3d ", nPats );
400  Gia_ManEquivPrintClasses( pAig, 0, 0 );
401  }
402 
403  // write equivalence classes
404  Gia_AigerWrite( pAig, "gore.aig", 0, 0 );
405  // reduce the model
406  pReduce = Gia_ManSpecReduce( pAig, 0, 0, 1, 0, 0 );
407  if ( pReduce )
408  {
409  pReduce = Gia_ManSeqStructSweep( pAux = pReduce, 1, 1, 0 );
410  Gia_ManStop( pAux );
411  Gia_AigerWrite( pReduce, "gsrm.aig", 0, 0 );
412 // Abc_Print( 1, "Speculatively reduced model was written into file \"%s\".\n", "gsrm.aig" );
413 // Gia_ManPrintStatsShort( pReduce );
414  Gia_ManStop( pReduce );
415  }
416 
417  if ( RetValue )
418  {
419  Abc_Print( 1, "Cec_ManSeqSemiformal(): An output of the miter is asserted. Refinement stopped.\n" );
420  break;
421  }
422  // decide when to stop
423  if ( nPats > 0 )
424  nCountNoRef = 0;
425  else if ( ++nCountNoRef == pPars->nNonRefines )
426  break;
427  }
428  ABC_FREE( pState );
429  if ( pPars->fCheckMiter )
430  {
431  int nNonConsts = Cec_ManCountNonConstOutputs( pAig );
432  if ( nNonConsts )
433  Abc_Print( 1, "The number of POs that are not const-0 candidates = %d.\n", nNonConsts );
434  }
435  return RetValue;
436 }
Gia_Man_t * Gia_ManSpecReduce(Gia_Man_t *p, int fDualOut, int fSynthesis, int fReduce, int fSkipSome, int fVerbose)
Definition: giaEquiv.c:848
int nFrames
Definition: cec.h:82
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
ABC_NAMESPACE_IMPL_START Abc_Cex_t * Abc_CexAlloc(int nRegs, int nRealPis, int nFrames)
DECLARATIONS ///.
Definition: utilCex.c:51
int nRounds
Definition: cec.h:81
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition: giaUtil.c:215
void Gia_ManEquivPrintClasses(Gia_Man_t *p, int fVerbose, float Mem)
Definition: giaEquiv.c:304
unsigned Gia_ManRandom(int fReset)
FUNCTION DEFINITIONS ///.
Definition: giaUtil.c:49
int Cec_ManSeqResimulateInfo(Gia_Man_t *pAig, Vec_Ptr_t *vSimInfo, Abc_Cex_t *pBestState, int fCheckMiter)
Definition: cecSeq.c:184
Gia_Man_t * Gia_ManSpecReduceInitFrames(Gia_Man_t *p, Abc_Cex_t *pInit, int nFramesMax, int *pnFrames, int fDualOut, int nMinOutputs)
Definition: giaEquiv.c:1075
static void Vec_StrFree(Vec_Str_t *p)
Definition: bblif.c:616
int nBTLimit
Definition: cec.h:85
void Cec_ManSeqDeriveInfoInitRandom(Vec_Ptr_t *vInfo, Gia_Man_t *pAig, Abc_Cex_t *pCex)
Definition: cecSeq.c:104
Gia_Man_t * Gia_ManSeqStructSweep(Gia_Man_t *p, int fConst, int fEquiv, int fVerbose)
Definition: giaScl.c:258
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact)
Definition: giaAiger.c:1024
int fVerbose
Definition: cec.h:90
int fCheckMiter
Definition: cec.h:88
int nWords
Definition: cec.h:80
#define ABC_FREE(obj)
Definition: abc_global.h:232
Definition: gia.h:95
int fDualOut
Definition: cec.h:87
int Cec_ManCheckNonTrivialCands(Gia_Man_t *pAig)
Definition: cecSeq.c:295
Vec_Str_t * Cec_ManSatSolveSeq(Vec_Ptr_t *vPatts, Gia_Man_t *pAig, Cec_ParSat_t *pPars, int nRegs, int *pnPats)
Definition: cecSolve.c:867
typedefABC_NAMESPACE_HEADER_START struct Cec_ParSat_t_ Cec_ParSat_t
INCLUDES ///.
Definition: cec.h:43
Gia_Rpr_t * pReprs
Definition: gia.h:121
int nMinOutputs
Definition: cec.h:84
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition: utilCex.h:39
int nNonRefines
Definition: cec.h:83
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
int Cec_ManCountNonConstOutputs(Gia_Man_t *pAig)
Definition: cecSeq.c:272
void Cec_ManSatSetDefaultParams(Cec_ParSat_t *p)
DECLARATIONS ///.
Definition: cecCore.c:45
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
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
void Cec_ManSimSetDefaultParams ( Cec_ParSim_t p)

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

Synopsis [This procedure sets default parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 70 of file cecCore.c.

71 {
72  memset( p, 0, sizeof(Cec_ParSim_t) );
73  p->nWords = 31; // the number of simulation words
74  p->nFrames = 100; // the number of simulation frames
75  p->nRounds = 20; // the max number of simulation rounds
76  p->nNonRefines = 3; // the max number of rounds without refinement
77  p->TimeLimit = 0; // the runtime limit in seconds
78  p->fCheckMiter = 0; // the circuit is the miter
79 // p->fFirstStop = 0; // stop on the first sat output
80  p->fDualOut = 0; // miter with separate outputs
81  p->fConstCorr = 0; // consider only constants
82  p->fSeqSimulate = 0; // performs sequential simulation
83  p->fVeryVerbose = 0; // verbose stats
84  p->fVerbose = 0; // verbose stats
85 }
char * memset()
int fVerbose
Definition: cec.h:73
int TimeLimit
Definition: cec.h:65
int fVeryVerbose
Definition: cec.h:72
int fSeqSimulate
Definition: cec.h:69
int fCheckMiter
Definition: cec.h:67
int fConstCorr
Definition: cec.h:71
int nFrames
Definition: cec.h:62
int nNonRefines
Definition: cec.h:64
int fDualOut
Definition: cec.h:66
int nRounds
Definition: cec.h:63
int nWords
Definition: cec.h:61
void Cec_ManSimulation ( Gia_Man_t pAig,
Cec_ParSim_t pPars 
)

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

Synopsis [Core procedure for simulation.]

Description []

SideEffects []

SeeAlso []

Definition at line 284 of file cecCore.c.

285 {
286  int r, nLitsOld, nLitsNew, nCountNoRef = 0, fStop = 0;
287  Gia_ManRandom( 1 );
288  if ( pPars->fSeqSimulate )
289  Abc_Print( 1, "Performing rounds of random simulation of %d frames with %d words.\n",
290  pPars->nRounds, pPars->nFrames, pPars->nWords );
291  nLitsOld = Gia_ManEquivCountLits( pAig );
292  for ( r = 0; r < pPars->nRounds; r++ )
293  {
294  if ( Cec_ManSimulationOne( pAig, pPars ) )
295  {
296  fStop = 1;
297  break;
298  }
299  // decide when to stop
300  nLitsNew = Gia_ManEquivCountLits( pAig );
301  if ( nLitsOld == 0 || nLitsOld > nLitsNew )
302  {
303  nLitsOld = nLitsNew;
304  nCountNoRef = 0;
305  }
306  else if ( ++nCountNoRef == pPars->nNonRefines )
307  {
308  r++;
309  break;
310  }
311  assert( nLitsOld == nLitsNew );
312  }
313 // if ( pPars->fVerbose )
314  if ( r == pPars->nRounds || fStop )
315  Abc_Print( 1, "Random simulation is stopped after %d rounds.\n", r );
316  else
317  Abc_Print( 1, "Random simulation saturated after %d rounds.\n", r );
318  if ( pPars->fCheckMiter )
319  {
320  int nNonConsts = Cec_ManCountNonConstOutputs( pAig );
321  if ( nNonConsts )
322  Abc_Print( 1, "The number of POs that are not const-0 candidates = %d.\n", nNonConsts );
323  }
324 }
int Gia_ManEquivCountLits(Gia_Man_t *p)
Definition: giaEquiv.c:253
int fSeqSimulate
Definition: cec.h:69
int fCheckMiter
Definition: cec.h:67
unsigned Gia_ManRandom(int fReset)
FUNCTION DEFINITIONS ///.
Definition: giaUtil.c:49
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
int Cec_ManCountNonConstOutputs(Gia_Man_t *pAig)
Definition: cecSeq.c:272
int Cec_ManSimulationOne(Gia_Man_t *pAig, Cec_ParSim_t *pPars)
Definition: cecCore.c:257
int nFrames
Definition: cec.h:62
int nNonRefines
Definition: cec.h:64
#define assert(ex)
Definition: util_old.h:213
int nRounds
Definition: cec.h:63
int nWords
Definition: cec.h:61
void Cec_ManSmfSetDefaultParams ( Cec_ParSmf_t p)

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

Synopsis [This procedure sets default parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 98 of file cecCore.c.

99 {
100  memset( p, 0, sizeof(Cec_ParSmf_t) );
101  p->nWords = 31; // the number of simulation words
102  p->nRounds = 200; // the number of simulation rounds
103  p->nFrames = 200; // the max number of time frames
104  p->nNonRefines = 3; // the max number of rounds without refinement
105  p->nMinOutputs = 0; // the min outputs to accumulate
106  p->nBTLimit = 100; // conflict limit at a node
107  p->TimeLimit = 0; // the runtime limit in seconds
108  p->fDualOut = 0; // miter with separate outputs
109  p->fCheckMiter = 0; // the circuit is the miter
110 // p->fFirstStop = 0; // stop on the first sat output
111  p->fVerbose = 0; // verbose stats
112 }
char * memset()
int nFrames
Definition: cec.h:82
int nRounds
Definition: cec.h:81
int nBTLimit
Definition: cec.h:85
int fVerbose
Definition: cec.h:90
int fCheckMiter
Definition: cec.h:88
int TimeLimit
Definition: cec.h:86
int nWords
Definition: cec.h:80
int fDualOut
Definition: cec.h:87
int nMinOutputs
Definition: cec.h:84
int nNonRefines
Definition: cec.h:83
int Cec_ManVerify ( Gia_Man_t pInit,
Cec_ParCec_t pPars 
)

MACRO DEFINITIONS ///.

FUNCTION DECLARATIONS ///

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

Synopsis [New CEC engine.]

Description []

SideEffects []

SeeAlso []

Definition at line 308 of file cecCec.c.

309 {
310  int fDumpUndecided = 0;
311  Cec_ParFra_t ParsFra, * pParsFra = &ParsFra;
312  Gia_Man_t * p, * pNew;
313  int RetValue;
314  abctime clk = Abc_Clock();
315  abctime clkTotal = Abc_Clock();
316  // consider special cases:
317  // 1) (SAT) a pair of POs have different value under all-0 pattern
318  // 2) (SAT) a pair of POs has different PI/Const drivers
319  // 3) (UNSAT) 1-2 do not hold and there is no nodes
320  RetValue = Cec_ManHandleSpecialCases( pInit, pPars );
321  if ( RetValue == 0 || RetValue == 1 )
322  return RetValue;
323  // preprocess
324  p = Gia_ManDup( pInit );
326  p = Gia_ManCleanup( pNew = p );
327  Gia_ManStop( pNew );
328  if ( pPars->fNaive )
329  {
330  RetValue = Cec_ManVerifyNaive( p, pPars );
331  Gia_ManStop( p );
332  return RetValue;
333  }
334  // sweep for equivalences
335  Cec_ManFraSetDefaultParams( pParsFra );
336  pParsFra->nItersMax = 1000;
337  pParsFra->nBTLimit = pPars->nBTLimit;
338  pParsFra->TimeLimit = pPars->TimeLimit;
339  pParsFra->fVerbose = pPars->fVerbose;
340  pParsFra->fCheckMiter = 1;
341  pParsFra->fDualOut = 1;
342  pNew = Cec_ManSatSweeping( p, pParsFra );
343  pPars->iOutFail = pParsFra->iOutFail;
344  // update
345  pInit->pCexComb = p->pCexComb; p->pCexComb = NULL;
346  Gia_ManStop( p );
347  p = pInit;
348  // continue
349  if ( pNew == NULL )
350  {
351  if ( p->pCexComb != NULL )
352  {
353  if ( p->pCexComb && !Gia_ManVerifyCex( p, p->pCexComb, 1 ) )
354  Abc_Print( 1, "Counter-example simulation has failed.\n" );
355  Abc_Print( 1, "Networks are NOT EQUIVALENT. " );
356  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
357  return 0;
358  }
359  p = Gia_ManDup( pInit );
361  p = Gia_ManCleanup( pNew = p );
362  Gia_ManStop( pNew );
363  pNew = p;
364  }
365  if ( pPars->fVerbose )
366  {
367  Abc_Print( 1, "Networks are UNDECIDED after the new CEC engine. " );
368  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
369  }
370  if ( fDumpUndecided )
371  {
372  ABC_FREE( pNew->pReprs );
373  ABC_FREE( pNew->pNexts );
374  Gia_AigerWrite( pNew, "gia_cec_undecided.aig", 0, 0 );
375  Abc_Print( 1, "The result is written into file \"%s\".\n", "gia_cec_undecided.aig" );
376  }
377  if ( pPars->TimeLimit && (Abc_Clock() - clkTotal)/CLOCKS_PER_SEC >= pPars->TimeLimit )
378  {
379  Gia_ManStop( pNew );
380  return -1;
381  }
382  // call other solver
383  if ( pPars->fVerbose )
384  Abc_Print( 1, "Calling the old CEC engine.\n" );
385  fflush( stdout );
386  RetValue = Cec_ManVerifyOld( pNew, pPars->fVerbose, &pPars->iOutFail, clkTotal );
387  p->pCexComb = pNew->pCexComb; pNew->pCexComb = NULL;
388  if ( p->pCexComb && !Gia_ManVerifyCex( p, p->pCexComb, 1 ) )
389  Abc_Print( 1, "Counter-example simulation has failed.\n" );
390  Gia_ManStop( pNew );
391  return RetValue;
392 }
Gia_Man_t * Cec_ManSatSweeping(Gia_Man_t *pAig, Cec_ParFra_t *pPars)
Definition: cecCore.c:337
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition: giaDup.c:552
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
int Gia_ManVerifyCex(Gia_Man_t *pAig, Abc_Cex_t *p, int fDualOut)
DECLARATIONS ///.
Definition: giaCex.c:44
int * pNexts
Definition: gia.h:122
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Cec_ManVerifyOld(Gia_Man_t *pMiter, int fVerbose, int *piOutFail, abctime clkTotal)
Definition: cecCec.c:71
int nBTLimit
Definition: cec.h:120
int TimeLimit
Definition: cec.h:101
Abc_Cex_t * pCexComb
Definition: gia.h:135
static abctime Abc_Clock()
Definition: abc_global.h:279
int fVerbose
Definition: cec.h:112
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
int fDualOut
Definition: cec.h:107
int TimeLimit
Definition: cec.h:121
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact)
Definition: giaAiger.c:1024
int iOutFail
Definition: cec.h:128
int Cec_ManVerifyNaive(Gia_Man_t *p, Cec_ParCec_t *pPars)
Definition: cecCec.c:207
int nBTLimit
Definition: cec.h:100
int nItersMax
Definition: cec.h:99
#define ABC_FREE(obj)
Definition: abc_global.h:232
Definition: gia.h:95
int fCheckMiter
Definition: cec.h:105
int fVerbose
Definition: cec.h:127
void Cec_ManFraSetDefaultParams(Cec_ParFra_t *p)
Definition: cecCore.c:125
Gia_Rpr_t * pReprs
Definition: gia.h:121
int fNaive
Definition: cec.h:125
int Cec_ManHandleSpecialCases(Gia_Man_t *p, Cec_ParCec_t *pPars)
Definition: cecCec.c:135
ABC_INT64_T abctime
Definition: abc_global.h:278
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
void Gia_ManEquivFixOutputPairs(Gia_Man_t *p)
Definition: giaEquiv.c:480
int iOutFail
Definition: cec.h:113
int Cec_ManVerifyTwo ( Gia_Man_t p0,
Gia_Man_t p1,
int  fVerbose 
)

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

Synopsis [New CEC engine applied to two circuits.]

Description []

SideEffects []

SeeAlso []

Definition at line 405 of file cecCec.c.

406 {
407  Cec_ParCec_t ParsCec, * pPars = &ParsCec;
408  Gia_Man_t * pMiter;
409  int RetValue;
411  pPars->fVerbose = fVerbose;
412  pMiter = Gia_ManMiter( p0, p1, 0, 1, 0, 0, pPars->fVerbose );
413  if ( pMiter == NULL )
414  return -1;
415  RetValue = Cec_ManVerify( pMiter, pPars );
416  p0->pCexComb = pMiter->pCexComb; pMiter->pCexComb = NULL;
417  Gia_ManStop( pMiter );
418  return RetValue;
419 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
int Cec_ManVerify(Gia_Man_t *pInit, Cec_ParCec_t *pPars)
MACRO DEFINITIONS ///.
Definition: cecCec.c:308
Abc_Cex_t * pCexComb
Definition: gia.h:135
void Cec_ManCecSetDefaultParams(Cec_ParCec_t *p)
Definition: cecCore.c:157
Definition: gia.h:95
int fVerbose
Definition: cec.h:127
Gia_Man_t * Gia_ManMiter(Gia_Man_t *pAig0, Gia_Man_t *pAig1, int nInsDup, int fDualOut, int fSeq, int fImplic, int fVerbose)
Definition: giaDup.c:2128
int Cec_SeqReadMinDomSize ( Cec_ParSeq_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 73 of file cecSynth.c.

74 {
75  return p->nMinDomSize;
76 }
int nMinDomSize
Definition: cec.h:183
int Cec_SeqReadVerbose ( Cec_ParSeq_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 89 of file cecSynth.c.

90 {
91  return p->fVerbose;
92 }
int fVerbose
Definition: cec.h:185
void Cec_SeqSynthesisSetDefaultParams ( Cec_ParSeq_t p)

DECLARATIONS ///.

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

FileName [cecSynth.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Combinational equivalence checking.]

Synopsis [Partitioned sequential synthesis.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Populate sequential synthesis parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file cecSynth.c.

47 {
48  memset( p, 0, sizeof(Cec_ParSeq_t) );
49  p->fUseLcorr = 0; // enables latch correspondence
50  p->fUseScorr = 0; // enables signal correspondence
51  p->nBTLimit = 1000; // (scorr/lcorr) conflict limit at a node
52  p->nFrames = 1; // (scorr only) the number of timeframes
53  p->nLevelMax = -1; // (scorr only) the max number of levels
54  p->fConsts = 1; // (scl only) merging constants
55  p->fEquivs = 1; // (scl only) merging equivalences
56  p->fUseMiniSat = 0; // enables MiniSat in lcorr/scorr
57  p->nMinDomSize = 100; // the size of minimum clock domain
58  p->fVeryVerbose = 0; // verbose stats
59  p->fVerbose = 0; // verbose stats
60 }
char * memset()
int fUseLcorr
Definition: cec.h:175
int fVerbose
Definition: cec.h:185
int nFrames
Definition: cec.h:178
int fUseScorr
Definition: cec.h:176
int nBTLimit
Definition: cec.h:177
int fVeryVerbose
Definition: cec.h:184
int fEquivs
Definition: cec.h:181
int nLevelMax
Definition: cec.h:179
int fUseMiniSat
Definition: cec.h:182
int nMinDomSize
Definition: cec.h:183
int fConsts
Definition: cec.h:180
int Cec_SequentialSynthesisPart ( Gia_Man_t p,
Cec_ParSeq_t pPars 
)

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

Synopsis [Partitioned sequential synthesis.]

Description [Returns AIG annotated with equivalence classes.]

SideEffects []

SeeAlso []

Definition at line 291 of file cecSynth.c.

292 {
293  int fPrintParts = 0;
294  char Buffer[100];
295  Gia_Man_t * pTemp;
296  Vec_Ptr_t * vParts = (Vec_Ptr_t *)p->vClockDoms;
297  Vec_Int_t * vPart;
298  int * pMapBack, * pReprs;
299  int i, nCountPis, nCountRegs;
300  int nClasses;
301  abctime clk = Abc_Clock();
302 
303  // save parameters
304  if ( fPrintParts )
305  {
306  // print partitions
307  Abc_Print( 1, "The following clock domains are used:\n" );
308  Vec_PtrForEachEntry( Vec_Int_t *, vParts, vPart, i )
309  {
310  pTemp = Gia_ManRegCreatePart( p, vPart, &nCountPis, &nCountRegs, NULL );
311  sprintf( Buffer, "part%03d.aig", i );
312  Gia_AigerWrite( pTemp, Buffer, 0, 0 );
313  Abc_Print( 1, "part%03d.aig : Reg = %4d. PI = %4d. (True = %4d. Regs = %4d.) And = %5d.\n",
314  i, Vec_IntSize(vPart), Gia_ManCiNum(pTemp)-Vec_IntSize(vPart), nCountPis, nCountRegs, Gia_ManAndNum(pTemp) );
315  Gia_ManStop( pTemp );
316  }
317  }
318 
319  // perform sequential synthesis for clock domains
320  pReprs = ABC_FALLOC( int, Gia_ManObjNum(p) );
321  Vec_PtrForEachEntry( Vec_Int_t *, vParts, vPart, i )
322  {
323  pTemp = Gia_ManRegCreatePart( p, vPart, &nCountPis, &nCountRegs, &pMapBack );
324  if ( nCountPis > 0 )
325  {
326  if ( pPars->fUseScorr )
327  {
328  Cec_ParCor_t CorPars, * pCorPars = &CorPars;
329  Cec_ManCorSetDefaultParams( pCorPars );
330  pCorPars->nBTLimit = pPars->nBTLimit;
331  pCorPars->nLevelMax = pPars->nLevelMax;
332  pCorPars->fVerbose = pPars->fVeryVerbose;
333  pCorPars->fUseCSat = 1;
334  Cec_ManLSCorrespondenceClasses( pTemp, pCorPars );
335  }
336  else if ( pPars->fUseLcorr )
337  {
338  Cec_ParCor_t CorPars, * pCorPars = &CorPars;
339  Cec_ManCorSetDefaultParams( pCorPars );
340  pCorPars->fLatchCorr = 1;
341  pCorPars->nBTLimit = pPars->nBTLimit;
342  pCorPars->fVerbose = pPars->fVeryVerbose;
343  pCorPars->fUseCSat = 1;
344  Cec_ManLSCorrespondenceClasses( pTemp, pCorPars );
345  }
346  else
347  {
348 // pNew = Gia_ManSeqStructSweep( pTemp, pPars->fConsts, pPars->fEquivs, pPars->fVerbose );
349 // Gia_ManStop( pNew );
350  Gia_ManSeqCleanupClasses( pTemp, pPars->fConsts, pPars->fEquivs, pPars->fVerbose );
351  }
352 //Abc_Print( 1, "Part equivalences = %d.\n", Gia_ManEquivCountLitsAll(pTemp) );
353  nClasses = Gia_TransferMappedClasses( pTemp, pMapBack, pReprs );
354  if ( pPars->fVerbose )
355  {
356  Abc_Print( 1, "%3d : Reg = %4d. PI = %4d. (True = %4d. Regs = %4d.) And = %5d. Cl = %5d.\n",
357  i, Vec_IntSize(vPart), Gia_ManCiNum(pTemp)-Vec_IntSize(vPart), nCountPis, nCountRegs, Gia_ManAndNum(pTemp), nClasses );
358  }
359  }
360  Gia_ManStop( pTemp );
361  ABC_FREE( pMapBack );
362  }
363 
364  // generate resulting equivalences
365  Gia_ManNormalizeEquivalences( p, pReprs );
366 //Abc_Print( 1, "Total equivalences = %d.\n", Gia_ManEquivCountLitsAll(p) );
367  ABC_FREE( pReprs );
368  if ( pPars->fVerbose )
369  {
370  Abc_PrintTime( 1, "Total time", Abc_Clock() - clk );
371  }
372  return 1;
373 }
void Cec_ManCorSetDefaultParams(Cec_ParCor_t *p)
Definition: cecCore.c:181
Gia_Man_t * Gia_ManRegCreatePart(Gia_Man_t *p, Vec_Int_t *vPart, int *pnCountPis, int *pnCountRegs, int **ppMapBack)
Definition: cecSynth.c:105
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
int fUseLcorr
Definition: cec.h:175
int fUseCSat
Definition: cec.h:146
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
int fVerbose
Definition: cec.h:185
static abctime Abc_Clock()
Definition: abc_global.h:279
int fUseScorr
Definition: cec.h:176
int fLatchCorr
Definition: cec.h:142
int nBTLimit
Definition: cec.h:177
int fVerbose
Definition: cec.h:152
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
int fVeryVerbose
Definition: cec.h:184
int nLevelMax
Definition: cec.h:140
void Gia_ManSeqCleanupClasses(Gia_Man_t *p, int fConst, int fEquiv, int fVerbose)
Definition: giaAig.c:603
char * sprintf()
void Gia_ManNormalizeEquivalences(Gia_Man_t *p, int *pReprs)
Definition: cecSynth.c:262
int Cec_ManLSCorrespondenceClasses(Gia_Man_t *pAig, Cec_ParCor_t *pPars)
Definition: cecCorr.c:909
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact)
Definition: giaAiger.c:1024
int fEquivs
Definition: cec.h:181
int nLevelMax
Definition: cec.h:179
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
Vec_Vec_t * vClockDoms
Definition: gia.h:163
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define ABC_FREE(obj)
Definition: abc_global.h:232
int nBTLimit
Definition: cec.h:139
Definition: gia.h:95
int Gia_TransferMappedClasses(Gia_Man_t *pPart, int *pMapBack, int *pReprs)
Definition: cecSynth.c:204
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_INT64_T abctime
Definition: abc_global.h:278
int fConsts
Definition: cec.h:180
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
#define ABC_FALLOC(type, num)
Definition: abc_global.h:231