Skip to content

Commit

Permalink
cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
Dolu1990 committed Jan 5, 2024
1 parent 14f0664 commit cf265e7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
4 changes: 3 additions & 1 deletion src/main/scala/vexiiriscv/Param.scala
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class ParamSimple(){
def getName() : String = {
def opt(that : Boolean, v : String) = that.mux(v, "")
val r = new ArrayBuffer[String]()
r += s"rv${xlen}im"
r += s"rv${xlen}im${privParam.withSupervisor.mux("s","")}${privParam.withUser.mux("u","")}"
r += s"d${decoders}"
r += s"l${lanes}"
r += regFileSync.mux("rfs","rfa")
Expand All @@ -90,6 +90,8 @@ class ParamSimple(){
opt[Unit]("relaxed-src") action { (v, c) => relaxedSrc = true }
opt[Unit]("with-mul") action { (v, c) => withMul = true }
opt[Unit]("with-div") action { (v, c) => withDiv = true }
opt[Unit]("with-supervisor") action { (v, c) => privParam.withSupervisor = true; privParam.withUser = true }
opt[Unit]("with-user") action { (v, c) => privParam.withUser = true }
opt[Unit]("without-mul") action { (v, c) => withMul = false }
opt[Unit]("without-div") action { (v, c) => withDiv = false }
opt[Unit]("with-gshare") action { (v, c) => withGShare = true }
Expand Down
22 changes: 11 additions & 11 deletions src/main/scala/vexiiriscv/misc/PrivilegedPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,6 @@ class PrivilegedPlugin(val p : PrivilegedParam, hartIds : Seq[Int], trapAt : Int
}
}

// Implement read-only CSR space
when(cap.onDecodeWrite && cap.onDecodeAddress(11 downto 10) === U"11") {
cap.onDecodeTrap()
}

val defaultTrap = new Area {
val csrPrivilege = cap.onDecodeAddress(8, 2 bits)
val csrReadOnly = cap.onDecodeAddress(10, 2 bits) === U"11"
Expand All @@ -357,15 +352,19 @@ class PrivilegedPlugin(val p : PrivilegedParam, hartIds : Seq[Int], trapAt : Int
}
}


val tvecFilter = CsrListFilter(List(CSR.MTVEC) ++ p.withSupervisor.option(CSR.STVEC))
val epcFilter = CsrListFilter(List(CSR.MEPC) ++ p.withSupervisor.option(CSR.SEPC))
cap.onWrite(tvecFilter, false) {cap.onWriteBits(0, 2 bits) := 0}
cap.onWrite(epcFilter, false) {cap.onWriteBits(0, log2Up(Fetch.SLICE_BYTES) bits) := 0}
val readAnyWriteLegal = new Area {
val tvecFilter = CsrListFilter(List(CSR.MTVEC) ++ p.withSupervisor.option(CSR.STVEC))
val epcFilter = CsrListFilter(List(CSR.MEPC) ++ p.withSupervisor.option(CSR.SEPC))
cap.onWrite(tvecFilter, false) {
cap.onWriteBits(0, 2 bits) := 0
}
cap.onWrite(epcFilter, false) {
cap.onWriteBits(0, log2Up(Fetch.SLICE_BYTES) bits) := 0
}
}


ramRetainers.csr.release()

trapLock.await()

val harts = for(hartId <- 0 until HART_COUNT) yield new Area{
Expand Down Expand Up @@ -668,6 +667,7 @@ class PrivilegedPlugin(val p : PrivilegedParam, hartIds : Seq[Int], trapAt : Int
}
}
}

ramRetainers.port.release()
buildBefore.release()
}
Expand Down

0 comments on commit cf265e7

Please sign in to comment.