ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
bbr.h File Reference
#include <stdio.h>
#include "aig/aig/aig.h"
#include "aig/saig/saig.h"
#include "bdd/cudd/cuddInt.h"
Include dependency graph for bbr.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct Bbr_ImageTree_t_ Bbr_ImageTree_t
 FUNCTION DECLARATIONS ///.
 
typedef struct Bbr_ImageTree2_t_ Bbr_ImageTree2_t
 

Functions

Bbr_ImageTree_tBbr_bddImageStart (DdManager *dd, DdNode *bCare, int nParts, DdNode **pbParts, int nVars, DdNode **pbVars, int nBddMax, int fVerbose)
 
DdNode * Bbr_bddImageCompute (Bbr_ImageTree_t *pTree, DdNode *bCare)
 
void Bbr_bddImageTreeDelete (Bbr_ImageTree_t *pTree)
 
DdNode * Bbr_bddImageRead (Bbr_ImageTree_t *pTree)
 
Bbr_ImageTree2_tBbr_bddImageStart2 (DdManager *dd, DdNode *bCare, int nParts, DdNode **pbParts, int nVars, DdNode **pbVars, int fVerbose)
 
DdNode * Bbr_bddImageCompute2 (Bbr_ImageTree2_t *pTree, DdNode *bCare)
 
void Bbr_bddImageTreeDelete2 (Bbr_ImageTree2_t *pTree)
 
DdNode * Bbr_bddImageRead2 (Bbr_ImageTree2_t *pTree)
 
void Aig_ManFreeGlobalBdds (Aig_Man_t *p, DdManager *dd)
 
int Aig_ManSizeOfGlobalBdds (Aig_Man_t *p)
 
DdManager * Aig_ManComputeGlobalBdds (Aig_Man_t *p, int nBddSizeMax, int fDropInternal, int fReorder, int fVerbose)
 
int Aig_ManVerifyUsingBdds (Aig_Man_t *p, Saig_ParBbr_t *pPars)
 
void Bbr_ManSetDefaultParams (Saig_ParBbr_t *p)
 FUNCTION DEFINITIONS ///.
 

Typedef Documentation

◆ Bbr_ImageTree2_t

Definition at line 66 of file bbr.h.

◆ Bbr_ImageTree_t

FUNCTION DECLARATIONS ///.

Definition at line 58 of file bbr.h.

Function Documentation

◆ Aig_ManComputeGlobalBdds()

DdManager * Aig_ManComputeGlobalBdds ( Aig_Man_t * p,
int nBddSizeMax,
int fDropInternal,
int fReorder,
int fVerbose )
extern

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

Synopsis [Recursively computes global BDDs for the AIG in the manager.]

Description [On exit, BDDs are stored in the pNode->pData fields.]

SideEffects []

SeeAlso []

Definition at line 157 of file bbrNtbdd.c.

158{
159 ProgressBar * pProgress = NULL;
160 Aig_Obj_t * pObj;
161 DdManager * dd;
162 DdNode * bFunc;
163 int i, Counter;
164 // start the manager
165 dd = Cudd_Init( Aig_ManCiNum(p), 0, CUDD_UNIQUE_SLOTS, CUDD_CACHE_SLOTS, 0 );
166 // set reordering
167 if ( fReorder )
168 Cudd_AutodynEnable( dd, CUDD_REORDER_SYMM_SIFT );
169 // prepare to construct global BDDs
171 // assign the constant node BDD
172 Aig_ObjSetGlobalBdd( Aig_ManConst1(p), dd->one ); Cudd_Ref( dd->one );
173 // set the elementary variables
174 Aig_ManForEachCi( p, pObj, i )
175 {
176 Aig_ObjSetGlobalBdd( pObj, dd->vars[i] ); Cudd_Ref( dd->vars[i] );
177 }
178
179 // collect the global functions of the COs
180 Counter = 0;
181 // construct the BDDs
182// pProgress = Extra_ProgressBarStart( stdout, Aig_ManNodeNum(p) );
183 Aig_ManForEachCo( p, pObj, i )
184 {
185 bFunc = Bbr_NodeGlobalBdds_rec( dd, Aig_ObjFanin0(pObj), nBddSizeMax, fDropInternal, pProgress, &Counter, fVerbose );
186 if ( bFunc == NULL )
187 {
188 if ( fVerbose )
189 printf( "Constructing global BDDs is aborted.\n" );
191 Cudd_Quit( dd );
192 // reset references
194 return NULL;
195 }
196 bFunc = Cudd_NotCond( bFunc, Aig_ObjFaninC0(pObj) ); Cudd_Ref( bFunc );
197 Aig_ObjSetGlobalBdd( pObj, bFunc );
198 }
199// Extra_ProgressBarStop( pProgress );
200 // reset references
202 // reorder one more time
203 if ( fReorder )
204 {
205 Cudd_ReduceHeap( dd, CUDD_REORDER_SYMM_SIFT, 1 );
206 Cudd_AutodynDisable( dd );
207 }
208// Cudd_PrintInfo( dd, stdout );
209 return dd;
210}
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition aig.h:393
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
void Aig_ManResetRefs(Aig_Man_t *p)
Definition aigUtil.c:122
#define Aig_ManForEachCo(p, pObj, i)
Definition aig.h:398
void Aig_ManCleanData(Aig_Man_t *p)
Definition aigUtil.c:205
DdNode * Bbr_NodeGlobalBdds_rec(DdManager *dd, Aig_Obj_t *pNode, int nBddSizeMax, int fDropInternal, ProgressBar *pProgress, int *pCounter, int fVerbose)
FUNCTION DEFINITIONS ///.
Definition bbrNtbdd.c:51
ABC_NAMESPACE_IMPL_START typedef char ProgressBar
Definition bbrNtbdd.c:27
void Aig_ManFreeGlobalBdds(Aig_Man_t *p, DdManager *dd)
Definition bbrNtbdd.c:112
Cube * p
Definition exorList.c:222
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Aig_ManFreeGlobalBdds()

void Aig_ManFreeGlobalBdds ( Aig_Man_t * p,
DdManager * dd )
extern

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

Synopsis [Frees the global BDDs of the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 112 of file bbrNtbdd.c.

113{
114 Aig_Obj_t * pObj;
115 int i;
116 Aig_ManForEachObj( p, pObj, i )
117 if ( Aig_ObjGlobalBdd(pObj) )
118 Aig_ObjCleanGlobalBdd( dd, pObj );
119}
#define Aig_ManForEachObj(p, pObj, i)
Definition aig.h:403
Here is the caller graph for this function:

◆ Aig_ManSizeOfGlobalBdds()

int Aig_ManSizeOfGlobalBdds ( Aig_Man_t * p)
extern

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

Synopsis [Returns the shared size of global BDDs of the COs.]

Description []

SideEffects []

SeeAlso []

Definition at line 132 of file bbrNtbdd.c.

133{
134 Vec_Ptr_t * vFuncsGlob;
135 Aig_Obj_t * pObj;
136 int RetValue, i;
137 // complement the global functions
138 vFuncsGlob = Vec_PtrAlloc( Aig_ManCoNum(p) );
139 Aig_ManForEachCo( p, pObj, i )
140 Vec_PtrPush( vFuncsGlob, Aig_ObjGlobalBdd(pObj) );
141 RetValue = Cudd_SharingSize( (DdNode **)Vec_PtrArray(vFuncsGlob), Vec_PtrSize(vFuncsGlob) );
142 Vec_PtrFree( vFuncsGlob );
143 return RetValue;
144}
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42

◆ Aig_ManVerifyUsingBdds()

int Aig_ManVerifyUsingBdds ( Aig_Man_t * pInit,
Saig_ParBbr_t * pPars )
extern

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

Synopsis [Performs reachability to see if any PO can be asserted.]

Description []

SideEffects []

SeeAlso []

Definition at line 592 of file saigDup.c.

592{ return 0; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bbr_bddImageCompute()

DdNode * Bbr_bddImageCompute ( Bbr_ImageTree_t * pTree,
DdNode * bCare )
extern

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

Synopsis [Compute the image.]

Description []

SideEffects []

SeeAlso []

Definition at line 253 of file bbrImage.c.

254{
255 DdManager * dd = pTree->pCare->dd;
256 DdNode * bSupp, * bRem;
257
258 pTree->nIter++;
259
260 // make sure the supports are okay
261 bSupp = Cudd_Support( dd, bCare ); Cudd_Ref( bSupp );
262 if ( bSupp != pTree->bCareSupp )
263 {
264 bRem = Cudd_bddExistAbstract( dd, bSupp, pTree->bCareSupp ); Cudd_Ref( bRem );
265 if ( bRem != b1 )
266 {
267printf( "Original care set support: " );
268ABC_PRB( dd, pTree->bCareSupp );
269printf( "Current care set support: " );
270ABC_PRB( dd, bSupp );
271 Cudd_RecursiveDeref( dd, bSupp );
272 Cudd_RecursiveDeref( dd, bRem );
273 printf( "The care set depends on some vars that were not in the care set during scheduling.\n" );
274 return NULL;
275 }
276 Cudd_RecursiveDeref( dd, bRem );
277 }
278 Cudd_RecursiveDeref( dd, bSupp );
279
280 // remove the previous image
281 Cudd_RecursiveDeref( dd, pTree->pCare->bImage );
282 pTree->pCare->bImage = bCare; Cudd_Ref( bCare );
283
284 // compute the image
285 pTree->nNodesMax = 0;
286 if ( !Bbr_bddImageCompute_rec( pTree, pTree->pRoot ) )
287 return NULL;
288 if ( pTree->nNodesMaxT < pTree->nNodesMax )
289 pTree->nNodesMaxT = pTree->nNodesMax;
290
291// if ( pTree->fVerbose )
292// printf( "Iter %2d : Max nodes = %5d.\n", pTree->nIter, pTree->nNodesMax );
293 return pTree->pRoot->bImage;
294}
#define b1
Definition bbrImage.c:97
#define ABC_PRB(dd, f)
Definition bbrImage.c:100
Bbr_ImageNode_t * pRoot
Definition bbrImage.c:48
DdNode * bCareSupp
Definition bbrImage.c:50
Bbr_ImageNode_t * pCare
Definition bbrImage.c:49
Here is the caller graph for this function:

◆ Bbr_bddImageCompute2()

DdNode * Bbr_bddImageCompute2 ( Bbr_ImageTree2_t * pTree,
DdNode * bCare )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1273 of file bbrImage.c.

1274{
1275 if ( pTree->bImage )
1276 Cudd_RecursiveDeref( pTree->dd, pTree->bImage );
1277 pTree->bImage = Cudd_bddAndAbstract( pTree->dd, pTree->bRel, bCare, pTree->bCube );
1278 Cudd_Ref( pTree->bImage );
1279 return pTree->bImage;
1280}
DdManager * dd
Definition bbrImage.c:1214
Here is the caller graph for this function:

◆ Bbr_bddImageRead()

DdNode * Bbr_bddImageRead ( Bbr_ImageTree_t * pTree)
extern

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

Synopsis [Reads the image from the tree.]

Description []

SideEffects []

SeeAlso []

Definition at line 326 of file bbrImage.c.

327{
328 return pTree->pRoot->bImage;
329}

◆ Bbr_bddImageRead2()

DdNode * Bbr_bddImageRead2 ( Bbr_ImageTree2_t * pTree)
extern

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

Synopsis [Returns the previously computed image.]

Description []

SideEffects []

SeeAlso []

Definition at line 1315 of file bbrImage.c.

1316{
1317 return pTree->bImage;
1318}

◆ Bbr_bddImageStart()

Bbr_ImageTree_t * Bbr_bddImageStart ( DdManager * dd,
DdNode * bCare,
int nParts,
DdNode ** pbParts,
int nVars,
DdNode ** pbVars,
int nBddMax,
int fVerbose )
extern

AutomaticEnd Function*************************************************************

Synopsis [Starts the image computation using tree-based scheduling.]

Description [This procedure starts the image computation. It uses the given care set to test-run the image computation and creates the quantification tree by scheduling variable quantifications. The tree can be used to compute images for other care sets without rescheduling. In this case, Bbr_bddImageCompute() should be called.]

SideEffects []

SeeAlso []

Definition at line 168 of file bbrImage.c.

172{
173 Bbr_ImageTree_t * pTree;
174 Bbr_ImagePart_t ** pParts;
175 Bbr_ImageVar_t ** pVars;
176 Bbr_ImageNode_t ** pNodes, * pCare;
177 int fStop, v;
178
179 if ( fVerbose && dd->size <= 80 )
180 Bbr_bddImagePrintLatchDependency( dd, bCare, nParts, pbParts, nVars, pbVars );
181
182 // create variables, partitions and leaf nodes
183 pParts = Bbr_CreateParts( dd, nParts, pbParts, bCare );
184 pVars = Bbr_CreateVars( dd, nParts + 1, pParts, nVars, pbVars );
185 pNodes = Bbr_CreateNodes( dd, nParts + 1, pParts, dd->size, pVars );
186 pCare = pNodes[nParts];
187
188 // process the nodes
189 while ( Bbr_BuildTreeNode( dd, nParts + 1, pNodes, dd->size, pVars, &fStop, nBddMax ) );
190
191 // consider the case of BDD node blowup
192 if ( fStop )
193 {
194 for ( v = 0; v < dd->size; v++ )
195 if ( pVars[v] )
196 ABC_FREE( pVars[v] );
197 ABC_FREE( pVars );
198 for ( v = 0; v <= nParts; v++ )
199 if ( pNodes[v] )
200 {
201 Bbr_DeleteParts_rec( pNodes[v] );
202 Bbr_bddImageTreeDelete_rec( pNodes[v] );
203 }
204 ABC_FREE( pNodes );
205 ABC_FREE( pParts );
206 return NULL;
207 }
208
209 // make sure the variables are gone
210 for ( v = 0; v < dd->size; v++ )
211 assert( pVars[v] == NULL );
212 ABC_FREE( pVars );
213
214 // create the tree
215 pTree = ABC_ALLOC( Bbr_ImageTree_t, 1 );
216 memset( pTree, 0, sizeof(Bbr_ImageTree_t) );
217 pTree->pCare = pCare;
218 pTree->nBddMax = nBddMax;
219 pTree->fVerbose = fVerbose;
220
221 // merge the topmost nodes
222 while ( (pTree->pRoot = Bbr_MergeTopNodes( dd, nParts + 1, pNodes )) == NULL );
223
224 // make sure the nodes are gone
225 for ( v = 0; v < nParts + 1; v++ )
226 assert( pNodes[v] == NULL );
227 ABC_FREE( pNodes );
228
229// if ( fVerbose )
230// Bbr_bddImagePrintTree( pTree );
231
232 // set the support of the care set
233 pTree->bCareSupp = Cudd_Support( dd, bCare ); Cudd_Ref( pTree->bCareSupp );
234
235 // clean the partitions
236 Bbr_DeleteParts_rec( pTree->pRoot );
237 ABC_FREE( pParts );
238
239 return pTree;
240}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_FREE(obj)
Definition abc_global.h:267
struct Bbr_ImageVar_t_ Bbr_ImageVar_t
Definition bbrImage.c:44
typedefABC_NAMESPACE_IMPL_START struct Bbr_ImageNode_t_ Bbr_ImageNode_t
Definition bbrImage.c:42
struct Bbr_ImagePart_t_ Bbr_ImagePart_t
Definition bbrImage.c:43
struct Bbr_ImageTree_t_ Bbr_ImageTree_t
FUNCTION DECLARATIONS ///.
Definition bbr.h:58
#define assert(ex)
Definition util_old.h:213
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bbr_bddImageStart2()

Bbr_ImageTree2_t * Bbr_bddImageStart2 ( DdManager * dd,
DdNode * bCare,
int nParts,
DdNode ** pbParts,
int nVars,
DdNode ** pbVars,
int fVerbose )
extern

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

Synopsis [Starts the monolithic image computation.]

Description []

SideEffects []

SeeAlso []

Definition at line 1231 of file bbrImage.c.

1235{
1236 Bbr_ImageTree2_t * pTree;
1237 DdNode * bCubeAll, * bCubeNot, * bTemp;
1238 int i;
1239
1240 pTree = ABC_ALLOC( Bbr_ImageTree2_t, 1 );
1241 pTree->dd = dd;
1242 pTree->bImage = NULL;
1243
1244 bCubeAll = Bbr_bddComputeCube( dd, dd->vars, dd->size ); Cudd_Ref( bCubeAll );
1245 bCubeNot = Bbr_bddComputeCube( dd, pbVars, nVars ); Cudd_Ref( bCubeNot );
1246 pTree->bCube = Cudd_bddExistAbstract( dd, bCubeAll, bCubeNot ); Cudd_Ref( pTree->bCube );
1247 Cudd_RecursiveDeref( dd, bCubeAll );
1248 Cudd_RecursiveDeref( dd, bCubeNot );
1249
1250 // derive the monolithic relation
1251 pTree->bRel = b1; Cudd_Ref( pTree->bRel );
1252 for ( i = 0; i < nParts; i++ )
1253 {
1254 pTree->bRel = Cudd_bddAnd( dd, bTemp = pTree->bRel, pbParts[i] ); Cudd_Ref( pTree->bRel );
1255 Cudd_RecursiveDeref( dd, bTemp );
1256 }
1257 Bbr_bddImageCompute2( pTree, bCare );
1258 return pTree;
1259}
DdNode * Bbr_bddImageCompute2(Bbr_ImageTree2_t *pTree, DdNode *bCare)
Definition bbrImage.c:1273
DdNode * Bbr_bddComputeCube(DdManager *dd, DdNode **bXVars, int nVars)
Definition bbrImage.c:1191
struct Bbr_ImageTree2_t_ Bbr_ImageTree2_t
Definition bbr.h:66
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bbr_bddImageTreeDelete()

void Bbr_bddImageTreeDelete ( Bbr_ImageTree_t * pTree)
extern

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

Synopsis [Delete the tree.]

Description []

SideEffects []

SeeAlso []

Definition at line 307 of file bbrImage.c.

308{
309 if ( pTree->bCareSupp )
310 Cudd_RecursiveDeref( pTree->pRoot->dd, pTree->bCareSupp );
311 Bbr_bddImageTreeDelete_rec( pTree->pRoot );
312 ABC_FREE( pTree );
313}
Here is the caller graph for this function:

◆ Bbr_bddImageTreeDelete2()

void Bbr_bddImageTreeDelete2 ( Bbr_ImageTree2_t * pTree)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1293 of file bbrImage.c.

1294{
1295 if ( pTree->bRel )
1296 Cudd_RecursiveDeref( pTree->dd, pTree->bRel );
1297 if ( pTree->bCube )
1298 Cudd_RecursiveDeref( pTree->dd, pTree->bCube );
1299 if ( pTree->bImage )
1300 Cudd_RecursiveDeref( pTree->dd, pTree->bImage );
1301 ABC_FREE( pTree );
1302}
Here is the caller graph for this function:

◆ Bbr_ManSetDefaultParams()

void Bbr_ManSetDefaultParams ( Saig_ParBbr_t * p)
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [This procedure sets default resynthesis parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 593 of file saigDup.c.

593{}
Here is the call graph for this function:
Here is the caller graph for this function: