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

Go to the source code of this file.

Functions

static
ABC_NAMESPACE_IMPL_START word 
Bmc_CexBitMask (int iBit)
 DECLARATIONS ///. More...
 
static void Bmc_CexCopySim (Vec_Wrd_t *vSims, int iObjTo, int iObjFrom)
 
static void Bmc_CexAndSim (Vec_Wrd_t *vSims, int iObjTo, int i, int j)
 
static void Bmc_CexOrSim (Vec_Wrd_t *vSims, int iObjTo, int i, int j)
 
static int Bmc_CexSim (Vec_Wrd_t *vSims, int iObj, int i)
 
int Bmc_CexBitCount (Abc_Cex_t *p, int nInputs)
 FUNCTION DEFINITIONS ///. More...
 
void Bmc_CexDumpStats (Gia_Man_t *p, Abc_Cex_t *pCex, Abc_Cex_t *pCexCare, Abc_Cex_t *pCexEss, Abc_Cex_t *pCexMin, abctime clk)
 
void Bmc_CexDumpAogStats (Gia_Man_t *p, abctime clk)
 
Gia_Man_tBmc_CexPerformUnrolling (Gia_Man_t *p, Abc_Cex_t *pCex)
 
void Bmc_CexPerformUnrollingTest (Gia_Man_t *p, Abc_Cex_t *pCex)
 
Gia_Man_tBmc_CexBuildNetwork (Gia_Man_t *p, Abc_Cex_t *pCex)
 
void Bmc_CexBuildNetworkTest (Gia_Man_t *p, Abc_Cex_t *pCex)
 
void Bmc_CexPrint (Abc_Cex_t *pCex, int nInputs, int fVerbose)
 
int Bmc_CexVerify (Gia_Man_t *p, Abc_Cex_t *pCex, Abc_Cex_t *pCexCare)
 
Abc_Cex_tBmc_CexInnerStates (Gia_Man_t *p, Abc_Cex_t *pCex, Abc_Cex_t **ppCexImpl, int fVerbose)
 DECLARATIONS ///. More...
 
void Bmc_CexCareBits_rec (Gia_Man_t *p, Gia_Obj_t *pObj)
 
void Bmc_CexCareBits2_rec (Gia_Man_t *p, Gia_Obj_t *pObj)
 
Abc_Cex_tBmc_CexCareBits (Gia_Man_t *p, Abc_Cex_t *pCexState, Abc_Cex_t *pCexImpl, Abc_Cex_t *pCexEss, int fFindAll, int fVerbose)
 
Abc_Cex_tBmc_CexEssentialBitOne (Gia_Man_t *p, Abc_Cex_t *pCexState, int iBit, Abc_Cex_t *pCexPrev, int *pfEqual)
 
void Bmc_CexEssentialBitTest (Gia_Man_t *p, Abc_Cex_t *pCexState)
 
Abc_Cex_tBmc_CexEssentialBits (Gia_Man_t *p, Abc_Cex_t *pCexState, Abc_Cex_t *pCexCare, int fVerbose)
 
void Bmc_CexTest (Gia_Man_t *p, Abc_Cex_t *pCex, int fVerbose)
 

Function Documentation

static void Bmc_CexAndSim ( Vec_Wrd_t vSims,
int  iObjTo,
int  i,
int  j 
)
inlinestatic

Definition at line 32 of file bmcCexTools.c.

32 { Vec_WrdWriteEntry( vSims, iObjTo, Vec_WrdEntry(vSims, i) & Vec_WrdEntry(vSims, j) ); }
static void Vec_WrdWriteEntry(Vec_Wrd_t *p, int i, word Entry)
Definition: vecWrd.h:418
static word Vec_WrdEntry(Vec_Wrd_t *p, int i)
Definition: vecWrd.h:384
int Bmc_CexBitCount ( Abc_Cex_t p,
int  nInputs 
)

FUNCTION DEFINITIONS ///.

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 51 of file bmcCexTools.c.

52 {
53  int k, Counter = 0, Counter2 = 0;
54  if ( p == NULL )
55  {
56  printf( "The counter example is NULL.\n" );
57  return -1;
58  }
59  for ( k = 0; k < p->nBits; k++ )
60  {
61  Counter += Abc_InfoHasBit(p->pData, k);
62  if ( (k - p->nRegs) % p->nPis < nInputs )
63  Counter2 += Abc_InfoHasBit(p->pData, k);
64  }
65  return Counter2;
66 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
static int Counter
static ABC_NAMESPACE_IMPL_START word Bmc_CexBitMask ( int  iBit)
inlinestatic

DECLARATIONS ///.

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

FileName [bmcCexTools.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [SAT-based bounded model checking.]

Synopsis [CEX analysis and optimization toolbox.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Definition at line 30 of file bmcCexTools.c.

30 { assert( iBit < 64 ); return ~(((word)1) << iBit); }
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
#define assert(ex)
Definition: util_old.h:213
Gia_Man_t* Bmc_CexBuildNetwork ( Gia_Man_t p,
Abc_Cex_t pCex 
)

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

Synopsis [Computes CE-induced network.]

Description []

SideEffects []

SeeAlso []

Definition at line 195 of file bmcCexTools.c.

196 {
197  Gia_Man_t * pNew, * pTemp;
198  Gia_Obj_t * pObj, * pObjRo, * pObjRi;
199  int fCompl0, fCompl1;
200  int i, k, iBit = pCex->nRegs;
201  // start the manager
202  pNew = Gia_ManStart( 1000 );
203  pNew->pName = Abc_UtilStrsav( "unate" );
204  // set const0
205  Gia_ManConst0(p)->fMark0 = 0;
206  Gia_ManConst0(p)->fMark1 = 1;
207  Gia_ManConst0(p)->Value = ~0;
208  // set init state
209  Gia_ManForEachRi( p, pObj, k )
210  {
211  pObj->fMark0 = 0;
212  pObj->fMark1 = 1;
213  pObj->Value = ~0;
214  }
215  Gia_ManHashAlloc( pNew );
216  for ( i = 0; i <= pCex->iFrame; i++ )
217  {
218  // primary inputs
219  Gia_ManForEachPi( p, pObj, k )
220  {
221  pObj->fMark0 = Abc_InfoHasBit( pCex->pData, iBit++ );
222  pObj->fMark1 = 0;
223  pObj->Value = Gia_ManAppendCi(pNew);
224  }
225  // transfer
226  Gia_ManForEachRiRo( p, pObjRi, pObjRo, k )
227  {
228  pObjRo->fMark0 = pObjRi->fMark0;
229  pObjRo->fMark1 = pObjRi->fMark1;
230  pObjRo->Value = pObjRi->Value;
231  }
232  // internal nodes
233  Gia_ManForEachAnd( p, pObj, k )
234  {
235  fCompl0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
236  fCompl1 = Gia_ObjFanin1(pObj)->fMark0 ^ Gia_ObjFaninC1(pObj);
237  pObj->fMark0 = fCompl0 & fCompl1;
238  if ( pObj->fMark0 )
239  pObj->fMark1 = Gia_ObjFanin0(pObj)->fMark1 & Gia_ObjFanin1(pObj)->fMark1;
240  else if ( !fCompl0 && !fCompl1 )
241  pObj->fMark1 = Gia_ObjFanin0(pObj)->fMark1 | Gia_ObjFanin1(pObj)->fMark1;
242  else if ( !fCompl0 )
243  pObj->fMark1 = Gia_ObjFanin0(pObj)->fMark1;
244  else if ( !fCompl1 )
245  pObj->fMark1 = Gia_ObjFanin1(pObj)->fMark1;
246  else assert( 0 );
247  pObj->Value = ~0;
248  if ( pObj->fMark1 )
249  continue;
250  if ( pObj->fMark0 )
251  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0(pObj)->Value, Gia_ObjFanin1(pObj)->Value );
252  else if ( !fCompl0 && !fCompl1 )
253  pObj->Value = Gia_ManHashOr( pNew, Gia_ObjFanin0(pObj)->Value, Gia_ObjFanin1(pObj)->Value );
254  else if ( !fCompl0 )
255  pObj->Value = Gia_ObjFanin0(pObj)->Value;
256  else if ( !fCompl1 )
257  pObj->Value = Gia_ObjFanin1(pObj)->Value;
258  else assert( 0 );
259  assert( pObj->Value > 0 );
260  }
261  // combinational outputs
262  Gia_ManForEachCo( p, pObj, k )
263  {
264  pObj->fMark0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
265  pObj->fMark1 = Gia_ObjFanin0(pObj)->fMark1;
266  pObj->Value = Gia_ObjFanin0(pObj)->Value;
267  }
268  }
269  Gia_ManHashStop( pNew );
270  assert( iBit == pCex->nBits );
271  // create primary output
272  pObj = Gia_ManPo(p, pCex->iPo);
273  assert( pObj->fMark0 == 1 );
274  assert( pObj->fMark1 == 0 );
275  assert( pObj->Value > 0 );
276  Gia_ManAppendCo( pNew, pObj->Value );
277  // cleanup
278  pNew = Gia_ManCleanup( pTemp = pNew );
279  Gia_ManStop( pTemp );
280  return pNew;
281 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
unsigned fMark1
Definition: gia.h:84
Definition: gia.h:75
#define Gia_ManForEachRiRo(p, pObjRi, pObjRo, i)
Definition: gia.h:1042
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
char * pName
Definition: gia.h:97
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
unsigned fMark0
Definition: gia.h:79
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
int Gia_ManHashOr(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:611
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
void Bmc_CexBuildNetworkTest ( Gia_Man_t p,
Abc_Cex_t pCex 
)

Definition at line 282 of file bmcCexTools.c.

283 {
284  Gia_Man_t * pNew;
285  abctime clk = Abc_Clock();
286  pNew = Bmc_CexBuildNetwork( p, pCex );
287  Gia_ManPrintStats( pNew, NULL );
288  Gia_AigerWrite( pNew, "unate.aig", 0, 0 );
289 //Bmc_CexDumpAogStats( pNew, Abc_Clock() - clk );
290  Gia_ManStop( pNew );
291  printf( "CE-induced network is written into file \"unate.aig\".\n" );
292  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
293 }
Gia_Man_t * Bmc_CexBuildNetwork(Gia_Man_t *p, Abc_Cex_t *pCex)
Definition: bmcCexTools.c:195
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
void Gia_ManPrintStats(Gia_Man_t *p, Gps_Par_t *pPars)
Definition: giaMan.c:389
static abctime Abc_Clock()
Definition: abc_global.h:279
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact)
Definition: giaAiger.c:1024
Definition: gia.h:95
ABC_INT64_T abctime
Definition: abc_global.h:278
Abc_Cex_t* Bmc_CexCareBits ( Gia_Man_t p,
Abc_Cex_t pCexState,
Abc_Cex_t pCexImpl,
Abc_Cex_t pCexEss,
int  fFindAll,
int  fVerbose 
)

Definition at line 550 of file bmcCexTools.c.

551 {
552  Abc_Cex_t * pNew;
553  Gia_Obj_t * pObj;
554  int fCompl0, fCompl1;
555  int i, k, iBit;
556  assert( pCexState->nRegs == 0 );
557  // start the counter-example
558  pNew = Abc_CexAlloc( 0, Gia_ManCiNum(p), pCexState->iFrame + 1 );
559  pNew->iFrame = pCexState->iFrame;
560  pNew->iPo = pCexState->iPo;
561  // set initial state
563  // set const0
564  Gia_ManConst0(p)->fMark0 = 0;
565  Gia_ManConst0(p)->fMark1 = 1;
566  for ( i = pCexState->iFrame; i >= 0; i-- )
567  {
568  // set correct values
569  iBit = pCexState->nPis * i;
570  Gia_ManForEachCi( p, pObj, k )
571  {
572  pObj->fMark0 = Abc_InfoHasBit(pCexState->pData, iBit+k);
573  pObj->fMark1 = 0;
574  if ( pCexImpl )
575  pObj->fMark1 |= Abc_InfoHasBit(pCexImpl->pData, iBit+k);
576  if ( pCexEss )
577  pObj->fMark1 |= Abc_InfoHasBit(pCexEss->pData, iBit+k);
578  }
579  Gia_ManForEachAnd( p, pObj, k )
580  {
581  fCompl0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
582  fCompl1 = Gia_ObjFanin1(pObj)->fMark0 ^ Gia_ObjFaninC1(pObj);
583  pObj->fMark0 = fCompl0 & fCompl1;
584  if ( pObj->fMark0 )
585  pObj->fMark1 = Gia_ObjFanin0(pObj)->fMark1 & Gia_ObjFanin1(pObj)->fMark1;
586  else if ( !fCompl0 && !fCompl1 )
587  pObj->fMark1 = Gia_ObjFanin0(pObj)->fMark1 | Gia_ObjFanin1(pObj)->fMark1;
588  else if ( !fCompl0 )
589  pObj->fMark1 = Gia_ObjFanin0(pObj)->fMark1;
590  else if ( !fCompl1 )
591  pObj->fMark1 = Gia_ObjFanin1(pObj)->fMark1;
592  else assert( 0 );
593  }
594  Gia_ManForEachCo( p, pObj, k )
595  pObj->fMark0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
596  // move values from COs to CIs
597  if ( i == pCexState->iFrame )
598  {
599  assert( Gia_ManPo(p, pCexState->iPo)->fMark0 == 1 );
600  if ( fFindAll )
601  Bmc_CexCareBits_rec( p, Gia_ObjFanin0(Gia_ManPo(p, pCexState->iPo)) );
602  else
603  Bmc_CexCareBits2_rec( p, Gia_ObjFanin0(Gia_ManPo(p, pCexState->iPo)) );
604  }
605  else
606  {
607  Gia_ManForEachRi( p, pObj, k )
608  if ( Abc_InfoHasBit(pNew->pData, pNew->nPis * (i+1) + Gia_ManPiNum(p) + k) )
609  {
610  if ( fFindAll )
612  else
614  }
615  }
616  // save the results
617  Gia_ManForEachCi( p, pObj, k )
618  if ( pObj->fMark1 )
619  {
620  pObj->fMark1 = 0;
621  if ( pCexImpl == NULL || !Abc_InfoHasBit(pCexImpl->pData, pNew->nPis * i + k) )
622  Abc_InfoSetBit(pNew->pData, pNew->nPis * i + k);
623  }
624  }
625  if ( pCexEss )
626  printf( "Minimized: " );
627  else
628  printf( "Care bits: " );
629  Bmc_CexPrint( pNew, Gia_ManPiNum(p), fVerbose );
630  return pNew;
631 }
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
ABC_NAMESPACE_IMPL_START Abc_Cex_t * Abc_CexAlloc(int nRegs, int nRealPis, int nFrames)
DECLARATIONS ///.
Definition: utilCex.c:51
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
void Bmc_CexCareBits_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: bmcCexTools.c:491
unsigned fMark1
Definition: gia.h:84
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
if(last==0)
Definition: sparse_int.h:34
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
void Bmc_CexCareBits2_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: bmcCexTools.c:519
static void Abc_InfoSetBit(unsigned *p, int i)
Definition: abc_global.h:259
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
unsigned fMark0
Definition: gia.h:79
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition: utilCex.h:39
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
void Gia_ManCleanMark01(Gia_Man_t *p)
Definition: giaUtil.c:177
void Bmc_CexPrint(Abc_Cex_t *pCex, int nInputs, int fVerbose)
Definition: bmcCexTools.c:307
void Bmc_CexCareBits2_rec ( Gia_Man_t p,
Gia_Obj_t pObj 
)

Definition at line 519 of file bmcCexTools.c.

520 {
521  int fCompl0, fCompl1;
522  if ( Gia_ObjIsConst0(pObj) )
523  return;
524  if ( pObj->fMark1 )
525  return;
526  pObj->fMark1 = 1;
527  if ( Gia_ObjIsCi(pObj) )
528  return;
529  assert( Gia_ObjIsAnd(pObj) );
530  fCompl0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
531  fCompl1 = Gia_ObjFanin1(pObj)->fMark0 ^ Gia_ObjFaninC1(pObj);
532  if ( pObj->fMark0 )
533  {
534  assert( fCompl0 == 1 && fCompl1 == 1 );
537  }
538  else
539  {
540  assert( fCompl0 == 0 || fCompl1 == 0 );
541  if ( fCompl0 == 0 )
543  /**/
544  else
545  /**/
546  if ( fCompl1 == 0 )
548  }
549 }
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
unsigned fMark1
Definition: gia.h:84
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
void Bmc_CexCareBits2_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: bmcCexTools.c:519
unsigned fMark0
Definition: gia.h:79
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
void Bmc_CexCareBits_rec ( Gia_Man_t p,
Gia_Obj_t pObj 
)

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

Synopsis [Computes care bits of the CEX.]

Description []

SideEffects []

SeeAlso []

Definition at line 491 of file bmcCexTools.c.

492 {
493  int fCompl0, fCompl1;
494  if ( Gia_ObjIsConst0(pObj) )
495  return;
496  if ( pObj->fMark1 )
497  return;
498  pObj->fMark1 = 1;
499  if ( Gia_ObjIsCi(pObj) )
500  return;
501  assert( Gia_ObjIsAnd(pObj) );
502  fCompl0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
503  fCompl1 = Gia_ObjFanin1(pObj)->fMark0 ^ Gia_ObjFaninC1(pObj);
504  if ( pObj->fMark0 )
505  {
506  assert( fCompl0 == 1 && fCompl1 == 1 );
509  }
510  else
511  {
512  assert( fCompl0 == 0 || fCompl1 == 0 );
513  if ( fCompl0 == 0 )
515  if ( fCompl1 == 0 )
517  }
518 }
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
void Bmc_CexCareBits_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: bmcCexTools.c:491
unsigned fMark1
Definition: gia.h:84
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
unsigned fMark0
Definition: gia.h:79
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
static void Bmc_CexCopySim ( Vec_Wrd_t vSims,
int  iObjTo,
int  iObjFrom 
)
inlinestatic

Definition at line 31 of file bmcCexTools.c.

31 { Vec_WrdWriteEntry( vSims, iObjTo, iObjFrom ); }
static void Vec_WrdWriteEntry(Vec_Wrd_t *p, int i, word Entry)
Definition: vecWrd.h:418
void Bmc_CexDumpAogStats ( Gia_Man_t p,
abctime  clk 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 115 of file bmcCexTools.c.

116 {
117  FILE * pTable = fopen( "cex/aig_stats.txt", "a+" );
118  fprintf( pTable, "%s ", p->pName );
119  fprintf( pTable, "%d ", Gia_ManPiNum(p) );
120  fprintf( pTable, "%d ", Gia_ManAndNum(p) );
121  fprintf( pTable, "%d ", Gia_ManLevelNum(p) );
122  fprintf( pTable, "%.2f ", 1.0*clk/(CLOCKS_PER_SEC) );
123  fprintf( pTable, "\n" );
124  fclose( pTable );
125 }
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
char * pName
Definition: gia.h:97
int Gia_ManLevelNum(Gia_Man_t *p)
Definition: giaUtil.c:505
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
void Bmc_CexDumpStats ( Gia_Man_t p,
Abc_Cex_t pCex,
Abc_Cex_t pCexCare,
Abc_Cex_t pCexEss,
Abc_Cex_t pCexMin,
abctime  clk 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 78 of file bmcCexTools.c.

79 {
80  int nInputs = Gia_ManPiNum(p);
81  int nBitsTotal = (pCex->iFrame + 1) * nInputs;
82  int nBitsCare = Bmc_CexBitCount(pCexCare, nInputs);
83  int nBitsDC = nBitsTotal - nBitsCare;
84  int nBitsEss = Bmc_CexBitCount(pCexEss, nInputs);
85  int nBitsOpt = nBitsCare - nBitsEss;
86  int nBitsMin = Bmc_CexBitCount(pCexMin, nInputs);
87 
88  FILE * pTable = fopen( "cex/stats.txt", "a+" );
89  fprintf( pTable, "%s ", p->pName );
90  fprintf( pTable, "%d ", nInputs );
91  fprintf( pTable, "%d ", Gia_ManRegNum(p) );
92  fprintf( pTable, "%d ", pCex->iFrame + 1 );
93  fprintf( pTable, "%d ", nBitsTotal );
94  fprintf( pTable, "%.2f ", 100.0 * nBitsDC / nBitsTotal );
95  fprintf( pTable, "%.2f ", 100.0 * nBitsOpt / nBitsTotal );
96  fprintf( pTable, "%.2f ", 100.0 * nBitsEss / nBitsTotal );
97  fprintf( pTable, "%.2f ", 100.0 * nBitsMin / nBitsTotal );
98  fprintf( pTable, "%.2f ", 1.0*clk/(CLOCKS_PER_SEC) );
99  fprintf( pTable, "\n" );
100  fclose( pTable );
101 }
int Bmc_CexBitCount(Abc_Cex_t *p, int nInputs)
FUNCTION DEFINITIONS ///.
Definition: bmcCexTools.c:51
char * pName
Definition: gia.h:97
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Abc_Cex_t* Bmc_CexEssentialBitOne ( Gia_Man_t p,
Abc_Cex_t pCexState,
int  iBit,
Abc_Cex_t pCexPrev,
int *  pfEqual 
)

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

Synopsis [Simulates one bit to check whether it is essential.]

Description []

SideEffects []

SeeAlso []

Definition at line 644 of file bmcCexTools.c.

645 {
646  Abc_Cex_t * pNew;
647  Gia_Obj_t * pObj;
648  int i, k, fCompl0, fCompl1;
649  assert( pCexState->nRegs == 0 );
650  assert( iBit < pCexState->nBits );
651  if ( pfEqual )
652  *pfEqual = 0;
653  // start the counter-example
654  pNew = Abc_CexAllocFull( 0, Gia_ManCiNum(p), pCexState->iFrame + 1 );
655  pNew->iFrame = pCexState->iFrame;
656  pNew->iPo = pCexState->iPo;
657  // clean bit
658  Abc_InfoXorBit( pNew->pData, iBit );
659  // simulate the remaining frames
660  Gia_ManConst0(p)->fMark0 = 0;
661  Gia_ManConst0(p)->fMark1 = 1;
662  for ( i = iBit / pCexState->nPis; i <= pCexState->iFrame; i++ )
663  {
664  Gia_ManForEachCi( p, pObj, k )
665  {
666  pObj->fMark0 = Abc_InfoHasBit( pCexState->pData, i * pCexState->nPis + k );
667  pObj->fMark1 = Abc_InfoHasBit( pNew->pData, i * pCexState->nPis + k );
668  }
669  Gia_ManForEachAnd( p, pObj, k )
670  {
671  fCompl0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
672  fCompl1 = Gia_ObjFanin1(pObj)->fMark0 ^ Gia_ObjFaninC1(pObj);
673  pObj->fMark0 = fCompl0 & fCompl1;
674  if ( pObj->fMark0 )
675  pObj->fMark1 = Gia_ObjFanin0(pObj)->fMark1 & Gia_ObjFanin1(pObj)->fMark1;
676  else if ( !fCompl0 && !fCompl1 )
677  pObj->fMark1 = Gia_ObjFanin0(pObj)->fMark1 | Gia_ObjFanin1(pObj)->fMark1;
678  else if ( !fCompl0 )
679  pObj->fMark1 = Gia_ObjFanin0(pObj)->fMark1;
680  else if ( !fCompl1 )
681  pObj->fMark1 = Gia_ObjFanin1(pObj)->fMark1;
682  else assert( 0 );
683  }
684  Gia_ManForEachCo( p, pObj, k )
685  {
686  pObj->fMark0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
687  pObj->fMark1 = Gia_ObjFanin0(pObj)->fMark1;
688  }
689  if ( i < pCexState->iFrame )
690  {
691  int fChanges = 0;
692  int fEqual = (pCexPrev != NULL);
693  int iBitShift = (i + 1) * pCexState->nPis + Gia_ManPiNum(p);
694  Gia_ManForEachRi( p, pObj, k )
695  {
696  if ( fEqual && pCexPrev && (int)pObj->fMark1 != Abc_InfoHasBit(pCexPrev->pData, iBitShift + k) )
697  fEqual = 0;
698  if ( !pObj->fMark1 )
699  {
700  fChanges = 1;
701  Abc_InfoXorBit( pNew->pData, iBitShift + k );
702  }
703  }
704  if ( !fChanges || fEqual )
705  {
706  if ( pfEqual )
707  *pfEqual = fEqual;
708  Abc_CexFree( pNew );
709  return NULL;
710  }
711  }
712 /*
713  if ( i == 20 )
714  {
715  printf( "Frame %d : ", i );
716  Gia_ManForEachRi( p, pObj, k )
717  printf( "%d", pObj->fMark1 );
718  printf( "\n" );
719  }
720 */
721  }
722  return pNew;
723 }
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
static void Abc_InfoXorBit(unsigned *p, int i)
Definition: abc_global.h:260
unsigned fMark1
Definition: gia.h:84
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
Abc_Cex_t * Abc_CexAllocFull(int nRegs, int nRealPis, int nFrames)
Definition: utilCex.c:62
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
unsigned fMark0
Definition: gia.h:79
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition: utilCex.h:39
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
void Abc_CexFree(Abc_Cex_t *p)
Definition: utilCex.c:371
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
Abc_Cex_t* Bmc_CexEssentialBits ( Gia_Man_t p,
Abc_Cex_t pCexState,
Abc_Cex_t pCexCare,
int  fVerbose 
)

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

Synopsis [Computes essential bits of the CEX.]

Description []

SideEffects []

SeeAlso []

Definition at line 755 of file bmcCexTools.c.

756 {
757  Abc_Cex_t * pNew, * pTemp, * pPrev = NULL;
758  int b, fEqual = 0, fPrevStatus = 0;
759 // abctime clk = Abc_Clock();
760  assert( pCexState->nBits == pCexCare->nBits );
761  // start the counter-example
762  pNew = Abc_CexAlloc( 0, Gia_ManCiNum(p), pCexState->iFrame + 1 );
763  pNew->iFrame = pCexState->iFrame;
764  pNew->iPo = pCexState->iPo;
765  // iterate through care-bits
766  for ( b = 0; b < pCexState->nBits; b++ )
767  {
768  // skip don't-care bits
769  if ( !Abc_InfoHasBit(pCexCare->pData, b) )
770  continue;
771 
772  // skip state bits
773  if ( b % pCexCare->nPis >= Gia_ManPiNum(p) )
774  {
775  Abc_InfoSetBit( pNew->pData, b );
776  continue;
777  }
778 
779  // check if this is an essential bit
780  pTemp = Bmc_CexEssentialBitOne( p, pCexState, b, pPrev, &fEqual );
781 // pTemp = Bmc_CexEssentialBitOne( p, pCexState, b, NULL, &fEqual );
782  if ( pTemp == NULL )
783  {
784  if ( fEqual && fPrevStatus )
785  Abc_InfoSetBit( pNew->pData, b );
786  continue;
787  }
788 // Bmc_CexPrint( pTemp, Gia_ManPiNum(p), fVerbose );
789  Abc_CexFree( pPrev );
790  pPrev = pTemp;
791 
792  // record essential bit
793  fPrevStatus = !Gia_ManPo(p, pCexState->iPo)->fMark1;
794  if ( !Gia_ManPo(p, pCexState->iPo)->fMark1 )
795  Abc_InfoSetBit( pNew->pData, b );
796  }
797  Abc_CexFreeP( &pPrev );
798 // Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
799  printf( "Essentials: " );
800  Bmc_CexPrint( pNew, Gia_ManPiNum(p), fVerbose );
801  return pNew;
802 }
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
ABC_NAMESPACE_IMPL_START Abc_Cex_t * Abc_CexAlloc(int nRegs, int nRealPis, int nFrames)
DECLARATIONS ///.
Definition: utilCex.c:51
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
unsigned fMark1
Definition: gia.h:84
Abc_Cex_t * Bmc_CexEssentialBitOne(Gia_Man_t *p, Abc_Cex_t *pCexState, int iBit, Abc_Cex_t *pCexPrev, int *pfEqual)
Definition: bmcCexTools.c:644
void Abc_CexFreeP(Abc_Cex_t **p)
Definition: utilCex.c:350
static void Abc_InfoSetBit(unsigned *p, int i)
Definition: abc_global.h:259
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition: utilCex.h:39
void Abc_CexFree(Abc_Cex_t *p)
Definition: utilCex.c:371
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
void Bmc_CexPrint(Abc_Cex_t *pCex, int nInputs, int fVerbose)
Definition: bmcCexTools.c:307
void Bmc_CexEssentialBitTest ( Gia_Man_t p,
Abc_Cex_t pCexState 
)

Definition at line 724 of file bmcCexTools.c.

725 {
726  Abc_Cex_t * pNew;
727  int b;
728  for ( b = 0; b < pCexState->nBits; b++ )
729  {
730  if ( b % 100 )
731  continue;
732  pNew = Bmc_CexEssentialBitOne( p, pCexState, b, NULL, NULL );
733  Bmc_CexPrint( pNew, Gia_ManPiNum(p), 0 );
734 
735  if ( Gia_ManPo(p, pCexState->iPo)->fMark1 )
736  printf( "Not essential\n" );
737  else
738  printf( "Essential\n" );
739 
740  Abc_CexFree( pNew );
741  }
742 }
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
unsigned fMark1
Definition: gia.h:84
Abc_Cex_t * Bmc_CexEssentialBitOne(Gia_Man_t *p, Abc_Cex_t *pCexState, int iBit, Abc_Cex_t *pCexPrev, int *pfEqual)
Definition: bmcCexTools.c:644
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition: utilCex.h:39
void Abc_CexFree(Abc_Cex_t *p)
Definition: utilCex.c:371
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
void Bmc_CexPrint(Abc_Cex_t *pCex, int nInputs, int fVerbose)
Definition: bmcCexTools.c:307
Abc_Cex_t* Bmc_CexInnerStates ( Gia_Man_t p,
Abc_Cex_t pCex,
Abc_Cex_t **  ppCexImpl,
int  fVerbose 
)

DECLARATIONS ///.

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

Synopsis [Computes internal states of the CEX.]

Description []

SideEffects []

SeeAlso []

Definition at line 388 of file bmcCexTools.c.

389 {
390  Abc_Cex_t * pNew, * pNew2;
391  Gia_Obj_t * pObj, * pObjRo, * pObjRi;
392  int fCompl0, fCompl1;
393  int i, k, iBit = 0;
394  assert( pCex->nRegs > 0 );
395  // start the counter-example
396  pNew = Abc_CexAlloc( 0, Gia_ManCiNum(p), pCex->iFrame + 1 );
397  pNew->iFrame = pCex->iFrame;
398  pNew->iPo = pCex->iPo;
399  // start the counter-example
400  pNew2 = Abc_CexAlloc( 0, Gia_ManCiNum(p), pCex->iFrame + 1 );
401  pNew2->iFrame = pCex->iFrame;
402  pNew2->iPo = pCex->iPo;
403  // set initial state
405  // set const0
406  Gia_ManConst0(p)->fMark0 = 0;
407  Gia_ManConst0(p)->fMark1 = 1;
408  // set init state
409  Gia_ManForEachRi( p, pObjRi, k )
410  {
411  pObjRi->fMark0 = 0;
412  pObjRi->fMark1 = 1;
413  }
414  iBit = pCex->nRegs;
415  for ( i = 0; i <= pCex->iFrame; i++ )
416  {
417  Gia_ManForEachPi( p, pObj, k )
418  pObj->fMark0 = Abc_InfoHasBit(pCex->pData, iBit++);
419  Gia_ManForEachRiRo( p, pObjRi, pObjRo, k )
420  {
421  pObjRo->fMark0 = pObjRi->fMark0;
422  pObjRo->fMark1 = pObjRi->fMark1;
423  }
424  Gia_ManForEachCi( p, pObj, k )
425  {
426  if ( pObj->fMark0 )
427  Abc_InfoSetBit( pNew->pData, pNew->nPis * i + k );
428  if ( pObj->fMark1 )
429  Abc_InfoSetBit( pNew2->pData, pNew2->nPis * i + k );
430  }
431  Gia_ManForEachAnd( p, pObj, k )
432  {
433  fCompl0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
434  fCompl1 = Gia_ObjFanin1(pObj)->fMark0 ^ Gia_ObjFaninC1(pObj);
435  pObj->fMark0 = fCompl0 & fCompl1;
436  if ( pObj->fMark0 )
437  pObj->fMark1 = Gia_ObjFanin0(pObj)->fMark1 & Gia_ObjFanin1(pObj)->fMark1;
438  else if ( !fCompl0 && !fCompl1 )
439  pObj->fMark1 = Gia_ObjFanin0(pObj)->fMark1 | Gia_ObjFanin1(pObj)->fMark1;
440  else if ( !fCompl0 )
441  pObj->fMark1 = Gia_ObjFanin0(pObj)->fMark1;
442  else if ( !fCompl1 )
443  pObj->fMark1 = Gia_ObjFanin1(pObj)->fMark1;
444  else assert( 0 );
445  }
446  Gia_ManForEachCo( p, pObj, k )
447  {
448  pObj->fMark0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
449  pObj->fMark1 = Gia_ObjFanin0(pObj)->fMark1;
450  }
451 
452 /*
453  // print input/state/output
454  printf( "%3d : ", i );
455  Gia_ManForEachPi( p, pObj, k )
456  printf( "%d", pObj->fMark0 );
457  printf( " " );
458  Gia_ManForEachRo( p, pObj, k )
459  printf( "%d", pObj->fMark0 );
460  printf( " " );
461  Gia_ManForEachPo( p, pObj, k )
462  printf( "%d", pObj->fMark0 );
463  printf( "\n" );
464 */
465  }
466  assert( iBit == pCex->nBits );
467  assert( Gia_ManPo(p, pCex->iPo)->fMark0 == 1 );
468 
469  printf( "Inner states: " );
470  Bmc_CexPrint( pNew, Gia_ManPiNum(p), fVerbose );
471  printf( "Implications: " );
472  Bmc_CexPrint( pNew2, Gia_ManPiNum(p), fVerbose );
473  if ( ppCexImpl )
474  *ppCexImpl = pNew2;
475  else
476  Abc_CexFree( pNew2 );
477  return pNew;
478 }
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
ABC_NAMESPACE_IMPL_START Abc_Cex_t * Abc_CexAlloc(int nRegs, int nRealPis, int nFrames)
DECLARATIONS ///.
Definition: utilCex.c:51
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
unsigned fMark1
Definition: gia.h:84
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
#define Gia_ManForEachRiRo(p, pObjRi, pObjRo, i)
Definition: gia.h:1042
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static void Abc_InfoSetBit(unsigned *p, int i)
Definition: abc_global.h:259
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
unsigned fMark0
Definition: gia.h:79
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition: utilCex.h:39
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
void Abc_CexFree(Abc_Cex_t *p)
Definition: utilCex.c:371
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
void Gia_ManCleanMark01(Gia_Man_t *p)
Definition: giaUtil.c:177
void Bmc_CexPrint(Abc_Cex_t *pCex, int nInputs, int fVerbose)
Definition: bmcCexTools.c:307
static void Bmc_CexOrSim ( Vec_Wrd_t vSims,
int  iObjTo,
int  i,
int  j 
)
inlinestatic

Definition at line 33 of file bmcCexTools.c.

33 { Vec_WrdWriteEntry( vSims, iObjTo, Vec_WrdEntry(vSims, i) | Vec_WrdEntry(vSims, j) ); }
static void Vec_WrdWriteEntry(Vec_Wrd_t *p, int i, word Entry)
Definition: vecWrd.h:418
static word Vec_WrdEntry(Vec_Wrd_t *p, int i)
Definition: vecWrd.h:384
Gia_Man_t* Bmc_CexPerformUnrolling ( Gia_Man_t p,
Abc_Cex_t pCex 
)

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

Synopsis [Performs initialized unrolling till the last frame.]

Description []

SideEffects []

SeeAlso []

Definition at line 138 of file bmcCexTools.c.

139 {
140  Gia_Man_t * pNew, * pTemp;
141  Gia_Obj_t * pObj, * pObjRo, * pObjRi;
142  int i, k;
143  assert( Gia_ManRegNum(p) > 0 );
144  pNew = Gia_ManStart( (pCex->iFrame + 1) * Gia_ManObjNum(p) );
145  pNew->pName = Abc_UtilStrsav( p->pName );
146  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
147  Gia_ManConst0(p)->Value = 0;
148  Gia_ManForEachRi( p, pObj, k )
149  pObj->Value = 0;
150  Gia_ManHashAlloc( pNew );
151  for ( i = 0; i <= pCex->iFrame; i++ )
152  {
153  Gia_ManForEachPi( p, pObj, k )
154  pObj->Value = Gia_ManAppendCi( pNew );
155  Gia_ManForEachRiRo( p, pObjRi, pObjRo, k )
156  pObjRo->Value = pObjRi->Value;
157  Gia_ManForEachAnd( p, pObj, k )
158  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
159  Gia_ManForEachCo( p, pObj, k )
160  pObj->Value = Gia_ObjFanin0Copy(pObj);
161  }
162  Gia_ManHashStop( pNew );
163  pObj = Gia_ManPo(p, pCex->iPo);
164  Gia_ManAppendCo( pNew, pObj->Value );
165  // cleanup
166  pNew = Gia_ManCleanup( pTemp = pNew );
167  Gia_ManStop( pTemp );
168  return pNew;
169 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
for(p=first;p->value< newval;p=p->next)
Definition: gia.h:75
#define Gia_ManForEachRiRo(p, pObjRi, pObjRo, i)
Definition: gia.h:1042
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
void Bmc_CexPerformUnrollingTest ( Gia_Man_t p,
Abc_Cex_t pCex 
)

Definition at line 170 of file bmcCexTools.c.

171 {
172  Gia_Man_t * pNew;
173  abctime clk = Abc_Clock();
174  pNew = Bmc_CexPerformUnrolling( p, pCex );
175  Gia_ManPrintStats( pNew, NULL );
176  Gia_AigerWrite( pNew, "unroll.aig", 0, 0 );
177 //Bmc_CexDumpAogStats( pNew, Abc_Clock() - clk );
178  Gia_ManStop( pNew );
179  printf( "CE-induced network is written into file \"unroll.aig\".\n" );
180  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
181 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
void Gia_ManPrintStats(Gia_Man_t *p, Gps_Par_t *pPars)
Definition: giaMan.c:389
static abctime Abc_Clock()
Definition: abc_global.h:279
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact)
Definition: giaAiger.c:1024
Definition: gia.h:95
Gia_Man_t * Bmc_CexPerformUnrolling(Gia_Man_t *p, Abc_Cex_t *pCex)
Definition: bmcCexTools.c:138
ABC_INT64_T abctime
Definition: abc_global.h:278
void Bmc_CexPrint ( Abc_Cex_t pCex,
int  nInputs,
int  fVerbose 
)

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

Synopsis [Prints one counter-example.]

Description []

SideEffects []

SeeAlso []

Definition at line 307 of file bmcCexTools.c.

308 {
309  int i, k, Count, iBit = pCex->nRegs;
310  Abc_CexPrintStatsInputs( pCex, nInputs );
311  if ( !fVerbose )
312  return;
313 
314  for ( i = 0; i <= pCex->iFrame; i++ )
315  {
316  Count = 0;
317  printf( "%3d : ", i );
318  for ( k = 0; k < nInputs; k++ )
319  {
320  Count += Abc_InfoHasBit(pCex->pData, iBit);
321  printf( "%d", Abc_InfoHasBit(pCex->pData, iBit++) );
322  }
323  printf( " %3d ", Count );
324  Count = 0;
325  for ( ; k < pCex->nPis; k++ )
326  {
327  Count += Abc_InfoHasBit(pCex->pData, iBit);
328  printf( "%d", Abc_InfoHasBit(pCex->pData, iBit++) );
329  }
330  printf( " %3d\n", Count );
331  }
332  assert( iBit == pCex->nBits );
333 }
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
void Abc_CexPrintStatsInputs(Abc_Cex_t *p, int nInputs)
Definition: utilCex.c:275
#define assert(ex)
Definition: util_old.h:213
static int Bmc_CexSim ( Vec_Wrd_t vSims,
int  iObj,
int  i 
)
inlinestatic

Definition at line 34 of file bmcCexTools.c.

34 { return (Vec_WrdEntry(vSims, iObj) >> i) & 1; }
static word Vec_WrdEntry(Vec_Wrd_t *p, int i)
Definition: vecWrd.h:384
void Bmc_CexTest ( Gia_Man_t p,
Abc_Cex_t pCex,
int  fVerbose 
)

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

Synopsis [Computes essential bits of the CEX.]

Description []

SideEffects []

SeeAlso []

Definition at line 816 of file bmcCexTools.c.

817 {
818  abctime clk = Abc_Clock();
819  Abc_Cex_t * pCexImpl = NULL;
820  Abc_Cex_t * pCexStates = Bmc_CexInnerStates( p, pCex, &pCexImpl, fVerbose );
821  Abc_Cex_t * pCexCare = Bmc_CexCareBits( p, pCexStates, pCexImpl, NULL, 1, fVerbose );
822  Abc_Cex_t * pCexEss, * pCexMin;
823 
824  if ( !Bmc_CexVerify( p, pCex, pCexCare ) )
825  printf( "Counter-example care-set verification has failed.\n" );
826 
827  pCexEss = Bmc_CexEssentialBits( p, pCexStates, pCexCare, fVerbose );
828  pCexMin = Bmc_CexCareBits( p, pCexStates, pCexImpl, pCexEss, 0, fVerbose );
829 
830  if ( !Bmc_CexVerify( p, pCex, pCexMin ) )
831  printf( "Counter-example min-set verification has failed.\n" );
832 
833 // Bmc_CexDumpStats( p, pCex, pCexCare, pCexEss, pCexMin, Abc_Clock() - clk );
834 
835  Abc_CexFreeP( &pCexStates );
836  Abc_CexFreeP( &pCexImpl );
837  Abc_CexFreeP( &pCexCare );
838  Abc_CexFreeP( &pCexEss );
839  Abc_CexFreeP( &pCexMin );
840 
841  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
842 // Bmc_CexBuildNetworkTest( p, pCex );
843 // Bmc_CexPerformUnrollingTest( p, pCex );
844 }
int Bmc_CexVerify(Gia_Man_t *p, Abc_Cex_t *pCex, Abc_Cex_t *pCexCare)
Definition: bmcCexTools.c:346
Abc_Cex_t * Bmc_CexEssentialBits(Gia_Man_t *p, Abc_Cex_t *pCexState, Abc_Cex_t *pCexCare, int fVerbose)
Definition: bmcCexTools.c:755
static abctime Abc_Clock()
Definition: abc_global.h:279
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
void Abc_CexFreeP(Abc_Cex_t **p)
Definition: utilCex.c:350
Abc_Cex_t * Bmc_CexInnerStates(Gia_Man_t *p, Abc_Cex_t *pCex, Abc_Cex_t **ppCexImpl, int fVerbose)
DECLARATIONS ///.
Definition: bmcCexTools.c:388
Abc_Cex_t * Bmc_CexCareBits(Gia_Man_t *p, Abc_Cex_t *pCexState, Abc_Cex_t *pCexImpl, Abc_Cex_t *pCexEss, int fFindAll, int fVerbose)
Definition: bmcCexTools.c:550
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition: utilCex.h:39
ABC_INT64_T abctime
Definition: abc_global.h:278
int Bmc_CexVerify ( Gia_Man_t p,
Abc_Cex_t pCex,
Abc_Cex_t pCexCare 
)

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

Synopsis [Verifies the care set of the counter-example.]

Description []

SideEffects []

SeeAlso []

Definition at line 346 of file bmcCexTools.c.

347 {
348  Gia_Obj_t * pObj;
349  int i, k;
350  assert( pCex->nRegs > 0 );
351 // assert( pCexCare->nRegs == 0 );
353  Gia_ManForEachRi( p, pObj, k )
354  Gia_ObjTerSimSet0( pObj );
355  for ( i = 0; i <= pCex->iFrame; i++ )
356  {
357  Gia_ManForEachPi( p, pObj, k )
358  {
359  if ( !Abc_InfoHasBit( pCexCare->pData, pCexCare->nRegs + i * pCexCare->nPis + k ) )
360  Gia_ObjTerSimSetX( pObj );
361  else if ( Abc_InfoHasBit( pCex->pData, pCex->nRegs + i * pCex->nPis + k ) )
362  Gia_ObjTerSimSet1( pObj );
363  else
364  Gia_ObjTerSimSet0( pObj );
365  }
366  Gia_ManForEachRo( p, pObj, k )
367  Gia_ObjTerSimRo( p, pObj );
368  Gia_ManForEachAnd( p, pObj, k )
369  Gia_ObjTerSimAnd( pObj );
370  Gia_ManForEachCo( p, pObj, k )
371  Gia_ObjTerSimCo( pObj );
372  }
373  pObj = Gia_ManPo( p, pCex->iPo );
374  return Gia_ObjTerSimGet1(pObj);
375 }
static void Gia_ObjTerSimCo(Gia_Obj_t *pObj)
Definition: gia.h:797
static void Gia_ObjTerSimRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:808
static void Gia_ObjTerSimSet0(Gia_Obj_t *pObj)
Definition: gia.h:770
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
for(p=first;p->value< newval;p=p->next)
Definition: gia.h:75
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static int Gia_ObjTerSimGet1(Gia_Obj_t *pObj)
Definition: gia.h:776
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
static void Gia_ObjTerSimSet1(Gia_Obj_t *pObj)
Definition: gia.h:771
#define Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
#define assert(ex)
Definition: util_old.h:213
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
static void Gia_ObjTerSimSetX(Gia_Obj_t *pObj)
Definition: gia.h:772
static void Gia_ObjTerSimAnd(Gia_Obj_t *pObj)
Definition: gia.h:785