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

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START int Llb_ManCountEntries (Vec_Int_t *vCands)
 DECLARATIONS ///. More...
 
void Llb_ManPrintEntries (Aig_Man_t *p, Vec_Int_t *vCands)
 
void Llb_ManDerefenceBdds (Aig_Man_t *p, DdManager *dd)
 
DdNodeLlb_ManComputeIndCase_rec (Aig_Man_t *p, Aig_Obj_t *pObj, DdManager *dd, Vec_Ptr_t *vBdds)
 
void Llb_ManComputeIndCase (Aig_Man_t *p, DdManager *dd, Vec_Int_t *vNodes)
 
Vec_Int_tLlb_ManComputeBaseCase (Aig_Man_t *p, DdManager *dd)
 
DdManagerLlb_ManConstructGlobalBdds (Aig_Man_t *p)
 
Vec_Int_tLlb_ManDeriveConstraints (Aig_Man_t *p)
 FUNCTION DECLARATIONS ///. More...
 
void Llb_ManConstrTest (Aig_Man_t *p)
 

Function Documentation

Vec_Int_t* Llb_ManComputeBaseCase ( Aig_Man_t p,
DdManager dd 
)

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

Synopsis [Returns the array of constraint candidates.]

Description []

SideEffects []

SeeAlso []

Definition at line 199 of file llb1Constr.c.

