Exemple #1
0
static void
set_copy_match(vset_t dst, vset_t src, int p_len, int* proj, int*match)
{
    LACE_ME;

    // Create bdd of "match"
    // Assumption: proj is ordered (if not, you get bad performance)

    sylvan_deref(dst->bdd);

    sylvan_gc_disable();
    BDD match_bdd = sylvan_true;
    for (int i=p_len;i-->0;) {
        uint32_t b = match[i];
        for (int j=fddbits;j-->0;) {
            BDD val = sylvan_ithvar(src->dom->vec_to_bddvar[proj[i]*fddbits+j]);
            if (!(b&1)) val = sylvan_not(val);
            match_bdd = sylvan_and(val, match_bdd);
            b >>= 1;
        }
    }
    sylvan_ref(match_bdd);
    sylvan_gc_enable();

    dst->bdd = sylvan_ref(sylvan_and(match_bdd, src->bdd));
    sylvan_deref(match_bdd);
}
Exemple #2
0
/**
 * Enumerate all states that match partial state <match>
 * <match> is p_len long
 * <proj> is a list of integers, containing indices of each match integer
 */
static void
set_enum_match(vset_t set, int p_len, int* proj, int* match, vset_element_cb cb, void* context) 
{
    LACE_ME;

    // Create bdd of "match"
    // Assumption: proj is ordered (if not, you get bad performance)

    sylvan_gc_disable();
    BDD match_bdd = sylvan_true;
    for (int i=p_len;i-->0;) {
        uint32_t b = match[i];
        for (int j=fddbits;j-->0;) {
            BDD val = sylvan_ithvar(set->dom->vec_to_bddvar[proj[i]*fddbits+j]);
            if (!(b&1)) val = sylvan_not(val);
            match_bdd = sylvan_and(val, match_bdd);
            b >>= 1;
        }
    }
    sylvan_ref(match_bdd);
    sylvan_gc_enable();

    BDD old = match_bdd;
    match_bdd = sylvan_ref(sylvan_and(match_bdd, set->bdd));
    sylvan_deref(old);

    int vec[set->vector_size];
    memset(vec, 0, sizeof(int)*set->vector_size);
    set_enum_do(match_bdd, set->variables, vec, 0, cb, context);
    sylvan_deref(match_bdd);
}
Exemple #3
0
JNIEXPORT jlong JNICALL
Java_jsylvan_JSylvan_makeNot(JNIEnv *env, jclass cl, jlong bdd)
{
    return sylvan_not(bdd);
}