Add option to make misa read-only
This commit is contained in:
		| @@ -606,7 +606,8 @@ class CSRFile(perfEventSets: EventSets = new EventSets(Seq()))(implicit p: Param | ||||
|     when (decoded_addr(CSRs.misa)) { | ||||
|       val mask = UInt(isaStringToMask(isaMaskString), xLen) | ||||
|       val f = wdata('f' - 'a') | ||||
|       reg_misa := ~(~wdata | (!f << ('d' - 'a'))) & mask | reg_misa & ~mask | ||||
|       if (coreParams.misaWritable) | ||||
|         reg_misa := ~(~wdata | (!f << ('d' - 'a'))) & mask | reg_misa & ~mask | ||||
|     } | ||||
|     when (decoded_addr(CSRs.mip)) { | ||||
|       // MIP should be modified based on the value in reg_mip, not the value | ||||
|   | ||||
| @@ -24,6 +24,7 @@ case class RocketCoreParams( | ||||
|   nPMPs: Int = 8, | ||||
|   nPerfCounters: Int = 0, | ||||
|   haveBasicCounters: Boolean = true, | ||||
|   misaWritable: Boolean = true, | ||||
|   nL2TLBEntries: Int = 0, | ||||
|   mtvecInit: Option[BigInt] = Some(BigInt(0)), | ||||
|   mtvecWritable: Boolean = true, | ||||
|   | ||||
| @@ -29,6 +29,7 @@ trait CoreParams { | ||||
|   val nBreakpoints: Int | ||||
|   val nPerfCounters: Int | ||||
|   val haveBasicCounters: Boolean | ||||
|   val misaWritable: Boolean | ||||
|   val nL2TLBEntries: Int | ||||
|   val mtvecInit: Option[BigInt] | ||||
|   val mtvecWritable: Boolean | ||||
|   | ||||
		Reference in New Issue
	
	Block a user