예제 #1
0
파일: syn.py 프로젝트: pku-dasys/cocoon
    def config(self, tcl_name, flow):
        rtl_file = self.design.rtl_input
        lib_file = self.design.liberty_input
        tcl_path = util.getScriptPath(self.design)
        tcl = open(os.path.join(tcl_path, tcl_name + ".ys"),
                   'w',
                   encoding='utf-8')

        tcl.write("# Synthesis script for yosys created by qflow\n")
        tcl.write(
            f"read_liberty -lib -ignore_miss_dir -setattr blackbox {lib_file}\n"
        )
        tcl.write(f"read_verilog {rtl_file}\n\n")
        tcl.write("# High-level synthesis\n")
        tcl.write(f"synth -top {self.design.top_name}\n")
        tcl.write(f"dfflibmap -liberty {lib_file}\nopt\n\n")

        abc_path = os.path.join(flow.yosys_bin_path, "yosys-abc")
        tcl.write(
            f"abc -exe {abc_path} -liberty {lib_file} " +
            "-script +strash;scorr;ifraig;retime,{D};strash;dch,-f;map,-M,1,{D}\n"
        )
        tcl.write(
            "flatten\nsetundef -zero\nclean -purge\niopadmap -outpad BUFX2 A:Y -bits\n"
        )
        tcl.write("opt\nclean\nrename -enumerate\n")
        tcl.write(f"write_verilog {self.getObjHDL()}\n")
        tcl.write("stat\n")

        tcl.close()

        self.writeSDC()
예제 #2
0
    def config(self, design, tcl_file):
        tcl_path = util.getScriptPath(self.design)
        tcl = open(os.path.join(tcl_path, tcl_file + ".tcl"), 'w', encoding='utf-8')

        #init design
        util.createMMMC(self.design, self.getObjMMMC())
        tcl.write("set init_mmmc_file {%s}\n" % self.getObjMMMC()) 
        tcl.write("set init_lef_file %s\n" % self.design.lef_input) 
        tcl.write("set init_verilog %s\n" % self.getObjHDL())  # need to specified
        tcl.write('set init_gnd_net "VSS"\n')
        tcl.write('set init_pwr_net "VDD"\n')
        tcl.write("init_design\n")

        #floorplan
        tcl.write("floorPlan")
        for param in self.params:
            if (self.params[param] != False):
                tcl.write(" -%s %s"%(param, self.params[param]))
        tcl.write("\n")

        if self.paramsExtern["def_out"]:
            # tcl.write("set dbgLefDefOutVersion 5.8\ndefOut -netlist %s_after_fp.def\n" % self.design.top_name)
            tcl.write("defOut -netlist %s_after_fp.def\n" % self.design.top_name)

        tcl.close()
예제 #3
0
def main():
    # Argument processing
    scriptDir = util.getScriptPath()
    parser = argparse.ArgumentParser(description='Compare annotations')
    parser.add_argument('-q',
                        '--quoteIds',
                        dest='quoteIdsFile',
                        help="List of original quoteIds")
    parser.add_argument('-c',
                        '--characters',
                        dest='characterDir',
                        help='directory for character files',
                        action='store',
                        default=os.path.join(scriptDir, '../data/characters'))
    parser.add_argument('file1',
                        help='file with new annotations',
                        action='store')
    parser.add_argument('file2',
                        help='file with old annotations',
                        action='store')
    args = parser.parse_args()

    quoteIds = []
    if args.quoteIdsFile != None:
        quoteIds = util.readlines(args.quoteIdsFile)
    compare(args.file1, args.file2, quoteIds)
예제 #4
0
    def config(self, design, tcl_file):
        tcl_path = util.getScriptPath(self.design, "Cadence")
        ret = 'place_design'
        for i in self.params:
            if self.params[i] == True:
                ret = ret + " -" + i

        tcl = open(tcl_path + "/" + tcl_file + ".tcl", 'w', encoding='utf-8')
        tcl.writelines(ret)
        tcl.close()

        return ret
예제 #5
0
    def config(self, design, tcl_file):
        tcl_path = util.getScriptPath(self.design)
        tcl = open(os.path.join(tcl_path, tcl_file + ".tcl"), 'w', encoding='utf-8')

        tcl.write('globalNetConnect VDD -type pgpin -pin VDD -inst * -verbose\n')
        tcl.write('globalNetConnect VSS -type pgpin -pin VSS -inst * -verbose\n')
        tcl.write('sroute -nets {VDD VSS}\n')
        tcl.write('addRing -nets {VDD VSS} -width 0.6 -spacing 0.5 -layer [list top 7 bottom 7 left 6 right 6]\n')
        tcl.write('addStripe -nets {VSS VDD} -layer 6 -direction vertical -width 0.4 -spacing 0.5 -set_to_set_distance 5 -start 0.5\n')
        tcl.write('addStripe -nets {VSS VDD} -layer 7 -direction horizontal -width 0.4 -spacing 0.5 -set_to_set_distance 5 -start 0.5\n')

        tcl.close()
예제 #6
0
    def config(self, design, json_file):

        json_path = util.getScriptPath(self.design)
        json_path = os.path.join(json_path,
                                 "%s_to_place.json" % self.design.top_name)

        self.params["lef_input"] = [self.design.lef_input]
        self.params["def_input"] = self.getFpDEF()
        self.params["result_dir"] = util.getRunPath(self.design)

        with open(json_path, "w", encoding='utf-8') as json_file:
            json.dump(self.params, json_file, indent=4)
예제 #7
0
    def config(self, design, tcl_file):
        tcl_path = util.getScriptPath(self.design)
        ret = 'routeDesign'
        for i in self.params:
            if self.params[i]:
                ret = ret + " -" + i

        assert not (self.paramsPassive['placementCheck'] and self.paramsPassive['noPlacementCheck']),\
            'Option -placementCheck and -noPlacementCheck are mutually exclusive.'
        assert not (self.paramsPassive['globalDetail'] and self.paramsPassive['detail']),\
            'Option -globalDetail and -detail are mutually exclusive.'

        if not self.params['passiveFill']:
            for i in self.paramsPassive:
                if self.paramsPassive[i]:
                    ret = ret + " -" + i

        tcl = open(os.path.join(tcl_path, tcl_file + ".tcl"),
                   'w',
                   encoding='utf-8')

        if self.paramsExtern["def_in"]:
            #init design
            tcl.write("set init_mmmc_file %s\n" % self.getObjMMMC())
            tcl.write("set init_lef_file %s\n" % self.design.lef_input)
            tcl.write("set init_verilog %s\n" %
                      self.getObjHDL())  # need to specified
            tcl.write('set init_gnd_net "VSS"\n')
            tcl.write('set init_pwr_net "VDD"\n')
            tcl.write("init_design\n")
            # Load DEF
            tcl.write("defIn %s\n" % self.getDreamplaceDef())

        if self.paramsExtern['detailed_place']:
            if self.paramsExtern['cadence_version'] == '19':
                tcl.write("place_design\n")
            elif self.paramsExtern['cadence_version'] == '15':
                tcl.write("placeDesign\n")
            else:
                Exception("Invalid Cadence version\n")

        # Routing
        tcl.write(ret + "\n")

        if self.paramsExtern['def_out']:
            tcl.write(
                'set dbgLefDefOutVersion 5.8\ndefOut -floorplan -netlist -routing %s.def\n'
                % self.design.top_name)

        tcl.close()

        return ret
