Skip to content

Commit

Permalink
feat: add dut config to the vcs and dc test
Browse files Browse the repository at this point in the history
  • Loading branch information
maksyuki committed Feb 27, 2024
1 parent 09a5dc8 commit fe285e8
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 32 deletions.
4 changes: 2 additions & 2 deletions src/dc_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import time
# import datetime
import config
from data_type import DCConfig
from data_type import DUTConfig, DCConfig

freqlist = ['100']
for freq in freqlist:
Expand Down Expand Up @@ -250,5 +250,5 @@
# os.remove(result_name)


def main(sub_cfg: DCConfig):
def main(dut_cfg: DUTConfig, sub_cfg: DCConfig):
return True
12 changes: 6 additions & 6 deletions src/dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import pickle
import config
import config_parser
import iv_test
import ver_test
# import iv_test
# import ver_test
import vcs_test
import dc_test
# import wave_test
Expand Down Expand Up @@ -35,12 +35,12 @@ def parse(self) -> bool:
sub_cfg = self.sub_list[0].sub_cfg
# only dut pass vcs test, then it can be test by dc flow
if sub_cfg.dut_cfg.commit == '':
if vcs_test.main(sub_cfg['vcs']) is True:
dc_test.main(sub_cfg['dc'])
if vcs_test.main(sub_cfg['dut'], sub_cfg['vcs']) is True:
dc_test.main(sub_cfg['dut'], sub_cfg['dc'])
elif sub_cfg.dut_cfg.commit == 'vcs':
vcs_test.main(sub_cfg['vcs'])
vcs_test.main(sub_cfg['dut'], sub_cfg['vcs'])
elif sub_cfg.dut_cfg.commit == 'dc':
dc_test.main(sub_cfg['dc'])
dc_test.main(sub_cfg['dut'], sub_cfg['dc'])

del self.sub_list[0]
return True
Expand Down
48 changes: 24 additions & 24 deletions src/vcs_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
from enum import Enum
import os
import config
from data_type import VCSConfig
import logging
from data_type import DUTConfig, VCSConfig


class LogState(Enum):
Expand All @@ -13,48 +14,46 @@ class LogState(Enum):

class VCSTest(object):
def __init__(self):
self.dut = ''
self.date = ''
self.time = ''
self.lint = []
self.warn = []
self.err = []
self.dut_cfg = DUTConfig('', '', '', '')
self.vcs_cfg = VCSConfig(25, ('', ''), False)

def clear(self):
self.dut = ''
self.date = ''
self.time = ''
self.lint = []
self.warn = []
self.err = []
self.clear_dir()
self.dut_cfg = DUTConfig('', '', '', '')
self.vcs_cfg = VCSConfig(25, ('', ''), False)
self.clear_env()

def clear_dir(self):
cmd = f'cd {config.VCS_RUN_DIR} && make clean'
cmd += ' && rm temp.fp getReg* novas* verdi* -rf'
# clear test env
def clear_env(self):
os.chdir(config.VCS_RUN_DIR)
cmd = 'make clean && rm temp.fp getReg* novas* verdi* -rf'
os.system(cmd)
cmd = f'find {config.VCS_CPU_DIR}/*'
cmd += ' grep -v ysyx_210000.v | xargs rm -rf'
os.chdir(config.VCS_CPU_DIR)
cmd = 'find *.v | grep -v ysyx_210000.v | xargs rm -rf'
os.system(cmd)
os.chdir(config.HOME_DIR)

def intg_soc(self):
core_path = config.SUB_DIR + '/' + self.dut
sv_format = core_path + '.sv'
v_format = core_path + '.sv'
if os.path.isfile(sv_format):
os.system(f'cp {sv_format} {config.VCS_CPU_DIR}')
elif os.path.isfile(v_format):
os.system(f'cp {v_format} {config.VCS_CPU_DIR}')
else:
print('not found core!')
os.chdir(config.VCS_CPU_DIR)
dut_path = config.SUB_DIR + '/' + self.dut_cfg.file
os.system(f'cp -rf {dut_path} .')

os.chdir(config.VCS_SCRIPT_DIR)
os.system('python autowire.py')
os.chdir(config.HOME_DIR)

def comp(self):
cmd = f'cd {config.VCS_RUN_DIR} && make comp'
os.chdir(config.VCS_RUN_DIR)
cmd = 'make comp'
os.system(cmd)

log_state = [LogState.end, LogState.end, LogState.end]
Expand All @@ -80,8 +79,8 @@ def comp(self):

def run(self):
# err_cnt = 0
cmd = f'cd {config.VCS_RUN_DIR} && '
cmd += 'make all_test'
os.chdir(config.VCS_RUN_DIR)
cmd = 'make all_test' # TODO: need to be modified by toml config
os.system(cmd)

def gen_rpt(self):
Expand All @@ -102,15 +101,16 @@ def gen_rpt(self):
vcstest = VCSTest()


def main(vcs_cfg: VCSConfig):
def main(dut_cfg: DUTConfig, vcs_cfg: VCSConfig):
print('[vcs test]')
vcstest.clear()
vcstest.dut_cfg = dut_cfg
vcstest.vcs_cfg = vcs_cfg
vcstest.intg_soc()
vcstest.comp()
vcstest.run()
vcstest.gen_rpt()


# if __name__ == '__main__':
# main(None)
if __name__ == '__main__':
main(DUTConfig('', '', '', ''), VCSConfig(25, ('', ''), False))

0 comments on commit fe285e8

Please sign in to comment.