Skip to content

Commit

Permalink
CSR: make mstatus.fs writable for software FPU emulation (#196)
Browse files Browse the repository at this point in the history
FS must not be read-only zero to allow software emulation of FPU.
  • Loading branch information
poemonsense authored May 15, 2024
1 parent 99214de commit 3630ab5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Binary file modified ready-to-run/riscv64-nemu-interpreter-so
Binary file not shown.
4 changes: 2 additions & 2 deletions src/main/scala/nutcore/backend/fu/CSR.scala
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ class CSR(implicit val p: NutCoreConfig) extends NutCoreModule with HasCSRConst{
GenMask(35, 32) | // SXL and UXL cannot be changed
GenMask(31, 23) | // WPRI
GenMask(16, 15) | // XS is read-only
GenMask(14, 13) | // FS is read-only
GenMask(6) | // UBE, always little-endian (0)
GenMask(4) | // WPRI
GenMask(2) | // WPRI
Expand Down Expand Up @@ -338,7 +337,8 @@ class CSR(implicit val p: NutCoreConfig) extends NutCoreModule with HasCSRConst{
// val sstatus = RegInit(UInt(XLEN.W), "h00000000".U)
val sstatusWmask = (~ZeroExt((
GenMask(63, 20) | // SD, WPRI, UXL, WPRI
GenMask(17, 9) | // WPRI, XS, FS, WPRI, VS
GenMask(17, 15) | // WPRI, XS
GenMask(12, 9) | // WPRI, VS
GenMask(7, 6) | // WPRI, UBE
GenMask(4, 2) | // WPRI
GenMask(0) // WPRI
Expand Down

0 comments on commit 3630ab5

Please sign in to comment.