No public description
PiperOrigin-RevId: 596713847
diff --git a/WORKSPACE b/WORKSPACE
index 840e641..3e2833e 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -6,17 +6,17 @@
# MPACT-RiscV repo
http_archive(
name = "com_google_mpact-riscv",
- sha256 = "76e2b701cb93abaebbdd0fa43771cee20db84ca6eb5140f12f7c873d4743a9ac",
- strip_prefix = "mpact-riscv-e33928ebc238f4dd526719ee398869ef8c353b53",
- url = "https://github.com/google/mpact-riscv/archive/e33928ebc238f4dd526719ee398869ef8c353b53.tar.gz",
+ sha256 = "2f51e0d90f6adf639fe6b23bee6dd86283326d86f8952e60cb26abeccc1e939b",
+ strip_prefix = "mpact-riscv-641f0748c6b17aa8789d455e82fb8f1296f79d26",
+ url = "https://github.com/google/mpact-riscv/archive/641f0748c6b17aa8789d455e82fb8f1296f79d26.tar.gz",
)
# MPACT-Sim repo
http_archive(
name = "com_google_mpact-sim",
- sha256 = "f6e97fad35d9e218e4f9e0e8737ba0f5163e24393f502b47ca7fc5a9a7924d20",
- strip_prefix = "mpact-sim-7ea1334bedf7f6f4a58aa3b2636e9613d8704f39",
- url = "https://github.com/google/mpact-sim/archive/7ea1334bedf7f6f4a58aa3b2636e9613d8704f39.tar.gz",
+ sha256 = "f39cbbe26df267a6d0bd64756e46c8606d08b3f78cb407e3943862f79237bbf8",
+ strip_prefix = "mpact-sim-0b5f0d18c69434e63f0ca20465067b5ef61f5046",
+ url = "https://github.com/google/mpact-sim/archive/0b5f0d18c69434e63f0ca20465067b5ef61f5046.tar.gz",
)
load("@com_google_mpact-sim//:repos.bzl", "mpact_sim_repos")
diff --git a/sim/kelvin_state.cc b/sim/kelvin_state.cc
index 68e017c..62b92f2 100644
--- a/sim/kelvin_state.cc
+++ b/sim/kelvin_state.cc
@@ -31,6 +31,10 @@
namespace kelvin::sim {
using ::mpact::sim::riscv::RiscVCsrEnum;
+using ::mpact::sim::riscv::RiscVCsrInterface;
+
+// The misa implementation uses only the 64-bit variant.
+constexpr uint64_t kKelvinMisaVal = 0x4000000000801100;
enum class KelvinCsrEnum {
kKIsa = 0xFC0,
@@ -50,7 +54,14 @@
}
if (!csr_set()->AddCsr(&kisa_).ok()) {
LOG(FATAL) << "Failed to register kisa";
- };
+ }
+
+ absl::StatusOr<RiscVCsrInterface *> result = csr_set()->GetCsr("misa");
+ if (!result.ok()) {
+ LOG(FATAL) << "Failed to get misa";
+ }
+ auto *misa = *result;
+ misa->Set(kKelvinMisaVal);
}
KelvinState::KelvinState(absl::string_view id,
diff --git a/sim/test/kelvin_top_test.cc b/sim/test/kelvin_top_test.cc
index 39c5c85..b4883d7 100644
--- a/sim/test/kelvin_top_test.cc
+++ b/sim/test/kelvin_top_test.cc
@@ -449,6 +449,15 @@
for (auto name : {"kisa"}) {
EXPECT_OK(kelvin_top_->ReadRegister(name));
}
+
+ // CSRs that diverge from stock values in MPACT.
+ constexpr uint32_t kMisaValue = 0x40801100;
+ for (auto &[name, expected_value] :
+ {std::tuple<std::string, uint32_t>{"misa", kMisaValue}}) {
+ auto result = kelvin_top_->ReadRegister(name);
+ EXPECT_OK(result.status());
+ EXPECT_EQ(result.value(), expected_value);
+ }
}
TEST_F(KelvinTopTest, RunKelvinVectorProgram) {