예제 #8
0
    def config(self, design, tcl_file):
        rtl_file = util.getHDL(self.design)
        lib_file = util.getLib(self.design)
        hdl_path = util.getHDLPath(self.design, "Cadence")
        lib_path = util.getLibPath(self.design, "Cadence")

        #tcl = open(tcl_file + ".tcl", 'w', encoding='utf-8')
        tcl_path = util.getScriptPath(self.design, "Cadence")
        tcl = open(tcl_path + "/" + tcl_file + ".tcl", 'w', encoding='utf-8')

        #tcl.write('set hdl_files %s\n'%(self.design.rtl_file))
        tcl.write('set hdl_files {%s}\n'%(rtl_file))
        tcl.write('set DESIGN %s\n'%(self.design.top_name))
        tcl.write('set clkpin %s\n'%(self.design.clk_name))
        tcl.write('set delay %d\n'%(self.design.delay))
        #tcl.write('set_attribute hdl_search_path %s\n'%(self.design.hdl_path))
        #tcl.write('set_attribute lib_search_path %s\n'%(self.design.lib_path))
        tcl.write('set_attribute hdl_search_path %s\n'%(hdl_path))
        tcl.write('set_attribute lib_search_path %s\n'%(lib_path))
        tcl.write('set_attribute information_level 6 \n')
        tcl.write('set_attribute library %s\n'%(lib_file))
        tcl.write('read_hdl ${hdl_files} \n')
        tcl.write('elaborate $DESIGN \n')
        tcl.write('set clock [define_clock -period ${delay} -name ${clkpin} [clock_ports]]\n')
        tcl.write('external_delay -input   0 -clock clk [find / -port ports_in/*]\n')
        tcl.write('external_delay -output  0 -clock clk [find / -port ports_out/*]\n')
        tcl.write('dc::set_clock_transition .4 clk\n')
        tcl.write('check_design -unresolved\n')
        tcl.write('report timing -lint\n')

        ret = 'synthesize -to_mapped'

        for i in self.params:
            if self.params[i]:
                ret = ret + " -" + i
        
        tcl.write(ret + '\n')

        #tcl.write("report timing > %s\n"%(self.design.rpt_timing))
        #tcl.write('report gates  > %s\n'%(self.design.rpt_gates))
        #tcl.write('report power  > %s\n'%(self.design.rpt_power))
        #tcl.write('write_hdl -mapped >  %s\n'%(self.design.obj_hdl))
        #tcl.write('write_sdc >  %s\n'%(self.design.obj_sdc))

        tcl.write("report timing > %s\n"%(self.getRptTiming()))
        tcl.write('report gates  > %s\n'%(self.getRptGates()))
        tcl.write('report power  > %s\n'%(self.getRptPower()))
        tcl.write('write_hdl -mapped >  %s\n'%(self.getObjHDL()))
        tcl.write('write_sdc >  %s\n'%(self.getObjSDC()))

        tcl.close()
예제 #9
0
    def config(self, design, tcl_file):
        tcl_path = util.getScriptPath(self.design, "Cadence")
        ret = 'ccopt_design'
        if self.outDir != '!':
            ret = ret + ' -outDir ' + self.outDir
        if self.prefix != '!':
            ret = ret + ' -prefix ' + self.prefix
        for i in self.params:
            if self.params[i] == True:
                ret = ret + ' -' + i

        tcl = open(tcl_path + "/" + tcl_file + ".tcl", 'w', encoding='utf-8')
        tcl.writelines(ret)
        tcl.close()
        return ret
예제 #10
0
def main():
    # Argument processing
    scriptDir = util.getScriptPath()
    parser = argparse.ArgumentParser(description='Compare annotations')
    parser.add_argument('-q', '--quoteIds', dest='quoteIdsFile', help="List of original quoteIds"); 
    parser.add_argument('-c', '--characters', dest='characterDir', help='directory for character files', 
        action='store', default=os.path.join(scriptDir, '../data/characters'))
    parser.add_argument('file1', help='file with new annotations', action='store')
    parser.add_argument('file2', help='file with old annotations', action='store')
    args = parser.parse_args()

    quoteIds = []
    if args.quoteIdsFile != None:
        quoteIds = util.readlines(args.quoteIdsFile)
    compare(args.file1, args.file2, quoteIds)
예제 #11
0
파일: syn.py 프로젝트: pku-dasys/cocoon
    def config(self, tcl_name):
        rtl_file = self.design.rtl_input
        lib_file = self.design.liberty_input
        tcl_path = util.getScriptPath(self.design)
        tcl = open(os.path.join(tcl_path, tcl_name + ".tcl"),
                   'w',
                   encoding='utf-8')

        tcl.write('set DESIGN %s\n' % (self.design.top_name))
        tcl.write('set clkpin %s\n' % (self.design.clk_name))
        tcl.write('set delay %d\n' % (self.design.delay))

        tcl.write('set_attribute information_level 6 \n')
        tcl.write('set_attribute library %s\n' % (lib_file))
        tcl.write(f'read_hdl {rtl_file}\n')

        tcl.write('elaborate $DESIGN \n')

        # Path group for timing optimization
        tcl.write(self.pathGroup())

        tcl.write(
            'set clock [define_clock -period ${delay} -name ${clkpin} [clock_ports]]\n'
        )
        tcl.write(
            'external_delay -input   0 -clock clk [find / -port ports_in/*]\n')
        tcl.write(
            'external_delay -output  0 -clock clk [find / -port ports_out/*]\n'
        )
        tcl.write('dc::set_clock_transition .4 clk\n')
        tcl.write('check_design -unresolved\n')
        tcl.write('report timing -lint\n')

        ret = 'synthesize -to_mapped'

        for i in self.params:
            if self.params[i]:
                ret = ret + " -" + i

        tcl.write(ret + '\n')

        tcl.write("report timing > %s\n" % (self.getRptTiming()))
        tcl.write('report gates  > %s\n' % (self.getRptGates()))
        tcl.write('report power  > %s\n' % (self.getRptPower()))
        tcl.write('write_hdl -mapped >  %s\n' % (self.getObjHDL()))
        tcl.write('write_sdc >  %s\n' % (self.getObjSDC()))

        tcl.close()
예제 #12
0
    def config(self, design, tcl_file):
        rtl_file = util.getHDL(self.design)
        lib_file = util.getLib(self.design)
        #top_name = self.design.top_name
        hdl_path = util.getHDLPath(self.design, "Yosys")
        lib_path = util.getLibPath(self.design, "Yosys")

        tcl_path = util.getScriptPath(self.design, "Yosys")
        tcl = open(tcl_path + "/" + tcl_file + ".ys", 'w', encoding='utf-8')

        tcl.write('read -sv %s\n' % (hdl_path + "/" + rtl_file))
        tcl.write('hierarchy -top %s\n' % (self.design.top_name))
        tcl.write('proc; opt; techmap; opt\n')
        tcl.write('write_verilog %s\n' % (self.getObjHDL()))

        tcl.close()
예제 #13
0
파일: drc.py 프로젝트: pku-dasys/cocoon
    def config(self, design, tcl_file):
        tcl_path = util.getScriptPath(self.design)
        ret = 'check_design'
        if self.params['out_file'] != 'default':
            ret = ret + " -out_file " + self.params['out_file']

        if self.params['no_check']:
            ret = ret + " -no_check"
        else:
            ret = ret + " -type " + self.params['type']

        tcl = open(os.path.join(tcl_path, tcl_file + ".tcl"), 'w', encoding='utf-8')
        tcl.writelines(ret)
        tcl.close()

        return ret
예제 #14
0
    def config(self, design, tcl_file):
        tcl_path = util.getScriptPath(self.design)
        ret = 'ccopt_design'
        if self.outDir != '!':
            ret = ret + ' -outDir ' + self.outDir
        if self.prefix != '!':
            ret = ret + ' -prefix ' + self.prefix
        for i in self.params:
            if self.params[i] == True:
                ret = ret + ' -' + i

        tcl = open(os.path.join(tcl_path, tcl_file + ".tcl"),
                   'w',
                   encoding='utf-8')
        tcl.write(
            'set_ccopt_property buffer_cells "CLKBUF1 CLKBUF2 CLKBUF3"\n')
        tcl.writelines(ret)
        tcl.close()
        return ret
