[13] | 1 | /* BDD user-visible definitions */ |
---|
| 2 | |
---|
| 3 | |
---|
| 4 | #if !defined(_BDDUSERH) |
---|
| 5 | #define _BDDUSERH |
---|
| 6 | |
---|
| 7 | |
---|
| 8 | #include <stdio.h> |
---|
| 9 | #include <memuser.h> |
---|
| 10 | |
---|
| 11 | |
---|
| 12 | #define ARGS(args) args |
---|
| 13 | |
---|
| 14 | |
---|
| 15 | /* Types */ |
---|
| 16 | |
---|
| 17 | typedef struct bdd_ *bdd; |
---|
| 18 | typedef struct bdd_manager_ *cmu_bdd_manager; |
---|
| 19 | typedef struct block_ *block; |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | /* Return values for cmu_bdd_type */ |
---|
| 23 | |
---|
| 24 | #define BDD_TYPE_NONTERMINAL 0 |
---|
| 25 | #define BDD_TYPE_ZERO 1 |
---|
| 26 | #define BDD_TYPE_ONE 2 |
---|
| 27 | #define BDD_TYPE_POSVAR 3 |
---|
| 28 | #define BDD_TYPE_NEGVAR 4 |
---|
| 29 | #define BDD_TYPE_OVERFLOW 5 |
---|
| 30 | #define BDD_TYPE_CONSTANT 6 |
---|
| 31 | |
---|
| 32 | |
---|
| 33 | /* Error codes for cmu_bdd_undump_bdd */ |
---|
| 34 | |
---|
| 35 | #define BDD_UNDUMP_FORMAT 1 |
---|
| 36 | #define BDD_UNDUMP_OVERFLOW 2 |
---|
| 37 | #define BDD_UNDUMP_IOERROR 3 |
---|
| 38 | #define BDD_UNDUMP_EOF 4 |
---|
| 39 | |
---|
| 40 | |
---|
| 41 | /* Basic BDD routine declarations */ |
---|
| 42 | |
---|
| 43 | extern bdd cmu_bdd_one ARGS((cmu_bdd_manager)); |
---|
| 44 | extern bdd cmu_bdd_zero ARGS((cmu_bdd_manager)); |
---|
| 45 | extern bdd cmu_bdd_new_var_first ARGS((cmu_bdd_manager)); |
---|
| 46 | extern bdd cmu_bdd_new_var_last ARGS((cmu_bdd_manager)); |
---|
| 47 | extern bdd cmu_bdd_new_var_before ARGS((cmu_bdd_manager, bdd)); |
---|
| 48 | extern bdd cmu_bdd_new_var_after ARGS((cmu_bdd_manager, bdd)); |
---|
| 49 | extern bdd cmu_bdd_var_with_index ARGS((cmu_bdd_manager, long)); |
---|
| 50 | extern bdd cmu_bdd_var_with_id ARGS((cmu_bdd_manager, long)); |
---|
| 51 | extern bdd cmu_bdd_ite ARGS((cmu_bdd_manager, bdd, bdd, bdd)); |
---|
| 52 | extern bdd cmu_bdd_and ARGS((cmu_bdd_manager, bdd, bdd)); |
---|
| 53 | extern bdd cmu_bdd_nand ARGS((cmu_bdd_manager, bdd, bdd)); |
---|
| 54 | extern bdd cmu_bdd_or ARGS((cmu_bdd_manager, bdd, bdd)); |
---|
| 55 | extern bdd cmu_bdd_nor ARGS((cmu_bdd_manager, bdd, bdd)); |
---|
| 56 | extern bdd cmu_bdd_xor ARGS((cmu_bdd_manager, bdd, bdd)); |
---|
| 57 | extern bdd cmu_bdd_xnor ARGS((cmu_bdd_manager, bdd, bdd)); |
---|
| 58 | extern bdd cmu_bdd_identity ARGS((cmu_bdd_manager, bdd)); |
---|
| 59 | extern bdd cmu_bdd_not ARGS((cmu_bdd_manager, bdd)); |
---|
| 60 | extern bdd cmu_bdd_if ARGS((cmu_bdd_manager, bdd)); |
---|
| 61 | extern long cmu_bdd_if_index ARGS((cmu_bdd_manager, bdd)); |
---|
| 62 | extern long cmu_bdd_if_id ARGS((cmu_bdd_manager, bdd)); |
---|
| 63 | extern bdd cmu_bdd_then ARGS((cmu_bdd_manager, bdd)); |
---|
| 64 | extern bdd cmu_bdd_else ARGS((cmu_bdd_manager, bdd)); |
---|
| 65 | extern bdd cmu_bdd_intersects ARGS((cmu_bdd_manager, bdd, bdd)); |
---|
| 66 | extern bdd cmu_bdd_implies ARGS((cmu_bdd_manager, bdd, bdd)); |
---|
| 67 | extern int cmu_bdd_type ARGS((cmu_bdd_manager, bdd)); |
---|
| 68 | extern void cmu_bdd_unfree ARGS((cmu_bdd_manager, bdd)); |
---|
| 69 | extern void cmu_bdd_free ARGS((cmu_bdd_manager, bdd)); |
---|
| 70 | extern long cmu_bdd_vars ARGS((cmu_bdd_manager)); |
---|
| 71 | extern long cmu_bdd_total_size ARGS((cmu_bdd_manager)); |
---|
| 72 | extern int cmu_bdd_cache_ratio ARGS((cmu_bdd_manager, int)); |
---|
| 73 | extern long cmu_bdd_node_limit ARGS((cmu_bdd_manager, long)); |
---|
| 74 | extern int cmu_bdd_overflow ARGS((cmu_bdd_manager)); |
---|
| 75 | extern void cmu_bdd_overflow_closure ARGS((cmu_bdd_manager, void (*) ARGS((cmu_bdd_manager, pointer)), pointer)); |
---|
| 76 | extern void cmu_bdd_abort_closure ARGS((cmu_bdd_manager, void (*) ARGS((cmu_bdd_manager, pointer)), pointer)); |
---|
| 77 | extern void cmu_bdd_stats ARGS((cmu_bdd_manager, FILE *)); |
---|
| 78 | extern cmu_bdd_manager cmu_bdd_init ARGS((void)); |
---|
| 79 | extern void cmu_bdd_quit ARGS((cmu_bdd_manager)); |
---|
| 80 | |
---|
| 81 | |
---|
| 82 | /* Variable association routine declarations */ |
---|
| 83 | |
---|
| 84 | extern int cmu_bdd_new_assoc ARGS((cmu_bdd_manager, bdd *, int)); |
---|
| 85 | extern void cmu_bdd_free_assoc ARGS((cmu_bdd_manager, int)); |
---|
| 86 | extern void cmu_bdd_temp_assoc ARGS((cmu_bdd_manager, bdd *, int)); |
---|
| 87 | extern void cmu_bdd_augment_temp_assoc ARGS((cmu_bdd_manager, bdd *, int)); |
---|
| 88 | extern int cmu_bdd_assoc ARGS((cmu_bdd_manager, int)); |
---|
| 89 | |
---|
| 90 | |
---|
| 91 | /* Comparison routine declarations */ |
---|
| 92 | |
---|
| 93 | extern int cmu_bdd_compare ARGS((cmu_bdd_manager, bdd, bdd, bdd)); |
---|
| 94 | |
---|
| 95 | |
---|
| 96 | /* Composition routine declarations */ |
---|
| 97 | |
---|
| 98 | extern bdd cmu_bdd_compose ARGS((cmu_bdd_manager, bdd, bdd, bdd)); |
---|
| 99 | extern bdd cmu_bdd_substitute ARGS((cmu_bdd_manager, bdd)); |
---|
| 100 | |
---|
| 101 | |
---|
| 102 | /* Variable exchange routine declarations */ |
---|
| 103 | |
---|
| 104 | extern bdd cmu_bdd_swap_vars ARGS((cmu_bdd_manager, bdd, bdd, bdd)); |
---|
| 105 | |
---|
| 106 | |
---|
| 107 | /* Quantification routine declarations */ |
---|
| 108 | |
---|
| 109 | extern bdd cmu_bdd_exists ARGS((cmu_bdd_manager, bdd)); |
---|
| 110 | extern bdd cmu_bdd_forall ARGS((cmu_bdd_manager, bdd)); |
---|
| 111 | |
---|
| 112 | |
---|
| 113 | /* Reduce routine declarations */ |
---|
| 114 | |
---|
| 115 | extern bdd cmu_bdd_reduce ARGS((cmu_bdd_manager, bdd, bdd)); |
---|
| 116 | extern bdd cmu_bdd_cofactor ARGS((cmu_bdd_manager, bdd, bdd)); |
---|
| 117 | |
---|
| 118 | |
---|
| 119 | /* Relational product routine declarations */ |
---|
| 120 | |
---|
| 121 | extern bdd cmu_bdd_rel_prod ARGS((cmu_bdd_manager, bdd, bdd)); |
---|
| 122 | |
---|
| 123 | |
---|
| 124 | /* Satisfying valuation routine declarations */ |
---|
| 125 | |
---|
| 126 | extern bdd cmu_bdd_satisfy ARGS((cmu_bdd_manager, bdd)); |
---|
| 127 | extern bdd cmu_bdd_satisfy_support ARGS((cmu_bdd_manager, bdd)); |
---|
| 128 | extern double cmu_bdd_satisfying_fraction ARGS((cmu_bdd_manager, bdd)); |
---|
| 129 | |
---|
| 130 | |
---|
| 131 | /* Generic apply routine declarations */ |
---|
| 132 | |
---|
| 133 | extern bdd bdd_apply2 ARGS((cmu_bdd_manager, bdd (*) ARGS((cmu_bdd_manager, bdd *, bdd *, pointer)), bdd, bdd, pointer)); |
---|
| 134 | extern bdd bdd_apply1 ARGS((cmu_bdd_manager, bdd (*) ARGS((cmu_bdd_manager, bdd *, pointer)), bdd, pointer)); |
---|
| 135 | |
---|
| 136 | |
---|
| 137 | /* Size and profile routine declarations */ |
---|
| 138 | |
---|
| 139 | extern long cmu_bdd_size ARGS((cmu_bdd_manager, bdd, int)); |
---|
| 140 | extern long cmu_bdd_size_multiple ARGS((cmu_bdd_manager, bdd *, int)); |
---|
| 141 | extern void cmu_bdd_profile ARGS((cmu_bdd_manager, bdd, long *, int)); |
---|
| 142 | extern void cmu_bdd_profile_multiple ARGS((cmu_bdd_manager, bdd *, long *, int)); |
---|
| 143 | extern void cmu_bdd_function_profile ARGS((cmu_bdd_manager, bdd, long *)); |
---|
| 144 | extern void cmu_bdd_function_profile_multiple ARGS((cmu_bdd_manager, bdd *, long *)); |
---|
| 145 | |
---|
| 146 | |
---|
| 147 | /* Print routine declarations */ |
---|
| 148 | |
---|
| 149 | #define bdd_naming_fn_none ((char *(*)(cmu_bdd_manager, bdd, pointer))0) |
---|
| 150 | #define bdd_terminal_id_fn_none ((char *(*)(cmu_bdd_manager, INT_PTR, INT_PTR, pointer))0) |
---|
| 151 | |
---|
| 152 | extern void cmu_bdd_print_bdd ARGS((cmu_bdd_manager, |
---|
| 153 | bdd, |
---|
| 154 | char *(*) ARGS((cmu_bdd_manager, bdd, pointer)), |
---|
| 155 | char *(*) ARGS((cmu_bdd_manager, INT_PTR, INT_PTR, pointer)), |
---|
| 156 | pointer, |
---|
| 157 | FILE *)); |
---|
| 158 | extern void cmu_bdd_print_profile_aux ARGS((cmu_bdd_manager, |
---|
| 159 | long *, |
---|
| 160 | char *(*) ARGS((cmu_bdd_manager, bdd, pointer)), |
---|
| 161 | pointer, |
---|
| 162 | int, |
---|
| 163 | FILE *)); |
---|
| 164 | extern void cmu_bdd_print_profile ARGS((cmu_bdd_manager, |
---|
| 165 | bdd, |
---|
| 166 | char *(*) ARGS((cmu_bdd_manager, bdd, pointer)), |
---|
| 167 | pointer, |
---|
| 168 | int, |
---|
| 169 | FILE *)); |
---|
| 170 | extern void cmu_bdd_print_profile_multiple ARGS((cmu_bdd_manager, |
---|
| 171 | bdd *, |
---|
| 172 | char *(*) ARGS((cmu_bdd_manager, bdd, pointer)), |
---|
| 173 | pointer, |
---|
| 174 | int, |
---|
| 175 | FILE *)); |
---|
| 176 | extern void cmu_bdd_print_function_profile ARGS((cmu_bdd_manager, |
---|
| 177 | bdd, |
---|
| 178 | char *(*) ARGS((cmu_bdd_manager, bdd, pointer)), |
---|
| 179 | pointer, |
---|
| 180 | int, |
---|
| 181 | FILE *)); |
---|
| 182 | extern void cmu_bdd_print_function_profile_multiple ARGS((cmu_bdd_manager, |
---|
| 183 | bdd *, |
---|
| 184 | char *(*) ARGS((cmu_bdd_manager, bdd, pointer)), |
---|
| 185 | pointer, |
---|
| 186 | int, |
---|
| 187 | FILE *)); |
---|
| 188 | |
---|
| 189 | |
---|
| 190 | /* Dump/undump routine declarations */ |
---|
| 191 | |
---|
| 192 | extern int cmu_bdd_dump_bdd ARGS((cmu_bdd_manager, bdd, bdd *, FILE *)); |
---|
| 193 | extern bdd cmu_bdd_undump_bdd ARGS((cmu_bdd_manager, bdd *, FILE *, int *)); |
---|
| 194 | |
---|
| 195 | |
---|
| 196 | /* Support routine declarations */ |
---|
| 197 | |
---|
| 198 | extern int cmu_bdd_depends_on ARGS((cmu_bdd_manager, bdd, bdd)); |
---|
| 199 | extern void cmu_bdd_support ARGS((cmu_bdd_manager, bdd, bdd *)); |
---|
| 200 | |
---|
| 201 | |
---|
| 202 | /* Unique table routine declarations */ |
---|
| 203 | |
---|
| 204 | extern void cmu_bdd_gc ARGS((cmu_bdd_manager)); |
---|
| 205 | extern void cmu_bdd_clear_refs ARGS((cmu_bdd_manager)); |
---|
| 206 | |
---|
| 207 | |
---|
| 208 | /* Dynamic reordering routines */ |
---|
| 209 | |
---|
| 210 | #define cmu_bdd_reorder_none ((void (*)(cmu_bdd_manager))0) |
---|
| 211 | |
---|
| 212 | extern void cmu_bdd_reorder_stable_window3 ARGS((cmu_bdd_manager)); |
---|
| 213 | extern void cmu_bdd_reorder_sift ARGS((cmu_bdd_manager)); |
---|
| 214 | extern void cmu_bdd_reorder_hybrid ARGS((cmu_bdd_manager)); |
---|
| 215 | extern void cmu_bdd_var_block_reorderable ARGS((cmu_bdd_manager, block, int)); |
---|
| 216 | extern void cmu_bdd_dynamic_reordering ARGS((cmu_bdd_manager, void (*) ARGS((cmu_bdd_manager)))); |
---|
| 217 | extern void cmu_bdd_reorder ARGS((cmu_bdd_manager)); |
---|
| 218 | |
---|
| 219 | extern bdd cmu_bdd_project ARGS((cmu_bdd_manager, bdd)); |
---|
| 220 | |
---|
| 221 | /* Variable block routines */ |
---|
| 222 | |
---|
| 223 | extern block cmu_bdd_new_var_block ARGS((cmu_bdd_manager, bdd, long)); |
---|
| 224 | |
---|
| 225 | |
---|
| 226 | /* Multi-terminal BDD routine declarations */ |
---|
| 227 | |
---|
| 228 | extern void mtbdd_transform_closure ARGS((cmu_bdd_manager, |
---|
| 229 | int (*) ARGS((cmu_bdd_manager, INT_PTR, INT_PTR, pointer)), |
---|
| 230 | void (*) ARGS((cmu_bdd_manager, INT_PTR, INT_PTR, INT_PTR *, INT_PTR *, pointer)), |
---|
| 231 | pointer)); |
---|
| 232 | extern void mtcmu_bdd_one_data ARGS((cmu_bdd_manager, INT_PTR, INT_PTR)); |
---|
| 233 | extern void cmu_mtbdd_free_terminal_closure ARGS((cmu_bdd_manager, |
---|
| 234 | void (*) ARGS((cmu_bdd_manager, INT_PTR, INT_PTR, pointer)), |
---|
| 235 | pointer)); |
---|
| 236 | extern bdd cmu_mtbdd_get_terminal ARGS((cmu_bdd_manager, INT_PTR, INT_PTR)); |
---|
| 237 | extern void cmu_mtbdd_terminal_value ARGS((cmu_bdd_manager, bdd, INT_PTR *, INT_PTR *)); |
---|
| 238 | extern bdd mtcmu_bdd_ite ARGS((cmu_bdd_manager, bdd, bdd, bdd)); |
---|
| 239 | extern bdd cmu_mtbdd_equal ARGS((cmu_bdd_manager, bdd, bdd)); |
---|
| 240 | extern bdd mtcmu_bdd_substitute ARGS((cmu_bdd_manager, bdd)); |
---|
| 241 | #define mtbdd_transform(bddm, f) (cmu_bdd_not(bddm, f)) |
---|
| 242 | |
---|
| 243 | |
---|
| 244 | #undef ARGS |
---|
| 245 | |
---|
| 246 | #endif |
---|