From 40e29fe40798fa27c74d14c77c8f94f8e59ec44c Mon Sep 17 00:00:00 2001 From: maksyuki Date: Sun, 3 Mar 2024 14:10:32 +0800 Subject: [PATCH] modify global vars path and wave conver method --- src/config.py | 34 ++++++++++++++++++---------------- src/def_config.toml | 2 +- src/vcs_test.py | 20 ++++++++++++++++++-- 3 files changed, 37 insertions(+), 19 deletions(-) diff --git a/src/config.py b/src/config.py index 3984ee9..c26e9b6 100644 --- a/src/config.py +++ b/src/config.py @@ -11,26 +11,28 @@ # CUR_BRAN = '202302' CUR_BRAN = 'main' # NOTE: just for test HOME_DIR = os.getcwd() + '/' -DATA_DIR = HOME_DIR + '../data/' + CUR_BRAN -SUBMIT_LIST_PATH = DATA_DIR + '/submit_list' -CORE_LIST_PATH = DATA_DIR + '/core_list' -QUEUE_LIST_PATH = DATA_DIR + '/queue_list' -RUN_LOG_PATH = DATA_DIR + '/run.log' +DATA_DIR = f'{HOME_DIR}../data/CUR_BRAN' +SUBMIT_LIST_PATH = f'{DATA_DIR}/submit_list' +CORE_LIST_PATH = f'{DATA_DIR}/core_list' +QUEUE_LIST_PATH = f'{DATA_DIR}/queue_list' +RUN_LOG_PATH = f'{DATA_DIR}/run.log' # NOTE: need to modify the SUBMIT_DIR path for the CICD repo # now just for test -SUBMIT_DIR = HOME_DIR + '../tests/intg' -SUB_DIR = SUBMIT_DIR + '/submit' -RPT_DIR = SUBMIT_DIR + '/report' +SUBMIT_DIR = f'{HOME_DIR}../tests/intg' +SUB_DIR = f'{SUBMIT_DIR}/submit' +RPT_DIR = f'{SUBMIT_DIR}/report' +WAVE_DIR = f'{HOME_DIR}../tests/wave' + # vcs -VCS_DIR = HOME_DIR + '../vcs' -VCS_RUN_DIR = VCS_DIR + '/run' -VCS_CPU_DIR = VCS_DIR + '/cpu' -VCS_SCRIPT_DIR = VCS_DIR + '/script' +VCS_DIR = f'{HOME_DIR}../vcs' +VCS_RUN_DIR = f'{VCS_DIR}/run' +VCS_CPU_DIR = f'{VCS_DIR}/cpu' +VCS_SCRIPT_DIR = f'{VCS_DIR}/script' # dc -DC_SRC_DIR = HOME_DIR + '../lib/dc/bes_data/syn/scr' -DC_CFG_DIR = HOME_DIR + '../lib/dc/bes_data/common' -DC_LOG_DIR = DC_SRC_DIR + '../log' -DC_RPT_DIR = DC_SRC_DIR + '../rpt' +DC_SRC_DIR = f'{HOME_DIR}../lib/dc/bes_data/syn/scr' +DC_CFG_DIR = f'{HOME_DIR}../lib/dc/bes_data/common' +DC_LOG_DIR = f'{DC_SRC_DIR}../log' +DC_RPT_DIR = f'{DC_SRC_DIR}../rpt' TESTCASE_NAME_LIST = ['hello', 'memtest', 'rtthread'] TESTCASE_TYPE_LIST = ['flash', 'mem', 'sdram'] diff --git a/src/def_config.toml b/src/def_config.toml index 04ea370..4d37449 100644 --- a/src/def_config.toml +++ b/src/def_config.toml @@ -28,7 +28,7 @@ flag = "vcs" # commit flag[dont use] freq = 25 prog = {name = "", type = ""} # format: [name]-[type] name: [hello, memtest, rtthread] type: [flash, mem, sdram] # leave name item a blank mean test all programs -wave = "off" # [off on] +wave = "off" # [off on] note: wave option only valid when prog.name is not a blank and wave is "on" [dc] flag = "dc" # flag[dont use] diff --git a/src/vcs_test.py b/src/vcs_test.py index 99a81da..034df47 100644 --- a/src/vcs_test.py +++ b/src/vcs_test.py @@ -97,6 +97,13 @@ def collect_run_log(self, prog_name: str, prog_type: str): self.run_res[f'{prog_name}-{prog_type}'] = tmp_res + def gen_wave_rpt(self): + os.chdir(config.VCS_RUN_DIR) + wave_name = f'{self.dut_cfg.top}_{self.vcs_cfg.prog[0]}_{self.vcs_cfg.prog[1]}' + os.system(f'fsdb2vcd asic_top.fsdb -o {wave_name}.vcd') + os.system(f'vcd2fst -v {wave_name}.vcd -f {wave_name}.fst') + os.chdir(config.HOME_DIR) + def comp(self): os.chdir(config.VCS_RUN_DIR) os.system('make comp') @@ -113,8 +120,16 @@ def run(self): else: self.program(self.vcs_cfg.prog[0], self.vcs_cfg.prog[1]) - os.system( - f'make run test={self.vcs_cfg.prog[0]}-{self.vcs_cfg.prog[1]}') + if self.vcs_cfg.wave == 'off': + os.system( + f'make run test={self.vcs_cfg.prog[0]}-{self.vcs_cfg.prog[1]}' + ) + else: + os.system( + f'make run test={self.vcs_cfg.prog[0]}-{self.vcs_cfg.prog[1]} wave=on' + ) + self.gen_wave_rpt() + self.collect_run_log(self.vcs_cfg.prog[0], self.vcs_cfg.prog[1]) def gen_rpt_dir(self) -> str: @@ -123,6 +138,7 @@ def gen_rpt_dir(self) -> str: os.system(f'mkdir -p {rpt_path}') return rpt_path + def gen_comp_rpt(self) -> bool: rpt_path = self.gen_rpt_dir() with open(f'{rpt_path}/vcs_report', 'a+', encoding='utf-8') as fp: