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

Fix: the reserved bits in the Mode field of m/stvec #154

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
11 changes: 8 additions & 3 deletions src/main/scala/nutcore/backend/fu/CSR.scala
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,8 @@ class CSR(implicit val p: NutCoreConfig) extends NutCoreModule with HasCSRConst{
// User Trap Setup
// MaskedRegMap(Ustatus, ustatus),
// MaskedRegMap(Uie, uie, 0.U, MaskedRegMap.Unwritable),
// MaskedRegMap(Utvec, utvec),
// When setting the value, clear bit 1. Subsequently, when reading BASE, clear bit 0.
// MaskedRegMap(Utvec, utvec, wfn = (value: UInt) => (value & ~2.U(64.W))),

// User Trap Handling
// MaskedRegMap(Uscratch, uscratch),
Expand All @@ -406,7 +407,9 @@ class CSR(implicit val p: NutCoreConfig) extends NutCoreModule with HasCSRConst{
// MaskedRegMap(Sedeleg, Sedeleg),
// MaskedRegMap(Sideleg, Sideleg),
MaskedRegMap(Sie, mie, sieMask, MaskedRegMap.NoSideEffect, sieMask),
MaskedRegMap(Stvec, stvec),
// When setting the value, clear bit 1. Subsequently, when reading BASE, clear bit 0.
MaskedRegMap(Stvec, stvec, wfn = (value: UInt) => (value & ~2.U(64.W))),

MaskedRegMap(Scounteren, scounteren),

// Supervisor Trap Handling
Expand All @@ -432,7 +435,9 @@ class CSR(implicit val p: NutCoreConfig) extends NutCoreModule with HasCSRConst{
MaskedRegMap(Medeleg, medeleg, "hbbff".U(64.W)),
MaskedRegMap(Mideleg, mideleg, "h222".U(64.W)),
MaskedRegMap(Mie, mie),
MaskedRegMap(Mtvec, mtvec),
// When setting the value, clear bit 1. Subsequently, when reading BASE, clear bit 0.
MaskedRegMap(Mtvec, mtvec, wfn = (value: UInt) => (value & ~2.U(64.W))),

MaskedRegMap(Mcounteren, mcounteren),

// Machine Trap Handling
Expand Down