Skip to content

Commit

Permalink
Disallow writes to MSTATUS.XS
Browse files Browse the repository at this point in the history
  • Loading branch information
jerryz123 committed Jun 18, 2020
1 parent 1872f5d commit 37d04a2
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/main/scala/rocket/CSR.scala
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ class CSRFile(
val reset_mstatus = Wire(init=new MStatus().fromBits(0))
reset_mstatus.mpp := PRV.M
reset_mstatus.prv := PRV.M
reset_mstatus.xs := (if (usingRoCC) UInt(3) else UInt(0))
val reg_mstatus = Reg(init=reset_mstatus)

val new_prv = Wire(init = reg_mstatus.prv)
Expand Down Expand Up @@ -821,7 +822,6 @@ class CSRFile(

if (usingSupervisor || usingFPU) reg_mstatus.fs := formFS(new_mstatus.fs)
reg_mstatus.vs := formVS(new_mstatus.vs)
if (usingRoCC) reg_mstatus.xs := Fill(2, new_mstatus.xs.orR)
}
when (decoded_addr(CSRs.misa)) {
val mask = UInt(isaStringToMask(isaMaskString), xLen)
Expand Down Expand Up @@ -894,7 +894,6 @@ class CSRFile(
reg_mstatus.mxr := new_sstatus.mxr
reg_mstatus.sum := new_sstatus.sum
}
if (usingRoCC) reg_mstatus.xs := Fill(2, new_sstatus.xs.orR)
}
when (decoded_addr(CSRs.sip)) {
val new_sip = new MIP().fromBits((read_mip & ~read_mideleg) | (wdata & read_mideleg))
Expand Down

0 comments on commit 37d04a2

Please sign in to comment.