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

Go to the source code of this file.

Macros

#define PDR_ZER   1
 DECLARATIONS ///. More...
 
#define PDR_ONE   2
 
#define PDR_UND   3
 

Functions

static int Pdr_ManSimInfoNot (int Value)
 
static int Pdr_ManSimInfoAnd (int Value0, int Value1)
 
static int Pdr_ManSimInfoGet (Aig_Man_t *p, Aig_Obj_t *pObj)
 
static void Pdr_ManSimInfoSet (Aig_Man_t *p, Aig_Obj_t *pObj, int Value)
 
void Pdr_ManCollectCone_rec (Aig_Man_t *pAig, Aig_Obj_t *pObj, Vec_Int_t *vCiObjs, Vec_Int_t *vNodes)
 FUNCTION DEFINITIONS ///. More...
 
void Pdr_ManCollectCone (Aig_Man_t *pAig, Vec_Int_t *vCoObjs, Vec_Int_t *vCiObjs, Vec_Int_t *vNodes)
 
int Pdr_ManExtendOneEval (Aig_Man_t *pAig, Aig_Obj_t *pObj)
 
int Pdr_ManSimDataInit (Aig_Man_t *pAig, Vec_Int_t *vCiObjs, Vec_Int_t *vCiVals, Vec_Int_t *vNodes, Vec_Int_t *vCoObjs, Vec_Int_t *vCoVals, Vec_Int_t *vCi2Rem)
 
int Pdr_ManExtendOne (Aig_Man_t *pAig, Aig_Obj_t *pObj, Vec_Int_t *vUndo, Vec_Int_t *vVis)
 
void Pdr_ManExtendUndo (Aig_Man_t *pAig, Vec_Int_t *vUndo)
 
void Pdr_ManDeriveResult (Aig_Man_t *pAig, Vec_Int_t *vCiObjs, Vec_Int_t *vCiVals, Vec_Int_t *vCi2Rem, Vec_Int_t *vRes, Vec_Int_t *vPiLits)
 
void Pdr_ManPrintCex (Aig_Man_t *pAig, Vec_Int_t *vCiObjs, Vec_Int_t *vCiVals, Vec_Int_t *vCi2Rem)
 
Pdr_Set_tPdr_ManTernarySim (Pdr_Man_t *p, int k, Pdr_Set_t *pCube)
 

Macro Definition Documentation

#define PDR_ONE   2

Definition at line 30 of file pdrTsim.c.

#define PDR_UND   3

Definition at line 31 of file pdrTsim.c.

#define PDR_ZER   1

DECLARATIONS ///.

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

FileName [pdrTsim.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Property driven reachability.]

Synopsis [Ternary simulation.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - November 20, 2010.]

Revision [

Id:
pdrTsim.c,v 1.00 2010/11/20 00:00:00 alanmi Exp

]

Definition at line 29 of file pdrTsim.c.

Function Documentation

void Pdr_ManCollectCone ( Aig_Man_t pAig,
Vec_Int_t vCoObjs,
Vec_Int_t vCiObjs,
Vec_Int_t vNodes 
)

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

