Example #1
0
        def simplify():

            with redirect.redirect(src=sys.stdout):
                with redirect.redirect(src=sys.stderr):
                    par.read_file_quiet(aig_filename)
                    par.pre_simp()
                    pyabc.run_command('write_aiger %s' % simplified_aig)

            return simplified_aig
Example #2
0
    def wrapper(argv):
        
        usage = "usage: %prog [options] <aig_file>"
    
        parser = optparse.OptionParser(usage, prog=command_name)
    
        parser.add_option("-n", "--no_redirect", dest="noisy", action="store_true", default=False, help="don't redirect output")
        parser.add_option("-d", "--current_dir", dest="current_dir", action="store_true", default=False, help="stay in current directory")

        options, args = parser.parse_args(argv)
        
        if len(args) != 2:
            print args
            parser.print_usage()
            return 0
            
        aig_filename = os.path.abspath(args[1])

        if not options.noisy:
            pyabc.run_command('/pushredirect')
            
        if not options.current_dir:
            pyabc.run_command('/pushdtemp')
            
        try:
            for d in os.environ['PATH'].split(':'):
                bip = os.path.join(d, 'bip')
                if os.path.exists(bip):
                    pyabc.run_command("load_plugin %s Bip"%bip)
                    break

            basename = os.path.basename( aig_filename )
            shutil.copyfile(aig_filename, basename)
            aig_filename = basename

            par.read_file_quiet(aig_filename)
            result = prooffunc()
            
            par.cex_list = []
        except:
            result = None

        if not options.current_dir:
            pyabc.run_command('/popdtemp')

        if not options.noisy:
            pyabc.run_command('/popredirect')
                
        if result=="SAT":
            print 1
        elif result=="UNSAT":
            print 0
        else:
            print 2

        return 0
Example #3
0
    def simplify(aiger_in, aiger_out):
        
        saved = utils.save_po_info(aiger_in, tmp[0])
        
        par.read_file_quiet(tmp[0])
        par.pre_simp()
        pyabc.run_command( 'write_aiger %s'%tmp[1] )

        #~ pyabc.run_command( 'read_aiger %s'%tmp[0] )
        #~ pyabc.run_command( 'dc2 ; dc2 ; dc2 ; dc2' )
        #~ pyabc.run_command( 'write_aiger %s'%tmp[1] )

        utils.restore_po_info( saved, tmp[1], aiger_out )
Example #4
0
    def simplify(aiger_in, aiger_out):

        with niklas.temp_file_names(2, suffix='.aig') as tmp:

            saved = utils.save_po_info(aiger_in, tmp[0])

            par.read_file_quiet(tmp[0])

            par.pre_simp()

            pyabc.run_command('write_aiger %s' % tmp[1])

            utils.restore_po_info(saved, tmp[1], aiger_out)

            return True
Example #5
0
    def simplify(aiger_in, aiger_out):

        with niklas.temp_file_names(2, suffix=".aig") as tmp:

            saved = utils.save_po_info(aiger_in, tmp[0])

            par.read_file_quiet(tmp[0])

            par.pre_simp()

            pyabc.run_command("write_aiger %s" % tmp[1])

            utils.restore_po_info(saved, tmp[1], aiger_out)

            return True
Example #6
0
    def super_prove(aiger_filename):

        par.read_file_quiet(aiger_filename)

        result = par.sp()

        if result == "SAT":
            return {'result': 'failed'}
        elif result == "UNSAT":
            return {'result': 'proved'}
        elif type(result) == list and len(result) > 0 and result[0] == "SAT":
            return {'result': 'failed'}
        elif type(result) == list and len(result) > 0 and result[0] == "UNSAT":
            return {'result': 'proved'}
        else:
            return {'result': 'unknwon'}
Example #7
0
    def simplify(aiger_in, aiger_out):
        print 'SIMPLIFY: start simplify', aiger_in, aiger_out

        with liveness.temp_file_names(2, suffix='.aig') as tmp:

            saved = utils.save_po_info(aiger_in, tmp[0])

            par.read_file_quiet(tmp[0])

            par.pre_simp()

            pyabc.run_command('write_aiger %s' % tmp[1])

            utils.restore_po_info(saved, tmp[1], aiger_out)

            print 'SIMPLIFY: ended simplify'

            return True
Example #8
0
 def pf(aig_filename):
     par.read_file_quiet(aig_filename)
     return prooffunc()
Example #9
0
def read_cmd(args):
    if len(args) == 2:
        par.read_file_quiet(args[1])
    else:
        par.read_file()
    return 0
Example #10
0
def read_cmd(args):
    if len(args)==2:
        par.read_file_quiet(args[1])
    else:
        par.read_file()
    return 0
Example #11
0
 def pf(aig_filename):
     par.read_file_quiet(aig_filename)
     return prooffunc()
Example #12
0
    def wrapper(argv):

        usage = "usage: %prog [options] <aig_file>"

        parser = optparse.OptionParser(usage, prog=command_name)

        parser.add_option("-n",
                          "--no_redirect",
                          dest="noisy",
                          action="store_true",
                          default=False,
                          help="don't redirect output")
        parser.add_option("-d",
                          "--current_dir",
                          dest="current_dir",
                          action="store_true",
                          default=False,
                          help="stay in current directory")

        options, args = parser.parse_args(argv)

        if len(args) != 2:
            print args
            parser.print_usage()
            return 0

        aig_filename = os.path.abspath(args[1])

        if not options.noisy:
            pyabc.run_command('/pushredirect')

        if not options.current_dir:
            pyabc.run_command('/pushdtemp')

        try:
            for d in os.environ['PATH'].split(':'):
                bip = os.path.join(d, 'bip')
                if os.path.exists(bip):
                    pyabc.run_command("load_plugin %s Bip" % bip)
                    break

            basename = os.path.basename(aig_filename)
            shutil.copyfile(aig_filename, basename)
            aig_filename = basename

            par.read_file_quiet(aig_filename)
            result = prooffunc()

            par.cex_list = []
        except:
            result = None

        if not options.current_dir:
            pyabc.run_command('/popdtemp')

        if not options.noisy:
            pyabc.run_command('/popredirect')

        if result == "SAT":
            print 1
        elif result == "UNSAT":
            print 0
        else:
            print 2

        return 0
Example #13
0
 def pf(aig_filename, old_stdout):
     par.read_file_quiet(aig_filename)
     return prooffunc()