abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
saigSimSeq.c File Reference
#include "saig.h"
#include "proof/ssw/ssw.h"

Go to the source code of this file.

Data Structures

struct  Raig_Man_t_
 

Typedefs

typedef
typedefABC_NAMESPACE_IMPL_START
struct Raig_Man_t_ 
Raig_Man_t
 DECLARATIONS ///. More...
 

Functions

static int Raig_Var2Lit (int Var, int fCompl)
 
static int Raig_Lit2Var (int Lit)
 
static int Raig_LitIsCompl (int Lit)
 
static int Raig_LitNot (int Lit)
 
static int Raig_LitNotCond (int Lit, int c)
 
static int Raig_LitRegular (int Lit)
 
int Raig_ManFindPo (Aig_Man_t *pAig, int iNode)
 FUNCTION DEFINITIONS ///. More...
 
int Raig_ManCreate_rec (Raig_Man_t *p, Aig_Obj_t *pObj)
 
Raig_Man_tRaig_ManCreate (Aig_Man_t *pAig)
 
void Raig_ManDelete (Raig_Man_t *p)
 
unsigned * Raig_ManSimRef (Raig_Man_t *p, int i)
 
unsigned * Raig_ManSimDeref (Raig_Man_t *p, int i)
 
int Raig_ManSimulateRound (Raig_Man_t *p, int fMiter, int fFirst, int *piPat)
 
Abc_Cex_tRaig_ManGenerateCounter (Aig_Man_t *pAig, int iFrame, int iOut, int nWords, int iPat, Vec_Int_t *vCis2Ids)
 
int Raig_ManSimulate (Aig_Man_t *pAig, int nWords, int nIters, int TimeLimit, int fMiter, int fVerbose)
 

Typedef Documentation

typedef typedefABC_NAMESPACE_IMPL_START struct Raig_Man_t_ Raig_Man_t

DECLARATIONS ///.

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

FileName [saigSimSeq.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Sequential AIG package.]

Synopsis [Fast sequential AIG simulator.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Definition at line 32 of file saigSimSeq.c.

Function Documentation

static int Raig_Lit2Var ( int  Lit)
inlinestatic

Definition at line 62 of file saigSimSeq.c.

62 { return Lit >> 1; }
static int Raig_LitIsCompl ( int  Lit)
inlinestatic

Definition at line 63 of file saigSimSeq.c.

63 { return Lit & 1; }
static int Raig_LitNot ( int  Lit)
inlinestatic

Definition at line 64 of file saigSimSeq.c.

64 { return Lit ^ 1; }
static int Raig_LitNotCond ( int  Lit,
int  c 
)
inlinestatic

Definition at line 65 of file saigSimSeq.c.

65 { return Lit ^ (int)(c > 0); }
static int Raig_LitRegular ( int  Lit)
inlinestatic

Definition at line 66 of file saigSimSeq.c.

66 { return Lit & ~01; }
Raig_Man_t* Raig_ManCreate ( Aig_Man_t pAig)

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

Synopsis [Creates fast simulation manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 146 of file saigSimSeq.c.

147 {
148  Raig_Man_t * p;
149  Aig_Obj_t * pObj;
150  int i, nObjs;
151  Aig_ManCleanData( pAig );
152  p = (Raig_Man_t *)ABC_ALLOC( Raig_Man_t, 1 );
153  memset( p, 0, sizeof(Raig_Man_t) );
154  p->pAig = pAig;
155  p->nPis = Saig_ManPiNum(pAig);
156  p->nPos = Saig_ManPoNum(pAig);
157  p->nCis = Aig_ManCiNum(pAig);
158  p->nCos = Aig_ManCoNum(pAig);
159  p->nNodes = Aig_ManNodeNum(pAig);
160  nObjs = p->nCis + p->nCos + p->nNodes + 2;
161  p->pFans0 = ABC_ALLOC( int, nObjs );
162  p->pFans1 = ABC_ALLOC( int, nObjs );
163  p->pRefs = ABC_ALLOC( int, nObjs );
164  p->pSims = ABC_CALLOC( unsigned, nObjs );
165  p->vCis2Ids = Vec_IntAlloc( Aig_ManCiNum(pAig) );
166  // add objects (0=unused; 1=const1)
167  p->nObjs = 2;
168  pObj = Aig_ManConst1( pAig );
169  pObj->iData = 1;
170  Aig_ManForEachCi( pAig, pObj, i )
171  if ( Aig_ObjRefs(pObj) == 0 )
172  Raig_ManCreate_rec( p, pObj );
173  Aig_ManForEachCo( pAig, pObj, i )
174  Raig_ManCreate_rec( p, pObj );
175  assert( Vec_IntSize(p->vCis2Ids) == Aig_ManCiNum(pAig) );
176  assert( p->nObjs == nObjs );
177  // collect flop outputs
178  p->vLos = Vec_IntAlloc( Aig_ManRegNum(pAig) );
179  Saig_ManForEachLo( pAig, pObj, i )
180  Vec_IntPush( p->vLos, pObj->iData );
181  // collect flop inputs
182  p->vLis = Vec_IntAlloc( Aig_ManRegNum(pAig) );
183  Saig_ManForEachLi( pAig, pObj, i )
184  {
185  Vec_IntPush( p->vLis, pObj->iData );
186  assert( p->pRefs[ pObj->iData ] == 0 );
187  p->pRefs[ pObj->iData ]++;
188  }
189  return p;
190 }
char * memset()
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
typedefABC_NAMESPACE_IMPL_START struct Raig_Man_t_ Raig_Man_t
DECLARATIONS ///.
Definition: saigSimSeq.c:32
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
#define Saig_ManForEachLo(p, pObj, i)
Definition: saig.h:96
int Raig_ManCreate_rec(Raig_Man_t *p, Aig_Obj_t *pObj)
Definition: saigSimSeq.c:104
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
int iData
Definition: aig.h:88
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjRefs(Aig_Obj_t *pObj)
Definition: aig.h:300
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
int Raig_ManCreate_rec ( Raig_Man_t p,
Aig_Obj_t pObj 
)

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

Synopsis [Creates fast simulation manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 104 of file saigSimSeq.c.

105 {
106  int iFan0, iFan1;
107  assert( !Aig_IsComplement(pObj) );
108  if ( pObj->iData )
109  return pObj->iData;
110  assert( !Aig_ObjIsConst1(pObj) );
111  if ( Aig_ObjIsNode(pObj) )
112  {
113  iFan0 = Raig_ManCreate_rec( p, Aig_ObjFanin0(pObj) );
114  iFan0 = (iFan0 << 1) | Aig_ObjFaninC0(pObj);
115  iFan1 = Raig_ManCreate_rec( p, Aig_ObjFanin1(pObj) );
116  iFan1 = (iFan1 << 1) | Aig_ObjFaninC1(pObj);
117  }
118  else if ( Aig_ObjIsCo(pObj) )
119  {
120  iFan0 = Raig_ManCreate_rec( p, Aig_ObjFanin0(pObj) );
121  iFan0 = (iFan0 << 1) | Aig_ObjFaninC0(pObj);
122  iFan1 = 0;
123  }
124  else
125  {
126  iFan0 = iFan1 = 0;
127  Vec_IntPush( p->vCis2Ids, Aig_ObjCioId(pObj) );
128  }
129  p->pFans0[p->nObjs] = iFan0;
130  p->pFans1[p->nObjs] = iFan1;
131  p->pRefs[p->nObjs] = Aig_ObjRefs(pObj);
132  return pObj->iData = p->nObjs++;
133 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
int Raig_ManCreate_rec(Raig_Man_t *p, Aig_Obj_t *pObj)
Definition: saigSimSeq.c:104
int iData
Definition: aig.h:88
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjRefs(Aig_Obj_t *pObj)
Definition: aig.h:300
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
static int Aig_ObjCioId(Aig_Obj_t *pObj)
Definition: aig.h:285
void Raig_ManDelete ( Raig_Man_t p)

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

Synopsis [Creates fast simulation manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 203 of file saigSimSeq.c.

204 {
205  Vec_IntFree( p->vCis2Ids );
206  Vec_IntFree( p->vLos );
207  Vec_IntFree( p->vLis );
208  ABC_FREE( p->pFans0 );
209  ABC_FREE( p->pFans1 );
210  ABC_FREE( p->pRefs );
211  ABC_FREE( p->pSims );
212  ABC_FREE( p->pMems );
213  ABC_FREE( p );
214 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
int Raig_ManFindPo ( Aig_Man_t pAig,
int  iNode 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Find the PO corresponding to the PO driver.]

Description []

SideEffects []

SeeAlso []

Definition at line 83 of file saigSimSeq.c.

84 {
85  Aig_Obj_t * pObj;
86  int i;
87  Saig_ManForEachPo( pAig, pObj, i )
88  if ( pObj->iData == iNode )
89  return i;
90  return -1;
91 }
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
Abc_Cex_t* Raig_ManGenerateCounter ( Aig_Man_t pAig,
int  iFrame,
int  iOut,
int  nWords,
int  iPat,
Vec_Int_t vCis2Ids 
)

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

Synopsis [Returns the counter-example.]

Description []

SideEffects []

SeeAlso []

Definition at line 416 of file saigSimSeq.c.

417 {
418  Abc_Cex_t * p;
419  unsigned * pData;
420  int f, i, w, iPioId, Counter;
421  p = Abc_CexAlloc( Aig_ManRegNum(pAig), Saig_ManPiNum(pAig), iFrame+1 );
422  p->iFrame = iFrame;
423  p->iPo = iOut;
424  // fill in the binary data
425  Aig_ManRandom( 1 );
426  Counter = p->nRegs;
427  pData = ABC_ALLOC( unsigned, nWords );
428  for ( f = 0; f <= iFrame; f++, Counter += p->nPis )
429  for ( i = 0; i < Aig_ManCiNum(pAig); i++ )
430  {
431  iPioId = Vec_IntEntry( vCis2Ids, i );
432  if ( iPioId >= p->nPis )
433  continue;
434  for ( w = 0; w < nWords; w++ )
435  pData[w] = Aig_ManRandom( 0 );
436  if ( Abc_InfoHasBit( pData, iPat ) )
437  Abc_InfoSetBit( p->pData, Counter + iPioId );
438  }
439  ABC_FREE( pData );
440  return p;
441 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
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
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
unsigned Aig_ManRandom(int fReset)
Definition: aigUtil.c:1157
int nWords
Definition: abcNpn.c:127
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
static int Counter
static void Abc_InfoSetBit(unsigned *p, int i)
Definition: abc_global.h:259
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
#define ABC_FREE(obj)
Definition: abc_global.h:232
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition: utilCex.h:39
unsigned* Raig_ManSimDeref ( Raig_Man_t p,
int  i 
)

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

Synopsis [Dereference simulaton info.]

Description []

SideEffects []

SeeAlso []

Definition at line 275 of file saigSimSeq.c.

276 {
277  unsigned * pSim;
278  assert( i );
279  if ( i == 1 ) // const 1
280  return p->pMems;
281  assert( p->pSims[i] > 0 );
282  pSim = p->pMems + p->pSims[i];
283  if ( --pSim[0] == 0 )
284  {
285  pSim[0] = p->MemFree;
286  p->MemFree = p->pSims[i];
287  p->pSims[i] = 0;
288  p->nMems--;
289  }
290  return pSim;
291 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
unsigned* Raig_ManSimRef ( Raig_Man_t p,
int  i 
)

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

Synopsis [References simulation info.]

Description []

SideEffects []

SeeAlso []

Definition at line 227 of file saigSimSeq.c.

228 {
229  unsigned * pSim;
230  assert( i > 1 );
231  assert( p->pSims[i] == 0 );
232  if ( p->MemFree == 0 )
233  {
234  unsigned * pPlace, Ent;
235  if ( p->nWordsAlloc == 0 )
236  {
237  assert( p->pMems == NULL );
238  p->nWordsAlloc = (1<<17); // -> 1Mb
239  p->nMems = 1;
240  }
241  p->nWordsAlloc *= 2;
242  p->pMems = ABC_REALLOC( unsigned, p->pMems, p->nWordsAlloc );
243  memset( p->pMems, 0xff, sizeof(unsigned) * (p->nWords + 1) );
244  pPlace = (unsigned *)&p->MemFree;
245  for ( Ent = p->nMems * (p->nWords + 1);
246  Ent + p->nWords + 1 < (unsigned)p->nWordsAlloc;
247  Ent += p->nWords + 1 )
248  {
249  *pPlace = Ent;
250  pPlace = p->pMems + Ent;
251  }
252  *pPlace = 0;
253  }
254  p->pSims[i] = p->MemFree;
255  pSim = p->pMems + p->MemFree;
256  p->MemFree = pSim[0];
257  pSim[0] = p->pRefs[i];
258  p->nMems++;
259  if ( p->nMemsMax < p->nMems )
260  p->nMemsMax = p->nMems;
261  return pSim;
262 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
for(p=first;p->value< newval;p=p->next)
#define assert(ex)
Definition: util_old.h:213
int Raig_ManSimulate ( Aig_Man_t pAig,
int  nWords,
int  nIters,
int  TimeLimit,
int  fMiter,
int  fVerbose 
)

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

Synopsis [Returns 1 if the bug is detected, 0 otherwise.]

Description []

SideEffects []

SeeAlso []

Definition at line 454 of file saigSimSeq.c.

455 {
456  Raig_Man_t * p;
457  Sec_MtrStatus_t Status;
458  int i, iPat, RetValue = 0;
459  abctime clk, clkTotal = Abc_Clock();
460  assert( Aig_ManRegNum(pAig) > 0 );
461  Status = Sec_MiterStatus( pAig );
462  if ( Status.nSat > 0 )
463  {
464  printf( "Miter is trivially satisfiable (output %d).\n", Status.iOut );
465  return 1;
466  }
467  if ( Status.nUndec == 0 )
468  {
469  printf( "Miter is trivially unsatisfiable.\n" );
470  return 0;
471  }
472  Aig_ManRandom( 1 );
473  p = Raig_ManCreate( pAig );
474  p->nWords = nWords;
475  // iterate through objects
476  for ( i = 0; i < nIters; i++ )
477  {
478  clk = Abc_Clock();
479  RetValue = Raig_ManSimulateRound( p, fMiter, i==0, &iPat );
480  if ( fVerbose )
481  {
482  printf( "Frame %4d out of %4d and timeout %3d sec. ", i+1, nIters, TimeLimit );
483  printf("Time = %7.2f sec\r", (1.0*Abc_Clock()-clkTotal)/CLOCKS_PER_SEC);
484  }
485  if ( RetValue > 0 )
486  {
487  int iOut = Raig_ManFindPo(p->pAig, RetValue);
488  assert( pAig->pSeqModel == NULL );
489  pAig->pSeqModel = Raig_ManGenerateCounter( pAig, i, iOut, nWords, iPat, p->vCis2Ids );
490  if ( fVerbose )
491  printf( "Miter is satisfiable after simulation (output %d).\n", iOut );
492  break;
493  }
494  if ( (Abc_Clock() - clk)/CLOCKS_PER_SEC >= TimeLimit )
495  {
496  printf( "No bug detected after %d frames with time limit %d seconds.\n", i+1, TimeLimit );
497  break;
498  }
499  }
500  if ( fVerbose )
501  {
502  printf( "Maxcut = %8d. AigMem = %7.2f MB. SimMem = %7.2f MB. ",
503  p->nMemsMax,
504  1.0*(p->nObjs * 16)/(1<<20),
505  1.0*(p->nMemsMax * 4 * (nWords+1))/(1<<20) );
506  ABC_PRT( "Total time", Abc_Clock() - clkTotal );
507  }
508  Raig_ManDelete( p );
509  return RetValue > 0;
510 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
unsigned Aig_ManRandom(int fReset)
Definition: aigUtil.c:1157
static abctime Abc_Clock()
Definition: abc_global.h:279
int nWords
Definition: abcNpn.c:127
typedefABC_NAMESPACE_IMPL_START struct Raig_Man_t_ Raig_Man_t
DECLARATIONS ///.
Definition: saigSimSeq.c:32
int Raig_ManFindPo(Aig_Man_t *pAig, int iNode)
FUNCTION DEFINITIONS ///.
Definition: saigSimSeq.c:83
Sec_MtrStatus_t Sec_MiterStatus(Aig_Man_t *p)
DECLARATIONS ///.
Definition: saigMiter.c:46
void Raig_ManDelete(Raig_Man_t *p)
Definition: saigSimSeq.c:203
int Raig_ManSimulateRound(Raig_Man_t *p, int fMiter, int fFirst, int *piPat)
Definition: saigSimSeq.c:304
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define ABC_PRT(a, t)
Definition: abc_global.h:220
Raig_Man_t * Raig_ManCreate(Aig_Man_t *pAig)
Definition: saigSimSeq.c:146
typedefABC_NAMESPACE_HEADER_START struct Sec_MtrStatus_t_ Sec_MtrStatus_t
INCLUDES ///.
Definition: saig.h:41
#define assert(ex)
Definition: util_old.h:213
ABC_INT64_T abctime
Definition: abc_global.h:278
Abc_Cex_t * Raig_ManGenerateCounter(Aig_Man_t *pAig, int iFrame, int iOut, int nWords, int iPat, Vec_Int_t *vCis2Ids)
Definition: saigSimSeq.c:416
int Raig_ManSimulateRound ( Raig_Man_t p,
int  fMiter,
int  fFirst,
int *  piPat 
)

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

Synopsis [Simulates one round.]

Description [Returns the number of PO entry if failed; 0 otherwise.]

SideEffects []

SeeAlso []

Definition at line 304 of file saigSimSeq.c.

305 {
306  unsigned * pRes0, * pRes1, * pRes;
307  int i, w, nCis, nCos, iFan0, iFan1, iPioNum;
308  // nove the values to the register outputs
309  Vec_IntForEachEntry( p->vCis2Ids, iPioNum, i )
310  {
311  if ( iPioNum < p->nPis )
312  continue;
313  pRes = Raig_ManSimRef( p, Vec_IntEntry(p->vLos, iPioNum-p->nPis) );
314  if ( fFirst )
315  memset( pRes + 1, 0, sizeof(unsigned) * p->nWords );
316  else
317  {
318  pRes0 = Raig_ManSimDeref( p, Vec_IntEntry(p->vLis, iPioNum-p->nPis) );
319  for ( w = 1; w <= p->nWords; w++ )
320  pRes[w] = pRes0[w];
321  }
322  // handle unused PIs
323  if ( pRes[0] == 0 )
324  {
325  pRes[0] = 1;
326  Raig_ManSimDeref( p, Vec_IntEntry(p->vLos, iPioNum-p->nPis) );
327  }
328  }
329  // simulate the logic
330  nCis = nCos = 0;
331  for ( i = 2; i < p->nObjs; i++ )
332  {
333  if ( p->pFans0[i] == 0 ) // ci always has zero first fanin
334  {
335  iPioNum = Vec_IntEntry( p->vCis2Ids, nCis );
336  if ( iPioNum < p->nPis )
337  {
338  pRes = Raig_ManSimRef( p, i );
339  for ( w = 1; w <= p->nWords; w++ )
340  pRes[w] = Aig_ManRandom( 0 );
341  // handle unused PIs
342  if ( pRes[0] == 0 )
343  {
344  pRes[0] = 1;
345  Raig_ManSimDeref( p, i );
346  }
347  }
348  else
349  assert( Vec_IntEntry(p->vLos, iPioNum-p->nPis) == i );
350  nCis++;
351  continue;
352  }
353  if ( p->pFans1[i] == 0 ) // co always has non-zero 1st fanin and zero 2nd fanin
354  {
355  pRes0 = Raig_ManSimDeref( p, Raig_Lit2Var(p->pFans0[i]) );
356  if ( nCos < p->nPos && fMiter )
357  {
358  unsigned Const = Raig_LitIsCompl(p->pFans0[i])? ~0 : 0;
359  for ( w = 1; w <= p->nWords; w++ )
360  if ( pRes0[w] != Const )
361  {
362  *piPat = 32*(w-1) + Aig_WordFindFirstBit( pRes0[w] ^ Const );
363  return i;
364  }
365  }
366  else
367  {
368  pRes = Raig_ManSimRef( p, i );
369  assert( pRes[0] == 1 );
370  if ( Raig_LitIsCompl(p->pFans0[i]) )
371  for ( w = 1; w <= p->nWords; w++ )
372  pRes[w] = ~pRes0[w];
373  else
374  for ( w = 1; w <= p->nWords; w++ )
375  pRes[w] = pRes0[w];
376  }
377  nCos++;
378  continue;
379  }
380  pRes = Raig_ManSimRef( p, i );
381  assert( pRes[0] > 0 );
382  iFan0 = p->pFans0[i];
383  iFan1 = p->pFans1[i];
384  pRes0 = Raig_ManSimDeref( p, Raig_Lit2Var(p->pFans0[i]) );
385  pRes1 = Raig_ManSimDeref( p, Raig_Lit2Var(p->pFans1[i]) );
386  if ( Raig_LitIsCompl(iFan0) && Raig_LitIsCompl(iFan1) )
387  for ( w = 1; w <= p->nWords; w++ )
388  pRes[w] = ~(pRes0[w] | pRes1[w]);
389  else if ( Raig_LitIsCompl(iFan0) && !Raig_LitIsCompl(iFan1) )
390  for ( w = 1; w <= p->nWords; w++ )
391  pRes[w] = ~pRes0[w] & pRes1[w];
392  else if ( !Raig_LitIsCompl(iFan0) && Raig_LitIsCompl(iFan1) )
393  for ( w = 1; w <= p->nWords; w++ )
394  pRes[w] = pRes0[w] & ~pRes1[w];
395  else if ( !Raig_LitIsCompl(iFan0) && !Raig_LitIsCompl(iFan1) )
396  for ( w = 1; w <= p->nWords; w++ )
397  pRes[w] = pRes0[w] & pRes1[w];
398  }
399  assert( nCis == p->nCis );
400  assert( nCos == p->nCos );
401  assert( p->nMems == 1 + Vec_IntSize(p->vLis) );
402  return 0;
403 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Raig_LitIsCompl(int Lit)
Definition: saigSimSeq.c:63
static int Raig_Lit2Var(int Lit)
Definition: saigSimSeq.c:62
unsigned Aig_ManRandom(int fReset)
Definition: aigUtil.c:1157
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Aig_WordFindFirstBit(unsigned uWord)
Definition: aig.h:237
unsigned * Raig_ManSimDeref(Raig_Man_t *p, int i)
Definition: saigSimSeq.c:275
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define assert(ex)
Definition: util_old.h:213
unsigned * Raig_ManSimRef(Raig_Man_t *p, int i)
Definition: saigSimSeq.c:227
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static int Raig_Var2Lit ( int  Var,
int  fCompl 
)
inlinestatic

Definition at line 61 of file saigSimSeq.c.

61 { return Var + Var + fCompl; }
int Var
Definition: SolverTypes.h:42