int cmu_bdd_type_aux(cmu_bdd_manager bddm, bdd f) { BDD_SETUP(f); if (BDD_IS_CONST(f)) { if (f == BDD_ZERO(bddm)) return (BDD_TYPE_ZERO); if (f == BDD_ONE(bddm)) return (BDD_TYPE_ONE); return (BDD_TYPE_CONSTANT); } if (BDD_THEN(f) == BDD_ONE(bddm) && BDD_ELSE(f) == BDD_ZERO(bddm)) return (BDD_TYPE_POSVAR); if (BDD_THEN(f) == BDD_ZERO(bddm) && BDD_ELSE(f) == BDD_ONE(bddm)) return (BDD_TYPE_NEGVAR); return (BDD_TYPE_NONTERMINAL); }
bdd cmu_bdd_then(cmu_bdd_manager bddm, bdd f) { if (bdd_check_arguments(1, f)) { BDD_SETUP(f); if (BDD_IS_CONST(f)) { cmu_bdd_warning("cmu_bdd_then: argument is a constant"); return (f); } f=BDD_THEN(f); BDD_RESET(f); BDD_INCREFS(f); } return (f); }
static void in_ite_form (FILE *fp, BDDPTR f) { if (BDD_0_P (f)) fputs (FALSE_STR, fp); else if (BDD_1_P (f)) fputs (TRUE_STR, fp); else if (BDD_X_P (f)) fputs (X_STR, fp); else { fprintf (fp, "ite (%s%s, ", bdd_var_name (BDD_VARID (f)), BDD_I_INV_EDGE_P (f) ? POSTFIX_NOT_STR : ""); in_ite_form (fp, BDD_THEN (f)); fputs (", ", fp); in_ite_form (fp, BDD_ELSE (f)); fprintf (fp, ")%s", BDD_NEG_P (f) ? POSTFIX_NOT_STR : ""); } }
static void sat_1 (BDDPTR f, BYTE *pi, int negate_result) { BDDPTR temp; if (BDD_1_P (f)) { if (!negate_result) { int i; fputs ("Satisfying truth-assignment is:\n", bdd_output_stream); for (i = 0; i < var_count; i++) { fprintf (bdd_output_stream, "%s\t:= %s\n", bdd_var_name (i), tvalue [pi[i]]); } } return; } /* Only happens when !use_neg_edges. */ if (BDD_0_P (f)) return; if (BDD_X_P (f)) return; /* Assign a value: */ pi[BDD_VARID (f)] = BDD_I_INV_EDGE_P (f) ? TRUE : FALSE; temp = BDD_ELSE (f); if (BDD_NEG_P (temp)) { sat_1 (BDD_O_OFF (temp), pi, !negate_result); } else sat_1 (temp, pi, negate_result); /* Not successful, try assigning the opposite: */ pi[BDD_VARID (f)] = BDD_I_INV_EDGE_P (f) ? FALSE : TRUE; temp = BDD_THEN (f); /* Can never have BDD_NEG_P (temp)! */ sat_1 (temp, pi, negate_result); pi[BDD_VARID (f)] = DONTCARE; }
static void plot_node (BDDPTR v) { /* Draw the node v: */ if (!BDD_CONST_P (v)) { BDDPTR T = BDD_THEN (v); BDDPTR E = BDD_ELSE (v); /* Draw the non-terminal node: */ draw_node (plot_fp, POSITION_F (v), Y_POS (v), (*plot_name) (v)); /* Draw the outgoing edges: */ if (BDD_0_P (T)) draw_then_const (plot_fp, POSITION_F (v), Y_POS (v), 0); else if (BDD_1_P (T)) draw_then_const (plot_fp, POSITION_F (v), Y_POS (v), 1); else if (BDD_X_P (T)) draw_then_const (plot_fp, POSITION_F (v), Y_POS (v), 2); else draw_then_edge (plot_fp, POSITION_F (v), Y_POS (v), POSITION_F (T), Y_POS (T), BDD_NEG_P (T), BDD_I_INV_EDGE_P (T)); if (BDD_0_P (E)) draw_else_const (plot_fp, POSITION_F (v), Y_POS (v), 0); else if (BDD_1_P (E)) draw_else_const (plot_fp, POSITION_F (v), Y_POS (v), 1); else if (BDD_X_P (E)) draw_else_const (plot_fp, POSITION_F (v), Y_POS (v), 2); else draw_else_edge (plot_fp, POSITION_F (v), Y_POS (v), POSITION_F (E), Y_POS (E), BDD_NEG_P (E), BDD_I_INV_EDGE_P (E)); } }