Exemplo n.º 1
0
    def _check_options(self):
        if not self.top_dir:
            self.top_dir = os.getcwd()
        else:
            if xTools.not_exists(self.top_dir, "Top Source Path"):
                return 1
        self.design = xTools.get_abs_path(self.design, self.top_dir)
        if xTools.not_exists(self.design, "Design absolute path"):
            return 1

        self.diamond = get_real_value(self.diamond, DIAMOND_EXTERNAL_ENV_KEY)
        self.squish = get_real_value(self.squish, SQUISH_EXTERNAL_ENV_KEY)

        if xTools.not_exists(self.diamond, "Diamond Path"):
            return 1
        if xTools.not_exists(self.squish, "Squish Path"):
            return 1
        if self.on_win:
            self.squish_server = os.path.join(self.squish, "bin",
                                              "squishserver.exe")
            self.squish_runner = os.path.join(self.squish, "bin",
                                              "squishrunner.exe")
        else:
            self.squish_server = os.path.join(self.squish, "bin",
                                              "squishserver")
            self.squish_runner = os.path.join(self.squish, "bin",
                                              "squishrunner")
Exemplo n.º 2
0
 def sanity_check(self):
     # get src_design and dst_design
     if self.top_dir:
         if not self.design:
             xTools.say_it("-Error. No design name specified")
             return 1
         self.top_dir = os.path.abspath(self.top_dir)
     else:
         if self.design:
             if os.path.isabs(self.design):
                 xTools.say_it("-Warning. <--design=[single design_name or relative design path for top_dir]> is nicer")
             self.top_dir = os.getcwd()
         else:
             self.top_dir, self.design = os.path.split(os.getcwd())
     self.src_design = xTools.get_abs_path(self.design, self.top_dir)
     if xTools.not_exists(self.top_dir, "Top Source path"):
         return 1
     if xTools.not_exists(self.src_design, "Source Design"):
         return 1
     if self.job_dir:
         self.job_dir = os.path.abspath(self.job_dir)
     else:
         self.job_dir = self.top_dir
     self.dst_design = os.path.join(self.job_dir, self.design, self.tag)
     if xTools.wrap_md(self.dst_design, "Job Working Design Path"):
         return 1
     self.scripts_options["src_design"] = self.src_design
     self.scripts_options["dst_design"] = self.dst_design
     for conf_f in os.listdir(self.scripts_options["src_design"]):
         if conf_f.endswith(".conf"):
             try:
                 shutil.copy(os.path.join(self.src_design,conf_f),os.path.join(self.job_dir, self.design))
             except:
                 pass
Exemplo n.º 3
0
 def parse_suite_ini_file(self, suite):
     print "---------------"
     print suite
     suite_url = "%s/%s" % (self.svn, suite)
     for item in (self.case_ini, self.cmd_ini):
         ini_url = "%s/%s" % (suite_url, item)
         _exists, _no_use = get_status_output("svn ls %s" % ini_url)
         if _exists:
             continue
         if export_file_from_svn(ini_url):
             pass
     if not_exists(self.case_ini, "file"):
         return 1
     if not os.path.isfile(self.cmd_ini):
         cmd_dict = dict()
         pass  # just give the warning message
     else:
         sts, cmd_dict = get_conf_options(self.cmd_ini, key_lower=False)
         if sts:
             return 1
     # -------------------
     cmd_section = cmd_dict.get("cmd", dict())
     ini_dict = ini2dict(self.case_ini)
     if self.run_check:
         self.run_check_flow(suite, ini_dict)
     else:
         self.dump_to_file(suite, ini_dict, cmd_section)
     # -------------------
     os.remove(self.case_ini)
     if os.path.isfile(self.cmd_ini):
         os.remove(self.cmd_ini)
Exemplo n.º 4
0
 def sanity_check(self):
     if xTools.not_exists(self.top_dir, "top result path"):
         return 1
     # get designs
     self.designs = list()
     if self.design:
         self.designs.append(self.design)
     else:
         for foo in os.listdir(self.top_dir):
             check_folder = os.path.join(self.top_dir, foo, "_scratch")
             if os.path.isdir(check_folder):
                 self.designs.append(foo)
         if not self.designs:
             xTools.say_it("Error. Not found any designs in %s" %
                           self.top_dir)
             return 1
     self.makejdv = _is_a_file(self.makejdv, self.xlib, "MAKEJDV EXE FILE")
     self.package = _is_a_file(self.package, self.xlib, "PACKAGE FILE")
     if not self.makejdv:
         return 1
     if not self.package:
         return 1
     if xTools.wrap_md(self.target_dir, "Target Path"):
         return 1
     self.target_dir = os.path.abspath(self.target_dir)
Exemplo n.º 5
0
def _is_a_file(file_string, default_path, comments):
    if not file_string:
        xTools.say_it("Error. no value for %s" % comments)
        return
    if os.path.isfile(file_string):
        return os.path.abspath(file_string)
    else:
        file_string = xTools.get_abs_path(file_string, default_path)
        if xTools.not_exists(file_string, comments):
            return
        return file_string
Exemplo n.º 6
0
def main():
    _default_suite = os.path.join(xTools.get_file_dir(sys.argv[0]), "xlib",
                                  "BasicSuite")
    parser = optparse.OptionParser()
    parser.add_option("--diamond",
                      default="DiamondInstallPath",
                      help="specify Diamond Install Path")
    parser.add_option("--ldf-file",
                      default="LDF_FILE",
                      help="specify the Diamond project file")
    parser.add_option("--base-suite",
                      default=_default_suite,
                      help="specify basic suite path")
    parser.add_option("--squish", help="specify Squish Install Path")
    parser.add_option("--x86",
                      action="store_true",
                      help="run with 32-bit vendor tool")

    opts, args = parser.parse_args()
    diamond = opts.diamond
    ldf_file = opts.ldf_file
    base_suite = opts.base_suite
    squish = opts.squish
    x86 = opts.x86

    if xTools.not_exists(diamond, "Diamond Install Path"):
        return 1
    diamond = os.path.abspath(diamond)
    if xTools.not_exists(ldf_file, "Diamond Project (ldf) File"):
        return 1
    ldf_file = os.path.abspath(ldf_file)
    if xTools.not_exists(base_suite, "Base Suite Path"):
        return 1
    base_suite = os.path.abspath(base_suite)
    if xTools.not_exists(squish, "Squish Install Path"):
        return 1
    squish = os.path.abspath(squish)

    my_gui_flow = RunGUI(diamond, ldf_file, base_suite, squish, x86)
    sts = my_gui_flow.process()
    return sts
Exemplo n.º 7
0
 def get_other_files(self):
     impl_pattern = os.path.join(self.top_dir, self.dsn, "_scratch", "*",
                                 "*.dir")
     impl_folder = glob.glob(impl_pattern)
     if not impl_folder:
         xTools.say_it("Error. Not found implementation folder like %s" %
                       impl_pattern)
         return 1
     self.basic_impl = os.path.splitext(impl_folder[0])[0]
     xTools.say_it("Basic Implementation string: %s" % self.basic_impl, "",
                   self.debug)
     self.pad_file = self.basic_impl + ".pad"
     if xTools.not_exists(self.pad_file, "pad file"):
         return 1
Exemplo n.º 8
0
 def copy_layout_file(self):
     user = getpass.getuser()
     testdata_path = os.path.join(self.design, "testdata")
     if xTools.not_exists(testdata_path, "testdata path"):
         return 1
     if self.on_win:
         layout_path = os.path.join(
             r"C:\Users\%s\AppData\Roaming\LatticeSemi\pnlayout" % user)
     else:
         layout_path = "/users/%s/.config/LatticeSemi/pnlayout" % user
     for foo in os.listdir(testdata_path):
         if xTools.get_fext_lower(foo) == ".ini":  # found layout file
             src_foo = os.path.join(testdata_path, foo)
             dst_foo = os.path.join(layout_path, foo)
             if xTools.wrap_cp_file(src_foo, dst_foo):
                 return 1
Exemplo n.º 9
0
    def run_check_flow(self):
        # // run check flow always!
        report_path = os.getcwd();
        report = "check_flow.csv"
        check_py = os.path.join(os.path.dirname(__file__),'..','tools','check', "check.py")
        check_py = os.path.abspath(check_py)
        if xTools.not_exists(check_py, "source script file"):
            return 1
        cmd_kwargs = dict()
        cmd_kwargs["top_dir"] = "--top-dir=%s" % self.job_dir
        cmd_kwargs["design"] = "--design=%s" % self.design

        _check_conf = self.scripts_options.get("check_conf")
        if _check_conf:
            cmd_kwargs["conf_file"] = "--conf-file=%s" % _check_conf
        else:
            ### the conf file will be used as as family_device_package.conf
            [self.family2,self.device2,self.package2] = ["","",""]
            if not self.family:
                try:
                    [self.family2,self.device2,self.package2] = self.scripts_options.get("devkit","").split(",")
                except:
                    pass
            if self.family2.strip():
                self.family = self.family2
            if self.device2.strip():
                self.device = self.device2
            if self.package2.strip():
                self.package = self.package2
            _check_conf = self.family.strip()+"_"+self.device.strip()+"_"+self.package.strip()+".conf"
            if(os.path.isfile(os.path.join(self.src_design,_check_conf))):
                cmd_kwargs["conf_file"] ="--conf-file="+ _check_conf.replace(".conf","")
            else:
                #cmd_kwargs["conf_file"] = ""
                pass
        cmd_kwargs["report_path"] = "--report-path=%s" % report_path
        cmd_kwargs["tag"] = "--tag=%s" % self.tag
        cmd_kwargs["report"] = "--report=%s" % report
        cmd_line = r"%s %s " % (sys.executable, check_py)
        for key, value in cmd_kwargs.items():
            cmd_line += " %s " % value
        cmd_line = xTools.win2unix(cmd_line, 0)
        xTools.say_it(" Launching %s" % cmd_line)
        sts, text = xTools.get_status_output(cmd_line)
        xTools.say_it(text)
        return sts
Exemplo n.º 10
0
 def merge_local_options(self):
     '''
     Get the info/project options from the case directory
     :return:
     '''
     if self.info_file_name:
         t = os.path.join(self.src_design, self.info_file_name)
         if xTools.not_exists(t, "user specified info file"):
             return 1
         info_file = [t]
         len_info_file = 1
     else:
         info_file = glob.glob(os.path.join(self.src_design, "*.info"))
         len_info_file = len(info_file)
         if len_info_file > 1:
             xTools.say_it("-Error. Found %d info file under %s" % (len_info_file, self.src_design))
             return 1
     if not len_info_file:  # read the project file directly
         ice_prj_files = glob.glob(os.path.join(self.src_design, "par", "*.project"))
         if not ice_prj_files:
             ice_prj_files = glob.glob(os.path.join(self.src_design, "synthesis", "*", "*.project"))
         if not ice_prj_files:
             ice_prj_files = glob.glob(os.path.join(self.src_design, "project", "*", "*", "*.project"))
         if xTools.check_file_number(ice_prj_files, "iCEcube2 project file"):
             return 1
         local_options = self.get_ice_project_options(ice_prj_files[0])
         self._merge_options(local_options)
         self.scripts_options["same_ldf_dir"] = os.path.dirname(ice_prj_files[0])
         self.scripts_options["use_ice_prj"] = 1
     else:
         sts, info_dict = xTools.get_conf_options(info_file)
         if sts:
             return 1
         qa_info_dict = info_dict.get("qa")
         if qa_info_dict:
             project_file = qa_info_dict.get("project_file")
         else:
             project_file = ""
         if project_file:
             local_options = self.get_ice_project_options(project_file)
             self.scripts_options["same_ldf_dir"] = os.path.dirname(project_file)
             self.scripts_options["use_ice_prj"] = 1
             self._merge_options(local_options)
         else:
             self.scripts_options["same_ldf_dir"] = os.path.dirname(info_file[0])
             self._merge_options(info_dict)
Exemplo n.º 11
0
 def get_lst_file(self):
     sim_dir = os.path.join(self.top_dir, self.dsn, "_scratch",
                            self.lst_from)
     if xTools.not_exists(sim_dir, "simulation result path"):
         return 1
     self.is_riviera = 0
     self.lst_file = ""
     for foo in os.listdir(sim_dir):
         abs_foo = os.path.join(sim_dir, foo)
         if not self.is_riviera:
             if self.p_sim_log.search(foo):
                 self.is_riviera = xTools.simple_parser(
                     abs_foo, [
                         self.p_riviera,
                     ])
                 if self.is_riviera:
                     self.is_riviera = 1
         if foo.lower().endswith(".lst"):
             self.lst_file = abs_foo
     if not self.lst_file:
         xTools.say_it("Error. Not found lst file in %s" % sim_dir)
         return 1
     xTools.say_it("LST File: %s" % self.lst_file, "", self.debug)
Exemplo n.º 12
0
 def merge_conf_options(self):
     '''
     get the conf file setting, and merge them with command options
     '''
     _conf = self.scripts_options.get("conf")
     if not _conf:
         _conf = os.path.join(os.path.dirname(sys.argv[0]), "..", "conf")
     if os.path.isdir(_conf):
         pass
     else:
         if xTools.not_exists(_conf, "Default Configuration Path"):
             return 1
     _conf = os.path.abspath(_conf)
     self.scripts_options["conf"] = _conf
     conf_files = glob.glob(os.path.join(_conf, "*.ini"))
     if not conf_files:
         xTools.say_it("-Error. Not found any ini file under %s" % _conf)
         return 1
     sts, conf_options = xTools.get_conf_options(conf_files)
     if sts:
         return 1
     #if conf_options.get("ice",""):
     #    conf_options["icecube_path"] = conf_options.get("ice","")
     self._merge_options(conf_options)
Exemplo n.º 13
0
 def _process(self):
     if xTools.not_exists(self.pad_file, "pad file"):
         return 1
     self.__create_pad_dict()
     if self.__create_ports():
         return 1