200 {
201  Vec_Int_t * vNodes;
202  Aig_Obj_t * pObj, * pRoot;
203  int i;
204  pRoot = Aig_ManCo( p, 0 );
205  vNodes = Vec_IntStartFull( Aig_ManObjNumMax(p) );
206  Aig_ManForEachObj( p, pObj, i )
207  {
208  if ( !Aig_ObjIsNode(pObj) && !Aig_ObjIsCi(pObj) )
209  continue;
210  if ( Cudd_bddLeq( dd, (DdNode *)pObj->pData, Cudd_Not(pRoot->pData) ) )
211  Vec_IntWriteEntry( vNodes, i, 1 );
212  else if ( Cudd_bddLeq( dd, Cudd_Not((DdNode *)pObj->pData), Cudd_Not(pRoot->pData) ) )
213  Vec_IntWriteEntry( vNodes, i, 0 );
214  }
215  return vNodes;
216 }
Definition: cudd.h:278
#define Cudd_Not(node)
Definition: cudd.h:367
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void * pData
Definition: aig.h:87
static Vec_Int_t * Vec_IntStartFull(int nSize)
Definition: vecInt.h:119
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
Definition: aig.h:69
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
int Cudd_bddLeq(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:536
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
void Llb_ManComputeIndCase ( Aig_Man_t p,
DdManager dd,
Vec_Int_t vNodes 
)

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

Synopsis [Returns the array of constraint candidates.]

Description []

SideEffects []

SeeAlso []

Definition at line 142 of file llb1Constr.c.

143 {
144  Vec_Ptr_t * vBdds;
145  Aig_Obj_t * pObj;
146  DdNode * bFunc;
147  int i, Entry;
148  vBdds = Vec_PtrStart( Aig_ManObjNumMax(p) );
149  bFunc = Cudd_ReadOne(dd); Cudd_Ref( bFunc );
150  Vec_PtrWriteEntry( vBdds, Aig_ObjId(Aig_ManConst1(p)), bFunc );
151  Saig_ManForEachPi( p, pObj, i )
152  {
153  bFunc = Cudd_bddIthVar( dd, Aig_ManCiNum(p) + i ); Cudd_Ref( bFunc );
154  Vec_PtrWriteEntry( vBdds, Aig_ObjId(pObj), bFunc );
155  }
156  Saig_ManForEachLi( p, pObj, i )
157  {
158  bFunc = (DdNode *)pObj->pData; Cudd_Ref( bFunc );
159  Vec_PtrWriteEntry( vBdds, Aig_ObjId(Saig_ObjLiToLo(p, pObj)), bFunc );
160  }
161  Vec_IntForEachEntry( vNodes, Entry, i )
162  {
163  if ( Entry != 0 && Entry != 1 )
164  continue;
165  pObj = Aig_ManObj( p, i );
166  bFunc = Llb_ManComputeIndCase_rec( p, pObj, dd, vBdds );
167  if ( Entry == 0 )
168  {
169 // Extra_bddPrint( dd, Cudd_Not(pObj->pData) ); printf( "\n" );
170 // Extra_bddPrint( dd, Cudd_Not(bFunc) ); printf( "\n" );
171  if ( !Cudd_bddLeq( dd, Cudd_Not(pObj->pData), Cudd_Not(bFunc) ) )
172  Vec_IntWriteEntry( vNodes, i, -1 );
173  }
174  else if ( Entry == 1 )
175  {
176 // Extra_bddPrint( dd, pObj->pData ); printf( "\n" );
177 // Extra_bddPrint( dd, bFunc ); printf( "\n" );
178  if ( !Cudd_bddLeq( dd, (DdNode *)pObj->pData, bFunc ) )
179  Vec_IntWriteEntry( vNodes, i, -1 );
180  }
181  }
182  Vec_PtrForEachEntry( DdNode *, vBdds, bFunc, i )
183  if ( bFunc )
184  Cudd_RecursiveDeref( dd, bFunc );
185  Vec_PtrFree( vBdds );
186 }
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
#define Cudd_Not(node)
Definition: cudd.h:367
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
DdNode * Llb_ManComputeIndCase_rec(Aig_Man_t *p, Aig_Obj_t *pObj, DdManager *dd, Vec_Ptr_t *vBdds)
Definition: llb1Constr.c:115
static Aig_Obj_t * Aig_ManObj(Aig_Man_t *p, int i)
Definition: aig.h:270
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
static Aig_Obj_t * Saig_ObjLiToLo(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:87
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
DdNode * Cudd_ReadOne(DdManager *dd)
Definition: cuddAPI.c:987
int Cudd_bddLeq(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:536
DdNode * Cudd_bddIthVar(DdManager *dd, int i)
Definition: cuddAPI.c:416
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
DdNode* Llb_ManComputeIndCase_rec ( Aig_Man_t p,
Aig_Obj_t pObj,
DdManager dd,
Vec_Ptr_t vBdds 
)

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

Synopsis [Returns the array of constraint candidates.]

Description []

SideEffects []

SeeAlso []

Definition at line 115 of file llb1Constr.c.

116 {
117  DdNode * bBdd0, * bBdd1;
118  DdNode * bFunc = (DdNode *)Vec_PtrEntry( vBdds, Aig_ObjId(pObj) );
119  if ( bFunc != NULL )
120  return bFunc;
121  assert( Aig_ObjIsNode(pObj) );
122  bBdd0 = Llb_ManComputeIndCase_rec( p, Aig_ObjFanin0(pObj), dd, vBdds );
123  bBdd1 = Llb_ManComputeIndCase_rec( p, Aig_ObjFanin1(pObj), dd, vBdds );
124  bBdd0 = Cudd_NotCond( bBdd0, Aig_ObjFaninC0(pObj) );
125  bBdd1 = Cudd_NotCond( bBdd1, Aig_ObjFaninC1(pObj) );
126  bFunc = Cudd_bddAnd( dd, bBdd0, bBdd1 ); Cudd_Ref( bFunc );
127  Vec_PtrWriteEntry( vBdds, Aig_ObjId(pObj), bFunc );
128  return bFunc;
129 }
Definition: cudd.h:278
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
DdNode * Llb_ManComputeIndCase_rec(Aig_Man_t *p, Aig_Obj_t *pObj, DdManager *dd, Vec_Ptr_t *vBdds)
Definition: llb1Constr.c:115
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_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define Cudd_NotCond(node, c)
Definition: cudd.h:383
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:314
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
#define assert(ex)
Definition: util_old.h:213
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
void Llb_ManConstrTest ( Aig_Man_t p)

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

Synopsis [Tests derived constraints.]

Description []

SideEffects []

SeeAlso []

Definition at line 299 of file llb1Constr.c.

300 {
301  Vec_Int_t * vNodes;
302  vNodes = Llb_ManDeriveConstraints( p );
303  Llb_ManPrintEntries( p, vNodes );
304  Vec_IntFreeP( &vNodes );
305 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
Vec_Int_t * Llb_ManDeriveConstraints(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: llb1Constr.c:267
void Llb_ManPrintEntries(Aig_Man_t *p, Vec_Int_t *vCands)
Definition: llb1Constr.c:64
DdManager* Llb_ManConstructGlobalBdds ( Aig_Man_t p)

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

Synopsis [Constructs global BDDs for each object in the AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 229 of file llb1Constr.c.

230 {
231  DdManager * dd;
232  DdNode * bBdd0, * bBdd1;
233  Aig_Obj_t * pObj;
234  int i;
237  pObj = Aig_ManConst1(p);
238  pObj->pData = Cudd_ReadOne(dd); Cudd_Ref( (DdNode *)pObj->pData );
239  Aig_ManForEachCi( p, pObj, i )
240  {
241  pObj->pData = Cudd_bddIthVar(dd, i); Cudd_Ref( (DdNode *)pObj->pData );
242  }
243  Aig_ManForEachNode( p, pObj, i )
244  {
245  bBdd0 = Cudd_NotCond( (DdNode *)Aig_ObjFanin0(pObj)->pData, Aig_ObjFaninC0(pObj) );
246  bBdd1 = Cudd_NotCond( (DdNode *)Aig_ObjFanin1(pObj)->pData, Aig_ObjFaninC1(pObj) );
247  pObj->pData = Cudd_bddAnd( dd, bBdd0, bBdd1 ); Cudd_Ref( (DdNode *)pObj->pData );
248  }
249  Aig_ManForEachCo( p, pObj, i )
250  {
251  pObj->pData = Cudd_NotCond( (DdNode *)Aig_ObjFanin0(pObj)->pData, Aig_ObjFaninC0(pObj) ); Cudd_Ref( (DdNode *)pObj->pData );
252  }
253  return dd;
254 }
#define CUDD_UNIQUE_SLOTS
Definition: cudd.h:97
Definition: cudd.h:278
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
#define CUDD_CACHE_SLOTS
Definition: cudd.h:98
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
DdManager * Cudd_Init(unsigned int numVars, unsigned int numVarsZ, unsigned int numSlots, unsigned int cacheSize, unsigned long maxMemory)
Definition: cuddInit.c:125
Definition: aig.h:69
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
DdNode * Cudd_ReadOne(DdManager *dd)
Definition: cuddAPI.c:987
DdNode * Cudd_bddIthVar(DdManager *dd, int i)
Definition: cuddAPI.c:416
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define Cudd_NotCond(node, c)
Definition: cudd.h:383
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:314
void Cudd_AutodynEnable(DdManager *unique, Cudd_ReorderingType method)
Definition: cuddAPI.c:669
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
ABC_NAMESPACE_IMPL_START int Llb_ManCountEntries ( Vec_Int_t vCands)

DECLARATIONS ///.

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

FileName [llb1Constr.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [BDD based reachability.]

Synopsis [Computing inductive constraints.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Returns the array of constraint candidates.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file llb1Constr.c.

46 {
47  int i, Entry, Counter = 0;
48  Vec_IntForEachEntry( vCands, Entry, i )
49  Counter += ((Entry == 0) || (Entry == 1));
50  return Counter;
51 }
static int Counter
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
void Llb_ManDerefenceBdds ( Aig_Man_t p,
DdManager dd 
)

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

Synopsis [Dereference BDD nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 96 of file llb1Constr.c.

97 {
98  Aig_Obj_t * pObj;
99  int i;
100  Aig_ManForEachObj( p, pObj, i )
101  Cudd_RecursiveDeref( dd, (DdNode *)pObj->pData );
102 }
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Definition: aig.h:69
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
Vec_Int_t* Llb_ManDeriveConstraints ( Aig_Man_t p)

FUNCTION DECLARATIONS ///.

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

Synopsis [Derives inductive constraints.]

Description []

SideEffects []

SeeAlso []

Definition at line 267 of file llb1Constr.c.

268 {
269  DdManager * dd;
270  Vec_Int_t * vNodes;
271  if ( Saig_ManPoNum(p) != 1 )
272  {
273  printf( "The AIG has %d property outputs.\n", Saig_ManPoNum(p) );
274  return NULL;
275  }
276  assert( Saig_ManPoNum(p) == 1 );
278  vNodes = Llb_ManComputeBaseCase( p, dd );
279  if ( Llb_ManCountEntries(vNodes) > 0 )
280  Llb_ManComputeIndCase( p, dd, vNodes );
281  if ( Llb_ManCountEntries(vNodes) == 0 )
282  Vec_IntFreeP( &vNodes );
283  Llb_ManDerefenceBdds( p, dd );
284  Extra_StopManager( dd );
285  return vNodes;
286 }
void Llb_ManComputeIndCase(Aig_Man_t *p, DdManager *dd, Vec_Int_t *vNodes)
Definition: llb1Constr.c:142
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void Extra_StopManager(DdManager *dd)
Definition: extraBddMisc.c:223
ABC_NAMESPACE_IMPL_START int Llb_ManCountEntries(Vec_Int_t *vCands)
DECLARATIONS ///.
Definition: llb1Constr.c:45
void Llb_ManDerefenceBdds(Aig_Man_t *p, DdManager *dd)
Definition: llb1Constr.c:96
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
#define assert(ex)
Definition: util_old.h:213
Vec_Int_t * Llb_ManComputeBaseCase(Aig_Man_t *p, DdManager *dd)
Definition: llb1Constr.c:199
DdManager * Llb_ManConstructGlobalBdds(Aig_Man_t *p)
Definition: llb1Constr.c:229
void Llb_ManPrintEntries ( Aig_Man_t p,
Vec_Int_t vCands 
)

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

Synopsis [Returns the array of constraint candidates.]

Description []

SideEffects []

SeeAlso []

Definition at line 64 of file llb1Constr.c.

65 {
66  int i, Entry;
67  if ( vCands == NULL )
68  {
69  printf( "There is no hints.\n" );
70  return;
71  }
72  Entry = Llb_ManCountEntries(vCands);
73  printf( "\n*** Using %d hint%s:\n", Entry, (Entry != 1 ? "s":"") );
74  Vec_IntForEachEntry( vCands, Entry, i )
75  {
76  if ( Entry != 0 && Entry != 1 )
77  continue;
78  printf( "%c", Entry ? '+' : '-' );
79  printf( "%-6d : ", i );
80  Aig_ObjPrint( p, Aig_ManObj(p, i) );
81  printf( "\n" );
82  }
83 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ManObj(Aig_Man_t *p, int i)
Definition: aig.h:270
ABC_NAMESPACE_IMPL_START int Llb_ManCountEntries(Vec_Int_t *vCands)
DECLARATIONS ///.
Definition: llb1Constr.c:45
void Aig_ObjPrint(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigObj.c:316
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54