Skip to content

Commit

Permalink
Object Model: useHypervisor param
Browse files Browse the repository at this point in the history
  • Loading branch information
ingallsj committed Jun 11, 2021
1 parent a58d179 commit 92b10a4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class RocketLogicalTreeNode(
def getOMInterruptTargets(): Seq[OMInterruptTarget] = {
Seq(OMInterruptTarget(
hartId = tile.rocketParams.hartId,
modes = OMModes.getModes(tile.rocketParams.core.hasSupervisorMode)
modes = OMModes.getModes(tile.rocketParams.core.hasSupervisorMode, tile.rocketParams.core.useHypervisor)
))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ package freechips.rocketchip.diplomaticobjectmodel.model

sealed trait PrivilegedArchitectureExtension extends OMEnum
case object MachineLevelISA extends PrivilegedArchitectureExtension
case object HypervisorLevelISA extends PrivilegedArchitectureExtension
case object SupervisorLevelISA extends PrivilegedArchitectureExtension

object PrivilegedArchitectureExtensions {
val specifications = Map[PrivilegedArchitectureExtension, String](
MachineLevelISA -> "Machine-Level ISA",
HypervisorLevelISA -> "Hypervisor-Level ISA",
SupervisorLevelISA -> "Supervisor-Level ISA"
)

Expand All @@ -36,7 +38,8 @@ object ISAExtensions {
C -> "C Standard Extension for Compressed Instruction",
B -> "B Standard Extension for Bit Manipulation",
U -> "The RISC‑V Instruction Set Manual, Volume II: Privileged Architecture",
S -> "Supervisor-Level ISA"
S -> "Supervisor-Level ISA",
H -> "H Standard Extension for Hypervisor",
)

def specVersion(extension: OMExtensionType, version: String): OMSpecification = OMSpecification(specifications(extension), version)
Expand Down
3 changes: 3 additions & 0 deletions src/main/scala/diplomaticobjectmodel/model/OMISA.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ case object C extends OMExtensionType
case object B extends OMExtensionType
case object U extends OMExtensionType
case object S extends OMExtensionType
case object H extends OMExtensionType

trait OMAddressTranslationMode extends OMEnum
case object Bare extends OMAddressTranslationMode
Expand Down Expand Up @@ -44,6 +45,7 @@ case class OMISA(
v: Option[OMVectorExtension] = None,
u: Option[OMSpecification],
s: Option[OMSpecification],
h: Option[OMSpecification],
addressTranslationModes: Seq[OMAddressTranslationMode],
customExtensions: Seq[OMCustomExtensionSpecification],
_types: Seq[String] = Seq("OMISA", "OMCompoundType")
Expand Down Expand Up @@ -105,6 +107,7 @@ object OMISA {
c = coreParams.useCompressed.option(isaExtSpec(C, "2.0")),
u = (coreParams.hasSupervisorMode || coreParams.useUser).option(isaExtSpec(U, "1.10")),
s = coreParams.hasSupervisorMode.option(isaExtSpec(S, "1.10")),
h = coreParams.useHypervisor.option(isaExtSpec(H, "0.6")),
addressTranslationModes = Seq(addressTranslationModes),
customExtensions = customExtensions
)
Expand Down
10 changes: 5 additions & 5 deletions src/main/scala/diplomaticobjectmodel/model/OMPLIC.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ package freechips.rocketchip.diplomaticobjectmodel.model

sealed trait OMPrivilegeMode extends OMEnum
case object OMMachineMode extends OMPrivilegeMode
case object OMHypervisorMode extends OMPrivilegeMode
case object OMSupervisorMode extends OMPrivilegeMode
case object OMUserMode extends OMPrivilegeMode

object OMModes {
def getModes(hasSupervisorMode: Boolean): Seq[OMPrivilegeMode] = {
hasSupervisorMode match {
case false => Seq(OMMachineMode)
case true => Seq(OMMachineMode, OMSupervisorMode)
}
def getModes(hasSupervisorMode: Boolean, hasHypervisorMode: Boolean): Seq[OMPrivilegeMode] = {
Seq(OMMachineMode) ++
(if (hasHypervisorMode) Seq(OMHypervisorMode) else Seq()) ++
(if (hasSupervisorMode) Seq(OMSupervisorMode) else Seq())
}
}

Expand Down

0 comments on commit 92b10a4

Please sign in to comment.