ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
bdc.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Bdc_Par_t_
 

Typedefs

typedef typedefABC_NAMESPACE_HEADER_START struct Bdc_Fun_t_ Bdc_Fun_t
 INCLUDES ///.
 
typedef struct Bdc_Man_t_ Bdc_Man_t
 
typedef struct Bdc_Par_t_ Bdc_Par_t
 

Functions

Bdc_Man_tBdc_ManAlloc (Bdc_Par_t *pPars)
 MACRO DEFINITIONS ///.
 
void Bdc_ManFree (Bdc_Man_t *p)
 
void Bdc_ManDecPrint (Bdc_Man_t *p)
 
int Bdc_ManDecompose (Bdc_Man_t *p, unsigned *puFunc, unsigned *puCare, int nVars, Vec_Ptr_t *vDivs, int nNodesMax)
 
Bdc_Fun_tBdc_ManFunc (Bdc_Man_t *p, int i)
 DECLARATIONS ///.
 
Bdc_Fun_tBdc_ManRoot (Bdc_Man_t *p)
 
int Bdc_ManNodeNum (Bdc_Man_t *p)
 
int Bdc_ManAndNum (Bdc_Man_t *p)
 
Bdc_Fun_tBdc_FuncFanin0 (Bdc_Fun_t *p)
 
Bdc_Fun_tBdc_FuncFanin1 (Bdc_Fun_t *p)
 
void * Bdc_FuncCopy (Bdc_Fun_t *p)
 
int Bdc_FuncCopyInt (Bdc_Fun_t *p)
 
void Bdc_FuncSetCopy (Bdc_Fun_t *p, void *pCopy)
 
void Bdc_FuncSetCopyInt (Bdc_Fun_t *p, int iCopy)
 
int Bdc_ManBidecNodeNum (word *pFunc, word *pCare, int nVars, int fVerbose)
 
Vec_Int_tBdc_ManBidecResub (word *pFunc, word *pCare, int nVars)
 

Typedef Documentation

◆ Bdc_Fun_t

typedef typedefABC_NAMESPACE_HEADER_START struct Bdc_Fun_t_ Bdc_Fun_t

INCLUDES ///.

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

FileName [bdc.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Truth-table-based bi-decomposition engine.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - January 30, 2007.]

Revision [

Id
bdc.h,v 1.00 2007/01/30 00:00:00 alanmi Exp

] PARAMETERS /// BASIC TYPES ///

Definition at line 42 of file bdc.h.

◆ Bdc_Man_t

typedef struct Bdc_Man_t_ Bdc_Man_t

Definition at line 43 of file bdc.h.

◆ Bdc_Par_t

typedef struct Bdc_Par_t_ Bdc_Par_t

Definition at line 44 of file bdc.h.

Function Documentation

◆ Bdc_FuncCopy()

void * Bdc_FuncCopy ( Bdc_Fun_t * p)
extern

Definition at line 52 of file bdcCore.c.

52{ return p->pCopy; }
Cube * p
Definition exorList.c:222

◆ Bdc_FuncCopyInt()

int Bdc_FuncCopyInt ( Bdc_Fun_t * p)
extern

Definition at line 53 of file bdcCore.c.

53{ return p->iCopy; }

◆ Bdc_FuncFanin0()

Bdc_Fun_t * Bdc_FuncFanin0 ( Bdc_Fun_t * p)
extern

Definition at line 50 of file bdcCore.c.

50{ return p->pFan0; }
Here is the caller graph for this function:

◆ Bdc_FuncFanin1()

Bdc_Fun_t * Bdc_FuncFanin1 ( Bdc_Fun_t * p)
extern

Definition at line 51 of file bdcCore.c.

51{ return p->pFan1; }
Here is the caller graph for this function:

◆ Bdc_FuncSetCopy()

void Bdc_FuncSetCopy ( Bdc_Fun_t * p,
void * pCopy )
extern

Definition at line 54 of file bdcCore.c.

54{ p->pCopy = pCopy; }
Here is the caller graph for this function:

◆ Bdc_FuncSetCopyInt()

void Bdc_FuncSetCopyInt ( Bdc_Fun_t * p,
int iCopy )
extern

Definition at line 55 of file bdcCore.c.

55{ p->iCopy = iCopy; }
Here is the caller graph for this function:

◆ Bdc_ManAlloc()

Bdc_Man_t * Bdc_ManAlloc ( Bdc_Par_t * pPars)
extern

MACRO DEFINITIONS ///.

FUNCTION DECLARATIONS ///

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

Synopsis [Allocate resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 68 of file bdcCore.c.

69{
70 Bdc_Man_t * p;
71 p = ABC_ALLOC( Bdc_Man_t, 1 );
72 memset( p, 0, sizeof(Bdc_Man_t) );
73 assert( pPars->nVarsMax > 1 && pPars->nVarsMax < 16 );
74 p->pPars = pPars;
75 p->nWords = Kit_TruthWordNum( pPars->nVarsMax );
76 p->nDivsLimit = 200;
77 // internal nodes
78 p->nNodesAlloc = 512;
79 p->pNodes = ABC_ALLOC( Bdc_Fun_t, p->nNodesAlloc );
80 // memory
81 p->vMemory = Vec_IntStart( 8 * p->nWords * p->nNodesAlloc );
82 Vec_IntClear(p->vMemory);
83 // set up hash table
84 p->nTableSize = (1 << p->pPars->nVarsMax);
85 p->pTable = ABC_ALLOC( Bdc_Fun_t *, p->nTableSize );
86 memset( p->pTable, 0, sizeof(Bdc_Fun_t *) * p->nTableSize );
87 p->vSpots = Vec_IntAlloc( 256 );
88 // truth tables
89 p->vTruths = Vec_PtrAllocTruthTables( p->pPars->nVarsMax );
90 p->puTemp1 = ABC_ALLOC( unsigned, 4 * p->nWords );
91 p->puTemp2 = p->puTemp1 + p->nWords;
92 p->puTemp3 = p->puTemp2 + p->nWords;
93 p->puTemp4 = p->puTemp3 + p->nWords;
94 // start the internal ISFs
95 p->pIsfOL = &p->IsfOL; Bdc_IsfStart( p, p->pIsfOL );
96 p->pIsfOR = &p->IsfOR; Bdc_IsfStart( p, p->pIsfOR );
97 p->pIsfAL = &p->IsfAL; Bdc_IsfStart( p, p->pIsfAL );
98 p->pIsfAR = &p->IsfAR; Bdc_IsfStart( p, p->pIsfAR );
99 return p;
100}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
typedefABC_NAMESPACE_HEADER_START struct Bdc_Fun_t_ Bdc_Fun_t
INCLUDES ///.
Definition bdc.h:42
struct Bdc_Man_t_ Bdc_Man_t
Definition bdc.h:43
int nVarsMax
Definition bdc.h:48
#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:

◆ Bdc_ManAndNum()

int Bdc_ManAndNum ( Bdc_Man_t * p)
extern

Definition at line 49 of file bdcCore.c.

49{ return p->nNodes-p->nVars-1;}
Here is the caller graph for this function:

◆ Bdc_ManBidecNodeNum()

int Bdc_ManBidecNodeNum ( word * pFunc,
word * pCare,
int nVars,
int fVerbose )
extern

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

Synopsis [Performs decomposition of one function.]

Description []

SideEffects []

SeeAlso []

Definition at line 378 of file bdcCore.c.

379{
380 int nNodes;
381 Bdc_Man_t * pManDec;
382 Bdc_Par_t Pars = {0}, * pPars = &Pars;
383 pPars->nVarsMax = nVars;
384 pManDec = Bdc_ManAlloc( pPars );
385 Bdc_ManDecompose( pManDec, (unsigned *)pFunc, (unsigned *)pCare, nVars, NULL, 1000 );
386 nNodes = Bdc_ManAndNum( pManDec );
387 if ( fVerbose )
388 Bdc_ManDecPrint( pManDec );
389 Bdc_ManFree( pManDec );
390 return nNodes;
391}
void Bdc_ManDecPrint(Bdc_Man_t *p)
Definition bdcCore.c:260
void Bdc_ManFree(Bdc_Man_t *p)
Definition bdcCore.c:113
int Bdc_ManAndNum(Bdc_Man_t *p)
Definition bdcCore.c:49
int Bdc_ManDecompose(Bdc_Man_t *p, unsigned *puFunc, unsigned *puCare, int nVars, Vec_Ptr_t *vDivs, int nNodesMax)
Definition bdcCore.c:291
Bdc_Man_t * Bdc_ManAlloc(Bdc_Par_t *pPars)
MACRO DEFINITIONS ///.
Definition bdcCore.c:68
struct Bdc_Par_t_ Bdc_Par_t
Definition bdc.h:44
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bdc_ManBidecResub()

Vec_Int_t * Bdc_ManBidecResub ( word * pFunc,
word * pCare,
int nVars )
extern

Definition at line 426 of file bdcCore.c.

427{
428 Vec_Int_t * vRes = NULL;
429 int nNodes;
430 Bdc_Man_t * pManDec;
431 Bdc_Par_t Pars = {0}, * pPars = &Pars;
432 pPars->nVarsMax = nVars;
433 pManDec = Bdc_ManAlloc( pPars );
434 Bdc_ManDecompose( pManDec, (unsigned *)pFunc, (unsigned *)pCare, nVars, NULL, 1000 );
435 if ( pManDec->pRoot != NULL )
436 {
437 //Bdc_ManDecPrint( pManDec );
438 nNodes = Bdc_ManAndNum( pManDec );
439 vRes = Vec_IntAlloc( 2*nNodes + 1 );
440 Bdc_ManBidecResubInt( pManDec, vRes );
441 assert( Vec_IntSize(vRes) == 2*nNodes + 1 );
442 }
443 Bdc_ManFree( pManDec );
444 return vRes;
445}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
void Bdc_ManBidecResubInt(Bdc_Man_t *p, Vec_Int_t *vRes)
Definition bdcCore.c:404
Bdc_Fun_t * pRoot
Definition bdcInt.h:94
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bdc_ManDecompose()

int Bdc_ManDecompose ( Bdc_Man_t * p,
unsigned * puFunc,
unsigned * puCare,
int nVars,
Vec_Ptr_t * vDivs,
int nNodesMax )
extern

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

Synopsis [Performs decomposition of one function.]

Description []

SideEffects []

SeeAlso []

Definition at line 291 of file bdcCore.c.

292{
293 Bdc_Isf_t Isf, * pIsf = &Isf;
294 abctime clk = Abc_Clock();
295 assert( nVars <= p->pPars->nVarsMax );
296 // set current manager parameters
297 p->nVars = nVars;
298 p->nWords = Kit_TruthWordNum( nVars );
299 p->nNodesMax = nNodesMax;
300 Bdc_ManPrepare( p, vDivs );
301 if ( puCare && Kit_TruthIsConst0( puCare, nVars ) )
302 {
303 p->pRoot = Bdc_Not(p->pNodes);
304 return 0;
305 }
306 // copy the function
307 Bdc_IsfStart( p, pIsf );
308 if ( puCare )
309 {
310 Kit_TruthAnd( pIsf->puOn, puCare, puFunc, p->nVars );
311 Kit_TruthSharp( pIsf->puOff, puCare, puFunc, p->nVars );
312 }
313 else
314 {
315 Kit_TruthCopy( pIsf->puOn, puFunc, p->nVars );
316 Kit_TruthNot( pIsf->puOff, puFunc, p->nVars );
317 }
318 Bdc_SuppMinimize( p, pIsf );
319 // call decomposition
320 p->pRoot = Bdc_ManDecompose_rec( p, pIsf );
321 p->timeTotal += Abc_Clock() - clk;
322 p->numCalls++;
323 p->numNodes += p->nNodesNew;
324 if ( p->pRoot == NULL )
325 return -1;
326 if ( !Bdc_ManNodeVerify( p, pIsf, p->pRoot ) )
327 printf( "Bdc_ManDecompose(): Internal verification failed.\n" );
328// assert( Bdc_ManNodeVerify( p, pIsf, p->pRoot ) );
329 return p->nNodesNew;
330}
ABC_INT64_T abctime
Definition abc_global.h:332
void Bdc_ManPrepare(Bdc_Man_t *p, Vec_Ptr_t *vDivs)
Definition bdcCore.c:147
int Bdc_ManNodeVerify(Bdc_Man_t *p, Bdc_Isf_t *pIsf, Bdc_Fun_t *pFunc)
Definition bdcDec.c:600
Bdc_Fun_t * Bdc_ManDecompose_rec(Bdc_Man_t *p, Bdc_Isf_t *pIsf)
MACRO DEFINITIONS ///.
Definition bdcDec.c:675
void Bdc_SuppMinimize(Bdc_Man_t *p, Bdc_Isf_t *pIsf)
Definition bdcDec.c:87
struct Bdc_Isf_t_ Bdc_Isf_t
Definition bdcInt.h:72
unsigned * puOn
Definition bdcInt.h:77
unsigned * puOff
Definition bdcInt.h:78
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bdc_ManDecPrint()

void Bdc_ManDecPrint ( Bdc_Man_t * p)
extern

Definition at line 260 of file bdcCore.c.

261{
262 Bdc_Fun_t * pRoot = Bdc_Regular(p->pRoot);
263
264 printf( "F = " );
265 if ( pRoot->Type == BDC_TYPE_CONST1 ) // constant 0
266 printf( "Constant %d", !Bdc_IsComplement(p->pRoot) );
267 else if ( pRoot->Type == BDC_TYPE_PI ) // literal
268 printf( "%s%d", Bdc_IsComplement(p->pRoot) ? "!" : "", Bdc_FunId(p,pRoot)-1 );
269 else
270 {
271 if ( Bdc_IsComplement(p->pRoot) )
272 printf( "!(" );
273 Bdc_ManDecPrint_rec( p, pRoot );
274 if ( Bdc_IsComplement(p->pRoot) )
275 printf( ")" );
276 }
277 printf( "\n" );
278}
void Bdc_ManDecPrint_rec(Bdc_Man_t *p, Bdc_Fun_t *pNode)
Definition bdcCore.c:233
@ BDC_TYPE_CONST1
Definition bdcInt.h:50
@ BDC_TYPE_PI
Definition bdcInt.h:51
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bdc_ManFree()

void Bdc_ManFree ( Bdc_Man_t * p)
extern

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

Synopsis [Deallocate resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 113 of file bdcCore.c.

114{
115 if ( p->pPars->fVerbose )
116 {
117 printf( "Bi-decomposition stats: Calls = %d. Nodes = %d. Reuse = %d.\n",
118 p->numCalls, p->numNodes, p->numReuse );
119 printf( "ANDs = %d. ORs = %d. Weak = %d. Muxes = %d. Memory = %.2f K\n",
120 p->numAnds, p->numOrs, p->numWeaks, p->numMuxes, 4.0 * Vec_IntSize(p->vMemory) / (1<<10) );
121 ABC_PRT( "Cache", p->timeCache );
122 ABC_PRT( "Check", p->timeCheck );
123 ABC_PRT( "Muxes", p->timeMuxes );
124 ABC_PRT( "Supps", p->timeSupps );
125 ABC_PRT( "TOTAL", p->timeTotal );
126 }
127 Vec_IntFree( p->vMemory );
128 Vec_IntFree( p->vSpots );
129 Vec_PtrFree( p->vTruths );
130 ABC_FREE( p->puTemp1 );
131 ABC_FREE( p->pNodes );
132 ABC_FREE( p->pTable );
133 ABC_FREE( p );
134}
#define ABC_PRT(a, t)
Definition abc_global.h:255
#define ABC_FREE(obj)
Definition abc_global.h:267
Here is the caller graph for this function:

◆ Bdc_ManFunc()

Bdc_Fun_t * Bdc_ManFunc ( Bdc_Man_t * p,
int i )
extern

DECLARATIONS ///.

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

FileName [bdcCore.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Truth-table-based bi-decomposition engine.]

Synopsis [The gateway to bi-decomposition.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - January 30, 2007.]

Revision [

Id
bdcCore.c,v 1.00 2007/01/30 00:00:00 alanmi Exp

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

Synopsis [Accessing contents of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file bdcCore.c.

46{ return Bdc_FunWithId(p, i); }
Here is the caller graph for this function:

◆ Bdc_ManNodeNum()

int Bdc_ManNodeNum ( Bdc_Man_t * p)
extern

Definition at line 48 of file bdcCore.c.

48{ return p->nNodes; }
Here is the caller graph for this function:

◆ Bdc_ManRoot()

Bdc_Fun_t * Bdc_ManRoot ( Bdc_Man_t * p)
extern

Definition at line 47 of file bdcCore.c.

47{ return p->pRoot; }
Here is the caller graph for this function: