forked from XS-MLVP/UnityChipForXiangShan
Compare commits
4 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
1ed87330e2 | |
|
|
a784144da4 | |
|
|
b1e39eae69 | |
|
|
3e7ac96b34 |
9
Makefile
9
Makefile
|
|
@ -18,13 +18,16 @@ clean:
|
||||||
clean_dut:
|
clean_dut:
|
||||||
cd dut && ls | grep -v __init__.py | xargs rm -rf
|
cd dut && ls | grep -v __init__.py | xargs rm -rf
|
||||||
|
|
||||||
test_all:
|
clean_rtl:
|
||||||
|
cd rtl && ls | grep -v README.md | xargs rm -rf
|
||||||
|
|
||||||
|
test_all: dut
|
||||||
@python3 run.py --config $(CFG) $(KV) -- $(REPORT) -vs ut_*/ $(args)
|
@python3 run.py --config $(CFG) $(KV) -- $(REPORT) -vs ut_*/ $(args)
|
||||||
|
|
||||||
test:
|
test: dut
|
||||||
@python3 run.py --config $(CFG) $(KV) -- $(REPORT) -vs $(target) $(args)
|
@python3 run.py --config $(CFG) $(KV) -- $(REPORT) -vs $(target) $(args)
|
||||||
|
|
||||||
dut:
|
dut: rtl
|
||||||
@python3 run.py --config $(CFG) --build $(DUTS) $(args)
|
@python3 run.py --config $(CFG) --build $(DUTS) $(args)
|
||||||
|
|
||||||
rtl:
|
rtl:
|
||||||
|
|
|
||||||
|
|
@ -180,10 +180,20 @@ def download_rtl(base_url, out_dir, version="latest"):
|
||||||
use_rtl(base_url.split("/")[-1], out_dir)
|
use_rtl(base_url.split("/")[-1], out_dir)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def _build_dut(d, cfg):
|
||||||
|
try:
|
||||||
|
module = importlib.import_module(f"scripts.{d}")
|
||||||
|
if not module.build(cfg):
|
||||||
|
warning(f"Build scripts/{d}.py failed")
|
||||||
|
else:
|
||||||
|
info(f"Build scripts/{d}.py success")
|
||||||
|
except Exception as e:
|
||||||
|
warning(f"Failed to build {d}, error: {e}\n{traceback.format_exc()}")
|
||||||
|
|
||||||
def build_dut(duts, cfg):
|
def build_dut(duts, cfg):
|
||||||
target_duts = [d.strip() for d in duts.split(",")]
|
target_duts = [d.strip() for d in duts.split(",")]
|
||||||
if len(target_duts) == 0:
|
if len(target_duts) == 0:
|
||||||
|
warning(f"No dut to build for: {duts}")
|
||||||
return
|
return
|
||||||
prefix = "build_ut_"
|
prefix = "build_ut_"
|
||||||
build_modules = [f.replace(".py", "") for f in
|
build_modules = [f.replace(".py", "") for f in
|
||||||
|
|
@ -199,16 +209,11 @@ def build_dut(duts, cfg):
|
||||||
if len(dut_to_build) == 0:
|
if len(dut_to_build) == 0:
|
||||||
warning(f"No dut to build for: {duts}")
|
warning(f"No dut to build for: {duts}")
|
||||||
return
|
return
|
||||||
for d in dut_to_build:
|
import multiprocessing
|
||||||
debug(f"Build {d}")
|
pool = multiprocessing.Pool()
|
||||||
try:
|
pool.starmap(_build_dut, [(d, cfg) for d in dut_to_build])
|
||||||
module = importlib.import_module(f"scripts.{d}")
|
pool.close()
|
||||||
if not module.build(cfg):
|
pool.join()
|
||||||
warning(f"Build scripts/{d}.py failed")
|
|
||||||
else:
|
|
||||||
info(f"Build scripts/{d}.py success")
|
|
||||||
except Exception as e:
|
|
||||||
warning(f"Failed to build {d}, error: {e}\n{traceback.format_exc()}")
|
|
||||||
|
|
||||||
|
|
||||||
def replace_default_vars(input_str, cfg):
|
def replace_default_vars(input_str, cfg):
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,8 @@ class Decode(toffee.Bundle):
|
||||||
def Input_instruction(self, i, valid, instr, isRVC, brType, isCall, isRet, pred_taken, instr_ex):
|
def Input_instruction(self, i, valid, instr, isRVC, brType, isCall, isRet, pred_taken, instr_ex):
|
||||||
self.input_inst[i].valid.value = valid
|
self.input_inst[i].valid.value = valid
|
||||||
self.input_inst[i].bits_instr.value = instr
|
self.input_inst[i].bits_instr.value = instr
|
||||||
self.input_inst[i].bits_foldpc.value = 0
|
if hasattr(self.input_inst[i], "bits_foldpc"):
|
||||||
|
self.input_inst[i].bits_foldpc.value = 0
|
||||||
self.input_inst[i].bits_exceptionVec_2.value = instr_ex
|
self.input_inst[i].bits_exceptionVec_2.value = instr_ex
|
||||||
for j in range(24):
|
for j in range(24):
|
||||||
p = getattr(self.dut, f'io_in_{i}_bits_exceptionVec_{j}', None)
|
p = getattr(self.dut, f'io_in_{i}_bits_exceptionVec_{j}', None)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue