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

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START
Abc_Cex_t
Bmc_CexInnerStates (Gia_Man_t *p, Abc_Cex_t *pCex, Abc_Cex_t **ppCexImpl, int fVerbose)
 DECLARATIONS ///. More...
 
Abc_Cex_tBmc_CexCareBits (Gia_Man_t *p, Abc_Cex_t *pCexState, Abc_Cex_t *pCexImpl, Abc_Cex_t *pCexEss, int fFindAll, int fVerbose)
 
int Bmc_CexVerify (Gia_Man_t *p, Abc_Cex_t *pCex, Abc_Cex_t *pCexCare)
 
Gia_Man_tBmc_CexTargetEnlarge (Gia_Man_t *p, int nFrames)
 FUNCTION DEFINITIONS ///. More...
 
Gia_Man_tBmc_CexTarget (Gia_Man_t *p, int nFrames)
 
Gia_Man_tBmc_CexBuildNetwork2 (Gia_Man_t *p, Abc_Cex_t *pCex, int fStart)
 
Gia_Man_tBmc_CexBuildNetwork2_ (Gia_Man_t *p, Abc_Cex_t *pCex, int fStart)
 
Gia_Man_tBmc_CexBuildNetwork2Test (Gia_Man_t *p, Abc_Cex_t *pCex, int nFramesMax)
 
Gia_Man_tBmc_CexDepthTest (Gia_Man_t *p, Abc_Cex_t *pCex, int nFrames, int fVerbose)
 

Function Documentation

Gia_Man_t* Bmc_CexBuildNetwork2 ( Gia_Man_t p,
Abc_Cex_t pCex,
int  fStart 
)

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

Synopsis [Computes CE-induced network.]

Description []

SideEffects []

SeeAlso []

Definition at line 128 of file bmcCexDepth.c.

129 {
130  Gia_Man_t * pNew, * pTemp;
131  Gia_Obj_t * pObj, * pObjRo, * pObjRi;
132  int fCompl0, fCompl1;
133  int i, k, iBit;
134  assert( pCex->nRegs == 0 );
135  assert( pCex->nPis == Gia_ManCiNum(p) );
136  assert( fStart <= pCex->iFrame );
137  // start the manager
138  pNew = Gia_ManStart( 1000 );
139  pNew->pName = Abc_UtilStrsav( "unate" );
140  // set const0
141  Gia_ManConst0(p)->fMark0 = 0; // value
142  Gia_ManConst0(p)->fMark1 = 1; // care
143  Gia_ManConst0(p)->Value = ~0;
144  // set init state
145  Gia_ManForEachRi( p, pObj, k )
146  {
147  pObj->fMark0 = Abc_InfoHasBit( pCex->pData, pCex->nRegs + fStart * Gia_ManCiNum(p) + Gia_ManPiNum(p) + k );
148  pObj->fMark1 = 0;
149  pObj->Value = Abc_LitNotCond( Gia_ManAppendCi(pNew), !pObj->fMark0 );
150  }
151  Gia_ManHashAlloc( pNew );
152  iBit = pCex->nRegs + fStart * Gia_ManCiNum(p);
153  for ( i = fStart; i <= pCex->iFrame; i++ )
154  {
155  // primary inputs
156  Gia_ManForEachPi( p, pObj, k )
157  {
158  pObj->fMark0 = Abc_InfoHasBit( pCex->pData, iBit++ );
159  pObj->fMark1 = 1;
160  pObj->Value = ~0;
161  }
162  iBit += Gia_ManRegNum(p);
163  // transfer
164  Gia_ManForEachRiRo( p, pObjRi, pObjRo, k )
165  {
166  pObjRo->fMark0 = pObjRi->fMark0;
167  pObjRo->fMark1 = pObjRi->fMark1;
168  pObjRo->Value = pObjRi->Value;
169  }
170  // internal nodes
171  Gia_ManForEachAnd( p, pObj, k )
172  {
173  fCompl0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
174  fCompl1 = Gia_ObjFanin1(pObj)->fMark0 ^ Gia_ObjFaninC1(pObj);
175  pObj->fMark0 = fCompl0 & fCompl1;
176  if ( pObj->fMark0 )
177  pObj->fMark1 = Gia_ObjFanin0(pObj)->fMark1 & Gia_ObjFanin1(pObj)->fMark1;
178  else if ( !fCompl0 && !fCompl1 )
179  pObj->fMark1 = Gia_ObjFanin0(pObj)->fMark1 | Gia_ObjFanin1(pObj)->fMark1;
180  else if ( !fCompl0 )
181  pObj->fMark1 = Gia_ObjFanin0(pObj)->fMark1;
182  else if ( !fCompl1 )
183  pObj->fMark1 = Gia_ObjFanin1(pObj)->fMark1;
184  else assert( 0 );
185  pObj->Value = ~0;
186  if ( pObj->fMark1 )
187  continue;
188  if ( pObj->fMark0 )
189  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0(pObj)->Value, Gia_ObjFanin1(pObj)->Value );
190  else if ( !fCompl0 && !fCompl1 )
191  pObj->Value = Gia_ManHashOr( pNew, Gia_ObjFanin0(pObj)->Value, Gia_ObjFanin1(pObj)->Value );
192  else if ( !fCompl0 )
193  pObj->Value = Gia_ObjFanin0(pObj)->Value;
194  else if ( !fCompl1 )
195  pObj->Value = Gia_ObjFanin1(pObj)->Value;
196  else assert( 0 );
197  assert( pObj->Value > 0 );
198  }
199  // combinational outputs
200  Gia_ManForEachCo( p, pObj, k )
201  {
202  pObj->fMark0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
203  pObj->fMark1 = Gia_ObjFanin0(pObj)->fMark1;
204  pObj->Value = Gia_ObjFanin0(pObj)->Value;
205  }
206  }
207  Gia_ManHashStop( pNew );
208  assert( iBit == pCex->nBits );
209  // create primary output
210  pObj = Gia_ManPo(p, pCex->iPo);
211  assert( pObj->fMark0 == 1 );
212  assert( pObj->fMark1 == 0 );
213  assert( pObj->Value > 0 );
214  Gia_ManAppendCo( pNew, pObj->Value );
215  // cleanup
216  pNew = Gia_ManCleanup( pTemp = pNew );
217  Gia_ManStop( pTemp );
218  return pNew;
219 }
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
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
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
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
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
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
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
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Bmc_CexBuildNetwork2_ ( Gia_Man_t p,
Abc_Cex_t pCex,
int  fStart 
)

Definition at line 220 of file bmcCexDepth.c.

