abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cecCore.c File Reference
#include "cecInt.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START 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_ManSatSolving (Gia_Man_t *pAig, Cec_ParSat_t *pPars)
 
int Cec_ManSimulationOne (Gia_Man_t *pAig, Cec_ParSim_t *pPars)
 
void Cec_ManSimulation (Gia_Man_t *pAig, Cec_ParSim_t *pPars)
 
Gia_Man_tCec_ManSatSweeping (Gia_Man_t *pAig, Cec_ParFra_t *pPars)
 

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
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
ABC_NAMESPACE_IMPL_START 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
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
int Cec_ManSimulationOne ( Gia_Man_t pAig,
Cec_ParSim_t pPars 
)

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

Synopsis [Core procedure for simulation.]

Description [Returns 1 if refinement has happened.]

SideEffects []

SeeAlso []

Definition at line 257 of file cecCore.c.

258 {
259  Cec_ManSim_t * pSim;
260  int RetValue = 0;
261  abctime clkTotal = Abc_Clock();
262  pSim = Cec_ManSimStart( pAig, pPars );
263  if ( (pAig->pReprs == NULL && (RetValue = Cec_ManSimClassesPrepare( pSim, -1 ))) ||
264  (RetValue == 0 && (RetValue = Cec_ManSimClassesRefine( pSim ))) )
265  Abc_Print( 1, "The number of failed outputs of the miter = %6d. (Words = %4d. Frames = %4d.)\n",
266  pSim->nOuts, pPars->nWords, pPars->nFrames );
267  if ( pPars->fVerbose )
268  Abc_PrintTime( 1, "Time", Abc_Clock() - clkTotal );
269  Cec_ManSimStop( pSim );
270  return RetValue;
271 }
int fVerbose
Definition: cec.h:73
int Cec_ManSimClassesPrepare(Cec_ManSim_t *p, int LevelMax)
Definition: cecClass.c:851
void Cec_ManSimStop(Cec_ManSim_t *p)
Definition: cecMan.c:232
static abctime Abc_Clock()
Definition: abc_global.h:279
Cec_ManSim_t * Cec_ManSimStart(Gia_Man_t *pAig, Cec_ParSim_t *pPars)
Definition: cecMan.c:198
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
int Cec_ManSimClassesRefine(Cec_ManSim_t *p)
Definition: cecClass.c:908
int nFrames
Definition: cec.h:62
Gia_Rpr_t * pReprs
Definition: gia.h:121
int nWords
Definition: cec.h:61
ABC_INT64_T abctime
Definition: abc_global.h:278
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