Skip to content

Commit

Permalink
Merge pull request #2434 from chipsalliance/OM_Sv48
Browse files Browse the repository at this point in the history
Object Model: add Sv48 to RocketISA addressTranslationModes
  • Loading branch information
ingallsj authored Apr 25, 2020
2 parents 05ea095 + 2e3f15b commit 9002625
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ class ICacheLogicalTreeNode(icache: ICache, deviceOpt: Option[SimpleDevice], par

class RocketLogicalTreeNode(
tile: RocketTile,
XLen: Int
XLen: Int,
PgLevels: Int
) extends LogicalTreeNode(() => Some(tile.cpuDevice)) {

def getOMInterruptTargets(): Seq[OMInterruptTarget] = {
Expand All @@ -83,7 +84,7 @@ class RocketLogicalTreeNode(
val omBusError = components.collectFirst { case x: OMBusError => x }

Seq(OMRocketCore(
isa = OMISA.rocketISA(tile, XLen),
isa = OMISA.rocketISA(tile, XLen, PgLevels),
mulDiv = coreParams.mulDiv.map{ md => OMMulDiv.makeOMI(md, XLen)},
fpu = coreParams.fpu.map{f => OMFPU(fLen = f.fLen)},
performanceMonitor = PerformanceMonitor.perfmon(coreParams),
Expand Down
11 changes: 6 additions & 5 deletions src/main/scala/diplomaticobjectmodel/model/OMISA.scala
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ case class OMVectorExtension(
)

object OMISA {
def rocketISA(tile: RocketTile, xLen: Int): OMISA = {
def rocketISA(tile: RocketTile, xLen: Int, pgLevels: Int): OMISA = {
val coreParams = tile.rocketParams.core

val baseInstructionSet = xLen match {
Expand All @@ -82,10 +82,11 @@ object OMISA {
}

val addressTranslationModes = xLen match {
case _ if !coreParams.useVM => Bare
case 32 => Sv32
case 64 => Sv39
case _ => throw new IllegalArgumentException(s"ERROR: Invalid Xlen: $xLen")
case _ if !coreParams.useVM => Bare
case 32 if (pgLevels == 2) => Sv32
case 64 if (pgLevels == 3) => Sv39
case 64 if (pgLevels == 4) => Sv48
case _ => throw new IllegalArgumentException(s"ERROR: Invalid Xlen/PgLevels combination: $xLen/$pgLevels")
}

OMISA(
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/rocket/PTW.scala
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class PTW(n: Int)(implicit edge: TLEdgeOut, p: Parameters) extends CoreModule()(
Cat(r_pte.ppn, vpn_idx) << log2Ceil(xLen/8)
}
val fragmented_superpage_ppn = {
val choices = (pgLevels-1 until 0 by -1).map(i => Cat(r_pte.ppn >> (pgLevelBits*i), r_req.addr(pgLevelBits*i-1, 0)))
val choices = (pgLevels-1 until 0 by -1).map(i => Cat(r_pte.ppn >> (pgLevelBits*i), r_req.addr(((pgLevelBits*i) min vpnBits)-1, 0).padTo(pgLevelBits*i)))
choices(count)
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/tile/RocketTile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class RocketTile private(
val slaveNode = TLIdentityNode()
val masterNode = visibilityNode

val rocketLogicalTree = new RocketLogicalTreeNode(this, p(XLen))
val rocketLogicalTree = new RocketLogicalTreeNode(this, p(XLen), pgLevels)

val dtim_adapter = tileParams.dcache.flatMap { d => d.scratch.map { s =>
val coreParams = {
Expand Down

0 comments on commit 9002625

Please sign in to comment.