Example #1
0
    def skip(self):
        if not self.use_rtl():
            Msg.user(
                "[RtlExecutor::skip] skipping due to no rtl information specified"
            )
            return True

        return False
Example #2
0
    def get_plus_args(self):
        rtl_root = self.rtl.get("root")
        meta_args = self.rtl.get(
            "meta_args",
            "tc_mode=force railhouse=on rvbar=80000000 prefetch_drop_int=10 "
            "no_commit_cycles=6000",
        )  # by default set railhouse on

        # look for additional meta args if any
        add_meta_args = self.rtl.get("add_meta_args", "")
        if len(add_meta_args) > 0:
            meta_args = " ".join([meta_args, add_meta_args])

        meta_converter = self.rtl.get("meta_converter")
        convert_cmd = meta_converter + ' -r %s -m "%s"' % (rtl_root, meta_args)
        plus_args, is_valid = SysUtils.get_command_output(convert_cmd)
        Msg.user("Meta args converting command: %s" % convert_cmd, "META-CONV")
        if not is_valid:
            Msg.user("Conversion failed.", "META-CONV")
            raise ValueError("Meta conversion failed: %s" % meta_args)
        else:
            Msg.user("Converted to plus args: %s" % plus_args, "META-CONV")

        if self.rtl.get("filter"):
            plus_args = self.filter_plus_args(plus_args)
            Msg.user("Filtered plus args: %s" % plus_args, "META-CONV")
        return plus_args
Example #3
0
    def query_result_log(self, aHfile):
        instr_count = None
        my_message = None
        for line in aHfile:
            if line.find("Executed") != -1:
                search_result = re.search(self.cInstrNumPattern, line)
                if search_result is not None:
                    Msg.user("Matched line: %s" % line, "ISS-LOG")
                    instr_count = int(search_result.group(1))
                    my_message = search_result.group(2)
                    break

        if instr_count is None:
            return 0, "Simulator terminated before completion"

        Msg.user(
            "InstructionCount: %d, Message: %s" % (instr_count, my_message),
            "ISS-LOG")

        return instr_count, my_message
Example #4
0
    def extract_results(self, a_result, a_log, a_elog):

        # extract information from the generate log
        my_result, my_error = self.query_logs(a_log, a_elog)
        Msg.user("Process: %s" % (str(a_result)), "RTL-SIM")
        Msg.user("Log[%s]: []" % (str(a_log)), "RTL-SIM")

        process_ret_code = int(a_result[RtlResult.process_retcode])
        test_passed = my_result[RtlResult.rtl_passed]

        if (process_ret_code == 0) and not test_passed:
            Msg.warn(
                "[RTL-SIM] Test Passed=%s, but process return code is %d, "
                "changing return code to 1" %
                (str(test_passed), process_ret_code))
            process_ret_code = 1

        my_process_data = {
            RtlKeys.rtl_retcode: process_ret_code,
            RtlKeys.rtl_stdout: str(a_result[RtlResult.process_stdout]),
            RtlKeys.rtl_stderr: str(a_result[RtlResult.process_stderr]),
            RtlKeys.rtl_start: str(a_result[RtlResult.process_start]),
            RtlKeys.rtl_end: str(a_result[RtlResult.process_end]),
            RtlKeys.rtl_count: int(my_result[RtlResult.rtl_cycle_count]),
            RtlKeys.rtl_message: str(my_result[RtlResult.rtl_message]),
            RtlKeys.rtl_log: a_log,
        }

        return my_process_data
Example #5
0
    def execute(self):

        test_passed = True

        try:
            self.build_cmd()

            self.copy_waves_fsdb_do_file()
            self.output_rerun_script()

            # report the command line
            Msg.info("RTLCommand = " + str({"rtl-command": self.rtl_cmd}))

            # execute the simulation
            my_result = SysUtils.exec_process(
                self.rtl_cmd,
                self.rtl_log,
                self.rtl_log,
                self.ctrl_item.timeout,
                True,
            )

            Msg.user("Results: %s" % (str(my_result)), "RTLEX-RESULT")
            my_extract_results = self.extract_results(my_result,
                                                      "./" + self.rtl_log,
                                                      None)

            # report the results
            Msg.info("RTLResult = " + str(my_extract_results))

        except Exception as arg_ex:
            Msg.error_trace("RTL Process Failure")
            Msg.err("RTL did not properly execute, Reason: %s" % (str(arg_ex)))
            return False

        return test_passed
