def test_simple():
    p = Program()
    p.create_decrement_component()
    p.create_decrement_component()
    p.create_increment_component()
    p.create_increment_component()
    print('Increment:')
    timed_synthesis(p, BVT.Psimple)
예제 #2
0
def test_simple():
    p = Program()
    p.create_decrement_component()
    p.create_decrement_component()
    p.create_increment_component()
    p.create_increment_component()
    print('Simple increment program:')
    ProgramSynthesis(p, BVT.Psimple_inc, 'Simple').timed_synthesis()
def P8_increment():
    p = Program()
    p.create_decrement_component()
    p.create_not_component()
    p.create_and_component()
    p.create_increment_component()
    p.create_increment_component()
    p.create_increment_component()
    return ProgramSynthesis(p, BVT.P8, 'P8 Increment')
def P7():
    p = Program()
    p.create_increment_component()
    p.create_and_component()
    p.create_or_component()
    p.create_not_component()
    p.create_add_component()
    p.create_xor_component()
    return ProgramSynthesis(p, BVT.P7, 'P7')
def inc_dec_and_or_with(comp, number):
    p = Program()
    p.create_increment_component()
    p.create_decrement_component()
    p.create_and_component()
    p.create_or_component()
    for _ in range(number):
        comp(p)
    return p
def first8_program_no_xor():
    p = Program()
    p.create_increment_component()
    p.create_decrement_component()
    p.create_and_component()
    # p.create_negate_component()
    # p.create_xor_component()
    p.create_or_component()
    p.create_not_component()
    return p
def shortestComparison_P7():
    ps = []
    p = Program(num_prog_inputs=1)
    p.create_not_component()
    p.create_increment_component()
    p.create_and_component()
    p.create_or_component()
    p.create_decrement_component()
    p.create_and_component()
    oracle = BVT.P7
    ps_short = ProgramSynthesis(p, oracle, 'Shortest')
    ps_short.find_shortest_program = True
    ps.append(ps_short)
    ps_no_short = ProgramSynthesis(p, oracle, 'No Shortest')
    ps_no_short.find_shortest_program = False
    ps.append(ps_no_short)
    return ps
def shortestComparison_P14():
    ps = []
    p = Program(num_prog_inputs=2)
    p.create_bitshiftleft_component(-1)
    p.create_increment_component()
    p.create_subtract_component()
    p.create_and_component()
    p.create_divide_component()
    p.create_xor_component()
    oracle = BVT.P14
    ps_short = ProgramSynthesis(p, oracle, 'Shortest')
    ps_short.find_shortest_program = True
    ps.append(ps_short)
    ps_no_short = ProgramSynthesis(p, oracle, 'No Shortest')
    ps_no_short.find_shortest_program = False
    ps.append(ps_no_short)
    return ps
def equal_components(num_prog_inputs, num_each_component):
    p = Program(num_prog_inputs=num_prog_inputs)
    for _ in range(num_each_component):
        p.create_increment_component()
        # p.create_decrement_component()
        # p.create_add_component()
        # p.create_subtract_component()
        # p.create_divide_component()
        p.create_and_component()
        p.create_or_component()
        # p.create_xor_component()
        # p.create_negate_component()
        p.create_not_component()
        # p.create_bitshiftright_component(1)
        # p.create_bitshiftleft_component(-1)
        # p.create_ule_component()
        # p.create_ult_component()
    return p