Patch mcsr test to allow any value of mhartid - Kelvin can have a different `mhartid` value that 0 (e.g. in Matcha) -- just make sure the CSR read doesn't assert. Change-Id: I42cbead6e839d283ae1391e5d4c3b7691b2b510f
diff --git a/build_tools/bazel/repos.bzl b/build_tools/bazel/repos.bzl index 8792bfa..adad000 100644 --- a/build_tools/bazel/repos.bzl +++ b/build_tools/bazel/repos.bzl
@@ -44,6 +44,12 @@ sha256 = "1c7eb58edd7399b3ad2f9624a2003862cd87a6904237a737f39cd3978bab46a8", urls = ["https://github.com/riscv-software-src/riscv-tests/archive/d4eaa5bd6674b51d3b9b24913713c4638e99cdd9.tar.gz"], strip_prefix = "riscv-tests-d4eaa5bd6674b51d3b9b24913713c4638e99cdd9", + patch_args = [ + "-p1", + ], + patches = [ + "//tests/riscv-tests:0001-mcsr.patch", + ], ) def tflm_repos():
diff --git a/tests/riscv-tests/0001-mcsr.patch b/tests/riscv-tests/0001-mcsr.patch new file mode 100644 index 0000000..0780462 --- /dev/null +++ b/tests/riscv-tests/0001-mcsr.patch
@@ -0,0 +1,17 @@ +diff --git a/isa/rv64mi/mcsr.S b/isa/rv64mi/mcsr.S +index 03cf29a..729889f 100644 +--- a/isa/rv64mi/mcsr.S ++++ b/isa/rv64mi/mcsr.S +@@ -21,7 +21,11 @@ RVTEST_CODE_BEGIN + #endif + + # Check that mhartid reports 0 +- TEST_CASE(3, a0, 0x0, csrr a0, mhartid) ++ # TEST_CASE(3, a0, 0x0, csrr a0, mhartid) ++ # For Kelvin, just check that the CSR doosen't cause an exception. ++ # Depending on how the core is instantiated, this may have ++ # differing values. ++ csrr a0, mhartid + + # Check that reading the following CSRs doesn't cause an exception + csrr a0, mimpid