Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSR: sstatus.fs should be read-only #195

Merged
merged 1 commit into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified ready-to-run/riscv64-nemu-interpreter-so
Binary file not shown.
8 changes: 7 additions & 1 deletion src/main/scala/nutcore/backend/fu/CSR.scala
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,13 @@ class CSR(implicit val p: NutCoreConfig) extends NutCoreModule with HasCSRConst{
// Superviser-Level CSRs

// val sstatus = RegInit(UInt(XLEN.W), "h00000000".U)
val sstatusWmask = "hc6122".U(64.W)
val sstatusWmask = (~ZeroExt((
GenMask(63, 20) | // SD, WPRI, UXL, WPRI
GenMask(17, 9) | // WPRI, XS, FS, WPRI, VS
GenMask(7, 6) | // WPRI, UBE
GenMask(4, 2) | // WPRI
GenMask(0) // WPRI
), 64)).asUInt
// Sstatus Write Mask
// -------------------------------------------------------
// 19 9 5 2
Expand Down