예제 #15
0
    def config(self, design, tcl_file):
        tcl_path = util.getScriptPath(self.design)
        ret = 'place_design'
        if self.params['cadence_version'] == '19':
            ret = 'place_design'
        elif self.params['cadence_version'] == '15':
            ret = 'placeDesign'
        else:
            Exception("Invalid Cadence version!\n")

        for i in self.params:
            if self.params[i] == True:
                ret = ret + " -" + i

        tcl = open(os.path.join(tcl_path, tcl_file + ".tcl"),
                   'w',
                   encoding='utf-8')
        tcl.writelines(ret)
        tcl.close()

        return ret
예제 #16
0
    def config(self, design, tcl_file):
        tcl_path = util.getScriptPath(self.design, "Cadence")
        ret = 'routeDesign'
        for i in self.params:
            if self.params[i]:
                ret = ret + " -" + i

        assert not (self.paramsPassive['placementCheck'] and self.paramsPassive['noPlacementCheck']),\
            'Option -placementCheck and -noPlacementCheck are mutually exclusive.'
        assert not (self.paramsPassive['globalDetail'] and self.paramsPassive['detail']),\
            'Option -globalDetail and -detail are mutually exclusive.'

        if not self.params['passiveFill']:
            for i in self.paramsPassive:
                if self.paramsPassive[i]:
                    ret = ret + " -" + i

        tcl = open(tcl_path + "/" + tcl_file + ".tcl", 'w', encoding='utf-8')
        tcl.writelines(ret)
        tcl.close()

        return ret
예제 #17
0
def main():
    # Argument processing
    scriptDir = util.getScriptPath()
    parser = argparse.ArgumentParser(description='Convert CQSC XML')
    parser.add_argument('-p', dest='includeSectionTags', help='paragraphs and headings', action='store_true')
    parser.add_argument('-c', '--characters', dest='characterDir', help='directory for character files', 
        action='store', default=os.path.join(scriptDir, '../data/characters'))
    parser.add_argument('-f', '--filter', dest='filter', help='filter pattern for input files', action='store')
    parser.add_argument('indir', help='directory to use', action='store')
    parser.add_argument('outdir', nargs='?')
    args = parser.parse_args()

    overallStats = collections.Counter()
    if args.outdir:
        if not os.path.exists(args.outdir):
            os.makedirs(args.outdir)
        overallStatsFile = os.path.join(args.outdir, 'all.stats.txt')
    else:
        overallStatsFile = os.path.join(args.indir, 'all.stats.txt')
    files = glob(args.indir + '/*/')
    for filename in files:
        (base,ext) = os.path.splitext(filename)
        file = os.path.basename(base.rstrip('/').rstrip('\\'))
        charactersFile = os.path.join(args.characterDir, file + ".characters.json")
        if not os.path.isfile(charactersFile):
            charactersFile = None
        outname = os.path.join(args.outdir, file + '.xml') if args.outdir else base + '.xml'
        statsFilename = os.path.join(args.outdir, file + '.stats.txt') if args.outdir else base + '.stats.txt'
        print "Assembling " + filename + " with characters " + str(charactersFile) + " to " + outname
        try:
            characters = util.readCharacters(charactersFile) if charactersFile else None
            assembleParts.assemble(filename, characters, args.includeSectionTags,
                outname, args.filter, overallStats, statsFilename)
        except:
            log.error("Unexpected error processing " + filename + ": ", exc_info=True)
    assembleParts.writeStats(overallStats, overallStatsFile)
예제 #18
0
def run(design, flow):
    design_name = design.top_name
    run_path = util.getRunPath(design, "Cadence")
    print(run_path)
    make_file = open(run_path + "/" + "Makefile", "w")
    tcl_path = util.getScriptPath(design, "Cadence")
    overall_tcl = open(tcl_path + "/" + "flow.tcl", 'w', encoding='utf-8')
    for x_list in flow.ops:
        x = x_list[0]
        if x[0] == "GenusSynth":
            script_path = "../scripts/"
            tmp_op_syn = eval("syn1." + "GenusSynth" + "(design)")
            for param in flow.params_syn:
                tmp_op_syn.setParams(param[0], param[1])
            tmp_op_syn.config(design, design_name + "_" + x[1])
            make_file.write("all:\n")
            make_file.write("\tgenus -legacy_ui -batch -files " + script_path + design_name + "_" + x[1] + ".tcl\n")

        if x[0] == "YosysSynth":
            script_path = "../scripts/"
            tmp_op_syn = eval("syn2." + "YosysSynth" + "(design)")
            tmp_op_syn.config(design, design_name + "_" + x[1])
            make_file.write("all:\n")
            make_file.write("\tyosys " + script_path + design_name + "_" + x[1] + ".ys\n")

        if x[0] == "InnovusFloorplan":
            tmp_op_fp = eval("fp1." + "InnovusFloorplan" + "(design)")
            for y in flow.params_fp:
                tmp_op_fp.setParams(y[0], y[1])
            tmp_op_fp.config(design, design_name + "_" + x[1])
            overall_tcl.write('source %s/%s_to_floorplan.tcl\n'%(tcl_path, design_name))

        if x[0] == "InnovusPDN":
            tmp_op_pdn = eval("pdn1." + "InnovusPDN" + "(design)")
            tmp_op_pdn.config(design, design_name + "_" + x[1])
            overall_tcl.write('source %s/%s_to_pdn.tcl\n'%(tcl_path, design_name))

        if x[0] == "InnovusPlace":
            tmp_op_place = eval("place1." + "InnovusPlace" + "(design)")
            for param in flow.params_place:
                if param[1] == True:
                    tmp_op_place.setParams(param[0])
            tmp_op_place.config(design, design_name + "_" + x[1])
            overall_tcl.write('source %s/%s_to_place.tcl\n'%(tcl_path, design_name))

        if x[0] == "InnovusCTS":
            tmp_op_cts = eval("cts1." + "InnovusCTS" + "(design)")
            tmp_op_cts.config(design, design_name + "_" + x[1])
            overall_tcl.write('source %s/%s_to_cts.tcl\n'%(tcl_path, design_name))

        if x[0] == "InnovusRoute":
            tmp_op_route = eval("route1." + "InnovusRoute" + "(design)")
            for param in flow.params_route:
                tmp_op_route.setParams(param[0], param[1])
            tmp_op_route.config(design, design_name + "_" + x[1])
            overall_tcl.write('source %s/%s_to_route.tcl\n'%(tcl_path, design_name))

        if x[0] == "InnovusDRC":
            tmp_op_drc = eval("drc1." + "InnovusDRC" + "(design)")
            tmp_op_drc.config(design, design_name + "_" + x[1])
            overall_tcl.write('source %s/%s_to_drc.tcl\n'%(tcl_path, design_name))
    

    #make_file.write("\tinnovus -batch -files " + script_path + "flow.tcl")
    run_path = util.getRunPath(design, "Yosys")
    os.chdir(run_path)
    print(os.getcwd())
    #cmd_clean = 'rm innovus.* genus.*'
    #subprocess.Popen(cmd_clean, shell=True).wait()
    #cmd_clean = 'rm -rf fv'
    #subprocess.Popen(cmd_clean, shell=True).wait()
    cmd = 'make'
    #subprocess.Popen(cmd)
    subprocess.Popen(cmd, shell=True).wait()

    return design
예제 #19
0
def run(design, flow, flow_name):
    begin_t = time.time()

    design_name = design.top_name
    run_path = util.getRunPath(design)
    # print(run_path)
    os.system("mkdir -p %s && rm -rf %s*" % (run_path, run_path))
    make_file = open(os.path.join(run_path, "Makefile"), "w")

    tcl_path = util.getScriptPath(design)
    os.system("mkdir -p %s && rm -rf %s*" % (tcl_path, tcl_path))
    overall_tcl = open(os.path.join(tcl_path, "flow.tcl"),
                       'w',
                       encoding='utf-8')

    obj_path = util.getObjPath(design)
    os.system("mkdir -p %s && rm -rf %s*" % (obj_path, obj_path))
    os.system(f"cp {design.rtl_input} {obj_path}")

    rpt_path = util.getRptPath(design)
    os.system("mkdir -p %s && rm -rf %s*" % (rpt_path, rpt_path))

    for x in flow.ops:
        if x[0] == "GenusSynth":
            script_path = "../scripts/"
            tmp_op_syn = syn.GenusSynth(design)
            tmp_op_syn.config(design_name + "_" + x[1])
            output = "\n" if flow.verbose else f" > {os.path.join(rpt_path, 'GenusSynth.log')}\n"
            make_file.write("all:\n")
            make_file.write("\tgenus -legacy_ui -batch -files " + script_path +
                            design_name + "_" + x[1] + ".tcl" + output)

        if x[0] == "yosys":
            script_path = "../scripts/"
            tmp_op_syn = syn.YosysSynth(design)
            tmp_op_syn.config(design_name + "_" + x[1], flow)
            make_file.write("all:\n")
            yosys_path = os.path.join(flow.yosys_bin_path, "yosys")
            save_log = f" | tee -a {os.path.join(rpt_path, 'yosys.log')}\n" if flow.verbose else f" > {os.path.join(rpt_path, 'YosysSynth.log')}\n"
            make_file.write(f"\t{yosys_path} " + script_path + design_name +
                            "_" + x[1] + ".ys" + save_log)

        if x[0] == "InnovusFloorplan":
            tmp_op_fp = fp.InnovusFloorplan(design)
            for key, val in flow.params_fp.items():
                tmp_op_fp.setParams(key, val)
            tmp_op_fp.config(design, design_name + "_" + x[1])
            overall_tcl.write('source %s%s_to_floorplan.tcl\n' %
                              (tcl_path, design_name))

        if x[0] == "InnovusPDN":
            tmp_op_pdn = pdn.InnovusPDN(design)
            tmp_op_pdn.config(design, design_name + "_" + x[1])
            overall_tcl.write('source %s%s_to_pdn.tcl\n' %
                              (tcl_path, design_name))

        if x[0] == "InnovusPlace":
            tmp_op_pdn = place.InnovusPlace(design)
            tmp_op_pdn.params['cadence_version'] = flow.cadence_version
            tmp_op_pdn.config(design, design_name + "_" + x[1])
            overall_tcl.write('source %s%s_to_place.tcl\n' %
                              (tcl_path, design_name))

        if x[0] == "DREAMPlace":
            tmp_op_place = place.DREAMPlace(design)
            tmp_op_place.config(design, design_name + "_" + x[1])

        if x[0] == "InnovusCTS":
            tmp_op_cts = cts.InnovusCTS(design)
            tmp_op_cts.config(design, design_name + "_" + x[1])
            overall_tcl.write('source %s%s_to_cts.tcl\n' %
                              (tcl_path, design_name))

        if x[0] == "InnovusRoute":
            tmp_op_route = route.InnovusRoute(design)
            for key, val in flow.params_route.items():
                tmp_op_route.setParams(key, val)
            tmp_op_route.paramsExtern['cadence_version'] = flow.cadence_version
            tmp_op_route.config(design, design_name + "_" + x[1])

            overall_tcl.write('source %s%s_to_route.tcl\n' %
                              (tcl_path, design_name))
            # overall_tcl.write('set dbgLefDefOutVersion 5.8\ndefOut -floorplan -netlist -routing %s.def\n'%(design_name))
        if x[0] == "InnovusDRC":
            tmp_op_drc = drc.InnovusDRC(design)
            tmp_op_drc.config(design, design_name + "_" + x[1])
            overall_tcl.write('source %s%s_to_drc.tcl\n' %
                              (tcl_path, design_name))

    if flow.flow['placement'] == "innovus":
        output = "\n" if flow.verbose else f" > {os.path.join(rpt_path, 'innovus.log')}\n"
        make_file.write("\tinnovus -batch -files " + script_path + "flow.tcl" +
                        output)
    elif flow.flow['placement'] == "dreamplace":
        output = "\n" if flow.verbose else f" > {os.path.join(rpt_path, 'innovus_fp.log')}\n"
        make_file.write("\tinnovus -batch -files " + script_path +
                        ("%s_to_floorplan.tcl" % design_name) + output)

        save_log = f" | tee -a {os.path.join(rpt_path, 'dreamplace.log')}\n" if flow.verbose else f" > {os.path.join(rpt_path, 'dreamplace.log')}\n"
        make_file.write("\tpython %s %s" %
                        (flow.dreamplace_bin_path, script_path +
                         "%s_to_place.json" % design_name) + save_log)

        output = "\n" if flow.verbose else f" > {os.path.join(rpt_path, 'innovus_route.log')}\n"
        make_file.write("\tinnovus -batch -files " + script_path +
                        ("%s_to_route.tcl" % design_name) + output)

    make_file.close()
    overall_tcl.close()

    run_path = util.getRunPath(design)
    print("Current working directory: %s" % run_path)
    proc_make = subprocess.Popen('make', cwd=run_path)  # Start a child process
    proc_make.wait()  # Wait until the process finishes
    assert proc_make.poll(
    ) == 0, "The flow [%s] failed and the process finished abnormally" % flow_name
    print("The basic flow has finished successfully!")
    print(f"Design is saved to {run_path}{design.top_name}\n\n")

    # Iterative Feedback Tuning
    if flow.n_iter_IFT > 0:
        for i in range(flow.n_iter_IFT):
            print("========== Start of the IFT iteration %d ==========\n" %
                  (i + 1))

            rpt_path = tmp_op_syn.getRptTiming()
            critical_path = util.parseTimingRpt(rpt_path)
            tmp_op_syn = syn.GenusSynth(design, critical_path)
            tmp_op_syn.config(design_name + "_" + "to_synth")

            proc_make = subprocess.Popen('make',
                                         cwd=run_path)  # Start a child process
            proc_make.wait()  # Wait until the process finishes
            assert proc_make.poll(
            ) == 0, "The flow failed and the process finished abnormally"
            print(f"========== Finish IFT round [{i+1}] ==========\n")

    end_t = time.time()
    print(
        "*************** Flow [{}] finishes in {:.1f} seconds ***************\n"
        .format(flow_name, end_t - begin_t))
예제 #20
0
# Run with ./monitor.py (or python monitor.py on Windows)

import argparse
import json
import os
import logging
import traceback
import requests
from threading import Lock
from flask import Flask, request, jsonify
from werkzeug import secure_filename

import util
import index

SCRIPT_DIR = util.getScriptPath()
INDEX_ALL_BIN = os.path.join(SCRIPT_DIR, 'index_scannet.sh')
CONVERT_H264_TO_MP4_BIN = os.path.join(SCRIPT_DIR, 'scripts', 'h264_to_mp4.sh')
CONVERT_H264_TO_THUMBNAIL_BIN = os.path.join(SCRIPT_DIR, 'scripts', 'h264_thumbnail.sh')

CMD_ARGS = []
if os.name == 'nt':
    GIT_BASH = 'C:\\Program Files\\Git\\bin\\bash.exe'
    CMD_ARGS = [GIT_BASH]

# where scan data is stored under as subdirs with unique ids
STAGING_FOLDER = os.path.join(SCRIPT_DIR, 'staging')

# informing our management UI of our updated state
WEBUI = 'http://localhost:3030'