00001 #ifndef _DSD 00002 #define _DSD 00003 00004 #ifdef DISABLE_SBDD 00005 #define DISABLE_GC 00006 #define DISABLE_SM 00007 #endif 00008 00009 #include "util.h" 00010 #include "cudd.h" 00011 #include "cuddInt.h" 00012 #include "fixheap.h" 00013 #include <assert.h> 00014 #include <stdio.h> 00015 00016 00020 #define VAR 0 00021 #define PRIME 1 00022 #define OR 2 00023 #define XOR 3 00024 00028 #define MAX_NOT_ALLOWED ~0 00029 #define TYPE_MASK 127<<25 00030 #define SIZE_MASK 255<<24 00031 #define MARK_MASK 1<<24 00032 #define SATURATION 16384 00033 #define CAN_MASK ((1<<16) - 1)<<16 00034 00035 00036 00037 typedef struct DSDNode DSDNode; 00038 typedef unsigned int int_32; 00039 typedef unsigned short int_16; 00040 typedef struct ActualNode ActualNode; 00041 typedef struct DSDManager DSDManager; 00042 typedef struct SupportList SupportList; 00043 00044 00045 00046 extern FixHeapPtr dsd_malloc_ptr; 00047 extern FixHeapPtr actual_malloc_ptr; 00048 00053 struct ActualNode{ 00057 DSDNode * decomposition; 00062 ActualNode * next; 00063 }; 00064 00069 struct SupportList{ 00070 int_32 support_var; 00071 SupportList *next; 00072 }; 00073 00074 00075 00083 struct DSDNode{ 00088 int_32 type_actualsize; 00089 00095 int_32 topvar_refsize; 00096 00100 ActualNode * actual_list; 00101 00105 DdNode * symbolic_kernel; 00106 00111 DdNode * bdd_analogue; 00112 00116 DSDNode * next; 00117 00118 DSDNode *parent; 00119 int *support; 00120 }; 00121 00122 00128 struct DSDManager{ 00132 DdManager * Ddmanager_analogue; 00133 00137 DSDNode *one; 00138 00142 int_32 num_outputs; 00143 00148 int_32 decomposed_outputs; 00149 00155 int_32 num_blocks; 00156 00157 int_32 num_unique_blocks; 00158 int_32 num_unique_symbolic_blocks; 00159 int_32 theoretical_DSD_consumption; 00160 int_32 theoretical_Actual_consumption; 00161 int_32 theoretical_memory_consumption; 00162 int_32 garbage_cleans; 00163 00167 DSDNode ** DSD_unique_table; 00168 00172 int_32 DSD_unique_table_size; 00173 00174 int_32 notdisjoint; 00175 00176 int_32 num_DSD_nodes; 00177 int_32 max_DSD_nodes; 00178 00179 int_32 support_size; 00180 int_32 max_support_size; 00181 00182 double max_average_actualsize; 00183 double current_average_actualsize; 00184 int_32 max_actualsize; 00185 int_32 total_actualsize; 00186 00187 int_32 max_memory_used; 00188 int_32 current_memory_used; 00189 00190 00196 int_32 dead_nodes_threshold; 00197 00201 int_32 dead_nodes_current; 00202 00203 00204 int_32 num_disjoint; 00205 int_32 num_commons; 00206 int_32 num_entered; 00207 int_32 num_primes; 00208 int_32 num_newdecomp; 00209 00210 int_32 num_snodes; 00211 int_32 num_onodes; 00212 DdNode **snodes_array; 00213 DdNode **onodes_array; 00214 int_32 snode_size; 00215 int_32 onode_size; 00216 int_32 snode_counter; 00217 int_32 onode_counter; 00218 00219 int_32 num_nodes; 00220 DdNode **nodes_array; 00221 int_32 node_size; 00222 int_32 node_counter; 00223 00224 }; 00225 00226 00227 #define DSD_Regular(x) ((DSDNode *)((int)(x) & ~01)) 00228 #define DSD_Not(x) ((DSDNode *) ((int)(x) ^ 01)) 00229 #define DSD_Complement(x) ((DSDNode *) ((int)(x) | 01)) 00230 #define DSD_IsComplement(x) ((int) ((int) (x) & 01)) 00231 00232 00233 #define GET_TYPE(x) (((x)->type_actualsize & TYPE_MASK)>>25) 00234 #define SET_TYPE(x, type) ((x)->type_actualsize = (((x)->type_actualsize & ~(TYPE_MASK)) | (type << 25))) 00235 #define INPUT_SIZE(x) ((x)->type_actualsize & ~(SIZE_MASK)) 00236 #define SET_SIZE(x, size) ((x)->type_actualsize = (((x)->type_actualsize & (SIZE_MASK)) | (size))) 00237 #define mark(x) ((x)->type_actualsize = (((x)->type_actualsize | (MARK_MASK)))) 00238 #define unmark(x) ((x)->type_actualsize = (((x)->type_actualsize & ~(MARK_MASK)))) 00239 00240 #define marked(x) (((x)->type_actualsize & (MARK_MASK))>>24) 00241 #define SET_CAN(x, value) ((x)->topvar_refsize = (((x)->topvar_refsize & ~(CAN_MASK)) | (value << 16))) 00242 #define GET_CAN(x) (((x)->topvar_refsize & CAN_MASK)>>16) 00243 #define GET_REF(x) ((x)->topvar_refsize & ~(CAN_MASK)) 00244 00245 #endif