221 {
222  Gia_Man_t * pNew, * pTemp;
223  Gia_Obj_t * pObj, * pObjRo, * pObjRi;
224  int fCompl0, fCompl1;
225  int i, k, iBit;
226  assert( pCex->nRegs == 0 );
227  assert( pCex->nPis == Gia_ManCiNum(p) );
228  assert( fStart <= pCex->iFrame );
229  // start the manager
230  pNew = Gia_ManStart( 1000 );
231  pNew->pName = Abc_UtilStrsav( "unate" );
232  // set const0
233  Gia_ManConst0(p)->fMark0 = 0; // value
234  Gia_ManConst0(p)->Value = 1;
235  // set init state
236  Gia_ManForEachRi( p, pObj, k )
237  {
238  pObj->fMark0 = Abc_InfoHasBit( pCex->pData, pCex->nRegs + fStart * Gia_ManCiNum(p) + Gia_ManPiNum(p) + k );
239  pObj->Value = Abc_LitNotCond( Gia_ManAppendCi(pNew), !pObj->fMark0 );
240  }
241  Gia_ManHashAlloc( pNew );
242  iBit = pCex->nRegs + fStart * Gia_ManCiNum(p);
243  for ( i = fStart; i <= pCex->iFrame; i++ )
244  {
245  // primary inputs
246  Gia_ManForEachPi( p, pObj, k )
247  {
248  pObj->fMark0 = Abc_InfoHasBit( pCex->pData, iBit++ );
249  pObj->Value = 1;
250  }
251  iBit += Gia_ManRegNum(p);
252  // transfer
253  Gia_ManForEachRiRo( p, pObjRi, pObjRo, k )
254  {
255  pObjRo->fMark0 = pObjRi->fMark0;
256  pObjRo->Value = pObjRi->Value;
257  }
258  // internal nodes
259  Gia_ManForEachAnd( p, pObj, k )
260  {
261  fCompl0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
262  fCompl1 = Gia_ObjFanin1(pObj)->fMark0 ^ Gia_ObjFaninC1(pObj);
263  pObj->fMark0 = fCompl0 & fCompl1;
264  if ( pObj->fMark0 )
265  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0(pObj)->Value, Gia_ObjFanin1(pObj)->Value );
266  else if ( !fCompl0 && !fCompl1 )
267  pObj->Value = Gia_ManHashOr( pNew, Gia_ObjFanin0(pObj)->Value, Gia_ObjFanin1(pObj)->Value );
268  else if ( !fCompl0 )
269  pObj->Value = Gia_ObjFanin0(pObj)->Value;
270  else if ( !fCompl1 )
271  pObj->Value = Gia_ObjFanin1(pObj)->Value;
272  else assert( 0 );
273  }
274  // combinational outputs
275  Gia_ManForEachCo( p, pObj, k )
276  {
277  pObj->fMark0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
278  pObj->Value = Gia_ObjFanin0(pObj)->Value;
279  }
280  }
281  Gia_ManHashStop( pNew );
282  assert( iBit == pCex->nBits );
283  // create primary output
284  pObj = Gia_ManPo(p, pCex->iPo);
285  assert( pObj->fMark0 == 1 );
286  assert( pObj->Value > 0 );
287  Gia_ManAppendCo( pNew, pObj->Value );
288  // cleanup
289  pNew = Gia_ManCleanup( pTemp = pNew );
290  Gia_ManStop( pTemp );
291  return pNew;
292 }
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
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
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
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
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
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
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
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Bmc_CexBuildNetwork2Test ( Gia_Man_t p,
Abc_Cex_t pCex,
int  nFramesMax 
)

Definition at line 294 of file bmcCexDepth.c.

295 {
296  Gia_Man_t * pNew, * pTemp;
297  Vec_Ptr_t * vCones;
298  abctime clk = Abc_Clock();
299  int i;
300  nFramesMax = Abc_MinInt( nFramesMax, pCex->iFrame );
301  printf( "Processing CEX in frame %d (max frames %d).\n", pCex->iFrame, nFramesMax );
302  vCones = Vec_PtrAlloc( nFramesMax );
303  for ( i = pCex->iFrame; i > pCex->iFrame - nFramesMax; i-- )
304  {
305  printf( "Frame %5d : ", i );
306  pNew = Bmc_CexBuildNetwork2_( p, pCex, i );
307  Gia_ManPrintStats( pNew, NULL );
308  Vec_PtrPush( vCones, pNew );
309  }
310  pNew = Gia_ManDupAppendCones( p, (Gia_Man_t **)Vec_PtrArray(vCones), Vec_PtrSize(vCones), 1 );
311  Gia_AigerWrite( pNew, "miter2.aig", 0, 0 );
312 //Bmc_CexDumpAogStats( pNew, Abc_Clock() - clk );
313  Vec_PtrForEachEntry( Gia_Man_t *, vCones, pTemp, i )
314  Gia_ManStop( pTemp );
315  Vec_PtrFree( vCones );
316  printf( "GIA with additional properties is written into \"miter2.aig\".\n" );
317 // printf( "CE-induced network is written into file \"unate.aig\".\n" );
318  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
319 // Gia_ManStop( pNew );
320  return pNew;
321 }
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
void Gia_ManPrintStats(Gia_Man_t *p, Gps_Par_t *pPars)
Definition: giaMan.c:389
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
Gia_Man_t * Bmc_CexBuildNetwork2_(Gia_Man_t *p, Abc_Cex_t *pCex, int fStart)
Definition: bmcCexDepth.c:220
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Gia_Man_t * Gia_ManDupAppendCones(Gia_Man_t *p, Gia_Man_t **ppCones, int nCones, int fOnlyRegs)
Definition: giaDup.c:836
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
static int Abc_MinInt(int a, int b)
Definition: abc_global.h:239
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact)
Definition: giaAiger.c:1024
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Definition: gia.h:95
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_INT64_T abctime
Definition: abc_global.h:278
static void ** Vec_PtrArray(Vec_Ptr_t *p)
Definition: vecPtr.h:279
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
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
Gia_Man_t* Bmc_CexDepthTest ( Gia_Man_t p,
Abc_Cex_t pCex,
int  nFrames,
int  fVerbose 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 335 of file bmcCexDepth.c.

336 {
337  Gia_Man_t * pNew;
338  abctime clk = Abc_Clock();
339  Abc_Cex_t * pCexImpl = NULL;
340  Abc_Cex_t * pCexStates = Bmc_CexInnerStates( p, pCex, &pCexImpl, fVerbose );
341  Abc_Cex_t * pCexCare = Bmc_CexCareBits( p, pCexStates, pCexImpl, NULL, 1, fVerbose );
342 // Abc_Cex_t * pCexEss, * pCexMin;
343 
344  if ( !Bmc_CexVerify( p, pCex, pCexCare ) )
345  printf( "Counter-example care-set verification has failed.\n" );
346 
347 // pCexEss = Bmc_CexEssentialBits( p, pCexStates, pCexCare, fVerbose );
348 // pCexMin = Bmc_CexCareBits( p, pCexStates, pCexImpl, pCexEss, 0, fVerbose );
349 
350 // if ( !Bmc_CexVerify( p, pCex, pCexMin ) )
351 // printf( "Counter-example min-set verification has failed.\n" );
352 
353 // Bmc_CexDumpStats( p, pCex, pCexCare, pCexEss, pCexMin, Abc_Clock() - clk );
354 
355  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
356  pNew = Bmc_CexBuildNetwork2Test( p, pCexStates, nFrames );
357 // Bmc_CexPerformUnrollingTest( p, pCex );
358 
359  Abc_CexFreeP( &pCexStates );
360  Abc_CexFreeP( &pCexImpl );
361  Abc_CexFreeP( &pCexCare );
362 // Abc_CexFreeP( &pCexEss );
363 // Abc_CexFreeP( &pCexMin );
364  return pNew;
365 }
int Bmc_CexVerify(Gia_Man_t *p, Abc_Cex_t *pCex, Abc_Cex_t *pCexCare)
Definition: bmcCexTools.c:346
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
Gia_Man_t * Bmc_CexBuildNetwork2Test(Gia_Man_t *p, Abc_Cex_t *pCex, int nFramesMax)
Definition: bmcCexDepth.c:294
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
ABC_NAMESPACE_IMPL_START Abc_Cex_t * Bmc_CexInnerStates(Gia_Man_t *p, Abc_Cex_t *pCex, Abc_Cex_t **ppCexImpl, int fVerbose)
DECLARATIONS ///.
Definition: bmcCexTools.c:388
void Abc_CexFreeP(Abc_Cex_t **p)
Definition: utilCex.c:350
Definition: gia.h:95
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
ABC_NAMESPACE_IMPL_START Abc_Cex_t* Bmc_CexInnerStates ( Gia_Man_t p,
Abc_Cex_t pCex,
Abc_Cex_t **  ppCexImpl,
int  fVerbose 
)

DECLARATIONS ///.

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

FileName [bmcCexDepth.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [SAT-based bounded model checking.]

Synopsis [CEX depth minimization.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

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
Gia_Man_t* Bmc_CexTarget ( Gia_Man_t p,
int  nFrames 
)

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

Synopsis [Create target with quantified inputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 94 of file bmcCexDepth.c.

95 {
96  Gia_Man_t * pNew, * pTemp;
97  int i, Limit = nFrames * Gia_ManPiNum(p);
98  pNew = Bmc_CexTargetEnlarge( p, nFrames );
99  for ( i = 0; i < Limit; i++ )
100  {
101  printf( "%3d : ", i );
102  if ( i % Gia_ManPiNum(p) == 0 )
103  Gia_ManPrintStats( pNew, NULL );
104  pNew = Gia_ManDupExist( pTemp = pNew, i );
105  Gia_ManStop( pTemp );
106  }
107  Gia_ManPrintStats( pNew, NULL );
108  pNew = Gia_ManDupLastPis( pTemp = pNew, Gia_ManRegNum(p) );
109  Gia_ManStop( pTemp );
110  Gia_ManPrintStats( pNew, NULL );
111  pTemp = Gia_ManDupAppendCones( p, &pNew, 1, 1 );
112  Gia_ManStop( pNew );
113  Gia_AigerWrite( pTemp, "miter3.aig", 0, 0 );
114  return pTemp;
115 }
Gia_Man_t * Bmc_CexTargetEnlarge(Gia_Man_t *p, int nFrames)
FUNCTION DEFINITIONS ///.
Definition: bmcCexDepth.c:49
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
Gia_Man_t * Gia_ManDupAppendCones(Gia_Man_t *p, Gia_Man_t **ppCones, int nCones, int fOnlyRegs)
Definition: giaDup.c:836
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact)
Definition: giaAiger.c:1024
Gia_Man_t * Gia_ManDupLastPis(Gia_Man_t *p, int nLastPis)
Definition: giaDup.c:429
Definition: gia.h:95
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
Gia_Man_t * Gia_ManDupExist(Gia_Man_t *p, int iVar)
Definition: giaDup.c:1360
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Bmc_CexTargetEnlarge ( Gia_Man_t p,
int  nFrames 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Performs targe enlargement of the given size.]

Description []

SideEffects []

SeeAlso []

Definition at line 49 of file bmcCexDepth.c.

50 {
51  Gia_Man_t * pNew, * pOne;
52  Gia_Obj_t * pObj, * pObjRo;
53  int i, k;
54  pNew = Gia_ManStart( Gia_ManObjNum(p) );
55  pNew->pName = Abc_UtilStrsav( p->pName );
56  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
57  Gia_ManHashAlloc( pNew );
58  Gia_ManConst0(p)->Value = 0;
59  for ( k = 0; k < nFrames; k++ )
60  Gia_ManForEachPi( p, pObj, i )
61  Gia_ManAppendCi( pNew );
62  Gia_ManForEachRo( p, pObj, i )
63  pObj->Value = Gia_ManAppendCi( pNew );
64  for ( k = 0; k < nFrames; k++ )
65  {
66  Gia_ManForEachPi( p, pObj, i )
67  pObj->Value = Gia_ManCiLit( pNew, (nFrames - 1 - k) * Gia_ManPiNum(p) + i );
68  Gia_ManForEachAnd( p, pObj, i )
69  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
70  Gia_ManForEachRi( p, pObj, i )
71  pObj->Value = Gia_ObjFanin0Copy(pObj);
72  Gia_ManForEachRiRo( p, pObj, pObjRo, i )
73  pObjRo->Value = pObj->Value;
74  }
75  pObj = Gia_ManPo( p, 0 );
76  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
77  Gia_ManHashStop( pNew );
78  pNew = Gia_ManCleanup( pOne = pNew );
79  Gia_ManStop( pOne );
80  return pNew;
81 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManCiLit(Gia_Man_t *p, int CiId)
Definition: gia.h:435
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 Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
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
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