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

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START DdNodeLlb_BddComputeBad (Aig_Man_t *pInit, DdManager *dd, abctime TimeOut)
 DECLARATIONS ///. More...
 
DdNodeLlb_BddQuantifyPis (Aig_Man_t *pInit, DdManager *dd, DdNode *bFunc)
 

Function Documentation

ABC_NAMESPACE_IMPL_START DdNode* Llb_BddComputeBad ( Aig_Man_t pInit,
DdManager dd,
abctime  TimeOut 
)

DECLARATIONS ///.

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

FileName [llb2Bad.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [BDD based reachability.]

Synopsis [Computing bad states.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Computes bad in working manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file llb2Bad.c.

46 {
47  Vec_Ptr_t * vNodes;
48  DdNode * bBdd0, * bBdd1, * bTemp, * bResult;
49  Aig_Obj_t * pObj;
50  int i, k;
51  assert( Cudd_ReadSize(dd) == Aig_ManCiNum(pInit) );
52  // initialize elementary variables
53  Aig_ManConst1(pInit)->pData = Cudd_ReadOne( dd );
54  Saig_ManForEachLo( pInit, pObj, i )
55  pObj->pData = Cudd_bddIthVar( dd, i );
56  Saig_ManForEachPi( pInit, pObj, i )
57  pObj->pData = Cudd_bddIthVar( dd, Aig_ManRegNum(pInit) + i );
58  // compute internal nodes
59  vNodes = Aig_ManDfsNodes( pInit, (Aig_Obj_t **)Vec_PtrArray(pInit->vCos), Saig_ManPoNum(pInit) );
60  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
61  {
62  if ( !Aig_ObjIsNode(pObj) )
63  continue;
64  bBdd0 = Cudd_NotCond( (DdNode *)Aig_ObjFanin0(pObj)->pData, Aig_ObjFaninC0(pObj) );
65  bBdd1 = Cudd_NotCond( (DdNode *)Aig_ObjFanin1(pObj)->pData, Aig_ObjFaninC1(pObj) );
66 // pObj->pData = Extra_bddAndTime( dd, bBdd0, bBdd1, TimeOut );
67  pObj->pData = Cudd_bddAnd( dd, bBdd0, bBdd1 );
68  if ( pObj->pData == NULL )
69  {
70  Vec_PtrForEachEntryStop( Aig_Obj_t *, vNodes, pObj, k, i )
71  if ( pObj->pData )
72  Cudd_RecursiveDeref( dd, (DdNode *)pObj->pData );
73  Vec_PtrFree( vNodes );
74  return NULL;
75  }
76  Cudd_Ref( (DdNode *)pObj->pData );
77  }
78  // quantify PIs of each PO
79  bResult = Cudd_ReadLogicZero( dd ); Cudd_Ref( bResult );
80  Saig_ManForEachPo( pInit, pObj, i )
81  {
82  bBdd0 = Cudd_NotCond( Aig_ObjFanin0(pObj)->pData, Aig_ObjFaninC0(pObj) );
83  bResult = Cudd_bddOr( dd, bTemp = bResult, bBdd0 ); Cudd_Ref( bResult );
84  Cudd_RecursiveDeref( dd, bTemp );
85  }
86  // deref
87  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
88  {
89  if ( !Aig_ObjIsNode(pObj) )
90  continue;
91  Cudd_RecursiveDeref( dd, (DdNode *)pObj->pData );
92  }
93  Vec_PtrFree( vNodes );
94  Cudd_Deref( bResult );
95  return bResult;
96 }
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
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
void Cudd_Deref(DdNode *node)
Definition: cuddRef.c:438
void * pData
Definition: aig.h:87
DdNode * Cudd_ReadLogicZero(DdManager *dd)
Definition: cuddAPI.c:1058
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
int Cudd_ReadSize(DdManager *dd)
Definition: cuddAPI.c:1441
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
Vec_Ptr_t * Aig_ManDfsNodes(Aig_Man_t *p, Aig_Obj_t **ppNodes, int nNodes)
Definition: aigDfs.c:333
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
#define Saig_ManForEachLo(p, pObj, i)
Definition: saig.h:96
DdNode * Cudd_bddOr(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:381
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
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
DdNode * Cudd_ReadOne(DdManager *dd)
Definition: cuddAPI.c:987
#define Vec_PtrForEachEntryStop(Type, vVec, pEntry, i, Stop)
Definition: vecPtr.h:59
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
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
#define assert(ex)
Definition: util_old.h:213
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void ** Vec_PtrArray(Vec_Ptr_t *p)
Definition: vecPtr.h:279
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
DdNode* Llb_BddQuantifyPis ( Aig_Man_t pInit,
DdManager dd,
DdNode bFunc 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 109 of file llb2Bad.c.

110 {
111  DdNode * bVar, * bCube, * bTemp;
112  Aig_Obj_t * pObj;
113  int i;
114  abctime TimeStop;
115  assert( Cudd_ReadSize(dd) == Aig_ManCiNum(pInit) );
116  TimeStop = dd->TimeStop; dd->TimeStop = 0;
117  // create PI cube
118  bCube = Cudd_ReadOne( dd ); Cudd_Ref( bCube );
119  Saig_ManForEachPi( pInit, pObj, i ) {
120  bVar = Cudd_bddIthVar( dd, Aig_ManRegNum(pInit) + i );
121  bCube = Cudd_bddAnd( dd, bTemp = bCube, bVar ); Cudd_Ref( bCube );
122  Cudd_RecursiveDeref( dd, bTemp );
123  }
124  // quantify PI cube
125  bFunc = Cudd_bddExistAbstract( dd, bFunc, bCube ); Cudd_Ref( bFunc );
126  Cudd_RecursiveDeref( dd, bCube );
127  Cudd_Deref( bFunc );
128  dd->TimeStop = TimeStop;
129  return bFunc;
130 }
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
abctime TimeStop
Definition: cuddInt.h:489
Definition: cudd.h:278
void Cudd_Deref(DdNode *node)
Definition: cuddRef.c:438
DdNode * Cudd_bddExistAbstract(DdManager *manager, DdNode *f, DdNode *cube)
Definition: cuddBddAbs.c:130
int Cudd_ReadSize(DdManager *dd)
Definition: cuddAPI.c:1441
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
Definition: aig.h:69
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
DdNode * Cudd_ReadOne(DdManager *dd)
Definition: cuddAPI.c:987
DdNode * Cudd_bddIthVar(DdManager *dd, int i)
Definition: cuddAPI.c:416
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:314
#define assert(ex)
Definition: util_old.h:213
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
ABC_INT64_T abctime
Definition: abc_global.h:278
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91