Example #6
0
    def skip(self):
        if self.ctrl_item.no_sim:
            Msg.user("[FpixExecutor::skip] skipping due to no-sim")
            return True

        if "skip" in self.ctrl_item.fpix_riscv.keys():
            if self.ctrl_item.fpix_riscv["skip"]:
                Msg.user("[FpixExecutor::skip] skipping due to "
                         "--fpix_riscv.skip specified")
            return True

        if "fpix_path" not in self.ctrl_item.fpix_riscv.keys():
            Msg.user(
                "[FpixExecutor::skip] skipping due to no fpix_path specified")
            return True

        return False
Example #7
0
    def execute(self):
        my_result = None
        try:
            if self.ctrl_item.suffix is not None:
                my_task_name = self.task_name.replace(
                    "_force", "_%s_force" % (str(self.ctrl_item.suffix)))
            else:
                my_task_name = self.task_name

            my_elf = self.locate_test_case("*.Default.ELF", my_task_name)

            my_log = self.sim_log
            my_elog = self.sim_log

            if "cfg" not in self.ctrl_item.fpix_riscv.keys():
                Msg.err("Fpix_ISS did not properly execute, "
                        "Reason: Fpix config was not specified")
                return False

            if "fpix_path" not in self.ctrl_item.fpix_riscv.keys():
                Msg.err(
                    "FpixExecutor::execute: did not recieve a path to Fpix "
                    "application fpix_path.")
                raise
            else:
                self.mFpixPath = self.ctrl_item.fpix_riscv["fpix_path"]

            # build the sim_cmd now that we have full information available
            self.sim_cmd = ("%s --railhouse %s --cluster_num %d "
                            "--core_num %d --threads_per_cpu %d -i %d "
                            "--cfg %s" % (
                                self.mFpixPath,
                                self.MY_RAILHOUSE_LOG,
                                self.ctrl_item.num_chips,
                                self.ctrl_item.num_cores,
                                self.ctrl_item.num_threads,
                                self.ctrl_item.max_instr,
                                self.ctrl_item.fpix_riscv["cfg"],
                            ))

            self.sim_cmd += " %s"

            # initalize the iss summary
            my_cmd = self.sim_cmd % my_elf

            # report the command line
            Msg.info("ISSCommand = " + str({"command": my_cmd}))
            # execute the simulation
            my_result = SysUtils.exec_process(my_cmd, my_log, my_elog,
                                              self.ctrl_item.timeout, True)

            my_extract_results = self.extract_results(my_result, my_log,
                                                      my_elog)

            # report the results
            Msg.info("ISSResult = " + str(my_extract_results))

            # Fpix riscv is not made to provide the sort of information that
            # the message system expects. Almost anything here will cause the
            # next app not to run.

        except Exception as arg_ex:
            Msg.error_trace("Fpix_ISS Execute Failure")
            Msg.err("Fpix_ISS did not properly execute, Reason: %s" %
                    (str(arg_ex)))
            return False

        return SysUtils.success(int(my_result[IssResult.process_retcode]))
Example #8
0
    def load(self, arg_ctrl_item):
        super().load(arg_ctrl_item)

        Msg.dbg("ExecuteController::initialize_sim()")
        if not self.ctrl_item.no_sim:
            self.sim_log = "fpix_sim.log"
Example #9
0
    def build_cmd(self):
        rtl_root = self.rtl.get("root")
        regr_val = self.rtl.get("regr")
        bld_cfg_val = self.rtl.get("bld_cfg")
        exe_val = self.rtl.get("exe")
        rtl_executable = "%s/verif/top/sim/%s/build/%s/%s" % (
            rtl_root,
            regr_val,
            bld_cfg_val,
            exe_val,
        )

        plus_args = self.get_plus_args()

        # finding ELF Files
        my_elf = self.locate_test_case("*.Default.ELF", self.task_name)
        my_elfns = self.locate_test_case("*.Secondary.ELF", self.task_name)

        my_task_name = my_elf.replace(".Default.ELF", "")

        Msg.user("Default Elf: %s, Secondary: %s" %
                 (str(my_elf), str(my_elfns)))

        self.rtl_log = "%s.log" % my_task_name

        my_params = list()
        my_params.append(
            RtlOption("+", "skyros_mem_default",
                      RtlDefaults.skyros_mem_default))
        my_params.append(
            RtlOption("+", "tbench_elf64",
                      RtlDefaults.tbench_elf64 % my_task_name))
        my_params.append(RtlOption("+", "s_mem_init", RtlDefaults.s_mem_init))
        my_params.append(RtlOption("+", "ns_mem_init",
                                   RtlDefaults.ns_mem_init))
        my_params.append(
            RtlOption("+", "goldmem_level", RtlDefaults.goldmem_level))
        my_params.append(RtlOption("+", "UVM_TC_PATH",
                                   RtlDefaults.UVM_TC_PATH))
        my_params.append(
            RtlOption("+", "UVM_TC_NAME",
                      RtlDefaults.UVM_TC_NAME % my_task_name))
        my_params.append(
            RtlOption(
                "+",
                "UVM_TC_SEED",
                RtlDefaults.UVM_TC_SEED % self.ctrl_item.seed,
            ))
        my_params.append(
            RtlOption(
                "+",
                "ntb_random_seed",
                RtlDefaults.ntb_random_seed % self.ctrl_item.seed,
            ))
        my_params.append(
            RtlOption("+", "UVM_TEST_DIR", RtlDefaults.UVM_TEST_DIR))

        # next one is a bit of an oddball
        my_params.append(
            RtlOption(
                "-",
                "reportstats -assert %s -l %s" %
                (RtlDefaults.assert_proc, self.rtl_log),
                None,
            ))

        #################################################
        # NOTE: DO NOT USE format to assemble string  ##
        #################################################

        self.rtl_cmd = rtl_executable + " " + plus_args + " " + self.assemble_cmd(
            my_params)

        # If FORCE_INIT is a detected argument we are preloading the boot code,
        # assemble the appropriate commands
        if self.yes_preload_boot_code:
            img_modify_script = "%s/bin/%s" % (
                rtl_root,
                self.rtl.get("img_modify"),
            )
            tst_handler_script = "%s/bin/%s" % (
                rtl_root,
                self.rtl.get("tst_handler"),
            )
            current_dir = PathUtils.current_dir()
            name_in_dir = current_dir + "/" + my_task_name
            tst_filename = "%s/%s.tst" % (current_dir, my_task_name)

            # These are options from the makefile and their default values
            # which have some meaning to the preload scripts. Since we don't
            # support MP, its not clear if they should be optional yet.
            force_thread1 = "0"
            clusters = "1"
            gpro_48 = "1"
            gpro_core_switch = "0"

            seed = self.ctrl_item.seed
            self.preload_cmd = ("%s %s %s; %s %s %s %s %s %s %s %s; "
                                "mkdir ELF; cp ./*.ELF ELF; cp ./*.img ELF;" %
                                (
                                    img_modify_script,
                                    name_in_dir,
                                    current_dir,
                                    tst_handler_script,
                                    tst_filename,
                                    current_dir,
                                    force_thread1,
                                    clusters,
                                    gpro_48,
                                    gpro_core_switch,
                                    seed,
                                ))
            # simply ";" splice the different commands together and run
            # compound command like usual.
            self.rtl_cmd = self.preload_cmd + self.rtl_cmd
            # self.rtl_cmd.replace("UVM_NONE", "UVM_HIGH")#DEBUG

        Msg.user("rtl_cmd: " + str(self.rtl_cmd), "RTL-EXEC")