00001
00021 #ifndef __BDC_INT_H__
00022 #define __BDC_INT_H__
00023
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027
00031
00032 #include "kit.h"
00033 #include "bdc.h"
00034
00038
00039 #define BDC_SCALE 100 // value used to compute the cost
00040
00044
00045
00046 typedef enum {
00047 BDC_TYPE_NONE = 0,
00048 BDC_TYPE_CONST1,
00049 BDC_TYPE_PI,
00050 BDC_TYPE_AND,
00051 BDC_TYPE_OR,
00052 BDC_TYPE_XOR,
00053 BDC_TYPE_MUX,
00054 BDC_TYPE_OTHER
00055 } Bdc_Type_t;
00056
00057 typedef struct Bdc_Fun_t_ Bdc_Fun_t;
00058 struct Bdc_Fun_t_
00059 {
00060 int Type;
00061 Bdc_Fun_t * pFan0;
00062 Bdc_Fun_t * pFan1;
00063 Bdc_Fun_t * pFan2;
00064 unsigned uSupp;
00065 unsigned * puFunc;
00066 Bdc_Fun_t * pNext;
00067 void * pCopy;
00068 };
00069
00070 typedef struct Bdc_Isf_t_ Bdc_Isf_t;
00071 struct Bdc_Isf_t_
00072 {
00073 int Var;
00074 unsigned uSupp;
00075 unsigned * puOn;
00076 unsigned * puOff;
00077 };
00078
00079 struct Bdc_Man_t_
00080 {
00081
00082 Bdc_Par_t * pPars;
00083 int nVars;
00084 int nWords;
00085 int nNodesLimit;
00086 int nDivsLimit;
00087
00088 Bdc_Fun_t * pNodes;
00089 int nNodes;
00090 int nNodesNew;
00091 int nNodesAlloc;
00092 Bdc_Fun_t * pRoot;
00093
00094 Bdc_Fun_t ** pTable;
00095 int nTableSize;
00096 Vec_Int_t * vSpots;
00097
00098 Vec_Ptr_t * vTruths;
00099 unsigned * puTemp1;
00100 unsigned * puTemp2;
00101 unsigned * puTemp3;
00102 unsigned * puTemp4;
00103
00104 Bdc_Isf_t * pIsfOL, IsfOL;
00105 Bdc_Isf_t * pIsfOR, IsfOR;
00106 Bdc_Isf_t * pIsfAL, IsfAL;
00107 Bdc_Isf_t * pIsfAR, IsfAR;
00108
00109 Vec_Int_t * vMemory;
00110 };
00111
00112
00113 static inline int Bdc_IsComplement( Bdc_Fun_t * p ) { return (int)((unsigned long)p & (unsigned long)01); }
00114 static inline Bdc_Fun_t * Bdc_Regular( Bdc_Fun_t * p ) { return (Bdc_Fun_t *)((unsigned long)p & ~(unsigned long)01); }
00115 static inline Bdc_Fun_t * Bdc_Not( Bdc_Fun_t * p ) { return (Bdc_Fun_t *)((unsigned long)p ^ (unsigned long)01); }
00116 static inline Bdc_Fun_t * Bdc_NotCond( Bdc_Fun_t * p, int c ) { return (Bdc_Fun_t *)((unsigned long)p ^ (unsigned long)(c!=0)); }
00117
00118 static inline Bdc_Fun_t * Bdc_FunNew( Bdc_Man_t * p ) { Bdc_Fun_t * pRes; if ( p->nNodes == p->nNodesLimit ) return NULL; pRes = p->pNodes + p->nNodes++; memset( pRes, 0, sizeof(Bdc_Fun_t) ); p->nNodesNew++; return pRes; }
00119 static inline void Bdc_IsfStart( Bdc_Man_t * p, Bdc_Isf_t * pF ) { pF->puOn = Vec_IntFetch( p->vMemory, p->nWords ); pF->puOff = Vec_IntFetch( p->vMemory, p->nWords ); }
00120 static inline void Bdc_IsfClean( Bdc_Isf_t * p ) { p->uSupp = 0; p->Var = 0; }
00121 static inline void Bdc_IsfCopy( Bdc_Isf_t * p, Bdc_Isf_t * q ) { Bdc_Isf_t T = *p; *p = *q; *q = T; }
00122 static inline void Bdc_IsfNot( Bdc_Isf_t * p ) { unsigned * puT = p->puOn; p->puOn = p->puOff; p->puOff = puT; }
00123
00127
00131
00132
00133 extern Bdc_Fun_t * Bdc_ManDecompose_rec( Bdc_Man_t * p, Bdc_Isf_t * pIsf );
00134
00135 extern Bdc_Fun_t * Bdc_TableLookup( Bdc_Man_t * p, Bdc_Isf_t * pIsf );
00136 extern void Bdc_TableAdd( Bdc_Man_t * p, Bdc_Fun_t * pFunc );
00137 extern void Bdc_TableClear( Bdc_Man_t * p );
00138 extern void Bdc_SuppMinimize( Bdc_Man_t * p, Bdc_Isf_t * pIsf );
00139 extern int Bdc_TableCheckContainment( Bdc_Man_t * p, Bdc_Isf_t * pIsf, unsigned * puTruth );
00140
00141 #ifdef __cplusplus
00142 }
00143 #endif
00144
00145 #endif
00146
00150