ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
bdcInt.h
Go to the documentation of this file.
1
20
21#ifndef ABC__aig__bdc__bdcInt_h
22#define ABC__aig__bdc__bdcInt_h
23
24
28
29#include "bool/kit/kit.h"
30#include "bdc.h"
31
35
36
37
39
40
41#define BDC_SCALE 1000 // value used to compute the cost
42
46
47// network types
48typedef enum {
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
58
60{
61 int Type; // Const1, PI, AND, XOR, MUX
62 Bdc_Fun_t * pFan0; // fanin of the given node
63 Bdc_Fun_t * pFan1; // fanin of the given node
64 unsigned uSupp; // bit mask of current support
65 unsigned * puFunc; // the function of the node
66 Bdc_Fun_t * pNext; // next function with same support
67 union { int iCopy; // the literal of the node (AIG)
68 void * pCopy; }; // the function of the node (BDD or AIG)
69
70};
71
72typedef struct Bdc_Isf_t_ Bdc_Isf_t;
74{
75 unsigned uSupp; // the complete support of this component
76 unsigned uUniq; // the unique variables of this component
77 unsigned * puOn; // on-set
78 unsigned * puOff; // off-set
79};
80
82{
83 // external parameters
84 Bdc_Par_t * pPars; // parameter set
85 int nVars; // the number of variables
86 int nWords; // the number of words
87 int nNodesMax; // the limit on the number of new nodes
88 int nDivsLimit; // the limit on the number of divisors
89 // internal nodes
90 Bdc_Fun_t * pNodes; // storage for decomposition nodes
91 int nNodesAlloc; // the number of nodes allocated
92 int nNodes; // the number of all nodes created so far
93 int nNodesNew; // the number of new AND nodes created so far
94 Bdc_Fun_t * pRoot; // the root node
95 // resub candidates
96 Bdc_Fun_t ** pTable; // hash table of candidates
97 int nTableSize; // hash table size (1 << nVarsMax)
98 Vec_Int_t * vSpots; // the occupied spots in the table
99 // elementary truth tables
100 Vec_Ptr_t * vTruths; // for const 1 and elementary variables
101 unsigned * puTemp1; // temporary truth table
102 unsigned * puTemp2; // temporary truth table
103 unsigned * puTemp3; // temporary truth table
104 unsigned * puTemp4; // temporary truth table
105 // temporary ISFs
110 // internal memory manager
111 Vec_Int_t * vMemory; // memory for internal truth tables
112 // statistics
120 // runtime
126};
127
128static inline Bdc_Fun_t * Bdc_FunNew( Bdc_Man_t * p ) { Bdc_Fun_t * pRes; if ( p->nNodes >= p->nNodesAlloc || p->nNodesNew >= p->nNodesMax ) return NULL; pRes = p->pNodes + p->nNodes++; p->nNodesNew++; memset( pRes, 0, sizeof(Bdc_Fun_t) ); return pRes; }
129static inline Bdc_Fun_t * Bdc_FunWithId( Bdc_Man_t * p, int Id ) { assert( Id < p->nNodes ); return p->pNodes + Id; }
130static inline int Bdc_FunId( Bdc_Man_t * p, Bdc_Fun_t * pFun ) { return pFun - p->pNodes; }
131static inline void Bdc_IsfStart( Bdc_Man_t * p, Bdc_Isf_t * pF ) { pF->uSupp = 0; pF->uUniq = 0; pF->puOn = Vec_IntFetch( p->vMemory, p->nWords ); pF->puOff = Vec_IntFetch( p->vMemory, p->nWords ); assert( pF->puOff && pF->puOn ); }
132static inline void Bdc_IsfClean( Bdc_Isf_t * p ) { p->uSupp = 0; p->uUniq = 0; }
133static inline void Bdc_IsfCopy( Bdc_Isf_t * p, Bdc_Isf_t * q ) { Bdc_Isf_t T = *p; *p = *q; *q = T; }
134static inline void Bdc_IsfNot( Bdc_Isf_t * p ) { unsigned * puT = p->puOn; p->puOn = p->puOff; p->puOff = puT; }
135
139
143
144/*=== bdcDec.c ==========================================================*/
146extern void Bdc_SuppMinimize( Bdc_Man_t * p, Bdc_Isf_t * pIsf );
147extern int Bdc_ManNodeVerify( Bdc_Man_t * p, Bdc_Isf_t * pIsf, Bdc_Fun_t * pFunc );
148/*=== bdcTable.c ==========================================================*/
149extern Bdc_Fun_t * Bdc_TableLookup( Bdc_Man_t * p, Bdc_Isf_t * pIsf );
150extern void Bdc_TableAdd( Bdc_Man_t * p, Bdc_Fun_t * pFunc );
151extern void Bdc_TableClear( Bdc_Man_t * p );
152extern int Bdc_TableCheckContainment( Bdc_Man_t * p, Bdc_Isf_t * pIsf, unsigned * puTruth );
153
154
155
157
158
159
160#endif
161
165
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_NAMESPACE_HEADER_END
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
int Bdc_ManNodeVerify(Bdc_Man_t *p, Bdc_Isf_t *pIsf, Bdc_Fun_t *pFunc)
Definition bdcDec.c:600
void Bdc_TableAdd(Bdc_Man_t *p, Bdc_Fun_t *pFunc)
Definition bdcTable.c:101
Bdc_Fun_t * Bdc_ManDecompose_rec(Bdc_Man_t *p, Bdc_Isf_t *pIsf)
MACRO DEFINITIONS ///.
Definition bdcDec.c:675
void Bdc_TableClear(Bdc_Man_t *p)
Definition bdcTable.c:120
int Bdc_TableCheckContainment(Bdc_Man_t *p, Bdc_Isf_t *pIsf, unsigned *puTruth)
DECLARATIONS ///.
Definition bdcTable.c:45
struct Bdc_Isf_t_ Bdc_Isf_t
Definition bdcInt.h:72
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
Bdc_Fun_t * Bdc_TableLookup(Bdc_Man_t *p, Bdc_Isf_t *pIsf)
Definition bdcTable.c:62
void Bdc_SuppMinimize(Bdc_Man_t *p, Bdc_Isf_t *pIsf)
Definition bdcDec.c:87
typedefABC_NAMESPACE_HEADER_START struct Bdc_Fun_t_ Bdc_Fun_t
INCLUDES ///.
Definition bdc.h:42
struct Bdc_Par_t_ Bdc_Par_t
Definition bdc.h:44
struct Bdc_Man_t_ Bdc_Man_t
Definition bdc.h:43
Cube * p
Definition exorList.c:222
int iCopy
Definition bdcInt.h:67
Bdc_Fun_t * pFan1
Definition bdcInt.h:63
void * pCopy
Definition bdcInt.h:68
int Type
Definition bdcInt.h:61
Bdc_Fun_t * pNext
Definition bdcInt.h:66
Bdc_Fun_t * pFan0
Definition bdcInt.h:62
unsigned uSupp
Definition bdcInt.h:64
unsigned * puFunc
Definition bdcInt.h:65
unsigned * puOn
Definition bdcInt.h:77
unsigned uUniq
Definition bdcInt.h:76
unsigned uSupp
Definition bdcInt.h:75
unsigned * puOff
Definition bdcInt.h:78
Bdc_Fun_t * pNodes
Definition bdcInt.h:90
int nNodesNew
Definition bdcInt.h:93
int nVars
Definition bdcInt.h:85
Bdc_Fun_t * pRoot
Definition bdcInt.h:94
abctime timeSupps
Definition bdcInt.h:124
int numReuse
Definition bdcInt.h:119
Bdc_Isf_t * pIsfOR
Definition bdcInt.h:107
Bdc_Isf_t IsfOL
Definition bdcInt.h:106
int nDivsLimit
Definition bdcInt.h:88
Bdc_Isf_t IsfOR
Definition bdcInt.h:107
int numCalls
Definition bdcInt.h:113
int numOrs
Definition bdcInt.h:117
Bdc_Isf_t IsfAL
Definition bdcInt.h:108
int nNodes
Definition bdcInt.h:92
unsigned * puTemp4
Definition bdcInt.h:104
int nNodesMax
Definition bdcInt.h:87
int nNodesAlloc
Definition bdcInt.h:91
int numMuxes
Definition bdcInt.h:115
int numAnds
Definition bdcInt.h:116
int numNodes
Definition bdcInt.h:114
int nTableSize
Definition bdcInt.h:97
int numWeaks
Definition bdcInt.h:118
Bdc_Fun_t ** pTable
Definition bdcInt.h:96
int nWords
Definition bdcInt.h:86
Vec_Int_t * vMemory
Definition bdcInt.h:111
Bdc_Isf_t * pIsfAL
Definition bdcInt.h:108
Bdc_Isf_t * pIsfOL
Definition bdcInt.h:106
Bdc_Isf_t IsfAR
Definition bdcInt.h:109
abctime timeCache
Definition bdcInt.h:121
abctime timeTotal
Definition bdcInt.h:125
abctime timeCheck
Definition bdcInt.h:122
abctime timeMuxes
Definition bdcInt.h:123
Vec_Ptr_t * vTruths
Definition bdcInt.h:100
unsigned * puTemp1
Definition bdcInt.h:101
unsigned * puTemp2
Definition bdcInt.h:102
Bdc_Par_t * pPars
Definition bdcInt.h:84
Bdc_Isf_t * pIsfAR
Definition bdcInt.h:109
Vec_Int_t * vSpots
Definition bdcInt.h:98
unsigned * puTemp3
Definition bdcInt.h:103
#define assert(ex)
Definition util_old.h:213
char * memset()
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42