Synopsis [Marks the TFI cone and collects CIs and nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 107 of file pdrTsim.c.

108 {
109  Aig_Obj_t * pObj;
110  int i;
111  Vec_IntClear( vCiObjs );
112  Vec_IntClear( vNodes );
113  Aig_ManIncrementTravId( pAig );
114  Aig_ObjSetTravIdCurrent( pAig, Aig_ManConst1(pAig) );
115  Aig_ManForEachObjVec( vCoObjs, pAig, pObj, i )
116  Pdr_ManCollectCone_rec( pAig, pObj, vCiObjs, vNodes );
117 }
#define Aig_ManForEachObjVec(vIds, p, pObj, i)
Definition: aig.h:408
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
Definition: aig.h:69
void Pdr_ManCollectCone_rec(Aig_Man_t *pAig, Aig_Obj_t *pObj, Vec_Int_t *vCiObjs, Vec_Int_t *vNodes)
FUNCTION DEFINITIONS ///.
Definition: pdrTsim.c:78
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
void Pdr_ManCollectCone_rec ( Aig_Man_t pAig,
Aig_Obj_t pObj,
Vec_Int_t vCiObjs,
Vec_Int_t vNodes 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Marks the TFI cone and collects CIs and nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 78 of file pdrTsim.c.

79 {
80  assert( !Aig_IsComplement(pObj) );
81  if ( Aig_ObjIsTravIdCurrent(pAig, pObj) )
82  return;
83  Aig_ObjSetTravIdCurrent(pAig, pObj);
84  if ( Aig_ObjIsCi(pObj) )
85  {
86  Vec_IntPush( vCiObjs, Aig_ObjId(pObj) );
87  return;
88  }
89  Pdr_ManCollectCone_rec( pAig, Aig_ObjFanin0(pObj), vCiObjs, vNodes );
90  if ( Aig_ObjIsCo(pObj) )
91  return;
92  Pdr_ManCollectCone_rec( pAig, Aig_ObjFanin1(pObj), vCiObjs, vNodes );
93  Vec_IntPush( vNodes, Aig_ObjId(pObj) );
94 }
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
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 void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
void Pdr_ManCollectCone_rec(Aig_Man_t *pAig, Aig_Obj_t *pObj, Vec_Int_t *vCiObjs, Vec_Int_t *vNodes)
FUNCTION DEFINITIONS ///.
Definition: pdrTsim.c:78
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
void Pdr_ManDeriveResult ( Aig_Man_t pAig,
Vec_Int_t vCiObjs,
Vec_Int_t vCiVals,
Vec_Int_t vCi2Rem,
Vec_Int_t vRes,
Vec_Int_t vPiLits 
)

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

Synopsis [Derives the resulting cube.]

Description []

SideEffects []

SeeAlso []

Definition at line 274 of file pdrTsim.c.

275 {
276  Aig_Obj_t * pObj;
277  int i, Lit;
278  // mark removed flop outputs
279  Aig_ManIncrementTravId( pAig );
280  Aig_ManForEachObjVec( vCi2Rem, pAig, pObj, i )
281  {
282  assert( Saig_ObjIsLo( pAig, pObj ) );
283  Aig_ObjSetTravIdCurrent(pAig, pObj);
284  }
285  // collect flop outputs that are not marked
286  Vec_IntClear( vRes );
287  Vec_IntClear( vPiLits );
288  Aig_ManForEachObjVec( vCiObjs, pAig, pObj, i )
289  {
290  if ( Saig_ObjIsPi(pAig, pObj) )
291  {
292  Lit = toLitCond( Aig_ObjCioId(pObj), (Vec_IntEntry(vCiVals, i) == 0) );
293  Vec_IntPush( vPiLits, Lit );
294  continue;
295  }
296  assert( Saig_ObjIsLo(pAig, pObj) );
297  if ( Aig_ObjIsTravIdCurrent(pAig, pObj) )
298  continue;
299  Lit = toLitCond( Aig_ObjCioId(pObj) - Saig_ManPiNum(pAig), (Vec_IntEntry(vCiVals, i) == 0) );
300  Vec_IntPush( vRes, Lit );
301  }
302  if ( Vec_IntSize(vRes) == 0 )
303  Vec_IntPush(vRes, 0);
304 }
static int Saig_ObjIsLo(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:84
#define Aig_ManForEachObjVec(vIds, p, pObj, i)
Definition: aig.h:408
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
static lit toLitCond(int v, int c)
Definition: satVec.h:143
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
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 assert(ex)
Definition: util_old.h:213
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
static int Saig_ObjIsPi(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:82
static int Aig_ObjCioId(Aig_Obj_t *pObj)
Definition: aig.h:285
int Pdr_ManExtendOne ( Aig_Man_t pAig,
Aig_Obj_t pObj,
Vec_Int_t vUndo,
Vec_Int_t vVis 
)

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

Synopsis [Tries to assign ternary value to one of the CIs.]

Description []

SideEffects []

SeeAlso []

Definition at line 199 of file pdrTsim.c.

200 {
201  Aig_Obj_t * pFanout;
202  int i, k, iFanout = -1, Value, Value2;
203  assert( Saig_ObjIsLo(pAig, pObj) );
204  assert( Aig_ObjIsTravIdCurrent(pAig, pObj) );
205  // save original value
206  Value = Pdr_ManSimInfoGet( pAig, pObj );
207  assert( Value == PDR_ZER || Value == PDR_ONE );
208  Vec_IntPush( vUndo, Aig_ObjId(pObj) );
209  Vec_IntPush( vUndo, Value );
210  // update original value
211  Pdr_ManSimInfoSet( pAig, pObj, PDR_UND );
212  // traverse
213  Vec_IntClear( vVis );
214  Vec_IntPush( vVis, Aig_ObjId(pObj) );
215  Aig_ManForEachObjVec( vVis, pAig, pObj, i )
216  {
217  Aig_ObjForEachFanout( pAig, pObj, pFanout, iFanout, k )
218  {
219  if ( !Aig_ObjIsTravIdCurrent(pAig, pFanout) )
220  continue;
221  assert( Aig_ObjId(pObj) < Aig_ObjId(pFanout) );
222  Value = Pdr_ManSimInfoGet( pAig, pFanout );
223  if ( Value == PDR_UND )
224  continue;
225  Value2 = Pdr_ManExtendOneEval( pAig, pFanout );
226  if ( Value2 == Value )
227  continue;
228  assert( Value2 == PDR_UND );
229  Vec_IntPush( vUndo, Aig_ObjId(pFanout) );
230  Vec_IntPush( vUndo, Value );
231  if ( Aig_ObjIsCo(pFanout) )
232  return 0;
233  assert( Aig_ObjIsNode(pFanout) );
234  Vec_IntPushOrder( vVis, Aig_ObjId(pFanout) );
235  }
236  }
237  return 1;
238 }
#define Aig_ObjForEachFanout(p, pObj, pFanout, iFan, i)
Definition: aig.h:427
#define PDR_ZER
DECLARATIONS ///.
Definition: pdrTsim.c:29
static void Vec_IntPushOrder(Vec_Int_t *p, int Entry)
Definition: vecInt.h:751
static int Saig_ObjIsLo(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:84
#define Aig_ManForEachObjVec(vIds, p, pObj, i)
Definition: aig.h:408
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
#define PDR_UND
Definition: pdrTsim.c:31
#define PDR_ONE
Definition: pdrTsim.c:30
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
int Pdr_ManExtendOneEval(Aig_Man_t *pAig, Aig_Obj_t *pObj)
Definition: pdrTsim.c:130
static void Pdr_ManSimInfoSet(Aig_Man_t *p, Aig_Obj_t *pObj, int Value)
Definition: pdrTsim.c:56
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
static int Pdr_ManSimInfoGet(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: pdrTsim.c:51
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
int Pdr_ManExtendOneEval ( Aig_Man_t pAig,
Aig_Obj_t pObj 
)

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

Synopsis [Performs ternary simulation for one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 130 of file pdrTsim.c.

131 {
132  int Value0, Value1, Value;
133  Value0 = Pdr_ManSimInfoGet( pAig, Aig_ObjFanin0(pObj) );
134  if ( Aig_ObjFaninC0(pObj) )
135  Value0 = Pdr_ManSimInfoNot( Value0 );
136  if ( Aig_ObjIsCo(pObj) )
137  {
138  Pdr_ManSimInfoSet( pAig, pObj, Value0 );
139  return Value0;
140  }
141  assert( Aig_ObjIsNode(pObj) );
142  Value1 = Pdr_ManSimInfoGet( pAig, Aig_ObjFanin1(pObj) );
143  if ( Aig_ObjFaninC1(pObj) )
144  Value1 = Pdr_ManSimInfoNot( Value1 );
145  Value = Pdr_ManSimInfoAnd( Value0, Value1 );
146  Pdr_ManSimInfoSet( pAig, pObj, Value );
147  return Value;
148 }
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Pdr_ManSimInfoAnd(int Value0, int Value1)
Definition: pdrTsim.c:42
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 Pdr_ManSimInfoNot(int Value)
Definition: pdrTsim.c:33
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static void Pdr_ManSimInfoSet(Aig_Man_t *p, Aig_Obj_t *pObj, int Value)
Definition: pdrTsim.c:56
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
static int Pdr_ManSimInfoGet(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: pdrTsim.c:51
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
void Pdr_ManExtendUndo ( Aig_Man_t pAig,
Vec_Int_t vUndo 
)

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

Synopsis [Undoes the partial results of ternary simulation.]

Description []

SideEffects []

SeeAlso []

Definition at line 251 of file pdrTsim.c.

252 {
253  Aig_Obj_t * pObj;
254  int i, Value;
255  Aig_ManForEachObjVec( vUndo, pAig, pObj, i )
256  {
257  Value = Vec_IntEntry(vUndo, ++i);
258  assert( Pdr_ManSimInfoGet(pAig, pObj) == PDR_UND );
259  Pdr_ManSimInfoSet( pAig, pObj, Value );
260  }
261 }
#define Aig_ManForEachObjVec(vIds, p, pObj, i)
Definition: aig.h:408
#define PDR_UND
Definition: pdrTsim.c:31
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Definition: aig.h:69
static void Pdr_ManSimInfoSet(Aig_Man_t *p, Aig_Obj_t *pObj, int Value)
Definition: pdrTsim.c:56
static int Pdr_ManSimInfoGet(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: pdrTsim.c:51
#define assert(ex)
Definition: util_old.h:213
void Pdr_ManPrintCex ( Aig_Man_t pAig,
Vec_Int_t vCiObjs,
Vec_Int_t vCiVals,
Vec_Int_t vCi2Rem 
)

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

Synopsis [Derives the resulting cube.]

Description []

SideEffects []

SeeAlso []

Definition at line 317 of file pdrTsim.c.

318 {
319  Aig_Obj_t * pObj;
320  int i;
321  char * pBuff = ABC_ALLOC( char, Aig_ManCiNum(pAig)+1 );
322  for ( i = 0; i < Aig_ManCiNum(pAig); i++ )
323  pBuff[i] = '-';
324  pBuff[i] = 0;
325  Aig_ManForEachObjVec( vCiObjs, pAig, pObj, i )
326  pBuff[Aig_ObjCioId(pObj)] = (Vec_IntEntry(vCiVals, i)? '1':'0');
327  if ( vCi2Rem )
328  Aig_ManForEachObjVec( vCi2Rem, pAig, pObj, i )
329  pBuff[Aig_ObjCioId(pObj)] = 'x';
330  Abc_Print( 1, "%s\n", pBuff );
331  ABC_FREE( pBuff );
332 }
#define Aig_ManForEachObjVec(vIds, p, pObj, i)
Definition: aig.h:408
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
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
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
#define ABC_FREE(obj)
Definition: abc_global.h:232
static int Aig_ObjCioId(Aig_Obj_t *pObj)
Definition: aig.h:285
int Pdr_ManSimDataInit ( Aig_Man_t pAig,
Vec_Int_t vCiObjs,
Vec_Int_t vCiVals,
Vec_Int_t vNodes,
Vec_Int_t vCoObjs,
Vec_Int_t vCoVals,
Vec_Int_t vCi2Rem 
)

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

Synopsis [Performs ternary simulation for one design.]

Description []

SideEffects []

SeeAlso []

Definition at line 161 of file pdrTsim.c.

164 {
165  Aig_Obj_t * pObj;
166  int i;
167  // set the CI values
168  Pdr_ManSimInfoSet( pAig, Aig_ManConst1(pAig), PDR_ONE );
169  Aig_ManForEachObjVec( vCiObjs, pAig, pObj, i )
170  Pdr_ManSimInfoSet( pAig, pObj, (Vec_IntEntry(vCiVals, i)?PDR_ONE:PDR_ZER) );
171  // set the FOs to remove
172  if ( vCi2Rem != NULL )
173  Aig_ManForEachObjVec( vCi2Rem, pAig, pObj, i )
174  Pdr_ManSimInfoSet( pAig, pObj, PDR_UND );
175  // perform ternary simulation
176  Aig_ManForEachObjVec( vNodes, pAig, pObj, i )
177  Pdr_ManExtendOneEval( pAig, pObj );
178  // transfer results to the output
179  Aig_ManForEachObjVec( vCoObjs, pAig, pObj, i )
180  Pdr_ManExtendOneEval( pAig, pObj );
181  // check the results
182  Aig_ManForEachObjVec( vCoObjs, pAig, pObj, i )
183  if ( Pdr_ManSimInfoGet( pAig, pObj ) != (Vec_IntEntry(vCoVals, i)?PDR_ONE:PDR_ZER) )
184  return 0;
185  return 1;
186 }
#define PDR_ZER
DECLARATIONS ///.
Definition: pdrTsim.c:29
#define Aig_ManForEachObjVec(vIds, p, pObj, i)
Definition: aig.h:408
#define PDR_UND
Definition: pdrTsim.c:31
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
#define PDR_ONE
Definition: pdrTsim.c:30
Definition: aig.h:69
int Pdr_ManExtendOneEval(Aig_Man_t *pAig, Aig_Obj_t *pObj)
Definition: pdrTsim.c:130
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static void Pdr_ManSimInfoSet(Aig_Man_t *p, Aig_Obj_t *pObj, int Value)
Definition: pdrTsim.c:56
static int Pdr_ManSimInfoGet(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: pdrTsim.c:51
static int Pdr_ManSimInfoAnd ( int  Value0,
int  Value1 
)
inlinestatic

Definition at line 42 of file pdrTsim.c.

43 {
44  if ( Value0 == PDR_ZER || Value1 == PDR_ZER )
45  return PDR_ZER;
46  if ( Value0 == PDR_ONE && Value1 == PDR_ONE )
47  return PDR_ONE;
48  return PDR_UND;
49 }
#define PDR_ZER
DECLARATIONS ///.
Definition: pdrTsim.c:29
#define PDR_UND
Definition: pdrTsim.c:31
#define PDR_ONE
Definition: pdrTsim.c:30
static int Pdr_ManSimInfoGet ( Aig_Man_t p,
Aig_Obj_t pObj 
)
inlinestatic

Definition at line 51 of file pdrTsim.c.

52 {
53  return 3 & (p->pTerSimData[Aig_ObjId(pObj) >> 4] >> ((Aig_ObjId(pObj) & 15) << 1));
54 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
static int Pdr_ManSimInfoNot ( int  Value)
inlinestatic

Definition at line 33 of file pdrTsim.c.

34 {
35  if ( Value == PDR_ZER )
36  return PDR_ONE;
37  if ( Value == PDR_ONE )
38  return PDR_ZER;
39  return PDR_UND;
40 }
#define PDR_ZER
DECLARATIONS ///.
Definition: pdrTsim.c:29
#define PDR_UND
Definition: pdrTsim.c:31
#define PDR_ONE
Definition: pdrTsim.c:30
static void Pdr_ManSimInfoSet ( Aig_Man_t p,
Aig_Obj_t pObj,
int  Value 
)
inlinestatic

Definition at line 56 of file pdrTsim.c.

57 {
58  assert( Value >= PDR_ZER && Value <= PDR_UND );
59  Value ^= Pdr_ManSimInfoGet( p, pObj );
60  p->pTerSimData[Aig_ObjId(pObj) >> 4] ^= (Value << ((Aig_ObjId(pObj) & 15) << 1));
61 }
#define PDR_ZER
DECLARATIONS ///.
Definition: pdrTsim.c:29
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define PDR_UND
Definition: pdrTsim.c:31
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
static int Pdr_ManSimInfoGet(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: pdrTsim.c:51
#define assert(ex)
Definition: util_old.h:213
Pdr_Set_t* Pdr_ManTernarySim ( Pdr_Man_t p,
int  k,
Pdr_Set_t pCube 
)

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

Synopsis [Shrinks values using ternary simulation.]

Description [The cube contains the set of flop index literals which, when converted into a clause and applied to the combinational outputs, led to a satisfiable SAT run in frame k (values stored in the SAT solver). If the cube is NULL, it is assumed that the first property output was asserted and failed. The resulting array is a set of flop index literals that asserts the COs. Priority contains 0 for i-th entry if the i-th FF is desirable to remove.]

SideEffects []

SeeAlso []

Definition at line 351 of file pdrTsim.c.

352 {
353  Pdr_Set_t * pRes;
354  Vec_Int_t * vPrio = p->vPrio; // priority flops (flop indices)
355  Vec_Int_t * vPiLits = p->vLits; // array of literals (0/1 PI values)
356  Vec_Int_t * vCiObjs = p->vCiObjs; // cone leaves (CI obj IDs)
357  Vec_Int_t * vCoObjs = p->vCoObjs; // cone roots (CO obj IDs)
358  Vec_Int_t * vCiVals = p->vCiVals; // cone leaf values (0/1 CI values)
359  Vec_Int_t * vCoVals = p->vCoVals; // cone root values (0/1 CO values)
360  Vec_Int_t * vNodes = p->vNodes; // cone nodes (node obj IDs)
361  Vec_Int_t * vUndo = p->vUndo; // cone undos (node obj IDs)
362  Vec_Int_t * vVisits = p->vVisits; // intermediate (obj IDs)
363  Vec_Int_t * vCi2Rem = p->vCi2Rem; // CIs to be removed (CI obj IDs)
364  Vec_Int_t * vRes = p->vRes; // final result (flop literals)
365  Aig_Obj_t * pObj;
366  int i, Entry, RetValue;
367  abctime clk = Abc_Clock();
368 
369  // collect CO objects
370  Vec_IntClear( vCoObjs );
371  if ( pCube == NULL ) // the target is the property output
372  {
373 // Vec_IntPush( vCoObjs, Aig_ObjId(Aig_ManCo(p->pAig, (p->pPars->iOutput==-1)?0:p->pPars->iOutput)) );
374  Vec_IntPush( vCoObjs, Aig_ObjId(Aig_ManCo(p->pAig, p->iOutCur)) );
375  }
376  else // the target is the cube
377  {
378  for ( i = 0; i < pCube->nLits; i++ )
379  {
380  if ( pCube->Lits[i] == -1 )
381  continue;
382  pObj = Saig_ManLi(p->pAig, (pCube->Lits[i] >> 1));
383  Vec_IntPush( vCoObjs, Aig_ObjId(pObj) );
384  }
385  }
386 if ( p->pPars->fVeryVerbose )
387 {
388 Abc_Print( 1, "Trying to justify cube " );
389 if ( pCube )
390  Pdr_SetPrint( stdout, pCube, Aig_ManRegNum(p->pAig), NULL );
391 else
392  Abc_Print( 1, "<prop=fail>" );
393 Abc_Print( 1, " in frame %d.\n", k );
394 }
395 
396  // collect CI objects
397  Pdr_ManCollectCone( p->pAig, vCoObjs, vCiObjs, vNodes );
398  // collect values
399  Pdr_ManCollectValues( p, k, vCiObjs, vCiVals );
400  Pdr_ManCollectValues( p, k, vCoObjs, vCoVals );
401  // simulate for the first time
402 if ( p->pPars->fVeryVerbose )
403 Pdr_ManPrintCex( p->pAig, vCiObjs, vCiVals, NULL );
404  RetValue = Pdr_ManSimDataInit( p->pAig, vCiObjs, vCiVals, vNodes, vCoObjs, vCoVals, NULL );
405  assert( RetValue );
406 
407 #if 1
408  // try removing high-priority flops
409  Vec_IntClear( vCi2Rem );
410  Aig_ManForEachObjVec( vCiObjs, p->pAig, pObj, i )
411  {
412  if ( !Saig_ObjIsLo( p->pAig, pObj ) )
413  continue;
414  Entry = Aig_ObjCioId(pObj) - Saig_ManPiNum(p->pAig);
415  if ( vPrio != NULL && Vec_IntEntry( vPrio, Entry ) != 0 )
416  continue;
417  Vec_IntClear( vUndo );
418  if ( Pdr_ManExtendOne( p->pAig, pObj, vUndo, vVisits ) )
419  Vec_IntPush( vCi2Rem, Aig_ObjId(pObj) );
420  else
421  Pdr_ManExtendUndo( p->pAig, vUndo );
422  }
423  // try removing low-priority flops
424  Aig_ManForEachObjVec( vCiObjs, p->pAig, pObj, i )
425  {
426  if ( !Saig_ObjIsLo( p->pAig, pObj ) )
427  continue;
428  Entry = Aig_ObjCioId(pObj) - Saig_ManPiNum(p->pAig);
429  if ( vPrio == NULL || Vec_IntEntry( vPrio, Entry ) == 0 )
430  continue;
431  Vec_IntClear( vUndo );
432  if ( Pdr_ManExtendOne( p->pAig, pObj, vUndo, vVisits ) )
433  Vec_IntPush( vCi2Rem, Aig_ObjId(pObj) );
434  else
435  Pdr_ManExtendUndo( p->pAig, vUndo );
436  }
437 #else
438  // try removing low-priority flops
439  Aig_ManForEachObjVec( vCiObjs, p->pAig, pObj, i )
440  {
441  if ( !Saig_ObjIsLo( p->pAig, pObj ) )
442  continue;
443  Entry = Aig_ObjCioId(pObj) - Saig_ManPiNum(p->pAig);
444  if ( vPrio == NULL || Vec_IntEntry( vPrio, Entry ) == 0 )
445  continue;
446  Vec_IntClear( vUndo );
447  if ( Pdr_ManExtendOne( p->pAig, pObj, vUndo, vVisits ) )
448  Vec_IntPush( vCi2Rem, Aig_ObjId(pObj) );
449  else
450  Pdr_ManExtendUndo( p->pAig, vUndo );
451  }
452  // try removing high-priority flops
453  Vec_IntClear( vCi2Rem );
454  Aig_ManForEachObjVec( vCiObjs, p->pAig, pObj, i )
455  {
456  if ( !Saig_ObjIsLo( p->pAig, pObj ) )
457  continue;
458  Entry = Aig_ObjCioId(pObj) - Saig_ManPiNum(p->pAig);
459  if ( vPrio != NULL && Vec_IntEntry( vPrio, Entry ) != 0 )
460  continue;
461  Vec_IntClear( vUndo );
462  if ( Pdr_ManExtendOne( p->pAig, pObj, vUndo, vVisits ) )
463  Vec_IntPush( vCi2Rem, Aig_ObjId(pObj) );
464  else
465  Pdr_ManExtendUndo( p->pAig, vUndo );
466  }
467 #endif
468 
469 if ( p->pPars->fVeryVerbose )
470 Pdr_ManPrintCex( p->pAig, vCiObjs, vCiVals, vCi2Rem );
471  RetValue = Pdr_ManSimDataInit( p->pAig, vCiObjs, vCiVals, vNodes, vCoObjs, vCoVals, vCi2Rem );
472  assert( RetValue );
473 
474  // derive the set of resulting registers
475  Pdr_ManDeriveResult( p->pAig, vCiObjs, vCiVals, vCi2Rem, vRes, vPiLits );
476  assert( Vec_IntSize(vRes) > 0 );
477  p->tTsim += Abc_Clock() - clk;
478  pRes = Pdr_SetCreate( vRes, vPiLits );
479  assert( k == 0 || !Pdr_SetIsInit(pRes, -1) );
480  return pRes;
481 }
Aig_Man_t * pAig
Definition: pdrInt.h:70
void Pdr_ManExtendUndo(Aig_Man_t *pAig, Vec_Int_t *vUndo)
Definition: pdrTsim.c:251
Pdr_Set_t * Pdr_SetCreate(Vec_Int_t *vLits, Vec_Int_t *vPiLits)
Definition: pdrUtil.c:65
Vec_Int_t * vPrio
Definition: pdrInt.h:90
static int Saig_ObjIsLo(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:84
#define Aig_ManForEachObjVec(vIds, p, pObj, i)
Definition: aig.h:408
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
int iOutCur
Definition: pdrInt.h:81
void Pdr_ManCollectCone(Aig_Man_t *pAig, Vec_Int_t *vCoObjs, Vec_Int_t *vCiObjs, Vec_Int_t *vNodes)
Definition: pdrTsim.c:107
Vec_Int_t * vRes
Definition: pdrInt.h:100
Vec_Int_t * vCiVals
Definition: pdrInt.h:94
void Pdr_SetPrint(FILE *pFile, Pdr_Set_t *p, int nRegs, Vec_Int_t *vFlopCounts)
Definition: pdrUtil.c:225
static abctime Abc_Clock()
Definition: abc_global.h:279
Vec_Int_t * vCi2Rem
Definition: pdrInt.h:99
Vec_Int_t * vCoVals
Definition: pdrInt.h:95
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Pdr_Par_t * pPars
Definition: pdrInt.h:69
Vec_Int_t * vNodes
Definition: pdrInt.h:96
static Aig_Obj_t * Saig_ManLi(Aig_Man_t *p, int i)
Definition: saig.h:80
typedefABC_NAMESPACE_HEADER_START struct Pdr_Set_t_ Pdr_Set_t
INCLUDES ///.
Definition: pdrInt.h:44
int Pdr_ManSimDataInit(Aig_Man_t *pAig, Vec_Int_t *vCiObjs, Vec_Int_t *vCiVals, Vec_Int_t *vNodes, Vec_Int_t *vCoObjs, Vec_Int_t *vCoVals, Vec_Int_t *vCi2Rem)
Definition: pdrTsim.c:161
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
abctime tTsim
Definition: pdrInt.h:129
Vec_Int_t * vVisits
Definition: pdrInt.h:98
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
Vec_Int_t * vLits
Definition: pdrInt.h:91
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
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
void Pdr_ManCollectValues(Pdr_Man_t *p, int k, Vec_Int_t *vObjIds, Vec_Int_t *vValues)
Definition: pdrSat.c:232
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
#define assert(ex)
Definition: util_old.h:213
Vec_Int_t * vCiObjs
Definition: pdrInt.h:92
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
ABC_INT64_T abctime
Definition: abc_global.h:278
void Pdr_ManDeriveResult(Aig_Man_t *pAig, Vec_Int_t *vCiObjs, Vec_Int_t *vCiVals, Vec_Int_t *vCi2Rem, Vec_Int_t *vRes, Vec_Int_t *vPiLits)
Definition: pdrTsim.c:274
int Pdr_SetIsInit(Pdr_Set_t *p, int iRemove)
Definition: pdrUtil.c:341
Vec_Int_t * vUndo
Definition: pdrInt.h:97
Vec_Int_t * vCoObjs
Definition: pdrInt.h:93
static int Aig_ObjCioId(Aig_Obj_t *pObj)
Definition: aig.h:285
int Pdr_ManExtendOne(Aig_Man_t *pAig, Aig_Obj_t *pObj, Vec_Int_t *vUndo, Vec_Int_t *vVis)
Definition: pdrTsim.c:199
void Pdr_ManPrintCex(Aig_Man_t *pAig, Vec_Int_t *vCiObjs, Vec_Int_t *vCiVals, Vec_Int_t *vCi2Rem)
Definition: pdrTsim.c:317