ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
bdcInt.h File Reference
#include "bool/kit/kit.h"
#include "bdc.h"
Include dependency graph for bdcInt.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Bdc_Fun_t_
 
struct  Bdc_Isf_t_
 
struct  Bdc_Man_t_
 

Macros

#define BDC_SCALE   1000
 INCLUDES ///.
 

Typedefs

typedef struct Bdc_Isf_t_ Bdc_Isf_t
 

Enumerations

enum  Bdc_Type_t {
  BDC_TYPE_NONE = 0 , BDC_TYPE_CONST1 , BDC_TYPE_PI , BDC_TYPE_AND ,
  BDC_TYPE_OR , BDC_TYPE_XOR , BDC_TYPE_MUX , BDC_TYPE_OTHER
}
 BASIC TYPES ///. More...
 

Functions

Bdc_Fun_tBdc_ManDecompose_rec (Bdc_Man_t *p, Bdc_Isf_t *pIsf)
 MACRO DEFINITIONS ///.
 
void Bdc_SuppMinimize (Bdc_Man_t *p, Bdc_Isf_t *pIsf)
 
int Bdc_ManNodeVerify (Bdc_Man_t *p, Bdc_Isf_t *pIsf, Bdc_Fun_t *pFunc)
 
Bdc_Fun_tBdc_TableLookup (Bdc_Man_t *p, Bdc_Isf_t *pIsf)
 
void Bdc_TableAdd (Bdc_Man_t *p, Bdc_Fun_t *pFunc)
 
void Bdc_TableClear (Bdc_Man_t *p)
 
int Bdc_TableCheckContainment (Bdc_Man_t *p, Bdc_Isf_t *pIsf, unsigned *puTruth)
 DECLARATIONS ///.
 

Macro Definition Documentation

◆ BDC_SCALE

#define BDC_SCALE   1000

INCLUDES ///.

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

FileName [bdcInt.h]

SystemName [ABC: Logic synthesis and verification system.]

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

Synopsis [Internal declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

Id
resInt.h,v 1.00 2007/01/15 00:00:00 alanmi Exp

] PARAMETERS ///

Definition at line 41 of file bdcInt.h.

Typedef Documentation

◆ Bdc_Isf_t

typedef struct Bdc_Isf_t_ Bdc_Isf_t

Definition at line 72 of file bdcInt.h.

Enumeration Type Documentation

◆ Bdc_Type_t

enum Bdc_Type_t

BASIC TYPES ///.

Enumerator
BDC_TYPE_NONE 
BDC_TYPE_CONST1 
BDC_TYPE_PI 
BDC_TYPE_AND 
BDC_TYPE_OR 
BDC_TYPE_XOR 
BDC_TYPE_MUX 
BDC_TYPE_OTHER 

Definition at line 48 of file bdcInt.h.

48 {
49 BDC_TYPE_NONE = 0, // 0: unknown
50 BDC_TYPE_CONST1, // 1: constant 1
51 BDC_TYPE_PI, // 2: primary input
52 BDC_TYPE_AND, // 3: AND-gate
53 BDC_TYPE_OR, // 4: OR-gate (temporary)
54 BDC_TYPE_XOR, // 5: XOR-gate
55 BDC_TYPE_MUX, // 6: MUX-gate
56 BDC_TYPE_OTHER // 7: unused
Bdc_Type_t
BASIC TYPES ///.
Definition bdcInt.h:48
@ BDC_TYPE_OR
Definition bdcInt.h:53
@ BDC_TYPE_OTHER
Definition bdcInt.h:56
@ BDC_TYPE_CONST1
Definition bdcInt.h:50
@ BDC_TYPE_NONE
Definition bdcInt.h:49
@ BDC_TYPE_AND
Definition bdcInt.h:52
@ BDC_TYPE_XOR
Definition bdcInt.h:54
@ BDC_TYPE_PI
Definition bdcInt.h:51
@ BDC_TYPE_MUX
Definition bdcInt.h:55

Function Documentation

◆ Bdc_ManDecompose_rec()

Bdc_Fun_t * Bdc_ManDecompose_rec ( Bdc_Man_t * p,
Bdc_Isf_t * pIsf )
extern

MACRO DEFINITIONS ///.

FUNCTION DECLARATIONS ///

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

Synopsis [Performs one step of bi-decomposition.]

Description []

SideEffects []

SeeAlso []

Definition at line 675 of file bdcDec.c.

676{
677// int static Counter = 0;
678// int LocalCounter = Counter++;
679 Bdc_Type_t Type;
680 Bdc_Fun_t * pFunc, * pFunc0, * pFunc1;
681 Bdc_Isf_t IsfL, * pIsfL = &IsfL;
682 Bdc_Isf_t IsfB, * pIsfR = &IsfB;
683 int iVar;
684 abctime clk = 0; // Suppress "might be used uninitialized"
685/*
686printf( "Init function (%d):\n", LocalCounter );
687Extra_PrintBinary( stdout, pIsf->puOn, 1<<4 );printf("\n");
688Extra_PrintBinary( stdout, pIsf->puOff, 1<<4 );printf("\n");
689*/
690 // check computed results
691 assert( Kit_TruthIsDisjoint(pIsf->puOn, pIsf->puOff, p->nVars) );
692 if ( p->pPars->fVerbose )
693 clk = Abc_Clock();
694 pFunc = Bdc_TableLookup( p, pIsf );
695 if ( p->pPars->fVerbose )
696 p->timeCache += Abc_Clock() - clk;
697 if ( pFunc )
698 return pFunc;
699 // decide on the decomposition type
700 if ( p->pPars->fVerbose )
701 clk = Abc_Clock();
702 Type = Bdc_DecomposeStep( p, pIsf, pIsfL, pIsfR );
703 if ( p->pPars->fVerbose )
704 p->timeCheck += Abc_Clock() - clk;
705 if ( Type == BDC_TYPE_MUX )
706 {
707 if ( p->pPars->fVerbose )
708 clk = Abc_Clock();
709 iVar = Bdc_DecomposeStepMux( p, pIsf, pIsfL, pIsfR );
710 if ( p->pPars->fVerbose )
711 p->timeMuxes += Abc_Clock() - clk;
712 p->numMuxes++;
713 pFunc0 = Bdc_ManDecompose_rec( p, pIsfL );
714 pFunc1 = Bdc_ManDecompose_rec( p, pIsfR );
715 if ( pFunc0 == NULL || pFunc1 == NULL )
716 return NULL;
717 pFunc = Bdc_FunWithId( p, iVar + 1 );
718 pFunc0 = Bdc_ManCreateGate( p, Bdc_Not(pFunc), pFunc0, BDC_TYPE_AND );
719 pFunc1 = Bdc_ManCreateGate( p, pFunc, pFunc1, BDC_TYPE_AND );
720 if ( pFunc0 == NULL || pFunc1 == NULL )
721 return NULL;
722 pFunc = Bdc_ManCreateGate( p, pFunc0, pFunc1, BDC_TYPE_OR );
723 }
724 else
725 {
726 pFunc0 = Bdc_ManDecompose_rec( p, pIsfL );
727 if ( pFunc0 == NULL )
728 return NULL;
729 // decompose the right branch
730 if ( Bdc_DecomposeUpdateRight( p, pIsf, pIsfL, pIsfR, pFunc0, Type ) )
731 {
732 p->nNodesNew--;
733 return pFunc0;
734 }
735 Bdc_SuppMinimize( p, pIsfR );
736 pFunc1 = Bdc_ManDecompose_rec( p, pIsfR );
737 if ( pFunc1 == NULL )
738 return NULL;
739 // create new gate
740 pFunc = Bdc_ManCreateGate( p, pFunc0, pFunc1, Type );
741 }
742 return pFunc;
743}
ABC_INT64_T abctime
Definition abc_global.h:332
int Bdc_DecomposeUpdateRight(Bdc_Man_t *p, Bdc_Isf_t *pIsf, Bdc_Isf_t *pIsfL, Bdc_Isf_t *pIsfR, Bdc_Fun_t *pFunc0, Bdc_Type_t Type)
Definition bdcDec.c:123
Bdc_Fun_t * Bdc_ManDecompose_rec(Bdc_Man_t *p, Bdc_Isf_t *pIsf)
MACRO DEFINITIONS ///.
Definition bdcDec.c:675
int Bdc_DecomposeStepMux(Bdc_Man_t *p, Bdc_Isf_t *pIsf, Bdc_Isf_t *pIsfL, Bdc_Isf_t *pIsfR)
Definition bdcDec.c:548
Bdc_Fun_t * Bdc_ManCreateGate(Bdc_Man_t *p, Bdc_Fun_t *pFunc0, Bdc_Fun_t *pFunc1, Bdc_Type_t Type)
Definition bdcDec.c:621
void Bdc_SuppMinimize(Bdc_Man_t *p, Bdc_Isf_t *pIsf)
Definition bdcDec.c:87
Bdc_Type_t Bdc_DecomposeStep(Bdc_Man_t *p, Bdc_Isf_t *pIsf, Bdc_Isf_t *pIsfL, Bdc_Isf_t *pIsfR)
Definition bdcDec.c:444
struct Bdc_Isf_t_ Bdc_Isf_t
Definition bdcInt.h:72
Bdc_Fun_t * Bdc_TableLookup(Bdc_Man_t *p, Bdc_Isf_t *pIsf)
Definition bdcTable.c:62
typedefABC_NAMESPACE_HEADER_START struct Bdc_Fun_t_ Bdc_Fun_t
INCLUDES ///.
Definition bdc.h:42
Cube * p
Definition exorList.c:222
unsigned * puOn
Definition bdcInt.h:77
unsigned * puOff
Definition bdcInt.h:78
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bdc_ManNodeVerify()

int Bdc_ManNodeVerify ( Bdc_Man_t * p,
Bdc_Isf_t * pIsf,
Bdc_Fun_t * pFunc )
extern

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

Synopsis [Creates gates.]

Description []

SideEffects []

SeeAlso []

Definition at line 600 of file bdcDec.c.

601{
602 unsigned * puTruth = p->puTemp1;
603 if ( Bdc_IsComplement(pFunc) )
604 Kit_TruthNot( puTruth, Bdc_Regular(pFunc)->puFunc, p->nVars );
605 else
606 Kit_TruthCopy( puTruth, pFunc->puFunc, p->nVars );
607 return Bdc_TableCheckContainment( p, pIsf, puTruth );
608}
int Bdc_TableCheckContainment(Bdc_Man_t *p, Bdc_Isf_t *pIsf, unsigned *puTruth)
DECLARATIONS ///.
Definition bdcTable.c:45
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bdc_SuppMinimize()

void Bdc_SuppMinimize ( Bdc_Man_t * p,
Bdc_Isf_t * pIsf )
extern

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

Synopsis [Minimizes the support of the ISF.]

Description []

SideEffects []

SeeAlso []

Definition at line 87 of file bdcDec.c.

88{
89 int v;
90 abctime clk = 0; // Suppress "might be used uninitialized"
91 if ( p->pPars->fVerbose )
92 clk = Abc_Clock();
93 // go through the support variables
94 pIsf->uSupp = 0;
95 for ( v = 0; v < p->nVars; v++ )
96 {
97 if ( !Kit_TruthVarInSupport( pIsf->puOn, p->nVars, v ) &&
98 !Kit_TruthVarInSupport( pIsf->puOff, p->nVars, v ) )
99 continue;
100 if ( Kit_TruthVarIsVacuous( pIsf->puOn, pIsf->puOff, p->nVars, v ) )
101 {
102 Kit_TruthExist( pIsf->puOn, p->nVars, v );
103 Kit_TruthExist( pIsf->puOff, p->nVars, v );
104 continue;
105 }
106 pIsf->uSupp |= (1 << v);
107 }
108 if ( p->pPars->fVerbose )
109 p->timeSupps += Abc_Clock() - clk;
110}
int Kit_TruthVarIsVacuous(unsigned *pOnset, unsigned *pOffset, int nVars, int iVar)
Definition kitTruth.c:625
int Kit_TruthVarInSupport(unsigned *pTruth, int nVars, int iVar)
Definition kitTruth.c:270
void Kit_TruthExist(unsigned *pTruth, int nVars, int iVar)
Definition kitTruth.c:684
unsigned uSupp
Definition bdcInt.h:75
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bdc_TableAdd()

void Bdc_TableAdd ( Bdc_Man_t * p,
Bdc_Fun_t * pFunc )
extern

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

Synopsis [Adds the new entry to the hash table.]

Description []

SideEffects []

SeeAlso []

Definition at line 101 of file bdcTable.c.

102{
103 if ( p->pTable[pFunc->uSupp] == NULL )
104 Vec_IntPush( p->vSpots, pFunc->uSupp );
105 pFunc->pNext = p->pTable[pFunc->uSupp];
106 p->pTable[pFunc->uSupp] = pFunc;
107}
Here is the caller graph for this function:

◆ Bdc_TableCheckContainment()

int Bdc_TableCheckContainment ( Bdc_Man_t * p,
Bdc_Isf_t * pIsf,
unsigned * puTruth )
extern

DECLARATIONS ///.

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

FileName [bdcTable.c]

SystemName [ABC: Logic synthesis and verification system.]

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

Synopsis [Hash table for intermediate nodes.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Checks containment of the function in the ISF.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file bdcTable.c.

46{
47 return Kit_TruthIsImply( pIsf->puOn, puTruth, p->nVars ) &&
48 Kit_TruthIsDisjoint( puTruth, pIsf->puOff, p->nVars );
49}
Here is the caller graph for this function:

◆ Bdc_TableClear()

void Bdc_TableClear ( Bdc_Man_t * p)
extern

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

Synopsis [Adds the new entry to the hash table.]

Description []

SideEffects []

SeeAlso []

Definition at line 120 of file bdcTable.c.

121{
122 int Spot, i;
123 Vec_IntForEachEntry( p->vSpots, Spot, i )
124 p->pTable[Spot] = NULL;
125 Vec_IntClear( p->vSpots );
126}
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
Here is the caller graph for this function:

◆ Bdc_TableLookup()

Bdc_Fun_t * Bdc_TableLookup ( Bdc_Man_t * p,
Bdc_Isf_t * pIsf )
extern

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

Synopsis [Adds the new entry to the hash table.]

Description []

SideEffects []

SeeAlso []

Definition at line 62 of file bdcTable.c.

63{
64 int fDisableCache = 0;
65 Bdc_Fun_t * pFunc;
66 if ( fDisableCache && Kit_WordCountOnes(pIsf->uSupp) > 1 )
67 return NULL;
68 if ( pIsf->uSupp == 0 )
69 {
70 assert( p->pTable[pIsf->uSupp] == p->pNodes );
71 if ( Kit_TruthIsConst1( pIsf->puOn, p->nVars ) )
72 return p->pNodes;
73 assert( Kit_TruthIsConst1( pIsf->puOff, p->nVars ) );
74 return Bdc_Not(p->pNodes);
75 }
76 for ( pFunc = p->pTable[pIsf->uSupp]; pFunc; pFunc = pFunc->pNext )
77 if ( Bdc_TableCheckContainment( p, pIsf, pFunc->puFunc ) )
78 return pFunc;
79 Bdc_IsfNot( pIsf );
80 for ( pFunc = p->pTable[pIsf->uSupp]; pFunc; pFunc = pFunc->pNext )
81 if ( Bdc_TableCheckContainment( p, pIsf, pFunc->puFunc ) )
82 {
83 Bdc_IsfNot( pIsf );
84 return Bdc_Not(pFunc);
85 }
86 Bdc_IsfNot( pIsf );
87 return NULL;
88}
ABC_NAMESPACE_IMPL_START int Bdc_TableCheckContainment(Bdc_Man_t *p, Bdc_Isf_t *pIsf, unsigned *puTruth)
DECLARATIONS ///.
Definition bdcTable.c:45
Here is the call graph for this function:
Here is the caller graph for this function: