Skip to content

Commit bcfbe7a

Browse files
Added PTW test cases (#150)
* ptw first commit, test_pwt_reset_smoke $ make test target=ut_frontend/l2tlb/ptw/ several signals are not zero during reset, such as io_perf_* * add test_ptw_ptwcache_req_sv39_l2l1miss_nos2xlate_smoke * add test_ptw_ptwcache_req_sv39_l2hit_nos2xlate * Add PTW test cases covering 2MB and 1GB page sizes. test_ptw_ptwcache_req_sv39_l2miss_nos2xlate_1gbpage PASSED test_ptw_ptwcache_req_sv39_l2l1miss_nos2xlate_2mbpage PASSED test_ptw_ptwcache_req_sv39_l2hit_nos2xlate_2mbpage PASSED * update README.md * update README.md * Delete the classic_version directory and split test cases into separate files. * change PTW settings in xiangshan-kmh.yaml * Fix build_ut_frontend_l2tlb_ptw.py. Move bundle.py to bundle/ Fix configs/dutree/xiangshan-kmh.yaml by changing PTW to lowercase. * Add page fault checks for large-page (2MB/1GB) PPN misalignment. Add test cases: test_ptw_ptwcache_req_sv39_l2hit_nos2xlate_2mbpage_ppn_misaligned test_ptw_ptwcache_req_sv39_l2miss_nos2xlate_1gbpage_ppn_misaligned test_ptw_ptwcache_req_sv39_l2l1miss_nos2xlate_2mbpage_ppn_misaligned
1 parent 4c1ee51 commit bcfbe7a

10 files changed

Lines changed: 2529 additions & 2 deletions

File tree

configs/dutree/xiangshan-kmh.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ children:
101101
desc: "指令非缓存"
102102
- name: "itlb"
103103
desc: "指令TLB"
104+
- name: "l2tlb"
105+
desc: "l2 TLB"
106+
children:
107+
- name: "ptw"
108+
desc: "Page Table Walker模块"
104109
- name: "pmp"
105110
desc: "物理内存保护"
106111
- name: "backend"
@@ -242,8 +247,6 @@ children:
242247
desc: "向量长度合并缓冲器"
243248
- name: "vs_merge_buffer"
244249
desc: "向量段合并缓冲器"
245-
- name: "ptw"
246-
desc: "页表Walker"
247250
- name: "uncache"
248251
desc: "非缓存"
249252
- name: "sbuffer"
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#coding=utf8
2+
#***************************************************************************************
3+
# This project is licensed under Mulan PSL v2.
4+
# You can use this software according to the terms and conditions of the Mulan PSL v2.
5+
# You may obtain a copy of Mulan PSL v2 at:
6+
# http://license.coscl.org.cn/MulanPSL2
7+
#
8+
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
9+
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
10+
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
11+
#
12+
# See the Mulan PSL v2 for more details.
13+
#**************************************************************************************/
14+
15+
16+
import os
17+
from comm import warning, info, get_all_rtl_files
18+
19+
20+
def build(cfg):
21+
# import base modules
22+
from tempfile import NamedTemporaryFile
23+
from toffee_test.markers import match_version
24+
from comm import is_all_file_exist, get_rtl_dir, exe_cmd, get_root_dir
25+
# check version
26+
if not match_version(cfg.rtl.version, "openxiangshan-kmh-*"):
27+
warning("frontend_l2tlb_ptw: %s" % f"Unsupported RTL version {cfg.rtl.version}")
28+
return False
29+
# check files
30+
f = is_all_file_exist(["rtl/PTW.v"], get_rtl_dir(cfg=cfg))
31+
assert f is True, f"File {f} not found"
32+
# find source files for PTW
33+
rtl_files = get_all_rtl_files("PTW", cfg=cfg)
34+
info(f"rtl_files: {rtl_files}")
35+
assert rtl_files, "Cannot find RTL files of PTW"
36+
37+
# build
38+
# export PTW.v
39+
if not os.path.exists(get_root_dir("dut/PTW")):
40+
info("Exporting PTW.sv")
41+
with NamedTemporaryFile("w+", encoding="utf-8", suffix=".txt") as filelist:
42+
filelist.write("\n".join(rtl_files))
43+
filelist.flush()
44+
s, _, err = exe_cmd(
45+
f"picker export --cp_lib false {rtl_files[0]} --fs {filelist.name} --lang python --tdir "
46+
f"{get_root_dir('dut')}/ -w PTW.fst -c")
47+
assert s, err
48+
return True
49+
50+
51+
def get_metadata():
52+
return {
53+
"dut_name": "frontend_l2tlb_ptw",
54+
"dut_dir": "PTW",
55+
"test_targets": [
56+
"ut_frontend/l2tlb/ptw",
57+
"ut_frontend/l2tlb",
58+
"ut_frontend"
59+
]
60+
}
61+
62+
63+
def line_coverage_files(cfg):
64+
return ["PTW.v"]

ut_frontend/l2tlb/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)