Exemplo n.º 1
0
def main(filename):
    model = aiglib.aiger_init()
    aiglib.aiger_open_and_read_from_file(model, filename)

    for i in range(model.num_latches):
        latch = aiglib.get_ith_latch(model, i)
        m = match(regex, latch.name)
        if m:
            ltype = m.groups()[1][0]
            if ltype == "b":
                aiglib.aiger_add_bad(model, latch.next, latch.name)
            if ltype == "c":
                aiglib.aiger_add_constraint(model, latch.next, latch.name)
            if ltype == "j":
                aiglib.aiger_add_justice(model, 1, [latch.next], latch.name)
            if ltype == "f":
                aiglib.aiger_add_fairness(model, latch.next, latch.name)

    res, string = aiglib.aiger_write_to_string(model,
                                               aiglib.aiger_ascii_mode,
                                               2147483648)

    assert res != 0, 'writing failure'

    print(string)
Exemplo n.º 2
0
def _write_result(model):
    # aiglib.aiger_reencode(model)  # ic3-ref needs (?) 'right' order of indices of ANDs, etc.

    res, string = aiglib.aiger_write_to_string(model, aiglib.aiger_ascii_mode, 2147483648)

    assert res != 0, 'writing failure'

    print(string)
Exemplo n.º 3
0
def _write_result(model):
    # aiglib.aiger_reencode(model)  # ic3-ref needs (?) 'right' order of indices of ANDs, etc.

    res, string = aiglib.aiger_write_to_string(model, aiglib.aiger_ascii_mode,
                                               2147483648)

    assert res != 0, 'writing failure'

    print(string)
Exemplo n.º 4
0
def write_and_die():
    global spec, out, new_format
    (j, f) = aiger_hacky_remove_jf(spec)
    res, string = aiglib.aiger_write_to_string(spec, aiglib.aiger_ascii_mode,
                                               2147483648)
    # maybe useful for gc?
    spec.num_justice = j
    spec.num_fairness = f
    assert res != 0, 'writing failure'

    if not new_format:
        # post-process
        ret, out_string, err = execute_shell(
            'aigmove -i | aigor | aigtoaig -a', input=string)
        assert ret == 0, 'post-processing failure: ' + \
                         to_str_ret_out_err(ret, string, err) + \
                         'input was:\n' + string
        string = out_string

    out.write(string)
    exit(0)
Exemplo n.º 5
0
def write_and_die():
    global spec, out, new_format
    (j, f) = aiger_hacky_remove_jf(spec)
    res, string = aiglib.aiger_write_to_string(spec,
                                               aiglib.aiger_ascii_mode,
                                               2147483648)
    # maybe useful for gc?
    spec.num_justice = j
    spec.num_fairness = f
    assert res != 0, 'writing failure'

    if not new_format:
        # post-process
        ret, out_string, err = execute_shell(
            'aigmove -i | aigor | aigtoaig -a',
            input=string)
        assert ret == 0, 'post-processing failure: ' + \
                         to_str_ret_out_err(ret, string, err) + \
                         'input was:\n' + string
        string = out_string

    out.write(string)
    exit(0)
Exemplo n.º 6
0
def main(filename):
    model = aiglib.aiger_init()
    aiglib.aiger_open_and_read_from_file(model, filename)

    for i in range(model.num_latches):
        latch = aiglib.get_ith_latch(model, i)
        m = match(regex, latch.name)
        if m:
            ltype = m.groups()[1][0]
            if ltype == "b":
                aiglib.aiger_add_bad(model, latch.next, latch.name)
            if ltype == "c":
                aiglib.aiger_add_constraint(model, latch.next, latch.name)
            if ltype == "j":
                aiglib.aiger_add_justice(model, 1, [latch.next], latch.name)
            if ltype == "f":
                aiglib.aiger_add_fairness(model, latch.next, latch.name)

    res, string = aiglib.aiger_write_to_string(model, aiglib.aiger_ascii_mode,
                                               2147483648)

    assert res != 0, 'writing failure'

    print(string)