ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
bbrCex.c File Reference
#include "bbr.h"
Include dependency graph for bbrCex.c:

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START DdNode * Bbr_bddComputeRangeCube (DdManager *dd, int iStart, int iStop)
 DECLARATIONS ///.
 
Abc_Cex_tAig_ManVerifyUsingBddsCountExample (Aig_Man_t *p, DdManager *dd, DdNode **pbParts, Vec_Ptr_t *vOnionRings, DdNode *bCubeFirst, int iOutput, int fVerbose, int fSilent)
 FUNCTION DEFINITIONS ///.
 

Function Documentation

◆ Aig_ManVerifyUsingBddsCountExample()

Abc_Cex_t * Aig_ManVerifyUsingBddsCountExample ( Aig_Man_t * p,
DdManager * dd,
DdNode ** pbParts,
Vec_Ptr_t * vOnionRings,
DdNode * bCubeFirst,
int iOutput,
int fVerbose,
int fSilent )

FUNCTION DEFINITIONS ///.

DECLARATIONS ///.

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

Synopsis [Derives the counter-example using the set of reached states.]

Description []

SideEffects []

SeeAlso []

Definition at line 47 of file bbrCex.c.

50{
51 Abc_Cex_t * pCex;
52 Aig_Obj_t * pObj;
53 Bbr_ImageTree_t * pTree;
54 DdNode * bCubeNs, * bState, * bImage;
55 DdNode * bTemp, * bVar, * bRing;
56 int i, v, RetValue, nPiOffset;
57 char * pValues;
58 abctime clk = Abc_Clock();
59//printf( "\nDeriving counter-example.\n" );
60
61 // allocate room for the counter-example
62 pCex = Abc_CexAlloc( Saig_ManRegNum(p), Saig_ManPiNum(p), Vec_PtrSize(vOnionRings)+1 );
63 pCex->iFrame = Vec_PtrSize(vOnionRings);
64 pCex->iPo = iOutput;
65 nPiOffset = Saig_ManRegNum(p) + Saig_ManPiNum(p) * Vec_PtrSize(vOnionRings);
66
67 // create the cube of NS variables
68 bCubeNs = Bbr_bddComputeRangeCube( dd, Saig_ManCiNum(p), Saig_ManCiNum(p)+Saig_ManRegNum(p) ); Cudd_Ref( bCubeNs );
69 pTree = Bbr_bddImageStart( dd, bCubeNs, Saig_ManRegNum(p), pbParts, Saig_ManCiNum(p), dd->vars, 100000000, fVerbose );
70 Cudd_RecursiveDeref( dd, bCubeNs );
71 if ( pTree == NULL )
72 {
73 if ( !fSilent )
74 printf( "BDDs blew up during qualitification scheduling. " );
75 return NULL;
76 }
77
78 // allocate room for the cube
79 pValues = ABC_ALLOC( char, dd->size );
80
81 // get the last cube
82 RetValue = Cudd_bddPickOneCube( dd, bCubeFirst, pValues );
83 assert( RetValue );
84
85 // write PIs of counter-example
86 Saig_ManForEachPi( p, pObj, i )
87 if ( pValues[i] == 1 )
88 Abc_InfoSetBit( pCex->pData, nPiOffset + i );
89 nPiOffset -= Saig_ManPiNum(p);
90
91 // write state in terms of NS variables
92 bState = (dd)->one; Cudd_Ref( bState );
93 Saig_ManForEachLo( p, pObj, i )
94 {
95 bVar = Cudd_NotCond( dd->vars[Saig_ManCiNum(p)+i], pValues[Saig_ManPiNum(p)+i] != 1 );
96 bState = Cudd_bddAnd( dd, bTemp = bState, bVar ); Cudd_Ref( bState );
97 Cudd_RecursiveDeref( dd, bTemp );
98 }
99
100 // perform backward analysis
101 Vec_PtrForEachEntryReverse( DdNode *, vOnionRings, bRing, v )
102 {
103 // compute the next states
104 bImage = Bbr_bddImageCompute( pTree, bState );
105 if ( bImage == NULL )
106 {
107 Cudd_RecursiveDeref( dd, bState );
108 if ( !fSilent )
109 printf( "BDDs blew up during image computation. " );
110 Bbr_bddImageTreeDelete( pTree );
111 ABC_FREE( pValues );
112 return NULL;
113 }
114 Cudd_Ref( bImage );
115 Cudd_RecursiveDeref( dd, bState );
116
117 // intersect with the previous set
118 bImage = Cudd_bddAnd( dd, bTemp = bImage, bRing ); Cudd_Ref( bImage );
119 Cudd_RecursiveDeref( dd, bTemp );
120
121 // find any assignment of the BDD
122 RetValue = Cudd_bddPickOneCube( dd, bImage, pValues );
123 assert( RetValue );
124 Cudd_RecursiveDeref( dd, bImage );
125
126 // write PIs of counter-example
127 Saig_ManForEachPi( p, pObj, i )
128 if ( pValues[i] == 1 )
129 Abc_InfoSetBit( pCex->pData, nPiOffset + i );
130 nPiOffset -= Saig_ManPiNum(p);
131
132 // check that we get the init state
133 if ( v == 0 )
134 {
135 Saig_ManForEachLo( p, pObj, i )
136 assert( pValues[Saig_ManPiNum(p)+i] == 0 );
137 break;
138 }
139
140 // write state in terms of NS variables
141 bState = (dd)->one; Cudd_Ref( bState );
142 Saig_ManForEachLo( p, pObj, i )
143 {
144 bVar = Cudd_NotCond( dd->vars[Saig_ManCiNum(p)+i], pValues[Saig_ManPiNum(p)+i] != 1 );
145 bState = Cudd_bddAnd( dd, bTemp = bState, bVar ); Cudd_Ref( bState );
146 Cudd_RecursiveDeref( dd, bTemp );
147 }
148 }
149 // cleanup
150 Bbr_bddImageTreeDelete( pTree );
151 ABC_FREE( pValues );
152 // verify the counter example
153 if ( Vec_PtrSize(vOnionRings) < 1000 )
154 {
155 RetValue = Saig_ManVerifyCex( p, pCex );
156 if ( RetValue == 0 && !fSilent )
157 printf( "Aig_ManVerifyUsingBdds(): Counter-example verification has FAILED.\n" );
158 }
159 if ( fVerbose && !fSilent )
160 {
161 ABC_PRT( "Counter-example generation time", Abc_Clock() - clk );
162 }
163 return pCex;
164}
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_PRT(a, t)
Definition abc_global.h:255
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_FREE(obj)
Definition abc_global.h:267
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
ABC_NAMESPACE_IMPL_START DdNode * Bbr_bddComputeRangeCube(DdManager *dd, int iStart, int iStop)
DECLARATIONS ///.
Definition bbrReach.c:74
void Bbr_bddImageTreeDelete(Bbr_ImageTree_t *pTree)
Definition bbrImage.c:307
Bbr_ImageTree_t * Bbr_bddImageStart(DdManager *dd, DdNode *bCare, int nParts, DdNode **pbParts, int nVars, DdNode **pbVars, int nBddMax, int fVerbose)
Definition bbrImage.c:168
DdNode * Bbr_bddImageCompute(Bbr_ImageTree_t *pTree, DdNode *bCare)
Definition bbrImage.c:253
struct Bbr_ImageTree_t_ Bbr_ImageTree_t
FUNCTION DECLARATIONS ///.
Definition bbr.h:58
Cube * p
Definition exorList.c:222
#define Saig_ManForEachLo(p, pObj, i)
Definition saig.h:96
#define Saig_ManForEachPi(p, pObj, i)
Definition saig.h:91
int Saig_ManVerifyCex(Aig_Man_t *pAig, Abc_Cex_t *p)
Definition saigDup.c:281
ABC_NAMESPACE_IMPL_START Abc_Cex_t * Abc_CexAlloc(int nRegs, int nRealPis, int nFrames)
DECLARATIONS ///.
Definition utilCex.c:51
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition utilCex.h:39
#define assert(ex)
Definition util_old.h:213
#define Vec_PtrForEachEntryReverse(Type, vVec, pEntry, i)
Definition vecPtr.h:63
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bbr_bddComputeRangeCube()

ABC_NAMESPACE_IMPL_START DdNode * Bbr_bddComputeRangeCube ( DdManager * dd,
int iStart,
int iStop )
extern

DECLARATIONS ///.

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

FileName [bbrCex.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [BDD-based reachability analysis.]

Synopsis [Procedures to derive a satisfiable counter-example.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

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

Synopsis [Performs the reordering-sensitive step of Extra_bddMove().]

Description []

SideEffects []

SeeAlso []

Definition at line 74 of file bbrReach.c.

75{
76 DdNode * bTemp, * bProd;
77 int i;
78 assert( iStart <= iStop );
79 assert( iStart >= 0 && iStart <= dd->size );
80 assert( iStop >= 0 && iStop <= dd->size );
81 bProd = (dd)->one; Cudd_Ref( bProd );
82 for ( i = iStart; i < iStop; i++ )
83 {
84 bProd = Cudd_bddAnd( dd, bTemp = bProd, dd->vars[i] ); Cudd_Ref( bProd );
85 Cudd_RecursiveDeref( dd, bTemp );
86 }
87 Cudd_Deref( bProd );
88 return bProd;
89}
Here is the caller graph for this function: