1 | /**CFile*********************************************************************** |
---|
2 | |
---|
3 | FileName [cmuPort.c] |
---|
4 | |
---|
5 | PackageName [cmu_port] |
---|
6 | |
---|
7 | Synopsis [Port routines for CMU package.] |
---|
8 | |
---|
9 | Description [optional] |
---|
10 | |
---|
11 | SeeAlso [optional] |
---|
12 | |
---|
13 | Author [Thomas R. Shiple. Some changes by Rajeev K. Ranjan.] |
---|
14 | |
---|
15 | Copyright [Copyright (c) 1994-1996 The Regents of the Univ. of California. |
---|
16 | All rights reserved. |
---|
17 | |
---|
18 | Permission is hereby granted, without written agreement and without license |
---|
19 | or royalty fees, to use, copy, modify, and distribute this software and its |
---|
20 | documentation for any purpose, provided that the above copyright notice and |
---|
21 | the following two paragraphs appear in all copies of this software. |
---|
22 | |
---|
23 | IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR |
---|
24 | DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT |
---|
25 | OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF |
---|
26 | CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
27 | |
---|
28 | THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, |
---|
29 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND |
---|
30 | FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN |
---|
31 | "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE |
---|
32 | MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.] |
---|
33 | |
---|
34 | Revision [$Id: cmuPort.c,v 1.78 2003/08/05 20:28:24 fabio Exp $] |
---|
35 | |
---|
36 | ******************************************************************************/ |
---|
37 | |
---|
38 | #include "cmuPortInt.h" |
---|
39 | #ifndef EPD_MAX_BIN |
---|
40 | #include "epd.h" |
---|
41 | #endif |
---|
42 | |
---|
43 | /*---------------------------------------------------------------------------*/ |
---|
44 | /* Constant declarations */ |
---|
45 | /*---------------------------------------------------------------------------*/ |
---|
46 | |
---|
47 | |
---|
48 | /*---------------------------------------------------------------------------*/ |
---|
49 | /* Type declarations */ |
---|
50 | /*---------------------------------------------------------------------------*/ |
---|
51 | |
---|
52 | |
---|
53 | /*---------------------------------------------------------------------------*/ |
---|
54 | /* Structure declarations */ |
---|
55 | /*---------------------------------------------------------------------------*/ |
---|
56 | |
---|
57 | |
---|
58 | /*---------------------------------------------------------------------------*/ |
---|
59 | /* Variable declarations */ |
---|
60 | /*---------------------------------------------------------------------------*/ |
---|
61 | |
---|
62 | |
---|
63 | /*---------------------------------------------------------------------------*/ |
---|
64 | /* Macro declarations */ |
---|
65 | /*---------------------------------------------------------------------------*/ |
---|
66 | |
---|
67 | |
---|
68 | /**AutomaticStart*************************************************************/ |
---|
69 | |
---|
70 | /*---------------------------------------------------------------------------*/ |
---|
71 | /* Static function prototypes */ |
---|
72 | /*---------------------------------------------------------------------------*/ |
---|
73 | |
---|
74 | /**AutomaticEnd***************************************************************/ |
---|
75 | |
---|
76 | |
---|
77 | /*---------------------------------------------------------------------------*/ |
---|
78 | /* Definition of exported functions */ |
---|
79 | /*---------------------------------------------------------------------------*/ |
---|
80 | |
---|
81 | /**Function******************************************************************** |
---|
82 | |
---|
83 | Synopsis [Builds the bdd_t structure.] |
---|
84 | |
---|
85 | Description [Builds the bdd_t structure from manager and node. |
---|
86 | Assumes that the reference count of the node has already been |
---|
87 | increased.] |
---|
88 | |
---|
89 | SideEffects [] |
---|
90 | |
---|
91 | ******************************************************************************/ |
---|
92 | bdd_t * |
---|
93 | bdd_construct_bdd_t(bdd_manager *manager, bdd_node *func) |
---|
94 | { |
---|
95 | bdd_t *result; |
---|
96 | cmu_bdd_manager mgr = (cmu_bdd_manager)manager; |
---|
97 | bdd fn = (bdd)func; |
---|
98 | |
---|
99 | if (fn == (struct bdd_ *) 0) { |
---|
100 | cmu_bdd_fatal("bdd_construct_bdd_t: possible memory overflow"); |
---|
101 | } |
---|
102 | |
---|
103 | result = ALLOC(bdd_t, 1); |
---|
104 | result->mgr = mgr; |
---|
105 | result->node = fn; |
---|
106 | result->free = FALSE; |
---|
107 | return result; |
---|
108 | } |
---|
109 | |
---|
110 | /**Function******************************************************************** |
---|
111 | Synopsis [required] |
---|
112 | |
---|
113 | Description [optional] |
---|
114 | |
---|
115 | SideEffects [required] |
---|
116 | |
---|
117 | SeeAlso [optional] |
---|
118 | ******************************************************************************/ |
---|
119 | bdd_package_type_t |
---|
120 | bdd_get_package_name(void) |
---|
121 | { |
---|
122 | return CMU; |
---|
123 | } |
---|
124 | |
---|
125 | /* |
---|
126 | BDD Manager Allocation And Destruction ---------------------------------------- |
---|
127 | */ |
---|
128 | void |
---|
129 | bdd_end(bdd_manager *manager) |
---|
130 | { |
---|
131 | bdd_external_hooks *hooks; |
---|
132 | cmu_bdd_manager mgr = (cmu_bdd_manager)manager; |
---|
133 | hooks = (bdd_external_hooks *) mgr->hooks; |
---|
134 | FREE(hooks); |
---|
135 | cmu_bdd_quit(mgr); |
---|
136 | } |
---|
137 | |
---|
138 | |
---|
139 | bdd_manager * |
---|
140 | bdd_start(int nvariables) |
---|
141 | { |
---|
142 | struct bdd_manager_ *mgr; |
---|
143 | int i; |
---|
144 | bdd_external_hooks *hooks; |
---|
145 | |
---|
146 | mgr = cmu_bdd_init(); /*no args*/ |
---|
147 | |
---|
148 | /* |
---|
149 | * Calls to UCB bdd_get_variable are translated into cmu_bdd_var_with_id calls. However, |
---|
150 | * cmu_bdd_var_with_id assumes that single variable BDDs have already been created for |
---|
151 | * all the variables that we wish to access. Thus, following, we explicitly create n |
---|
152 | * variables. We do not care about the return value of cmu_bdd_new_var_last; in the |
---|
153 | * CMU package, the single variable BDDs are NEVER garbage collected. |
---|
154 | */ |
---|
155 | for (i = 0; i < nvariables; i++) { |
---|
156 | (void) cmu_bdd_new_var_last(mgr); |
---|
157 | } |
---|
158 | |
---|
159 | hooks = ALLOC(bdd_external_hooks, 1); |
---|
160 | hooks->mdd = hooks->network = hooks->undef1 = (char *) 0; |
---|
161 | mgr->hooks = (char *) hooks; /* new field added to CMU manager */ |
---|
162 | |
---|
163 | return (bdd_manager *) mgr; |
---|
164 | } |
---|
165 | |
---|
166 | /* |
---|
167 | BDD Variable Allocation ------------------------------------------------------- |
---|
168 | */ |
---|
169 | |
---|
170 | bdd_t * |
---|
171 | bdd_create_variable(bdd_manager *manager) |
---|
172 | { |
---|
173 | cmu_bdd_manager mgr = (cmu_bdd_manager) manager; |
---|
174 | return bdd_construct_bdd_t(mgr, cmu_bdd_new_var_last(mgr)); |
---|
175 | } |
---|
176 | |
---|
177 | bdd_t * |
---|
178 | bdd_create_variable_after(bdd_manager *manager, bdd_variableId after_id) |
---|
179 | { |
---|
180 | struct bdd_ *after_var; |
---|
181 | bdd_t *result; |
---|
182 | cmu_bdd_manager mgr = (cmu_bdd_manager) manager; |
---|
183 | |
---|
184 | after_var = cmu_bdd_var_with_id(mgr, (long)after_id + 1); |
---|
185 | |
---|
186 | result = bdd_construct_bdd_t(mgr, cmu_bdd_new_var_after(mgr, after_var)); |
---|
187 | |
---|
188 | /* No need to free after_var, since single variable BDDs are never garbage collected */ |
---|
189 | |
---|
190 | return result; |
---|
191 | } |
---|
192 | |
---|
193 | |
---|
194 | |
---|
195 | bdd_t * |
---|
196 | bdd_get_variable(bdd_manager *manager, bdd_variableId variable_ID) |
---|
197 | { |
---|
198 | struct bdd_ *fn; |
---|
199 | cmu_bdd_manager mgr = (cmu_bdd_manager) manager; |
---|
200 | fn = cmu_bdd_var_with_id(mgr, (long) (variable_ID + 1)); |
---|
201 | |
---|
202 | if (fn == (struct bdd_ *) 0) { |
---|
203 | /* variable should always be found, since they are created at bdd_start */ |
---|
204 | cmu_bdd_fatal("bdd_get_variable: assumption violated"); |
---|
205 | } |
---|
206 | |
---|
207 | return bdd_construct_bdd_t(mgr, fn); |
---|
208 | } |
---|
209 | |
---|
210 | /* |
---|
211 | BDD Formula Management -------------------------------------------------------- |
---|
212 | */ |
---|
213 | |
---|
214 | bdd_t * |
---|
215 | bdd_dup(bdd_t *f) |
---|
216 | { |
---|
217 | return bdd_construct_bdd_t(f->mgr, cmu_bdd_identity(f->mgr, f->node)); |
---|
218 | } |
---|
219 | |
---|
220 | void |
---|
221 | bdd_free(bdd_t *f) |
---|
222 | { |
---|
223 | if (f == NIL(bdd_t)) { |
---|
224 | fail("bdd_free: trying to free a NIL bdd_t"); |
---|
225 | } |
---|
226 | |
---|
227 | if (f->free == TRUE) { |
---|
228 | fail("bdd_free: trying to free a freed bdd_t"); |
---|
229 | } |
---|
230 | |
---|
231 | cmu_bdd_free(f->mgr, f->node); |
---|
232 | |
---|
233 | /* |
---|
234 | * In case the user tries to free this bdd_t again, set the free field to TRUE, |
---|
235 | * and NIL out the other fields. Then free the bdd_t structure itself. |
---|
236 | */ |
---|
237 | f->free = TRUE; |
---|
238 | f->node = NIL(struct bdd_); |
---|
239 | f->mgr = NIL(struct bdd_manager_); |
---|
240 | FREE(f); |
---|
241 | } |
---|
242 | |
---|
243 | /* |
---|
244 | Operations on BDD Formulas ---------------------------------------------------- |
---|
245 | */ |
---|
246 | |
---|
247 | bdd_t * |
---|
248 | bdd_and( |
---|
249 | bdd_t *f, |
---|
250 | bdd_t *g, |
---|
251 | boolean f_phase, |
---|
252 | boolean g_phase) |
---|
253 | { |
---|
254 | struct bdd_ *temp1, *temp2; |
---|
255 | bdd_t *result; |
---|
256 | struct bdd_manager_ *mgr; |
---|
257 | |
---|
258 | mgr = f->mgr; |
---|
259 | temp1 = ( (f_phase == TRUE) ? cmu_bdd_identity(mgr, f->node) : cmu_bdd_not(mgr, f->node)); |
---|
260 | temp2 = ( (g_phase == TRUE) ? cmu_bdd_identity(mgr, g->node) : cmu_bdd_not(mgr, g->node)); |
---|
261 | result = bdd_construct_bdd_t(mgr, cmu_bdd_and(mgr, temp1, temp2)); |
---|
262 | cmu_bdd_free(mgr, temp1); |
---|
263 | cmu_bdd_free(mgr, temp2); |
---|
264 | return result; |
---|
265 | } |
---|
266 | |
---|
267 | bdd_t * |
---|
268 | bdd_and_with_limit( |
---|
269 | bdd_t *f, |
---|
270 | bdd_t *g, |
---|
271 | boolean f_phase, |
---|
272 | boolean g_phase, |
---|
273 | unsigned int limit) |
---|
274 | { |
---|
275 | /* Unsupported: fall back on standard AND. */ |
---|
276 | return bdd_and(f, g, f_phase, g_phase); |
---|
277 | } |
---|
278 | |
---|
279 | bdd_t * |
---|
280 | bdd_and_array( |
---|
281 | bdd_t *f, |
---|
282 | array_t *g_array, |
---|
283 | boolean f_phase, |
---|
284 | boolean g_phase) |
---|
285 | { |
---|
286 | struct bdd_ *temp1, *temp2, *result; |
---|
287 | bdd_t *g; |
---|
288 | struct bdd_manager_ *mgr; |
---|
289 | int i; |
---|
290 | |
---|
291 | mgr = f->mgr; |
---|
292 | result = ((f_phase == TRUE) ? cmu_bdd_identity(mgr, f->node) : |
---|
293 | cmu_bdd_not(mgr, f->node)); |
---|
294 | |
---|
295 | for (i = 0; i < array_n(g_array); i++) { |
---|
296 | g = array_fetch(bdd_t *, g_array, i); |
---|
297 | temp1 = result; |
---|
298 | temp2 = ((g_phase == TRUE) ? cmu_bdd_identity(mgr, g->node) : |
---|
299 | cmu_bdd_not(mgr, g->node)); |
---|
300 | result = cmu_bdd_and(mgr, temp1, temp2); |
---|
301 | cmu_bdd_free(mgr, temp1); |
---|
302 | cmu_bdd_free(mgr, temp2); |
---|
303 | if (result == NULL) |
---|
304 | return(NULL); |
---|
305 | } |
---|
306 | |
---|
307 | return(bdd_construct_bdd_t(mgr, result)); |
---|
308 | } |
---|
309 | |
---|
310 | bdd_t * |
---|
311 | bdd_multiway_and(bdd_manager *manager, array_t *bddArray) |
---|
312 | { |
---|
313 | int i; |
---|
314 | bdd temp, result; |
---|
315 | bdd_t *operand; |
---|
316 | cmu_bdd_manager mgr = (cmu_bdd_manager) manager; |
---|
317 | result = cmu_bdd_one(mgr); |
---|
318 | for (i=0; i<array_n(bddArray); i++){ |
---|
319 | operand = array_fetch(bdd_t *, bddArray, i); |
---|
320 | temp = cmu_bdd_and(mgr, result, operand->node); |
---|
321 | cmu_bdd_free(mgr, result); |
---|
322 | result = temp; |
---|
323 | } |
---|
324 | return bdd_construct_bdd_t(mgr, result); |
---|
325 | } |
---|
326 | |
---|
327 | bdd_t * |
---|
328 | bdd_multiway_or(bdd_manager *manager, array_t *bddArray) |
---|
329 | { |
---|
330 | int i; |
---|
331 | bdd temp, result; |
---|
332 | bdd_t *operand; |
---|
333 | cmu_bdd_manager mgr = (cmu_bdd_manager) manager; |
---|
334 | result = cmu_bdd_zero(mgr); |
---|
335 | for (i=0; i<array_n(bddArray); i++){ |
---|
336 | operand = array_fetch(bdd_t *, bddArray, i); |
---|
337 | temp = cmu_bdd_or(mgr, result, operand->node); |
---|
338 | cmu_bdd_free(mgr, result); |
---|
339 | result = temp; |
---|
340 | } |
---|
341 | return bdd_construct_bdd_t(mgr, result); |
---|
342 | } |
---|
343 | |
---|
344 | bdd_t * |
---|
345 | bdd_multiway_xor(bdd_manager *manager, array_t *bddArray) |
---|
346 | { |
---|
347 | int i; |
---|
348 | bdd temp, result; |
---|
349 | bdd_t *operand; |
---|
350 | cmu_bdd_manager mgr = (cmu_bdd_manager) manager; |
---|
351 | result = cmu_bdd_zero(mgr); |
---|
352 | for (i=0; i<array_n(bddArray); i++){ |
---|
353 | operand = array_fetch(bdd_t *, bddArray, i); |
---|
354 | temp = cmu_bdd_xor(mgr, result, operand->node); |
---|
355 | cmu_bdd_free(mgr, result); |
---|
356 | result = temp; |
---|
357 | } |
---|
358 | return bdd_construct_bdd_t(mgr, result); |
---|
359 | } |
---|
360 | |
---|
361 | array_t * |
---|
362 | bdd_pairwise_or(bdd_manager *manager, array_t *bddArray1, array_t |
---|
363 | *bddArray2) |
---|
364 | { |
---|
365 | int i; |
---|
366 | bdd_t *operand1, *operand2; |
---|
367 | array_t *resultArray; |
---|
368 | bdd result; |
---|
369 | cmu_bdd_manager mgr = (cmu_bdd_manager) manager; |
---|
370 | if (array_n(bddArray1) != array_n(bddArray2)){ |
---|
371 | fprintf(stderr, "bdd_pairwise_or: Arrays of different lengths.\n"); |
---|
372 | return NIL(array_t); |
---|
373 | } |
---|
374 | resultArray = array_alloc(bdd_t *, 0); |
---|
375 | for (i=0; i<array_n(bddArray1); i++){ |
---|
376 | operand1 = array_fetch(bdd_t *, bddArray1, i); |
---|
377 | operand2 = array_fetch(bdd_t *, bddArray2, i); |
---|
378 | result = cmu_bdd_or(mgr, operand1->node, operand2->node); |
---|
379 | array_insert_last(bdd_t*, resultArray, |
---|
380 | bdd_construct_bdd_t(mgr, result)); |
---|
381 | } |
---|
382 | return resultArray; |
---|
383 | } |
---|
384 | |
---|
385 | array_t * |
---|
386 | bdd_pairwise_and(bdd_manager *manager, array_t *bddArray1, array_t |
---|
387 | *bddArray2) |
---|
388 | { |
---|
389 | int i; |
---|
390 | bdd_t *operand1, *operand2; |
---|
391 | array_t *resultArray; |
---|
392 | bdd result; |
---|
393 | cmu_bdd_manager mgr = (cmu_bdd_manager) manager; |
---|
394 | if (array_n(bddArray1) != array_n(bddArray2)){ |
---|
395 | fprintf(stderr, "bdd_pairwise_and: Arrays of different lengths.\n"); |
---|
396 | return NIL(array_t); |
---|
397 | } |
---|
398 | resultArray = array_alloc(bdd_t *, 0); |
---|
399 | for (i=0; i<array_n(bddArray1); i++){ |
---|
400 | operand1 = array_fetch(bdd_t *, bddArray1, i); |
---|
401 | operand2 = array_fetch(bdd_t *, bddArray2, i); |
---|
402 | result = cmu_bdd_and(mgr, operand1->node, operand2->node); |
---|
403 | array_insert_last(bdd_t*, resultArray, |
---|
404 | bdd_construct_bdd_t(mgr, result)); |
---|
405 | } |
---|
406 | return resultArray; |
---|
407 | } |
---|
408 | |
---|
409 | array_t * |
---|
410 | bdd_pairwise_xor(bdd_manager *manager, array_t *bddArray1, array_t |
---|
411 | *bddArray2) |
---|
412 | { |
---|
413 | int i; |
---|
414 | bdd_t *operand1, *operand2; |
---|
415 | array_t *resultArray; |
---|
416 | bdd result; |
---|
417 | cmu_bdd_manager mgr = (cmu_bdd_manager) manager; |
---|
418 | if (array_n(bddArray1) != array_n(bddArray2)){ |
---|
419 | fprintf(stderr, "bdd_pairwise_xor: Arrays of different lengths.\n"); |
---|
420 | return NIL(array_t); |
---|
421 | } |
---|
422 | resultArray = array_alloc(bdd_t *, 0); |
---|
423 | for (i=0; i<array_n(bddArray1); i++){ |
---|
424 | operand1 = array_fetch(bdd_t *, bddArray1, i); |
---|
425 | operand2 = array_fetch(bdd_t *, bddArray2, i); |
---|
426 | result = cmu_bdd_xor(mgr, operand1->node, operand2->node); |
---|
427 | array_insert_last(bdd_t*, resultArray, |
---|
428 | bdd_construct_bdd_t(mgr, result)); |
---|
429 | } |
---|
430 | return resultArray; |
---|
431 | } |
---|
432 | |
---|
433 | bdd_t * |
---|
434 | bdd_and_smooth( |
---|
435 | bdd_t *f, |
---|
436 | bdd_t *g, |
---|
437 | array_t *smoothing_vars /* of bdd_t *'s */) |
---|
438 | { |
---|
439 | int num_vars, i; |
---|
440 | bdd_t *fn, *result; |
---|
441 | struct bdd_ **assoc; |
---|
442 | struct bdd_manager_ *mgr; |
---|
443 | |
---|
444 | num_vars = array_n(smoothing_vars); |
---|
445 | if (num_vars <= 0) { |
---|
446 | cmu_bdd_fatal("bdd_and_smooth: no smoothing variables"); |
---|
447 | } |
---|
448 | |
---|
449 | assoc = ALLOC(struct bdd_ *, num_vars+1); |
---|
450 | |
---|
451 | for (i = 0; i < num_vars; i++) { |
---|
452 | fn = array_fetch(bdd_t *, smoothing_vars, i); |
---|
453 | assoc[i] = fn->node; |
---|
454 | } |
---|
455 | assoc[num_vars] = (struct bdd_ *) 0; |
---|
456 | |
---|
457 | mgr = f->mgr; |
---|
458 | cmu_bdd_temp_assoc(mgr, assoc, 0); |
---|
459 | (void) cmu_bdd_assoc(mgr, -1); /* set the temp association as the current association */ |
---|
460 | |
---|
461 | result = bdd_construct_bdd_t(mgr, cmu_bdd_rel_prod(mgr, f->node, g->node)); |
---|
462 | FREE(assoc); |
---|
463 | return result; |
---|
464 | } |
---|
465 | |
---|
466 | bdd_t * |
---|
467 | bdd_and_smooth_with_limit( |
---|
468 | bdd_t *f, |
---|
469 | bdd_t *g, |
---|
470 | array_t *smoothing_vars /* of bdd_t *'s */, |
---|
471 | unsigned int limit) |
---|
472 | { |
---|
473 | /* Unsupported: fall back to standard and_smooth */ |
---|
474 | return bdd_and_smooth(f, g, smoothing_vars); |
---|
475 | } |
---|
476 | |
---|
477 | bdd_t * |
---|
478 | bdd_between(bdd_t *f_min, bdd_t *f_max) |
---|
479 | { |
---|
480 | bdd_t *temp, *ret; |
---|
481 | long size1, size2, size3; |
---|
482 | temp = bdd_or(f_min, f_max, 1, 0); |
---|
483 | ret = bdd_minimize(f_min, temp); |
---|
484 | bdd_free(temp); |
---|
485 | size1 = bdd_size(f_min); |
---|
486 | size2 = bdd_size(f_max); |
---|
487 | size3 = bdd_size(ret); |
---|
488 | if (size3 < size1) { |
---|
489 | if (size3 < size2){ |
---|
490 | return ret; |
---|
491 | } |
---|
492 | else { |
---|
493 | bdd_free(ret); |
---|
494 | return bdd_dup(f_max); |
---|
495 | } |
---|
496 | } |
---|
497 | else { |
---|
498 | bdd_free(ret); |
---|
499 | if (size1 < size2){ |
---|
500 | return bdd_dup(f_min); |
---|
501 | } |
---|
502 | else { |
---|
503 | return bdd_dup(f_max); |
---|
504 | } |
---|
505 | } |
---|
506 | } |
---|
507 | |
---|
508 | bdd_t * |
---|
509 | bdd_cofactor(bdd_t *f, bdd_t *g) |
---|
510 | { |
---|
511 | return bdd_construct_bdd_t(f->mgr, cmu_bdd_cofactor(f->mgr, f->node, g->node)); |
---|
512 | } |
---|
513 | |
---|
514 | bdd_t * |
---|
515 | bdd_cofactor_array(bdd_t *f, array_t *bddArray) |
---|
516 | { |
---|
517 | bdd_t *operand; |
---|
518 | struct bdd_ *result, *temp; |
---|
519 | int i; |
---|
520 | |
---|
521 | result = cmu_bdd_identity(f->mgr, f->node); |
---|
522 | |
---|
523 | for (i = 0; i < array_n(bddArray); i++) { |
---|
524 | operand = array_fetch(bdd_t *, bddArray, i); |
---|
525 | temp = cmu_bdd_cofactor(f->mgr, result, operand->node); |
---|
526 | if (temp == NULL) { |
---|
527 | cmu_bdd_free(f->mgr, result); |
---|
528 | return(NULL); |
---|
529 | } |
---|
530 | cmu_bdd_free(f->mgr, result); |
---|
531 | result = temp; |
---|
532 | } |
---|
533 | |
---|
534 | return(bdd_construct_bdd_t(f->mgr, result)); |
---|
535 | } |
---|
536 | |
---|
537 | bdd_t * |
---|
538 | bdd_compose( |
---|
539 | bdd_t *f, |
---|
540 | bdd_t *v, |
---|
541 | bdd_t *g) |
---|
542 | { |
---|
543 | return bdd_construct_bdd_t(f->mgr, cmu_bdd_compose(f->mgr, f->node, v->node, g->node)); |
---|
544 | } |
---|
545 | |
---|
546 | bdd_t * |
---|
547 | bdd_consensus( |
---|
548 | bdd_t *f, |
---|
549 | array_t *quantifying_vars /* of bdd_t *'s */) |
---|
550 | { |
---|
551 | int num_vars, i; |
---|
552 | bdd_t *fn, *result; |
---|
553 | struct bdd_ **assoc; |
---|
554 | struct bdd_manager_ *mgr; |
---|
555 | |
---|
556 | num_vars = array_n(quantifying_vars); |
---|
557 | if (num_vars <= 0) { |
---|
558 | cmu_bdd_fatal("bdd_consensus: no quantifying variables"); |
---|
559 | } |
---|
560 | |
---|
561 | assoc = ALLOC(struct bdd_ *, num_vars+1); |
---|
562 | |
---|
563 | for (i = 0; i < num_vars; i++) { |
---|
564 | fn = array_fetch(bdd_t *, quantifying_vars, i); |
---|
565 | assoc[i] = fn->node; |
---|
566 | } |
---|
567 | assoc[num_vars] = (struct bdd_ *) 0; |
---|
568 | |
---|
569 | mgr = f->mgr; |
---|
570 | cmu_bdd_temp_assoc(mgr, assoc, 0); |
---|
571 | (void) cmu_bdd_assoc(mgr, -1); /* set the temp association as the current association */ |
---|
572 | |
---|
573 | result = bdd_construct_bdd_t(mgr, cmu_bdd_forall(mgr, f->node)); |
---|
574 | FREE(assoc); |
---|
575 | return result; |
---|
576 | } |
---|
577 | |
---|
578 | |
---|
579 | bdd_t * |
---|
580 | bdd_cproject( |
---|
581 | bdd_t *f, |
---|
582 | array_t *quantifying_vars /* of bdd_t* */) |
---|
583 | { |
---|
584 | int num_vars, i; |
---|
585 | bdd_t *fn, *result; |
---|
586 | struct bdd_ **assoc; |
---|
587 | struct bdd_manager_ *mgr; |
---|
588 | |
---|
589 | if (f == NIL(bdd_t)) fail ("bdd_cproject: invalid BDD"); |
---|
590 | |
---|
591 | num_vars = array_n(quantifying_vars); |
---|
592 | if (num_vars <= 0) { |
---|
593 | printf("Warning: bdd_cproject: no projection variables\n"); |
---|
594 | result = bdd_dup(f); |
---|
595 | } |
---|
596 | else { |
---|
597 | assoc = ALLOC(struct bdd_ *, num_vars+1); |
---|
598 | for (i = 0; i < num_vars; i++) { |
---|
599 | fn = array_fetch(bdd_t *, quantifying_vars, i); |
---|
600 | assoc[i] = fn->node; |
---|
601 | } |
---|
602 | assoc[num_vars] = (struct bdd_ *) 0; |
---|
603 | mgr = f->mgr; |
---|
604 | cmu_bdd_temp_assoc(mgr, assoc, 0); |
---|
605 | (void) cmu_bdd_assoc(mgr, -1); /* set the temp association as the current a |
---|
606 | ssociation */ |
---|
607 | |
---|
608 | result = bdd_construct_bdd_t(mgr, cmu_bdd_project(mgr, f->node)); |
---|
609 | FREE(assoc); |
---|
610 | } |
---|
611 | return result; |
---|
612 | } |
---|
613 | |
---|
614 | |
---|
615 | bdd_t * |
---|
616 | bdd_else(bdd_t *f) |
---|
617 | { |
---|
618 | return bdd_construct_bdd_t(f->mgr, cmu_bdd_else(f->mgr, f->node)); |
---|
619 | } |
---|
620 | |
---|
621 | |
---|
622 | bdd_t * |
---|
623 | bdd_ite( |
---|
624 | bdd_t *i, |
---|
625 | bdd_t *t, |
---|
626 | bdd_t *e, |
---|
627 | boolean i_phase, |
---|
628 | boolean t_phase, |
---|
629 | boolean e_phase) |
---|
630 | { |
---|
631 | struct bdd_ *temp1, *temp2, *temp3; |
---|
632 | bdd_t *result; |
---|
633 | struct bdd_manager_ *mgr; |
---|
634 | |
---|
635 | mgr = i->mgr; |
---|
636 | temp1 = ( (i_phase == TRUE) ? cmu_bdd_identity(mgr, i->node) : cmu_bdd_not(mgr, i->node)); |
---|
637 | temp2 = ( (t_phase == TRUE) ? cmu_bdd_identity(mgr, t->node) : cmu_bdd_not(mgr, t->node)); |
---|
638 | temp3 = ( (e_phase == TRUE) ? cmu_bdd_identity(mgr, e->node) : cmu_bdd_not(mgr, e->node)); |
---|
639 | result = bdd_construct_bdd_t(mgr, cmu_bdd_ite(mgr, temp1, temp2, temp3)); |
---|
640 | cmu_bdd_free(mgr, temp1); |
---|
641 | cmu_bdd_free(mgr, temp2); |
---|
642 | cmu_bdd_free(mgr, temp3); |
---|
643 | return result; |
---|
644 | } |
---|
645 | |
---|
646 | bdd_t * |
---|
647 | bdd_minimize(bdd_t *f, bdd_t *c) |
---|
648 | { |
---|
649 | bdd_t *result = bdd_construct_bdd_t(f->mgr, cmu_bdd_reduce(f->mgr, |
---|
650 | f->node, |
---|
651 | c->node)); |
---|
652 | if (bdd_size(result) < bdd_size(f)){ |
---|
653 | return result; |
---|
654 | } |
---|
655 | else{ |
---|
656 | bdd_free(result); |
---|
657 | return bdd_dup(f); |
---|
658 | } |
---|
659 | } |
---|
660 | |
---|
661 | bdd_t * |
---|
662 | bdd_minimize_array(bdd_t *f, array_t *bddArray) |
---|
663 | { |
---|
664 | bdd_t *operand; |
---|
665 | struct bdd_ *result, *temp; |
---|
666 | bdd_t *final; |
---|
667 | int i; |
---|
668 | |
---|
669 | result = cmu_bdd_identity(f->mgr, f->node); |
---|
670 | for (i = 0; i < array_n(bddArray); i++) { |
---|
671 | operand = array_fetch(bdd_t *, bddArray, i); |
---|
672 | temp = cmu_bdd_reduce(f->mgr, result, operand->node); |
---|
673 | if (temp == NULL) { |
---|
674 | cmu_bdd_free(f->mgr, result); |
---|
675 | return(NULL); |
---|
676 | } |
---|
677 | cmu_bdd_free(f->mgr, result); |
---|
678 | result = temp; |
---|
679 | } |
---|
680 | |
---|
681 | final = bdd_construct_bdd_t(f->mgr, result); |
---|
682 | |
---|
683 | if (bdd_size(final) < bdd_size(f)){ |
---|
684 | return final; |
---|
685 | } |
---|
686 | else{ |
---|
687 | bdd_free(final); |
---|
688 | return bdd_dup(f); |
---|
689 | } |
---|
690 | } |
---|
691 | |
---|
692 | |
---|
693 | bdd_t * |
---|
694 | bdd_not(bdd_t *f) |
---|
695 | { |
---|
696 | return bdd_construct_bdd_t(f->mgr, cmu_bdd_not(f->mgr, f->node)); |
---|
697 | } |
---|
698 | |
---|
699 | bdd_t * |
---|
700 | bdd_one(bdd_manager *manager) |
---|
701 | { |
---|
702 | cmu_bdd_manager mgr = (cmu_bdd_manager) manager; |
---|
703 | return bdd_construct_bdd_t(mgr, cmu_bdd_one(mgr)); |
---|
704 | } |
---|
705 | |
---|
706 | bdd_t * |
---|
707 | bdd_or( |
---|
708 | bdd_t *f, |
---|
709 | bdd_t *g, |
---|
710 | boolean f_phase, |
---|
711 | boolean g_phase) |
---|
712 | { |
---|
713 | struct bdd_ *temp1, *temp2; |
---|
714 | bdd_t *result; |
---|
715 | struct bdd_manager_ *mgr; |
---|
716 | |
---|
717 | mgr = f->mgr; |
---|
718 | temp1 = ( (f_phase == TRUE) ? cmu_bdd_identity(mgr, f->node) : cmu_bdd_not(mgr, f->node)); |
---|
719 | temp2 = ( (g_phase == TRUE) ? cmu_bdd_identity(mgr, g->node) : cmu_bdd_not(mgr, g->node)); |
---|
720 | result = bdd_construct_bdd_t(mgr, cmu_bdd_or(mgr, temp1, temp2)); |
---|
721 | cmu_bdd_free(mgr, temp1); |
---|
722 | cmu_bdd_free(mgr, temp2); |
---|
723 | return result; |
---|
724 | } |
---|
725 | |
---|
726 | bdd_t * |
---|
727 | bdd_smooth( |
---|
728 | bdd_t *f, |
---|
729 | array_t *smoothing_vars /* of bdd_t *'s */) |
---|
730 | { |
---|
731 | int num_vars, i; |
---|
732 | bdd_t *fn, *result; |
---|
733 | struct bdd_ **assoc; |
---|
734 | struct bdd_manager_ *mgr; |
---|
735 | |
---|
736 | num_vars = array_n(smoothing_vars); |
---|
737 | if (num_vars <= 0) { |
---|
738 | cmu_bdd_fatal("bdd_smooth: no smoothing variables"); |
---|
739 | } |
---|
740 | |
---|
741 | assoc = ALLOC(struct bdd_ *, num_vars+1); |
---|
742 | |
---|
743 | for (i = 0; i < num_vars; i++) { |
---|
744 | fn = array_fetch(bdd_t *, smoothing_vars, i); |
---|
745 | assoc[i] = fn->node; |
---|
746 | } |
---|
747 | assoc[num_vars] = (struct bdd_ *) 0; |
---|
748 | |
---|
749 | mgr = f->mgr; |
---|
750 | cmu_bdd_temp_assoc(mgr, assoc, 0); |
---|
751 | (void) cmu_bdd_assoc(mgr, -1); /* set the temp association as the current association */ |
---|
752 | |
---|
753 | result = bdd_construct_bdd_t(mgr, cmu_bdd_exists(mgr, f->node)); |
---|
754 | FREE(assoc); |
---|
755 | return result; |
---|
756 | } |
---|
757 | |
---|
758 | bdd_t * |
---|
759 | bdd_substitute( |
---|
760 | bdd_t *f, |
---|
761 | array_t *old_array /* of bdd_t *'s */, |
---|
762 | array_t *new_array /* of bdd_t *'s */) |
---|
763 | { |
---|
764 | int num_old_vars, num_new_vars, i; |
---|
765 | bdd_t *fn_old, *fn_new, *result; |
---|
766 | struct bdd_ **assoc; |
---|
767 | struct bdd_manager_ *mgr; |
---|
768 | |
---|
769 | num_old_vars = array_n(old_array); |
---|
770 | num_new_vars = array_n(new_array); |
---|
771 | if (num_old_vars != num_new_vars) { |
---|
772 | cmu_bdd_fatal("bdd_substitute: mismatch of number of new and old variables"); |
---|
773 | } |
---|
774 | |
---|
775 | assoc = ALLOC(struct bdd_ *, 2*(num_old_vars+1)); |
---|
776 | |
---|
777 | for (i = 0; i < num_old_vars; i++) { |
---|
778 | fn_old = array_fetch(bdd_t *, old_array, i); |
---|
779 | fn_new = array_fetch(bdd_t *, new_array, i); |
---|
780 | assoc[2*i] = fn_old->node; |
---|
781 | assoc[2*i+1] = fn_new->node; |
---|
782 | } |
---|
783 | assoc[2*num_old_vars] = (struct bdd_ *) 0; |
---|
784 | assoc[2*num_old_vars+1] = (struct bdd_ *) 0; /* not sure if we need this second 0 */ |
---|
785 | |
---|
786 | mgr = f->mgr; |
---|
787 | cmu_bdd_temp_assoc(mgr, assoc, 1); |
---|
788 | (void) cmu_bdd_assoc(mgr, -1); /* set the temp association as the current association */ |
---|
789 | |
---|
790 | result = bdd_construct_bdd_t(mgr, cmu_bdd_substitute(mgr, f->node)); |
---|
791 | FREE(assoc); |
---|
792 | return result; |
---|
793 | } |
---|
794 | |
---|
795 | array_t * |
---|
796 | bdd_substitute_array( |
---|
797 | array_t *f_array, |
---|
798 | array_t *old_array /* of bdd_t *'s */, |
---|
799 | array_t *new_array /* of bdd_t *'s */) |
---|
800 | { |
---|
801 | int i; |
---|
802 | bdd_t *f, *new_; |
---|
803 | array_t *substitute_array = array_alloc(bdd_t *, 0); |
---|
804 | |
---|
805 | arrayForEachItem(bdd_t *, f_array, i, f) { |
---|
806 | new_ = bdd_substitute(f, old_array, new_array); |
---|
807 | array_insert_last(bdd_t *, substitute_array, new_); |
---|
808 | } |
---|
809 | return(substitute_array); |
---|
810 | } |
---|
811 | |
---|
812 | void * |
---|
813 | bdd_pointer(bdd_t *f) |
---|
814 | { |
---|
815 | return((void *)f->node); |
---|
816 | } |
---|
817 | |
---|
818 | bdd_t * |
---|
819 | bdd_then(bdd_t *f) |
---|
820 | { |
---|
821 | return bdd_construct_bdd_t(f->mgr, cmu_bdd_then(f->mgr, f->node)); |
---|
822 | } |
---|
823 | |
---|
824 | bdd_t * |
---|
825 | bdd_top_var(bdd_t *f) |
---|
826 | { |
---|
827 | return bdd_construct_bdd_t(f->mgr, cmu_bdd_if(f->mgr, f->node)); |
---|
828 | } |
---|
829 | |
---|
830 | bdd_t * |
---|
831 | bdd_xnor(bdd_t *f, bdd_t *g) |
---|
832 | { |
---|
833 | return bdd_construct_bdd_t(f->mgr, cmu_bdd_xnor(f->mgr, f->node, g->node)); |
---|
834 | } |
---|
835 | |
---|
836 | bdd_t * |
---|
837 | bdd_xor(bdd_t *f, bdd_t *g) |
---|
838 | { |
---|
839 | return bdd_construct_bdd_t(f->mgr, cmu_bdd_xor(f->mgr, f->node, g->node)); |
---|
840 | } |
---|
841 | |
---|
842 | bdd_t * |
---|
843 | bdd_zero(bdd_manager *manager) |
---|
844 | { |
---|
845 | cmu_bdd_manager mgr = (cmu_bdd_manager) manager; |
---|
846 | return bdd_construct_bdd_t(mgr, cmu_bdd_zero(mgr)); |
---|
847 | } |
---|
848 | |
---|
849 | /* |
---|
850 | Queries about BDD Formulas ---------------------------------------------------- |
---|
851 | */ |
---|
852 | |
---|
853 | boolean |
---|
854 | bdd_equal(bdd_t *f, bdd_t *g) |
---|
855 | { |
---|
856 | return (f->node == g->node); |
---|
857 | } |
---|
858 | |
---|
859 | boolean |
---|
860 | bdd_equal_mod_care_set(bdd_t *f, bdd_t *g, bdd_t *CareSet) |
---|
861 | { |
---|
862 | bdd_t *diffBdd; |
---|
863 | boolean result; |
---|
864 | |
---|
865 | if (bdd_equal(f, g)) |
---|
866 | return 1; |
---|
867 | |
---|
868 | diffBdd = bdd_xor(f, g); |
---|
869 | |
---|
870 | result = bdd_leq(diffBdd, CareSet, 1, 0); |
---|
871 | bdd_free(diffBdd); |
---|
872 | |
---|
873 | return(result); |
---|
874 | } |
---|
875 | |
---|
876 | bdd_t * |
---|
877 | bdd_intersects(bdd_t *f, bdd_t *g) |
---|
878 | { |
---|
879 | return bdd_construct_bdd_t(f->mgr, cmu_bdd_intersects(f->mgr, f->node, g->node)); |
---|
880 | } |
---|
881 | |
---|
882 | bdd_t * |
---|
883 | bdd_closest_cube(bdd_t *f, bdd_t *g, int *dist) |
---|
884 | { |
---|
885 | return (NULL); |
---|
886 | } |
---|
887 | |
---|
888 | boolean |
---|
889 | bdd_is_tautology(bdd_t *f, boolean phase) |
---|
890 | { |
---|
891 | return ((phase == TRUE) ? (f->node == cmu_bdd_one(f->mgr)) : (f->node == cmu_bdd_zero(f->mgr))); |
---|
892 | } |
---|
893 | |
---|
894 | boolean |
---|
895 | bdd_leq( |
---|
896 | bdd_t *f, |
---|
897 | bdd_t *g, |
---|
898 | boolean f_phase, |
---|
899 | boolean g_phase) |
---|
900 | { |
---|
901 | struct bdd_ *temp1, *temp2, *implies_fn; |
---|
902 | struct bdd_manager_ *mgr; |
---|
903 | boolean result_value; |
---|
904 | |
---|
905 | mgr = f->mgr; |
---|
906 | temp1 = ( (f_phase == TRUE) ? cmu_bdd_identity(mgr, f->node) : cmu_bdd_not(mgr, f->node)); |
---|
907 | temp2 = ( (g_phase == TRUE) ? cmu_bdd_identity(mgr, g->node) : cmu_bdd_not(mgr, g->node)); |
---|
908 | implies_fn = cmu_bdd_implies(mgr, temp1, temp2); /* returns a minterm of temp1*!temp2 */ |
---|
909 | result_value = (implies_fn == cmu_bdd_zero(mgr)); |
---|
910 | cmu_bdd_free(mgr, temp1); |
---|
911 | cmu_bdd_free(mgr, temp2); |
---|
912 | cmu_bdd_free(mgr, implies_fn); |
---|
913 | return result_value; |
---|
914 | } |
---|
915 | |
---|
916 | boolean |
---|
917 | bdd_lequal_mod_care_set( |
---|
918 | bdd_t *f, |
---|
919 | bdd_t *g, |
---|
920 | boolean f_phase, |
---|
921 | boolean g_phase, |
---|
922 | bdd_t *careSet) |
---|
923 | { |
---|
924 | bdd_t *temp; |
---|
925 | boolean result; |
---|
926 | |
---|
927 | if (bdd_leq(f, g, f_phase, g_phase)) |
---|
928 | return 1; |
---|
929 | |
---|
930 | temp = bdd_and(f, careSet, f_phase, 1); |
---|
931 | |
---|
932 | result = bdd_leq(temp, g, 1, g_phase); |
---|
933 | bdd_free(temp); |
---|
934 | |
---|
935 | return(result); |
---|
936 | } |
---|
937 | |
---|
938 | boolean |
---|
939 | bdd_leq_array( |
---|
940 | bdd_t *f, |
---|
941 | array_t *g_array, |
---|
942 | boolean f_phase, |
---|
943 | boolean g_phase) |
---|
944 | { |
---|
945 | int i; |
---|
946 | bdd_t *g; |
---|
947 | boolean result; |
---|
948 | |
---|
949 | arrayForEachItem(bdd_t *, g_array, i, g) { |
---|
950 | result = bdd_leq(f, g, f_phase, g_phase); |
---|
951 | if (g_phase) { |
---|
952 | if (!result) |
---|
953 | return(0); |
---|
954 | } else { |
---|
955 | if (result) |
---|
956 | return(1); |
---|
957 | } |
---|
958 | } |
---|
959 | if (g_phase) |
---|
960 | return(1); |
---|
961 | else |
---|
962 | return(0); |
---|
963 | } |
---|
964 | |
---|
965 | /* |
---|
966 | Statistics and Other Queries -------------------------------------------------- |
---|
967 | */ |
---|
968 | |
---|
969 | double |
---|
970 | bdd_count_onset( |
---|
971 | bdd_t *f, |
---|
972 | array_t *var_array /* of bdd_t *'s */) |
---|
973 | { |
---|
974 | int num_vars; |
---|
975 | double fraction; |
---|
976 | |
---|
977 | num_vars = array_n(var_array); |
---|
978 | fraction = cmu_bdd_satisfying_fraction(f->mgr, f->node); /* cannot give support vars */ |
---|
979 | return (fraction * pow((double) 2, (double) num_vars)); |
---|
980 | } |
---|
981 | |
---|
982 | /**Function******************************************************************** |
---|
983 | |
---|
984 | Synopsis [Counts the number of minterms in the on set.] |
---|
985 | |
---|
986 | SideEffects [] |
---|
987 | |
---|
988 | ******************************************************************************/ |
---|
989 | int |
---|
990 | bdd_epd_count_onset( |
---|
991 | bdd_t *f, |
---|
992 | array_t *var_array /* of bdd_t *'s */, |
---|
993 | EpDouble *epd) |
---|
994 | { |
---|
995 | double nMinterms; |
---|
996 | |
---|
997 | nMinterms = bdd_count_onset(f, var_array); |
---|
998 | EpdConvert(nMinterms, epd); |
---|
999 | return 0; |
---|
1000 | } /* end of bdd_epd_count_onset */ |
---|
1001 | |
---|
1002 | int |
---|
1003 | bdd_get_free(bdd_t *f) |
---|
1004 | { |
---|
1005 | return (f->free); |
---|
1006 | } |
---|
1007 | |
---|
1008 | bdd_manager * |
---|
1009 | bdd_get_manager(bdd_t *f) |
---|
1010 | { |
---|
1011 | return (bdd_manager *) (f->mgr); |
---|
1012 | } |
---|
1013 | |
---|
1014 | bdd_node * |
---|
1015 | bdd_get_node( |
---|
1016 | bdd_t *f, |
---|
1017 | boolean *is_complemented /* return */) |
---|
1018 | { |
---|
1019 | *is_complemented = (boolean) TAG0(f->node); /* using bddint.h */ |
---|
1020 | return ((bdd_node *) BDD_POINTER(f->node)); /* using bddint.h */ |
---|
1021 | } |
---|
1022 | |
---|
1023 | var_set_t * |
---|
1024 | bdd_get_support(bdd_t *f) |
---|
1025 | { |
---|
1026 | struct bdd_ **support, *var; |
---|
1027 | struct bdd_manager_ *mgr; |
---|
1028 | long num_vars; |
---|
1029 | var_set_t *result; |
---|
1030 | int id, i; |
---|
1031 | |
---|
1032 | mgr = f->mgr; |
---|
1033 | num_vars = cmu_bdd_vars(mgr); |
---|
1034 | |
---|
1035 | result = var_set_new((int) num_vars); |
---|
1036 | support = (struct bdd_ **) mem_get_block((num_vars+1) * sizeof(struct bdd_ *)); |
---|
1037 | (void) cmu_bdd_support(mgr, f->node, support); |
---|
1038 | |
---|
1039 | for (i = 0; i < num_vars; ++i) { /* can never have more than num_var non-zero entries in array */ |
---|
1040 | var = support[i]; |
---|
1041 | if (var == (struct bdd_ *) 0) { |
---|
1042 | break; /* have reach end of null-terminated array */ |
---|
1043 | } |
---|
1044 | id = (int) (cmu_bdd_if_id(mgr, var) - 1); /* a variable is never garbage collected, so no need to free */ |
---|
1045 | var_set_set_elt(result, id); |
---|
1046 | } |
---|
1047 | |
---|
1048 | mem_free_block((pointer)support); |
---|
1049 | |
---|
1050 | return result; |
---|
1051 | } |
---|
1052 | |
---|
1053 | int |
---|
1054 | bdd_is_support_var(bdd_t *f, bdd_t *var) |
---|
1055 | { |
---|
1056 | return(bdd_is_support_var_id(f, bdd_top_var_id(var))); |
---|
1057 | } |
---|
1058 | |
---|
1059 | int |
---|
1060 | bdd_is_support_var_id(bdd_t *f, int index) |
---|
1061 | { |
---|
1062 | struct bdd_ **support, *var; |
---|
1063 | struct bdd_manager_ *mgr; |
---|
1064 | long num_vars; |
---|
1065 | int id, i; |
---|
1066 | |
---|
1067 | mgr = f->mgr; |
---|
1068 | num_vars = cmu_bdd_vars(mgr); |
---|
1069 | |
---|
1070 | support = (struct bdd_ **) mem_get_block((num_vars+1) * sizeof(struct bdd_ *)); |
---|
1071 | (void) cmu_bdd_support(mgr, f->node, support); |
---|
1072 | |
---|
1073 | for (i = 0; i < num_vars; ++i) { /* can never have more than num_var non-zero entries in array */ |
---|
1074 | var = support[i]; |
---|
1075 | if (var == (struct bdd_ *) 0) { |
---|
1076 | break; /* have reach end of null-terminated array */ |
---|
1077 | } |
---|
1078 | id = (int) (cmu_bdd_if_id(mgr, var) - 1); /* a variable is never garbage collected, so no need to free */ |
---|
1079 | if (id == index) { |
---|
1080 | mem_free_block((pointer)support); |
---|
1081 | return 1; |
---|
1082 | } |
---|
1083 | } |
---|
1084 | |
---|
1085 | mem_free_block((pointer)support); |
---|
1086 | |
---|
1087 | return 0; |
---|
1088 | } |
---|
1089 | |
---|
1090 | array_t * |
---|
1091 | bdd_get_varids(array_t *var_array) |
---|
1092 | { |
---|
1093 | int i; |
---|
1094 | bdd_t *var; |
---|
1095 | array_t *result; |
---|
1096 | |
---|
1097 | result = array_alloc(bdd_variableId, 0); |
---|
1098 | for (i = 0; i < array_n(var_array); i++) { |
---|
1099 | var = array_fetch(bdd_t *, var_array, i); |
---|
1100 | array_insert_last(bdd_variableId, result, bdd_top_var_id(var)); |
---|
1101 | } |
---|
1102 | return result; |
---|
1103 | } |
---|
1104 | |
---|
1105 | unsigned int |
---|
1106 | bdd_num_vars(bdd_manager *manager) |
---|
1107 | { |
---|
1108 | cmu_bdd_manager mgr = (cmu_bdd_manager) manager; |
---|
1109 | return (cmu_bdd_vars(mgr)); |
---|
1110 | } |
---|
1111 | |
---|
1112 | void |
---|
1113 | bdd_print(bdd_t *f) |
---|
1114 | { |
---|
1115 | cmu_bdd_print_bdd(f->mgr, f->node, bdd_naming_fn_none, bdd_terminal_id_fn_none, (pointer) 0, stdout); |
---|
1116 | } |
---|
1117 | |
---|
1118 | void |
---|
1119 | bdd_print_stats(bdd_manager *manager, FILE *file) |
---|
1120 | { |
---|
1121 | cmu_bdd_manager mgr = (cmu_bdd_manager) manager; |
---|
1122 | cmu_bdd_stats(mgr, file); |
---|
1123 | } |
---|
1124 | |
---|
1125 | /**Function******************************************************************** |
---|
1126 | |
---|
1127 | Synopsis [Sets the internal parameters of the package to the given values.] |
---|
1128 | |
---|
1129 | SideEffects [] |
---|
1130 | |
---|
1131 | ******************************************************************************/ |
---|
1132 | int |
---|
1133 | bdd_set_parameters( |
---|
1134 | bdd_manager *mgr, |
---|
1135 | avl_tree *valueTable, |
---|
1136 | FILE *file) |
---|
1137 | { |
---|
1138 | (void) fprintf(file, "Functionality not supported yet in the CMU package\n"); |
---|
1139 | return 1; |
---|
1140 | } /* End of bdd_set_parameters */ |
---|
1141 | |
---|
1142 | int |
---|
1143 | bdd_size(bdd_t *f) |
---|
1144 | { |
---|
1145 | return ((int) cmu_bdd_size(f->mgr, f->node, 1)); |
---|
1146 | } |
---|
1147 | |
---|
1148 | int |
---|
1149 | bdd_node_size(bdd_node *f) |
---|
1150 | { |
---|
1151 | return(0); |
---|
1152 | } |
---|
1153 | |
---|
1154 | long |
---|
1155 | bdd_size_multiple(array_t *bdd_array) |
---|
1156 | { |
---|
1157 | long result; |
---|
1158 | struct bdd_ **vector_bdd; |
---|
1159 | bdd_t *f; |
---|
1160 | int i; |
---|
1161 | struct bdd_manager_ *mgr; |
---|
1162 | |
---|
1163 | if ((bdd_array == NIL(array_t)) || (array_n(bdd_array) == 0)) |
---|
1164 | return 0; |
---|
1165 | |
---|
1166 | f = array_fetch(bdd_t*, bdd_array, 0); |
---|
1167 | mgr = f->mgr; |
---|
1168 | |
---|
1169 | vector_bdd = (struct bdd_ **) |
---|
1170 | malloc((array_n(bdd_array)+1)*sizeof(struct bdd_ *)); |
---|
1171 | |
---|
1172 | for(i=0; i<array_n(bdd_array);i++){ |
---|
1173 | f = array_fetch(bdd_t*, bdd_array, i); |
---|
1174 | vector_bdd[i] = f->node; |
---|
1175 | } |
---|
1176 | vector_bdd[array_n(bdd_array)] = 0; |
---|
1177 | result = cmu_bdd_size_multiple(mgr, vector_bdd,1); |
---|
1178 | FREE(vector_bdd); |
---|
1179 | return result; |
---|
1180 | } |
---|
1181 | |
---|
1182 | bdd_variableId |
---|
1183 | bdd_top_var_id(bdd_t *f) |
---|
1184 | { |
---|
1185 | return ((bdd_variableId) (cmu_bdd_if_id(f->mgr, f->node) - 1)); |
---|
1186 | } |
---|
1187 | |
---|
1188 | /* |
---|
1189 | Miscellaneous ----------------------------------------------------------------- |
---|
1190 | */ |
---|
1191 | |
---|
1192 | bdd_external_hooks * |
---|
1193 | bdd_get_external_hooks(bdd_manager *manager) |
---|
1194 | { |
---|
1195 | cmu_bdd_manager mgr = (cmu_bdd_manager) manager; |
---|
1196 | return ((bdd_external_hooks *) mgr->hooks); |
---|
1197 | } |
---|
1198 | |
---|
1199 | |
---|
1200 | void |
---|
1201 | bdd_set_gc_mode(bdd_manager *manager, boolean no_gc) |
---|
1202 | { |
---|
1203 | cmu_bdd_warning("bdd_set_gc_mode: translated to no-op in CMU package"); |
---|
1204 | } |
---|
1205 | |
---|
1206 | void |
---|
1207 | bdd_dynamic_reordering(bdd_manager *manager, bdd_reorder_type_t |
---|
1208 | algorithm_type, bdd_reorder_verbosity_t verbosity) |
---|
1209 | { |
---|
1210 | cmu_bdd_manager mgr = (cmu_bdd_manager) manager; |
---|
1211 | switch(algorithm_type) { |
---|
1212 | case BDD_REORDER_SIFT: |
---|
1213 | cmu_bdd_dynamic_reordering(mgr, cmu_bdd_reorder_sift); |
---|
1214 | break; |
---|
1215 | case BDD_REORDER_WINDOW: |
---|
1216 | cmu_bdd_dynamic_reordering(mgr, cmu_bdd_reorder_stable_window3); |
---|
1217 | break; |
---|
1218 | case BDD_REORDER_NONE: |
---|
1219 | cmu_bdd_dynamic_reordering(mgr, cmu_bdd_reorder_none); |
---|
1220 | break; |
---|
1221 | default: |
---|
1222 | fprintf(stderr,"CMU: bdd_dynamic_reordering: unknown algorithm type\n"); |
---|
1223 | fprintf(stderr,"Using SIFT method instead\n"); |
---|
1224 | cmu_bdd_dynamic_reordering(mgr, cmu_bdd_reorder_sift); |
---|
1225 | } |
---|
1226 | } |
---|
1227 | |
---|
1228 | void |
---|
1229 | bdd_dynamic_reordering_zdd(bdd_manager *manager, bdd_reorder_type_t |
---|
1230 | algorithm_type, bdd_reorder_verbosity_t verbosity) |
---|
1231 | { |
---|
1232 | return; |
---|
1233 | } |
---|
1234 | |
---|
1235 | void |
---|
1236 | bdd_reorder(bdd_manager *manager) |
---|
1237 | { |
---|
1238 | cmu_bdd_manager mgr = (cmu_bdd_manager) manager; |
---|
1239 | cmu_bdd_reorder(mgr); |
---|
1240 | } |
---|
1241 | |
---|
1242 | bdd_variableId |
---|
1243 | bdd_get_id_from_level(bdd_manager *manager, long level) |
---|
1244 | { |
---|
1245 | cmu_bdd_manager mgr = (cmu_bdd_manager) manager; |
---|
1246 | struct bdd_ *fn; |
---|
1247 | |
---|
1248 | fn = cmu_bdd_var_with_index(mgr, level); |
---|
1249 | |
---|
1250 | if (fn == (struct bdd_ *) 0) { |
---|
1251 | /* variable should always be found, since they are created at bdd_start */ |
---|
1252 | cmu_bdd_fatal("bdd_get_id_from_level: assumption violated"); |
---|
1253 | } |
---|
1254 | |
---|
1255 | return ((bdd_variableId)(cmu_bdd_if_id(mgr, fn) - 1 )); |
---|
1256 | |
---|
1257 | } |
---|
1258 | |
---|
1259 | long |
---|
1260 | bdd_top_var_level(bdd_manager *manager, bdd_t *fn) |
---|
1261 | { |
---|
1262 | cmu_bdd_manager mgr = (cmu_bdd_manager) manager; |
---|
1263 | return cmu_bdd_if_index(mgr, fn->node); |
---|
1264 | } |
---|
1265 | |
---|
1266 | /* |
---|
1267 | * Return TRUE if f is a cube, else return FALSE. |
---|
1268 | */ |
---|
1269 | boolean |
---|
1270 | bdd_is_cube(bdd_t *f) |
---|
1271 | { |
---|
1272 | struct bdd_manager_ *manager; |
---|
1273 | |
---|
1274 | if (f == NIL(bdd_t)) { |
---|
1275 | fail("bdd_is_cube: invalid BDD"); |
---|
1276 | } |
---|
1277 | if( f->free ) fail ("Freed Bdd passed to bdd_is_cube"); |
---|
1278 | manager = f->mgr; |
---|
1279 | return ((boolean)cmu_bdd_is_cube(manager, f->node)); |
---|
1280 | } |
---|
1281 | |
---|
1282 | bdd_block * |
---|
1283 | bdd_new_var_block(bdd_t *f, long length) |
---|
1284 | { |
---|
1285 | struct bdd_manager_ *manager; |
---|
1286 | if (f == NIL(bdd_t)) { |
---|
1287 | fail("bdd_new_var_block: invalid BDD"); |
---|
1288 | } |
---|
1289 | manager = f->mgr; |
---|
1290 | return (bdd_block *)cmu_bdd_new_var_block(manager, f->node, length); |
---|
1291 | } |
---|
1292 | |
---|
1293 | bdd_t * |
---|
1294 | bdd_var_with_index(bdd_manager *manager, int index) |
---|
1295 | { |
---|
1296 | return bdd_construct_bdd_t(manager, |
---|
1297 | cmu_bdd_var_with_index((cmu_bdd_manager) manager, |
---|
1298 | index)); |
---|
1299 | } |
---|
1300 | |
---|
1301 | bdd_t * |
---|
1302 | bdd_compact(bdd_t *f, bdd_t *g) |
---|
1303 | { |
---|
1304 | return (NULL); |
---|
1305 | } |
---|
1306 | |
---|
1307 | |
---|
1308 | bdd_t * |
---|
1309 | bdd_squeeze(bdd_t *f, bdd_t *g) |
---|
1310 | { |
---|
1311 | return (NULL); |
---|
1312 | } |
---|
1313 | |
---|
1314 | double |
---|
1315 | bdd_correlation(bdd_t *f, bdd_t *g) |
---|
1316 | { |
---|
1317 | return (0.0); |
---|
1318 | } |
---|
1319 | |
---|
1320 | /**Function******************************************************************** |
---|
1321 | |
---|
1322 | Synopsis [Dummy functions defined in bdd.h] |
---|
1323 | |
---|
1324 | SideEffects [] |
---|
1325 | |
---|
1326 | ******************************************************************************/ |
---|
1327 | int |
---|
1328 | bdd_reordering_status( |
---|
1329 | bdd_manager *mgr, |
---|
1330 | bdd_reorder_type_t *method) |
---|
1331 | { |
---|
1332 | return 0; |
---|
1333 | } |
---|
1334 | |
---|
1335 | /**Function******************************************************************** |
---|
1336 | |
---|
1337 | Synopsis [Dummy functions defined in bdd.h] |
---|
1338 | |
---|
1339 | SideEffects [] |
---|
1340 | |
---|
1341 | ******************************************************************************/ |
---|
1342 | |
---|
1343 | bdd_t * |
---|
1344 | bdd_compute_cube( |
---|
1345 | bdd_manager *mgr, |
---|
1346 | array_t *vars) |
---|
1347 | { |
---|
1348 | return NIL(bdd_t); |
---|
1349 | } |
---|
1350 | |
---|
1351 | bdd_t * |
---|
1352 | bdd_compute_cube_with_phase( |
---|
1353 | bdd_manager *mgr, |
---|
1354 | array_t *vars, |
---|
1355 | array_t *phase) |
---|
1356 | { |
---|
1357 | return NIL(bdd_t); |
---|
1358 | } |
---|
1359 | |
---|
1360 | bdd_t * |
---|
1361 | bdd_clipping_and_smooth( |
---|
1362 | bdd_t *f, |
---|
1363 | bdd_t *g, |
---|
1364 | array_t *smoothing_vars /* of bdd_t *'s */, |
---|
1365 | int maxDepth, |
---|
1366 | int over) |
---|
1367 | { |
---|
1368 | return NIL(bdd_t); |
---|
1369 | } |
---|
1370 | |
---|
1371 | bdd_t * |
---|
1372 | bdd_approx_hb( |
---|
1373 | bdd_t *f, |
---|
1374 | bdd_approx_dir_t approxDir, |
---|
1375 | int numVars, |
---|
1376 | int threshold) |
---|
1377 | { |
---|
1378 | return NIL(bdd_t); |
---|
1379 | } |
---|
1380 | |
---|
1381 | bdd_t * |
---|
1382 | bdd_approx_sp( |
---|
1383 | bdd_t *f, |
---|
1384 | bdd_approx_dir_t approxDir, |
---|
1385 | int numVars, |
---|
1386 | int threshold, |
---|
1387 | int hardlimit) |
---|
1388 | { |
---|
1389 | return NIL(bdd_t); |
---|
1390 | } |
---|
1391 | |
---|
1392 | bdd_t * |
---|
1393 | bdd_approx_ua( |
---|
1394 | bdd_t *f, |
---|
1395 | bdd_approx_dir_t approxDir, |
---|
1396 | int numVars, |
---|
1397 | int threshold, |
---|
1398 | int safe, |
---|
1399 | double quality) |
---|
1400 | { |
---|
1401 | return NIL(bdd_t); |
---|
1402 | } |
---|
1403 | |
---|
1404 | bdd_t * |
---|
1405 | bdd_approx_remap_ua( |
---|
1406 | bdd_t *f, |
---|
1407 | bdd_approx_dir_t approxDir, |
---|
1408 | int numVars, |
---|
1409 | int threshold, |
---|
1410 | double quality) |
---|
1411 | { |
---|
1412 | return NIL(bdd_t); |
---|
1413 | } |
---|
1414 | |
---|
1415 | bdd_t * |
---|
1416 | bdd_approx_biased_rua( |
---|
1417 | bdd_t *f, |
---|
1418 | bdd_approx_dir_t approxDir, |
---|
1419 | bdd_t *bias, |
---|
1420 | int numVars, |
---|
1421 | int threshold, |
---|
1422 | double quality, |
---|
1423 | double quality1) |
---|
1424 | { |
---|
1425 | return NIL(bdd_t); |
---|
1426 | } |
---|
1427 | |
---|
1428 | bdd_t * |
---|
1429 | bdd_approx_compress( |
---|
1430 | bdd_t *f, |
---|
1431 | bdd_approx_dir_t approxDir, |
---|
1432 | int numVars, |
---|
1433 | int threshold) |
---|
1434 | { |
---|
1435 | return NIL(bdd_t); |
---|
1436 | } |
---|
1437 | |
---|
1438 | int |
---|
1439 | bdd_gen_decomp( |
---|
1440 | bdd_t *f, |
---|
1441 | bdd_partition_type_t partType, |
---|
1442 | bdd_t ***conjArray) |
---|
1443 | { |
---|
1444 | return 0; |
---|
1445 | } |
---|
1446 | |
---|
1447 | int |
---|
1448 | bdd_var_decomp( |
---|
1449 | bdd_t *f, |
---|
1450 | bdd_partition_type_t partType, |
---|
1451 | bdd_t ***conjArray) |
---|
1452 | { |
---|
1453 | return 0; |
---|
1454 | } |
---|
1455 | |
---|
1456 | int |
---|
1457 | bdd_approx_decomp( |
---|
1458 | bdd_t *f, |
---|
1459 | bdd_partition_type_t partType, |
---|
1460 | bdd_t ***conjArray) |
---|
1461 | { |
---|
1462 | return 0; |
---|
1463 | } |
---|
1464 | |
---|
1465 | int |
---|
1466 | bdd_iter_decomp( |
---|
1467 | bdd_t *f, |
---|
1468 | bdd_partition_type_t partType, |
---|
1469 | bdd_t ***conjArray) |
---|
1470 | { |
---|
1471 | return 0; |
---|
1472 | } |
---|
1473 | |
---|
1474 | int |
---|
1475 | bdd_add_hook( |
---|
1476 | bdd_manager *mgr, |
---|
1477 | int (*procedure)(bdd_manager *, char *, void *), |
---|
1478 | bdd_hook_type_t whichHook) |
---|
1479 | { |
---|
1480 | return 0; |
---|
1481 | } |
---|
1482 | |
---|
1483 | int |
---|
1484 | bdd_remove_hook( |
---|
1485 | bdd_manager *mgr, |
---|
1486 | int (*procedure)(bdd_manager *, char *, void *), |
---|
1487 | bdd_hook_type_t whichHook) |
---|
1488 | { |
---|
1489 | return 0; |
---|
1490 | } |
---|
1491 | |
---|
1492 | int |
---|
1493 | bdd_enable_reordering_reporting(bdd_manager *mgr) |
---|
1494 | { |
---|
1495 | return 0; |
---|
1496 | } |
---|
1497 | |
---|
1498 | int |
---|
1499 | bdd_disable_reordering_reporting(bdd_manager *mgr) |
---|
1500 | { |
---|
1501 | return 0; |
---|
1502 | } |
---|
1503 | |
---|
1504 | bdd_reorder_verbosity_t |
---|
1505 | bdd_reordering_reporting(bdd_manager *mgr) |
---|
1506 | { |
---|
1507 | return BDD_REORDER_VERBOSITY_DEFAULT; |
---|
1508 | } |
---|
1509 | |
---|
1510 | int |
---|
1511 | bdd_print_apa_minterm( |
---|
1512 | FILE *fp, |
---|
1513 | bdd_t *f, |
---|
1514 | int nvars, |
---|
1515 | int precision) |
---|
1516 | { |
---|
1517 | return 0; |
---|
1518 | } |
---|
1519 | |
---|
1520 | int |
---|
1521 | bdd_apa_compare_ratios( |
---|
1522 | int nvars, |
---|
1523 | bdd_t *f1, |
---|
1524 | bdd_t *f2, |
---|
1525 | int f1Num, |
---|
1526 | int f2Num) |
---|
1527 | { |
---|
1528 | return 0; |
---|
1529 | } |
---|
1530 | |
---|
1531 | int |
---|
1532 | bdd_read_node_count(bdd_manager *mgr) |
---|
1533 | { |
---|
1534 | return 0; |
---|
1535 | } |
---|
1536 | |
---|
1537 | |
---|
1538 | int |
---|
1539 | bdd_reordering_zdd_status( |
---|
1540 | bdd_manager *mgr, |
---|
1541 | bdd_reorder_type_t *method) |
---|
1542 | { |
---|
1543 | return 0; |
---|
1544 | } |
---|
1545 | |
---|
1546 | |
---|
1547 | bdd_node * |
---|
1548 | bdd_bdd_to_add( |
---|
1549 | bdd_manager *mgr, |
---|
1550 | bdd_node *fn) |
---|
1551 | { |
---|
1552 | return NIL(bdd_node); |
---|
1553 | } |
---|
1554 | |
---|
1555 | bdd_node * |
---|
1556 | bdd_add_permute( |
---|
1557 | bdd_manager *mgr, |
---|
1558 | bdd_node *fn, |
---|
1559 | int *permut) |
---|
1560 | { |
---|
1561 | return NIL(bdd_node); |
---|
1562 | } |
---|
1563 | |
---|
1564 | bdd_node * |
---|
1565 | bdd_bdd_permute( |
---|
1566 | bdd_manager *mgr, |
---|
1567 | bdd_node *fn, |
---|
1568 | int *permut) |
---|
1569 | { |
---|
1570 | return NIL(bdd_node); |
---|
1571 | } |
---|
1572 | |
---|
1573 | void |
---|
1574 | bdd_ref(bdd_node *fn) |
---|
1575 | { |
---|
1576 | return ; |
---|
1577 | } |
---|
1578 | |
---|
1579 | |
---|
1580 | void |
---|
1581 | bdd_recursive_deref(bdd_manager *mgr, bdd_node *f) |
---|
1582 | { |
---|
1583 | return; |
---|
1584 | } |
---|
1585 | |
---|
1586 | |
---|
1587 | bdd_node * |
---|
1588 | bdd_add_exist_abstract( |
---|
1589 | bdd_manager *mgr, |
---|
1590 | bdd_node *fn, |
---|
1591 | bdd_node *vars) |
---|
1592 | { |
---|
1593 | return NIL(bdd_node); |
---|
1594 | } |
---|
1595 | |
---|
1596 | |
---|
1597 | bdd_node * |
---|
1598 | bdd_add_apply( |
---|
1599 | bdd_manager *mgr, |
---|
1600 | bdd_node *(*operation)(bdd_manager *, bdd_node **, bdd_node **), |
---|
1601 | bdd_node *fn1, |
---|
1602 | bdd_node *fn2) |
---|
1603 | { |
---|
1604 | return NIL(bdd_node); |
---|
1605 | } |
---|
1606 | |
---|
1607 | |
---|
1608 | bdd_node * |
---|
1609 | bdd_add_nonsim_compose( |
---|
1610 | bdd_manager *mgr, |
---|
1611 | bdd_node *fn, |
---|
1612 | bdd_node **vector) |
---|
1613 | { |
---|
1614 | return NIL(bdd_node); |
---|
1615 | } |
---|
1616 | |
---|
1617 | |
---|
1618 | bdd_node * |
---|
1619 | bdd_add_residue( |
---|
1620 | bdd_manager *mgr, |
---|
1621 | int n, |
---|
1622 | int m, |
---|
1623 | int options, |
---|
1624 | int top) |
---|
1625 | { |
---|
1626 | return NIL(bdd_node); |
---|
1627 | } |
---|
1628 | |
---|
1629 | |
---|
1630 | bdd_node * |
---|
1631 | bdd_add_vector_compose( |
---|
1632 | bdd_manager *mgr, |
---|
1633 | bdd_node *fn, |
---|
1634 | bdd_node **vector) |
---|
1635 | { |
---|
1636 | return NIL(bdd_node); |
---|
1637 | } |
---|
1638 | |
---|
1639 | |
---|
1640 | bdd_node * |
---|
1641 | bdd_add_times( |
---|
1642 | bdd_manager *mgr, |
---|
1643 | bdd_node **fn1, |
---|
1644 | bdd_node **fn2) |
---|
1645 | { |
---|
1646 | return NIL(bdd_node); |
---|
1647 | } |
---|
1648 | |
---|
1649 | |
---|
1650 | int |
---|
1651 | bdd_check_zero_ref(bdd_manager *mgr) |
---|
1652 | { |
---|
1653 | return 0; |
---|
1654 | } |
---|
1655 | |
---|
1656 | |
---|
1657 | void |
---|
1658 | bdd_dynamic_reordering_disable(bdd_manager *mgr) |
---|
1659 | { |
---|
1660 | return; |
---|
1661 | } |
---|
1662 | |
---|
1663 | void |
---|
1664 | bdd_dynamic_reordering_zdd_disable(bdd_manager *mgr) |
---|
1665 | { |
---|
1666 | return; |
---|
1667 | } |
---|
1668 | |
---|
1669 | |
---|
1670 | bdd_node * |
---|
1671 | bdd_add_xnor( |
---|
1672 | bdd_manager *mgr, |
---|
1673 | bdd_node **fn1, |
---|
1674 | bdd_node **fn2) |
---|
1675 | { |
---|
1676 | return NIL(bdd_node); |
---|
1677 | } |
---|
1678 | |
---|
1679 | |
---|
1680 | int |
---|
1681 | bdd_shuffle_heap( |
---|
1682 | bdd_manager *mgr, |
---|
1683 | int *permut) |
---|
1684 | { |
---|
1685 | return 0; |
---|
1686 | } |
---|
1687 | |
---|
1688 | |
---|
1689 | bdd_node * |
---|
1690 | bdd_add_compose( |
---|
1691 | bdd_manager *mgr, |
---|
1692 | bdd_node *fn1, |
---|
1693 | bdd_node *fn2, |
---|
1694 | int var) |
---|
1695 | { |
---|
1696 | return NIL(bdd_node); |
---|
1697 | } |
---|
1698 | |
---|
1699 | |
---|
1700 | bdd_node * |
---|
1701 | bdd_add_ith_var( |
---|
1702 | bdd_manager *mgr, |
---|
1703 | int i) |
---|
1704 | { |
---|
1705 | return NIL(bdd_node); |
---|
1706 | } |
---|
1707 | |
---|
1708 | |
---|
1709 | int |
---|
1710 | bdd_get_level_from_id( |
---|
1711 | bdd_manager *mgr, |
---|
1712 | int id) |
---|
1713 | { |
---|
1714 | return 0; |
---|
1715 | } |
---|
1716 | |
---|
1717 | |
---|
1718 | bdd_node * |
---|
1719 | bdd_bdd_exist_abstract( |
---|
1720 | bdd_manager *mgr, |
---|
1721 | bdd_node *fn, |
---|
1722 | bdd_node *cube) |
---|
1723 | { |
---|
1724 | return NIL(bdd_node); |
---|
1725 | } |
---|
1726 | |
---|
1727 | |
---|
1728 | int |
---|
1729 | bdd_equal_sup_norm( |
---|
1730 | bdd_manager *mgr, |
---|
1731 | bdd_node *fn, |
---|
1732 | bdd_node *gn, |
---|
1733 | BDD_VALUE_TYPE tolerance, |
---|
1734 | int pr) |
---|
1735 | { |
---|
1736 | return 0; |
---|
1737 | } |
---|
1738 | |
---|
1739 | |
---|
1740 | bdd_node * |
---|
1741 | bdd_read_logic_zero(bdd_manager *mgr) |
---|
1742 | { |
---|
1743 | return NIL(bdd_node); |
---|
1744 | } |
---|
1745 | |
---|
1746 | |
---|
1747 | bdd_node * |
---|
1748 | bdd_bdd_ith_var(bdd_manager *mgr, int i) |
---|
1749 | { |
---|
1750 | return NIL(bdd_node); |
---|
1751 | } |
---|
1752 | |
---|
1753 | |
---|
1754 | bdd_node * |
---|
1755 | bdd_add_divide( |
---|
1756 | bdd_manager *mgr, |
---|
1757 | bdd_node **fn1, |
---|
1758 | bdd_node **fn2) |
---|
1759 | { |
---|
1760 | return NIL(bdd_node); |
---|
1761 | } |
---|
1762 | |
---|
1763 | |
---|
1764 | bdd_node * |
---|
1765 | bdd_bdd_constrain( |
---|
1766 | bdd_manager *mgr, |
---|
1767 | bdd_node *f, |
---|
1768 | bdd_node *c) |
---|
1769 | { |
---|
1770 | return NIL(bdd_node); |
---|
1771 | } |
---|
1772 | |
---|
1773 | bdd_node * |
---|
1774 | bdd_bdd_restrict( |
---|
1775 | bdd_manager *mgr, |
---|
1776 | bdd_node *f, |
---|
1777 | bdd_node *c) |
---|
1778 | { |
---|
1779 | return NIL(bdd_node); |
---|
1780 | } |
---|
1781 | |
---|
1782 | |
---|
1783 | bdd_node * |
---|
1784 | bdd_add_hamming( |
---|
1785 | bdd_manager *mgr, |
---|
1786 | bdd_node **xVars, |
---|
1787 | bdd_node **yVars, |
---|
1788 | int nVars) |
---|
1789 | { |
---|
1790 | return NIL(bdd_node); |
---|
1791 | } |
---|
1792 | |
---|
1793 | |
---|
1794 | bdd_node * |
---|
1795 | bdd_add_ite( |
---|
1796 | bdd_manager *mgr, |
---|
1797 | bdd_node *f, |
---|
1798 | bdd_node *g, |
---|
1799 | bdd_node *h) |
---|
1800 | { |
---|
1801 | return NIL(bdd_node); |
---|
1802 | } |
---|
1803 | |
---|
1804 | |
---|
1805 | bdd_node * |
---|
1806 | bdd_add_find_max( |
---|
1807 | bdd_manager *mgr, |
---|
1808 | bdd_node *f) |
---|
1809 | { |
---|
1810 | return NIL(bdd_node); |
---|
1811 | } |
---|
1812 | |
---|
1813 | |
---|
1814 | int |
---|
1815 | bdd_bdd_pick_one_cube( |
---|
1816 | bdd_manager *mgr, |
---|
1817 | bdd_node *node, |
---|
1818 | char *string) |
---|
1819 | { |
---|
1820 | return 0; |
---|
1821 | } |
---|
1822 | |
---|
1823 | |
---|
1824 | bdd_node * |
---|
1825 | bdd_add_swap_variables( |
---|
1826 | bdd_manager *mgr, |
---|
1827 | bdd_node *f, |
---|
1828 | bdd_node **x, |
---|
1829 | bdd_node **y, |
---|
1830 | int n) |
---|
1831 | { |
---|
1832 | return NIL(bdd_node); |
---|
1833 | } |
---|
1834 | |
---|
1835 | bdd_node * |
---|
1836 | bdd_bdd_swap_variables( |
---|
1837 | bdd_manager *mgr, |
---|
1838 | bdd_node *f, |
---|
1839 | bdd_node **x, |
---|
1840 | bdd_node **y, |
---|
1841 | int n) |
---|
1842 | { |
---|
1843 | return NIL(bdd_node); |
---|
1844 | } |
---|
1845 | |
---|
1846 | |
---|
1847 | bdd_node * |
---|
1848 | bdd_bdd_or( |
---|
1849 | bdd_manager *mgr, |
---|
1850 | bdd_node *f, |
---|
1851 | bdd_node *g) |
---|
1852 | { |
---|
1853 | return NIL(bdd_node); |
---|
1854 | } |
---|
1855 | |
---|
1856 | |
---|
1857 | bdd_node * |
---|
1858 | bdd_bdd_compute_cube( |
---|
1859 | bdd_manager *mgr, |
---|
1860 | bdd_node **vars, |
---|
1861 | int *phase, |
---|
1862 | int n) |
---|
1863 | { |
---|
1864 | return NIL(bdd_node); |
---|
1865 | } |
---|
1866 | |
---|
1867 | |
---|
1868 | bdd_node * |
---|
1869 | bdd_indices_to_cube( |
---|
1870 | bdd_manager *mgr, |
---|
1871 | int *idArray, |
---|
1872 | int n) |
---|
1873 | { |
---|
1874 | return NIL(bdd_node); |
---|
1875 | } |
---|
1876 | |
---|
1877 | bdd_node * |
---|
1878 | bdd_bdd_and( |
---|
1879 | bdd_manager *mgr, |
---|
1880 | bdd_node *f, |
---|
1881 | bdd_node *g) |
---|
1882 | { |
---|
1883 | return NIL(bdd_node); |
---|
1884 | } |
---|
1885 | |
---|
1886 | |
---|
1887 | bdd_node * |
---|
1888 | bdd_add_matrix_multiply( |
---|
1889 | bdd_manager *mgr, |
---|
1890 | bdd_node *A, |
---|
1891 | bdd_node *B, |
---|
1892 | bdd_node **z, |
---|
1893 | int nz) |
---|
1894 | { |
---|
1895 | return NIL(bdd_node); |
---|
1896 | } |
---|
1897 | |
---|
1898 | |
---|
1899 | bdd_node * |
---|
1900 | bdd_add_compute_cube( |
---|
1901 | bdd_manager *mgr, |
---|
1902 | bdd_node **vars, |
---|
1903 | int *phase, |
---|
1904 | int n) |
---|
1905 | { |
---|
1906 | return NIL(bdd_node); |
---|
1907 | } |
---|
1908 | |
---|
1909 | |
---|
1910 | bdd_node * |
---|
1911 | bdd_add_const( |
---|
1912 | bdd_manager *mgr, |
---|
1913 | BDD_VALUE_TYPE c) |
---|
1914 | { |
---|
1915 | return NIL(bdd_node); |
---|
1916 | } |
---|
1917 | |
---|
1918 | |
---|
1919 | double |
---|
1920 | bdd_count_minterm( |
---|
1921 | bdd_manager *mgr, |
---|
1922 | bdd_node *f, |
---|
1923 | int n) |
---|
1924 | { |
---|
1925 | return 0; |
---|
1926 | } |
---|
1927 | |
---|
1928 | |
---|
1929 | bdd_node * |
---|
1930 | bdd_add_bdd_threshold( |
---|
1931 | bdd_manager *mgr, |
---|
1932 | bdd_node *f, |
---|
1933 | BDD_VALUE_TYPE value) |
---|
1934 | { |
---|
1935 | return NIL(bdd_node); |
---|
1936 | } |
---|
1937 | |
---|
1938 | |
---|
1939 | bdd_node * |
---|
1940 | bdd_add_bdd_strict_threshold( |
---|
1941 | bdd_manager *mgr, |
---|
1942 | bdd_node *f, |
---|
1943 | BDD_VALUE_TYPE value) |
---|
1944 | { |
---|
1945 | return NIL(bdd_node); |
---|
1946 | } |
---|
1947 | |
---|
1948 | BDD_VALUE_TYPE |
---|
1949 | bdd_read_epsilon(bdd_manager *mgr) |
---|
1950 | { |
---|
1951 | return 0; |
---|
1952 | } |
---|
1953 | |
---|
1954 | bdd_node * |
---|
1955 | bdd_read_one(bdd_manager *mgr) |
---|
1956 | { |
---|
1957 | return NIL(bdd_node); |
---|
1958 | } |
---|
1959 | |
---|
1960 | |
---|
1961 | bdd_node * |
---|
1962 | bdd_bdd_pick_one_minterm( |
---|
1963 | bdd_manager *mgr, |
---|
1964 | bdd_node *f, |
---|
1965 | bdd_node **vars, |
---|
1966 | int n) |
---|
1967 | { |
---|
1968 | return NIL(bdd_node); |
---|
1969 | } |
---|
1970 | |
---|
1971 | |
---|
1972 | bdd_t * |
---|
1973 | bdd_pick_one_minterm( |
---|
1974 | bdd_t *f, |
---|
1975 | array_t *varsArray) |
---|
1976 | { |
---|
1977 | return NIL(bdd_t); |
---|
1978 | } |
---|
1979 | |
---|
1980 | |
---|
1981 | array_t * |
---|
1982 | bdd_bdd_pick_arbitrary_minterms( |
---|
1983 | bdd_t *f, |
---|
1984 | array_t *varsArray, |
---|
1985 | int n, |
---|
1986 | int k) |
---|
1987 | { |
---|
1988 | return NIL(array_t); |
---|
1989 | } |
---|
1990 | |
---|
1991 | bdd_node * |
---|
1992 | bdd_read_zero(bdd_manager *mgr) |
---|
1993 | { |
---|
1994 | return NIL(bdd_node); |
---|
1995 | } |
---|
1996 | |
---|
1997 | |
---|
1998 | bdd_node * |
---|
1999 | bdd_bdd_new_var(bdd_manager *mgr) |
---|
2000 | { |
---|
2001 | return NIL(bdd_node); |
---|
2002 | } |
---|
2003 | |
---|
2004 | |
---|
2005 | bdd_node * |
---|
2006 | bdd_bdd_and_abstract( |
---|
2007 | bdd_manager *mgr, |
---|
2008 | bdd_node *f, |
---|
2009 | bdd_node *g, |
---|
2010 | bdd_node *cube) |
---|
2011 | { |
---|
2012 | return NIL(bdd_node); |
---|
2013 | } |
---|
2014 | |
---|
2015 | void |
---|
2016 | bdd_deref(bdd_node *f) |
---|
2017 | { |
---|
2018 | } |
---|
2019 | |
---|
2020 | bdd_node * |
---|
2021 | bdd_add_plus( |
---|
2022 | bdd_manager *mgr, |
---|
2023 | bdd_node **fn1, |
---|
2024 | bdd_node **fn2) |
---|
2025 | { |
---|
2026 | return NIL(bdd_node); |
---|
2027 | } |
---|
2028 | |
---|
2029 | |
---|
2030 | int |
---|
2031 | bdd_read_reorderings(bdd_manager *mgr) |
---|
2032 | { |
---|
2033 | return 0; |
---|
2034 | } |
---|
2035 | |
---|
2036 | int |
---|
2037 | bdd_read_next_reordering(bdd_manager *mgr) |
---|
2038 | { |
---|
2039 | return 0; |
---|
2040 | } |
---|
2041 | |
---|
2042 | void |
---|
2043 | bdd_set_next_reordering(bdd_manager *mgr, int next) |
---|
2044 | { |
---|
2045 | } |
---|
2046 | |
---|
2047 | |
---|
2048 | bdd_node * |
---|
2049 | bdd_bdd_xnor( |
---|
2050 | bdd_manager *mgr, |
---|
2051 | bdd_node *f, |
---|
2052 | bdd_node *g) |
---|
2053 | { |
---|
2054 | return NIL(bdd_node); |
---|
2055 | } |
---|
2056 | |
---|
2057 | bdd_node * |
---|
2058 | bdd_bdd_vector_compose( |
---|
2059 | bdd_manager *mgr, |
---|
2060 | bdd_node *f, |
---|
2061 | bdd_node **vector) |
---|
2062 | { |
---|
2063 | return NIL(bdd_node); |
---|
2064 | } |
---|
2065 | |
---|
2066 | bdd_node * |
---|
2067 | bdd_extract_node_as_is(bdd_t *fn) |
---|
2068 | { |
---|
2069 | return NIL(bdd_node); |
---|
2070 | } |
---|
2071 | |
---|
2072 | |
---|
2073 | bdd_node * |
---|
2074 | bdd_zdd_get_node( |
---|
2075 | bdd_manager *mgr, |
---|
2076 | int id, |
---|
2077 | bdd_node *g, |
---|
2078 | bdd_node *h) |
---|
2079 | { |
---|
2080 | return NIL(bdd_node); |
---|
2081 | } |
---|
2082 | |
---|
2083 | bdd_node * |
---|
2084 | bdd_zdd_product( |
---|
2085 | bdd_manager *mgr, |
---|
2086 | bdd_node *f, |
---|
2087 | bdd_node *g) |
---|
2088 | { |
---|
2089 | return NIL(bdd_node); |
---|
2090 | } |
---|
2091 | |
---|
2092 | bdd_node * |
---|
2093 | bdd_zdd_product_recur( |
---|
2094 | bdd_manager *mgr, |
---|
2095 | bdd_node *f, |
---|
2096 | bdd_node *g) |
---|
2097 | { |
---|
2098 | return NIL(bdd_node); |
---|
2099 | } |
---|
2100 | |
---|
2101 | |
---|
2102 | bdd_node * |
---|
2103 | bdd_zdd_union( |
---|
2104 | bdd_manager *mgr, |
---|
2105 | bdd_node *f, |
---|
2106 | bdd_node *g) |
---|
2107 | { |
---|
2108 | return NIL(bdd_node); |
---|
2109 | } |
---|
2110 | |
---|
2111 | |
---|
2112 | bdd_node * |
---|
2113 | bdd_zdd_weak_div( |
---|
2114 | bdd_manager *mgr, |
---|
2115 | bdd_node *f, |
---|
2116 | bdd_node *g) |
---|
2117 | { |
---|
2118 | return NIL(bdd_node); |
---|
2119 | } |
---|
2120 | |
---|
2121 | bdd_node * |
---|
2122 | bdd_zdd_weak_div_recur( |
---|
2123 | bdd_manager *mgr, |
---|
2124 | bdd_node *f, |
---|
2125 | bdd_node *g) |
---|
2126 | { |
---|
2127 | return NIL(bdd_node); |
---|
2128 | } |
---|
2129 | |
---|
2130 | bdd_node * |
---|
2131 | bdd_zdd_isop_recur( |
---|
2132 | bdd_manager *mgr, |
---|
2133 | bdd_node *L, |
---|
2134 | bdd_node *U, |
---|
2135 | bdd_node **zdd_I) |
---|
2136 | { |
---|
2137 | return NIL(bdd_node); |
---|
2138 | } |
---|
2139 | |
---|
2140 | |
---|
2141 | bdd_node * |
---|
2142 | bdd_zdd_isop( |
---|
2143 | bdd_manager *mgr, |
---|
2144 | bdd_node *L, |
---|
2145 | bdd_node *U, |
---|
2146 | bdd_node **zdd_I) |
---|
2147 | { |
---|
2148 | return NIL(bdd_node); |
---|
2149 | } |
---|
2150 | |
---|
2151 | int |
---|
2152 | bdd_zdd_get_cofactors3( |
---|
2153 | bdd_manager *mgr, |
---|
2154 | bdd_node *f, |
---|
2155 | int v, |
---|
2156 | bdd_node **f1, |
---|
2157 | bdd_node **f0, |
---|
2158 | bdd_node **fd) |
---|
2159 | { |
---|
2160 | return 0; |
---|
2161 | } |
---|
2162 | |
---|
2163 | bdd_node * |
---|
2164 | bdd_bdd_and_recur( |
---|
2165 | bdd_manager *mgr, |
---|
2166 | bdd_node *f, |
---|
2167 | bdd_node *g) |
---|
2168 | { |
---|
2169 | return NIL(bdd_node); |
---|
2170 | } |
---|
2171 | |
---|
2172 | bdd_node * |
---|
2173 | bdd_unique_inter( |
---|
2174 | bdd_manager *mgr, |
---|
2175 | int v, |
---|
2176 | bdd_node *f, |
---|
2177 | bdd_node *g) |
---|
2178 | { |
---|
2179 | return NIL(bdd_node); |
---|
2180 | } |
---|
2181 | |
---|
2182 | bdd_node * |
---|
2183 | bdd_unique_inter_ivo( |
---|
2184 | bdd_manager *mgr, |
---|
2185 | int v, |
---|
2186 | bdd_node *f, |
---|
2187 | bdd_node *g) |
---|
2188 | { |
---|
2189 | return NIL(bdd_node); |
---|
2190 | } |
---|
2191 | |
---|
2192 | |
---|
2193 | bdd_node * |
---|
2194 | bdd_zdd_diff( |
---|
2195 | bdd_manager *mgr, |
---|
2196 | bdd_node *f, |
---|
2197 | bdd_node *g) |
---|
2198 | { |
---|
2199 | return NIL(bdd_node); |
---|
2200 | } |
---|
2201 | |
---|
2202 | bdd_node * |
---|
2203 | bdd_zdd_diff_recur( |
---|
2204 | bdd_manager *mgr, |
---|
2205 | bdd_node *f, |
---|
2206 | bdd_node *g) |
---|
2207 | { |
---|
2208 | return NIL(bdd_node); |
---|
2209 | } |
---|
2210 | |
---|
2211 | int |
---|
2212 | bdd_num_zdd_vars(bdd_manager *mgr) |
---|
2213 | { |
---|
2214 | return -1; |
---|
2215 | } |
---|
2216 | |
---|
2217 | bdd_node * |
---|
2218 | bdd_regular(bdd_node *f) |
---|
2219 | { |
---|
2220 | return NIL(bdd_node); |
---|
2221 | } |
---|
2222 | |
---|
2223 | int |
---|
2224 | bdd_is_constant(bdd_node *f) |
---|
2225 | { |
---|
2226 | return 0; |
---|
2227 | } |
---|
2228 | |
---|
2229 | int |
---|
2230 | bdd_is_complement(bdd_node *f) |
---|
2231 | { |
---|
2232 | return 0; |
---|
2233 | } |
---|
2234 | |
---|
2235 | bdd_node * |
---|
2236 | bdd_bdd_T(bdd_node *f) |
---|
2237 | { |
---|
2238 | return NIL(bdd_node); |
---|
2239 | } |
---|
2240 | |
---|
2241 | bdd_node * |
---|
2242 | bdd_bdd_E(bdd_node *f) |
---|
2243 | { |
---|
2244 | return NIL(bdd_node); |
---|
2245 | } |
---|
2246 | |
---|
2247 | bdd_node * |
---|
2248 | bdd_not_bdd_node(bdd_node *f) |
---|
2249 | { |
---|
2250 | return NIL(bdd_node); |
---|
2251 | } |
---|
2252 | |
---|
2253 | void |
---|
2254 | bdd_recursive_deref_zdd(bdd_manager *mgr, bdd_node *f) |
---|
2255 | { |
---|
2256 | return; |
---|
2257 | } |
---|
2258 | |
---|
2259 | int |
---|
2260 | bdd_zdd_count(bdd_manager *mgr, bdd_node *f) |
---|
2261 | { |
---|
2262 | return 0; |
---|
2263 | } |
---|
2264 | |
---|
2265 | int |
---|
2266 | bdd_read_zdd_level(bdd_manager *mgr, int index) |
---|
2267 | { |
---|
2268 | return -1; |
---|
2269 | } |
---|
2270 | |
---|
2271 | int |
---|
2272 | bdd_zdd_vars_from_bdd_vars(bdd_manager *mgr, int multiplicity) |
---|
2273 | { |
---|
2274 | return 0; |
---|
2275 | } |
---|
2276 | |
---|
2277 | void |
---|
2278 | bdd_zdd_realign_enable(bdd_manager *mgr) |
---|
2279 | { |
---|
2280 | return; |
---|
2281 | } |
---|
2282 | |
---|
2283 | void |
---|
2284 | bdd_zdd_realign_disable(bdd_manager *mgr) |
---|
2285 | { |
---|
2286 | return; |
---|
2287 | } |
---|
2288 | |
---|
2289 | int |
---|
2290 | bdd_zdd_realignment_enabled(bdd_manager *mgr) |
---|
2291 | { |
---|
2292 | return 0; |
---|
2293 | } |
---|
2294 | |
---|
2295 | void |
---|
2296 | bdd_realign_enable(bdd_manager *mgr) |
---|
2297 | { |
---|
2298 | return; |
---|
2299 | } |
---|
2300 | |
---|
2301 | void |
---|
2302 | bdd_realign_disable(bdd_manager *mgr) |
---|
2303 | { |
---|
2304 | return; |
---|
2305 | } |
---|
2306 | |
---|
2307 | int |
---|
2308 | bdd_realignment_enabled(bdd_manager *mgr) |
---|
2309 | { |
---|
2310 | return 0; |
---|
2311 | } |
---|
2312 | |
---|
2313 | int |
---|
2314 | bdd_node_read_index(bdd_node *f) |
---|
2315 | { |
---|
2316 | return -1; |
---|
2317 | } |
---|
2318 | |
---|
2319 | bdd_node * |
---|
2320 | bdd_read_next(bdd_node *f) |
---|
2321 | { |
---|
2322 | return NIL(bdd_node); |
---|
2323 | } |
---|
2324 | |
---|
2325 | |
---|
2326 | void |
---|
2327 | bdd_set_next(bdd_node *f, bdd_node *g) |
---|
2328 | { |
---|
2329 | return; |
---|
2330 | } |
---|
2331 | |
---|
2332 | |
---|
2333 | int |
---|
2334 | bdd_read_reordered_field(bdd_manager *mgr) |
---|
2335 | { |
---|
2336 | return -1; |
---|
2337 | } |
---|
2338 | |
---|
2339 | void |
---|
2340 | bdd_set_reordered_field(bdd_manager *mgr, int n) |
---|
2341 | { |
---|
2342 | return; |
---|
2343 | } |
---|
2344 | |
---|
2345 | bdd_node * |
---|
2346 | bdd_add_apply_recur( |
---|
2347 | bdd_manager *mgr, |
---|
2348 | bdd_node *(*operation)(bdd_manager *, bdd_node **, bdd_node **), |
---|
2349 | bdd_node *fn1, |
---|
2350 | bdd_node *fn2) |
---|
2351 | { |
---|
2352 | return NIL(bdd_node); |
---|
2353 | } |
---|
2354 | |
---|
2355 | BDD_VALUE_TYPE |
---|
2356 | bdd_add_value(bdd_node *f) |
---|
2357 | { |
---|
2358 | return 0.0; |
---|
2359 | } |
---|
2360 | |
---|
2361 | int |
---|
2362 | bdd_print_minterm(bdd_t *f) |
---|
2363 | { |
---|
2364 | return 0; |
---|
2365 | } |
---|
2366 | |
---|
2367 | bdd_t * |
---|
2368 | bdd_xor_smooth( |
---|
2369 | bdd_t *f, |
---|
2370 | bdd_t *g, |
---|
2371 | array_t *smoothing_vars) |
---|
2372 | { |
---|
2373 | return NIL(bdd_t); |
---|
2374 | } |
---|
2375 | |
---|
2376 | |
---|
2377 | bdd_node * |
---|
2378 | bdd_read_plus_infinity(bdd_manager *mgr) |
---|
2379 | { |
---|
2380 | return NIL(bdd_node); |
---|
2381 | |
---|
2382 | } /* end of bdd_read_plus_infinity */ |
---|
2383 | |
---|
2384 | |
---|
2385 | bdd_node * |
---|
2386 | bdd_priority_select( |
---|
2387 | bdd_manager *mgr, |
---|
2388 | bdd_node *R, |
---|
2389 | bdd_node **x, |
---|
2390 | bdd_node **y, |
---|
2391 | bdd_node **z, |
---|
2392 | bdd_node *Pi, |
---|
2393 | int n, |
---|
2394 | bdd_node *(*Pifunc)(bdd_manager *, int, bdd_node **, bdd_node **, bdd_node **)) |
---|
2395 | { |
---|
2396 | return NIL(bdd_node); |
---|
2397 | |
---|
2398 | } /* end of bdd_priority_select */ |
---|
2399 | |
---|
2400 | |
---|
2401 | void |
---|
2402 | bdd_set_background( |
---|
2403 | bdd_manager *mgr, |
---|
2404 | bdd_node *f) |
---|
2405 | { |
---|
2406 | return; |
---|
2407 | |
---|
2408 | } /* end of bdd_set_background */ |
---|
2409 | |
---|
2410 | |
---|
2411 | bdd_node * |
---|
2412 | bdd_read_background(bdd_manager *mgr) |
---|
2413 | { |
---|
2414 | return NIL(bdd_node); |
---|
2415 | |
---|
2416 | } /* end of bdd_read_background */ |
---|
2417 | |
---|
2418 | |
---|
2419 | bdd_node * |
---|
2420 | bdd_bdd_cofactor( |
---|
2421 | bdd_manager *mgr, |
---|
2422 | bdd_node *f, |
---|
2423 | bdd_node *g) |
---|
2424 | { |
---|
2425 | return NIL(bdd_node); |
---|
2426 | |
---|
2427 | } /* end of bdd_bdd_cofactor */ |
---|
2428 | |
---|
2429 | |
---|
2430 | bdd_node * |
---|
2431 | bdd_bdd_ite( |
---|
2432 | bdd_manager *mgr, |
---|
2433 | bdd_node *f, |
---|
2434 | bdd_node *g, |
---|
2435 | bdd_node *h) |
---|
2436 | { |
---|
2437 | return NIL(bdd_node); |
---|
2438 | |
---|
2439 | } /* end of bdd_bdd_ite */ |
---|
2440 | |
---|
2441 | |
---|
2442 | bdd_node * |
---|
2443 | bdd_add_minus( |
---|
2444 | bdd_manager *mgr, |
---|
2445 | bdd_node **fn1, |
---|
2446 | bdd_node **fn2) |
---|
2447 | { |
---|
2448 | return NIL(bdd_node); |
---|
2449 | |
---|
2450 | } /* end of bdd_add_plus */ |
---|
2451 | |
---|
2452 | |
---|
2453 | bdd_node * |
---|
2454 | bdd_dxygtdxz( |
---|
2455 | bdd_manager *mgr, |
---|
2456 | int N, |
---|
2457 | bdd_node **x, |
---|
2458 | bdd_node **y, |
---|
2459 | bdd_node **z) |
---|
2460 | { |
---|
2461 | return NIL(bdd_node); |
---|
2462 | |
---|
2463 | } /* end of bdd_dxygtdxz */ |
---|
2464 | |
---|
2465 | |
---|
2466 | bdd_node * |
---|
2467 | bdd_bdd_univ_abstract( |
---|
2468 | bdd_manager *mgr, |
---|
2469 | bdd_node *fn, |
---|
2470 | bdd_node *vars) |
---|
2471 | { |
---|
2472 | return NIL(bdd_node); |
---|
2473 | |
---|
2474 | } /* end of bdd_bdd_univ_abstract */ |
---|
2475 | |
---|
2476 | |
---|
2477 | bdd_node * |
---|
2478 | bdd_bdd_cprojection( |
---|
2479 | bdd_manager *mgr, |
---|
2480 | bdd_node *R, |
---|
2481 | bdd_node *Y) |
---|
2482 | { |
---|
2483 | return NIL(bdd_node); |
---|
2484 | |
---|
2485 | } /* end of bdd_bdd_cprojection */ |
---|
2486 | |
---|
2487 | bdd_node * |
---|
2488 | bdd_xeqy( |
---|
2489 | bdd_manager *mgr, |
---|
2490 | int N, |
---|
2491 | bdd_node **x, |
---|
2492 | bdd_node **y) |
---|
2493 | { |
---|
2494 | return NIL(bdd_node); |
---|
2495 | |
---|
2496 | } /* end of bdd_xeqy */ |
---|
2497 | |
---|
2498 | bdd_node * |
---|
2499 | bdd_add_roundoff( |
---|
2500 | bdd_manager *mgr, |
---|
2501 | bdd_node *f, |
---|
2502 | int N) |
---|
2503 | { |
---|
2504 | return NIL(bdd_node); |
---|
2505 | |
---|
2506 | } /* end of bdd_add_roundoff */ |
---|
2507 | |
---|
2508 | bdd_node * |
---|
2509 | bdd_xgty( |
---|
2510 | bdd_manager *mgr, |
---|
2511 | int N, |
---|
2512 | bdd_node **x, |
---|
2513 | bdd_node **y) |
---|
2514 | { |
---|
2515 | return NIL(bdd_node); |
---|
2516 | |
---|
2517 | } /* end of bdd_xgty */ |
---|
2518 | |
---|
2519 | bdd_node * |
---|
2520 | bdd_add_cmpl( |
---|
2521 | bdd_manager *mgr, |
---|
2522 | bdd_node *f) |
---|
2523 | { |
---|
2524 | return NIL(bdd_node); |
---|
2525 | |
---|
2526 | } /* end of bdd_add_cmpl */ |
---|
2527 | |
---|
2528 | bdd_node * |
---|
2529 | bdd_split_set( |
---|
2530 | bdd_manager *mgr, |
---|
2531 | bdd_node *f, |
---|
2532 | bdd_node **x, |
---|
2533 | int n, |
---|
2534 | double m) |
---|
2535 | { |
---|
2536 | return NIL(bdd_node); |
---|
2537 | |
---|
2538 | } /* end of bdd_split_set */ |
---|
2539 | |
---|
2540 | |
---|
2541 | int |
---|
2542 | bdd_debug_check(bdd_manager *mgr) |
---|
2543 | { |
---|
2544 | return (-1); |
---|
2545 | |
---|
2546 | } /* end of bdd_debug_check */ |
---|
2547 | |
---|
2548 | bdd_node * |
---|
2549 | bdd_bdd_xor( |
---|
2550 | bdd_manager *mgr, |
---|
2551 | bdd_node *f, |
---|
2552 | bdd_node *g) |
---|
2553 | { |
---|
2554 | return NIL(bdd_node); |
---|
2555 | } |
---|
2556 | |
---|
2557 | void |
---|
2558 | bdd_dump_blif( |
---|
2559 | bdd_manager *mgr, |
---|
2560 | int nBdds, |
---|
2561 | bdd_node **bdds, |
---|
2562 | char **inames, |
---|
2563 | char **onames, |
---|
2564 | char *model, |
---|
2565 | FILE *fp) |
---|
2566 | { |
---|
2567 | return; |
---|
2568 | } |
---|
2569 | |
---|
2570 | void |
---|
2571 | bdd_dump_blif_body( |
---|
2572 | bdd_manager *mgr, |
---|
2573 | int nBdds, |
---|
2574 | bdd_node **bdds, |
---|
2575 | char **inames, |
---|
2576 | char **onames, |
---|
2577 | FILE *fp) |
---|
2578 | { |
---|
2579 | return; |
---|
2580 | } |
---|
2581 | |
---|
2582 | void |
---|
2583 | bdd_dump_dot( |
---|
2584 | bdd_manager *mgr, |
---|
2585 | int nBdds, |
---|
2586 | bdd_node **bdds, |
---|
2587 | char **inames, |
---|
2588 | char **onames, |
---|
2589 | FILE *fp) |
---|
2590 | { |
---|
2591 | return; |
---|
2592 | } |
---|
2593 | |
---|
2594 | bdd_node * |
---|
2595 | bdd_make_bdd_from_zdd_cover(bdd_manager *mgr, bdd_node *node) |
---|
2596 | { |
---|
2597 | return(NIL(bdd_node)); |
---|
2598 | } |
---|
2599 | |
---|
2600 | bdd_node * |
---|
2601 | bdd_zdd_complement(bdd_manager *mgr, bdd_node *node) |
---|
2602 | { |
---|
2603 | return(NIL(bdd_node)); |
---|
2604 | } |
---|
2605 | |
---|
2606 | bdd_node * |
---|
2607 | bdd_bdd_vector_support( |
---|
2608 | bdd_manager *mgr, |
---|
2609 | bdd_node **F, |
---|
2610 | int n) |
---|
2611 | { |
---|
2612 | return NIL(bdd_node); |
---|
2613 | } |
---|
2614 | |
---|
2615 | int |
---|
2616 | bdd_bdd_vector_support_size( |
---|
2617 | bdd_manager *mgr, |
---|
2618 | bdd_node **F, |
---|
2619 | int n) |
---|
2620 | { |
---|
2621 | return -1; |
---|
2622 | } |
---|
2623 | |
---|
2624 | int |
---|
2625 | bdd_bdd_support_size( |
---|
2626 | bdd_manager *mgr, |
---|
2627 | bdd_node *F) |
---|
2628 | { |
---|
2629 | return -1; |
---|
2630 | } |
---|
2631 | |
---|
2632 | bdd_node * |
---|
2633 | bdd_bdd_support( |
---|
2634 | bdd_manager *mgr, |
---|
2635 | bdd_node *F) |
---|
2636 | { |
---|
2637 | return NIL(bdd_node); |
---|
2638 | } |
---|
2639 | |
---|
2640 | bdd_node * |
---|
2641 | bdd_add_general_vector_compose( |
---|
2642 | bdd_manager *mgr, |
---|
2643 | bdd_node *f, |
---|
2644 | bdd_node **vectorOn, |
---|
2645 | bdd_node **vectorOff) |
---|
2646 | { |
---|
2647 | return NIL(bdd_node); |
---|
2648 | } |
---|
2649 | |
---|
2650 | int |
---|
2651 | bdd_bdd_leq( |
---|
2652 | bdd_manager *mgr, |
---|
2653 | bdd_node *f, |
---|
2654 | bdd_node *g) |
---|
2655 | { |
---|
2656 | return -1; |
---|
2657 | } |
---|
2658 | |
---|
2659 | bdd_node * |
---|
2660 | bdd_bdd_boolean_diff( |
---|
2661 | bdd_manager *mgr, |
---|
2662 | bdd_node *f, |
---|
2663 | int x) |
---|
2664 | { |
---|
2665 | return NIL(bdd_node); |
---|
2666 | } |
---|
2667 | |
---|
2668 | /**Function******************************************************************** |
---|
2669 | |
---|
2670 | Synopsis [Compares two bdds are same.] |
---|
2671 | |
---|
2672 | SideEffects [] |
---|
2673 | |
---|
2674 | ******************************************************************************/ |
---|
2675 | int |
---|
2676 | bdd_ptrcmp(bdd_t *f, bdd_t *g) |
---|
2677 | { |
---|
2678 | if (f->node == g->node) |
---|
2679 | return(0); |
---|
2680 | else |
---|
2681 | return(1); |
---|
2682 | } |
---|
2683 | |
---|
2684 | |
---|
2685 | /**Function******************************************************************** |
---|
2686 | |
---|
2687 | Synopsis [Returns the hash value of a bdd.] |
---|
2688 | |
---|
2689 | SideEffects [] |
---|
2690 | |
---|
2691 | ******************************************************************************/ |
---|
2692 | int |
---|
2693 | bdd_ptrhash(bdd_t *f, int size) |
---|
2694 | { |
---|
2695 | int hash; |
---|
2696 | |
---|
2697 | hash = (int)((unsigned long)f->node >> 2) % size; |
---|
2698 | return(hash); |
---|
2699 | } |
---|
2700 | |
---|
2701 | bdd_t * |
---|
2702 | bdd_subset_with_mask_vars( |
---|
2703 | bdd_t *f, |
---|
2704 | array_t *varsArray, |
---|
2705 | array_t *maskVarsArray) |
---|
2706 | { |
---|
2707 | return NIL(bdd_t); |
---|
2708 | } |
---|
2709 | |
---|
2710 | bdd_t * |
---|
2711 | bdd_and_smooth_with_cube( |
---|
2712 | bdd_t *f, |
---|
2713 | bdd_t *g, |
---|
2714 | bdd_t *cube) |
---|
2715 | { |
---|
2716 | return NIL(bdd_t); |
---|
2717 | } |
---|
2718 | |
---|
2719 | bdd_t * |
---|
2720 | bdd_smooth_with_cube(bdd_t *f, bdd_t *cube) |
---|
2721 | { |
---|
2722 | int i; |
---|
2723 | bdd_t *var, *res; |
---|
2724 | array_t *smoothingVars; |
---|
2725 | var_set_t *supportVarSet; |
---|
2726 | |
---|
2727 | smoothingVars = array_alloc(bdd_t *, 0); |
---|
2728 | supportVarSet = bdd_get_support(f); |
---|
2729 | for (i = 0; i < supportVarSet->n_elts; i++) { |
---|
2730 | if (var_set_get_elt(supportVarSet, i) == 1) { |
---|
2731 | var = bdd_var_with_index(f->mgr, i); |
---|
2732 | array_insert_last(bdd_t *, smoothingVars, var); |
---|
2733 | } |
---|
2734 | } |
---|
2735 | var_set_free(supportVarSet); |
---|
2736 | |
---|
2737 | res = bdd_smooth(f, smoothingVars); |
---|
2738 | |
---|
2739 | for (i = 0; i < array_n(smoothingVars); i++) { |
---|
2740 | var = array_fetch(bdd_t *, smoothingVars, i); |
---|
2741 | bdd_free(var); |
---|
2742 | } |
---|
2743 | array_free(smoothingVars); |
---|
2744 | return res; |
---|
2745 | } |
---|
2746 | |
---|
2747 | bdd_t * |
---|
2748 | bdd_substitute_with_permut(bdd_t *f, int *permut) |
---|
2749 | { |
---|
2750 | return NIL(bdd_t); |
---|
2751 | } |
---|
2752 | |
---|
2753 | array_t * |
---|
2754 | bdd_substitute_array_with_permut( |
---|
2755 | array_t *f_array, |
---|
2756 | int *permut) |
---|
2757 | { |
---|
2758 | return NIL(array_t); |
---|
2759 | } |
---|
2760 | |
---|
2761 | bdd_t * |
---|
2762 | bdd_vector_compose( |
---|
2763 | bdd_t *f, |
---|
2764 | array_t *varArray, |
---|
2765 | array_t *funcArray) |
---|
2766 | { |
---|
2767 | return NIL(bdd_t); |
---|
2768 | } |
---|
2769 | |
---|
2770 | double * |
---|
2771 | bdd_cof_minterm(bdd_t *f) |
---|
2772 | { |
---|
2773 | return(NIL(double)); |
---|
2774 | } |
---|
2775 | |
---|
2776 | int |
---|
2777 | bdd_var_is_dependent(bdd_t *f, bdd_t *var) |
---|
2778 | { |
---|
2779 | return(0); |
---|
2780 | } |
---|
2781 | |
---|
2782 | array_t * |
---|
2783 | bdd_find_essential(bdd_t *f) |
---|
2784 | { |
---|
2785 | return(NIL(array_t)); |
---|
2786 | } |
---|
2787 | |
---|
2788 | bdd_t * |
---|
2789 | bdd_find_essential_cube(bdd_t *f) |
---|
2790 | { |
---|
2791 | return(NIL(bdd_t)); |
---|
2792 | } |
---|
2793 | |
---|
2794 | int |
---|
2795 | bdd_estimate_cofactor(bdd_t *f, bdd_t *var, int phase) |
---|
2796 | { |
---|
2797 | return(0); |
---|
2798 | } |
---|
2799 | |
---|
2800 | long |
---|
2801 | bdd_read_peak_memory(bdd_manager *mgr) |
---|
2802 | { |
---|
2803 | return(0); |
---|
2804 | } |
---|
2805 | |
---|
2806 | int |
---|
2807 | bdd_read_peak_live_node(bdd_manager *mgr) |
---|
2808 | { |
---|
2809 | return(0); |
---|
2810 | } |
---|
2811 | |
---|
2812 | int |
---|
2813 | bdd_set_pi_var(bdd_manager *mgr, int index) |
---|
2814 | { |
---|
2815 | return(0); |
---|
2816 | } |
---|
2817 | |
---|
2818 | int |
---|
2819 | bdd_set_ps_var(bdd_manager *mgr, int index) |
---|
2820 | { |
---|
2821 | return(0); |
---|
2822 | } |
---|
2823 | |
---|
2824 | int |
---|
2825 | bdd_set_ns_var(bdd_manager *mgr, int index) |
---|
2826 | { |
---|
2827 | return(0); |
---|
2828 | } |
---|
2829 | |
---|
2830 | int |
---|
2831 | bdd_is_pi_var(bdd_manager *mgr, int index) |
---|
2832 | { |
---|
2833 | return(0); |
---|
2834 | } |
---|
2835 | |
---|
2836 | int |
---|
2837 | bdd_is_ps_var(bdd_manager *mgr, int index) |
---|
2838 | { |
---|
2839 | return(0); |
---|
2840 | } |
---|
2841 | |
---|
2842 | int |
---|
2843 | bdd_is_ns_var(bdd_manager *mgr, int index) |
---|
2844 | { |
---|
2845 | return(0); |
---|
2846 | } |
---|
2847 | |
---|
2848 | int |
---|
2849 | bdd_set_pair_index(bdd_manager *mgr, int index, int pairIndex) |
---|
2850 | { |
---|
2851 | return(0); |
---|
2852 | } |
---|
2853 | |
---|
2854 | int |
---|
2855 | bdd_read_pair_index(bdd_manager *mgr, int index) |
---|
2856 | { |
---|
2857 | return(0); |
---|
2858 | } |
---|
2859 | |
---|
2860 | int |
---|
2861 | bdd_set_var_to_be_grouped(bdd_manager *mgr, int index) |
---|
2862 | { |
---|
2863 | return(0); |
---|
2864 | } |
---|
2865 | |
---|
2866 | int |
---|
2867 | bdd_set_var_hard_group(bdd_manager *mgr, int index) |
---|
2868 | { |
---|
2869 | return(0); |
---|
2870 | } |
---|
2871 | |
---|
2872 | int |
---|
2873 | bdd_reset_var_to_be_grouped(bdd_manager *mgr, int index) |
---|
2874 | { |
---|
2875 | return(0); |
---|
2876 | } |
---|
2877 | |
---|
2878 | int |
---|
2879 | bdd_is_var_to_be_grouped(bdd_manager *mgr, int index) |
---|
2880 | { |
---|
2881 | return(0); |
---|
2882 | } |
---|
2883 | |
---|
2884 | int |
---|
2885 | bdd_is_var_hard_group(bdd_manager *mgr, int index) |
---|
2886 | { |
---|
2887 | return(0); |
---|
2888 | } |
---|
2889 | |
---|
2890 | int |
---|
2891 | bdd_is_var_to_be_ungrouped(bdd_manager *mgr, int index) |
---|
2892 | { |
---|
2893 | return(0); |
---|
2894 | } |
---|
2895 | |
---|
2896 | int |
---|
2897 | bdd_set_var_to_be_ungrouped(bdd_manager *mgr, int index) |
---|
2898 | { |
---|
2899 | return(0); |
---|
2900 | } |
---|
2901 | |
---|
2902 | int |
---|
2903 | bdd_bind_var(bdd_manager *mgr, int index) |
---|
2904 | { |
---|
2905 | return(0); |
---|
2906 | } |
---|
2907 | |
---|
2908 | int |
---|
2909 | bdd_unbind_var(bdd_manager *mgr, int index) |
---|
2910 | { |
---|
2911 | return(0); |
---|
2912 | } |
---|
2913 | |
---|
2914 | int |
---|
2915 | bdd_is_lazy_sift(bdd_manager *mgr) |
---|
2916 | { |
---|
2917 | return(0); |
---|
2918 | } |
---|
2919 | |
---|
2920 | void |
---|
2921 | bdd_discard_all_var_groups(bdd_manager *mgr) |
---|
2922 | { |
---|
2923 | return; |
---|
2924 | } |
---|
2925 | |
---|
2926 | /*---------------------------------------------------------------------------*/ |
---|
2927 | /* Definition of internal functions */ |
---|
2928 | /*---------------------------------------------------------------------------*/ |
---|
2929 | |
---|
2930 | |
---|
2931 | /*---------------------------------------------------------------------------*/ |
---|
2932 | /* Definition of static functions */ |
---|
2933 | /*---------------------------------------------------------------------------*/ |
---|
2934 | |
---|
2935 | |
---|
2936 | |
---|