Rev | Line | |
---|
[13] | 1 | #include "bddint.h" |
---|
| 2 | /* |
---|
| 3 | * Recursively determine if f is a cube. f is a cube if there is a single |
---|
| 4 | * path to the constant one. |
---|
| 5 | */ |
---|
| 6 | int |
---|
| 7 | cmu_bdd_is_cube(struct bdd_manager_ *manager, struct bdd_ *f) |
---|
| 8 | { |
---|
| 9 | struct bdd_ *f0, *f1; |
---|
| 10 | |
---|
| 11 | BDD_SETUP(f); |
---|
| 12 | if (BDD_IS_CONST(f)){ |
---|
| 13 | if (f == BDD_ZERO(manager)){ |
---|
| 14 | cmu_bdd_fatal("cmu_bdd_is_cube called with 0"); |
---|
| 15 | } |
---|
| 16 | else return 1; |
---|
| 17 | } |
---|
| 18 | BDD_COFACTOR(BDD_INDEXINDEX(f), f, f1, f0); |
---|
| 19 | |
---|
| 20 | /* |
---|
| 21 | * Exactly one branch of f must point to ZERO to be a cube. |
---|
| 22 | */ |
---|
| 23 | if (f1 == BDD_ZERO(manager)) { |
---|
| 24 | return (cmu_bdd_is_cube(manager, f0)); |
---|
| 25 | } else if (f0 == BDD_ZERO(manager)) { |
---|
| 26 | return (cmu_bdd_is_cube(manager, f1)); |
---|
| 27 | } else { /* not a cube, because neither branch is zero */ |
---|
| 28 | return 0; |
---|
| 29 | } |
---|
| 30 | } |
---|
| 31 | |
---|
Note: See
TracBrowser
for help on using the repository browser.