DTS: collect common DTS nodes and move timebase-frequency to cores
Putting the common DTS nodes into a shared object makes them get emitted only one time. Plus it's better style. timebase-frequency should really have been in the cpu nodes in the first place according to the spec anyway. I was foolishly trying to save bytes. However, now we really want it there in case it differs.
This commit is contained in:
parent
3b299397db
commit
6f3ff634f2
@ -54,46 +54,22 @@ abstract class BaseCoreplex(implicit p: Parameters) extends BareCoreplex
|
|||||||
with HasMemoryBus {
|
with HasMemoryBus {
|
||||||
override val module: BaseCoreplexModule[BaseCoreplex]
|
override val module: BaseCoreplexModule[BaseCoreplex]
|
||||||
|
|
||||||
val root = new Device {
|
|
||||||
def describe(resources: ResourceBindings): Description = {
|
|
||||||
val width = resources("width").map(_.value)
|
|
||||||
Description("/", Map(
|
|
||||||
"#address-cells" -> width,
|
|
||||||
"#size-cells" -> width,
|
|
||||||
"model" -> Seq(ResourceString(p(DTSModel))),
|
|
||||||
"compatible" -> (p(DTSModel) +: p(DTSCompat)).map(s => ResourceString(s + "-dev"))))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val soc = new Device {
|
|
||||||
def describe(resources: ResourceBindings): Description = {
|
|
||||||
val width = resources("width").map(_.value)
|
|
||||||
Description("soc", Map(
|
|
||||||
"#address-cells" -> width,
|
|
||||||
"#size-cells" -> width,
|
|
||||||
"compatible" -> ((p(DTSModel) +: p(DTSCompat)).map(s => ResourceString(s + "-soc")) :+ ResourceString("simple-bus")),
|
|
||||||
"ranges" -> Nil))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val cpus = new Device {
|
|
||||||
def describe(resources: ResourceBindings): Description = {
|
|
||||||
Description("cpus", Map(
|
|
||||||
"#address-cells" -> Seq(ResourceInt(1)),
|
|
||||||
"#size-cells" -> Seq(ResourceInt(0)),
|
|
||||||
"timebase-frequency" -> Seq(ResourceInt(p(DTSTimebase)))))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make topManagers an Option[] so as to avoid LM name reflection evaluating it...
|
// Make topManagers an Option[] so as to avoid LM name reflection evaluating it...
|
||||||
lazy val topManagers = Some(ManagerUnification(sharedMemoryTLEdge.manager.managers))
|
lazy val topManagers = Some(ManagerUnification(sharedMemoryTLEdge.manager.managers))
|
||||||
ResourceBinding {
|
ResourceBinding {
|
||||||
val managers = topManagers.get
|
val managers = topManagers.get
|
||||||
val max = managers.flatMap(_.address).map(_.max).max
|
val max = managers.flatMap(_.address).map(_.max).max
|
||||||
val width = ResourceInt((log2Ceil(max)+31) / 32)
|
val width = ResourceInt((log2Ceil(max)+31) / 32)
|
||||||
Resource(root, "width").bind(width)
|
val model = p(DTSModel)
|
||||||
Resource(soc, "width").bind(width)
|
val compat = p(DTSCompat)
|
||||||
Resource(cpus, "null").bind(ResourceString(""))
|
val devCompat = (model +: compat).map(s => ResourceString(s + "-dev"))
|
||||||
|
val socCompat = (model +: compat).map(s => ResourceString(s + "-soc"))
|
||||||
|
devCompat.foreach { Resource(ResourceAnchors.root, "compat").bind(_) }
|
||||||
|
socCompat.foreach { Resource(ResourceAnchors.soc, "compat").bind(_) }
|
||||||
|
Resource(ResourceAnchors.root, "model").bind(ResourceString(model))
|
||||||
|
Resource(ResourceAnchors.root, "width").bind(width)
|
||||||
|
Resource(ResourceAnchors.soc, "width").bind(width)
|
||||||
|
Resource(ResourceAnchors.cpus, "width").bind(ResourceInt(1))
|
||||||
|
|
||||||
managers.foreach { case manager =>
|
managers.foreach { case manager =>
|
||||||
val value = manager.toResource
|
val value = manager.toResource
|
||||||
|
@ -285,3 +285,40 @@ object ResourceBinding
|
|||||||
scope.get.resourceBindingFns = { () => block } +: scope.get.resourceBindingFns
|
scope.get.resourceBindingFns = { () => block } +: scope.get.resourceBindingFns
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
object ResourceAnchors
|
||||||
|
{
|
||||||
|
val root = new Device {
|
||||||
|
def describe(resources: ResourceBindings): Description = {
|
||||||
|
val width = resources("width").map(_.value)
|
||||||
|
val model = resources("model").map(_.value)
|
||||||
|
val compat = resources("compat").map(_.value)
|
||||||
|
Description("/", Map(
|
||||||
|
"#address-cells" -> width,
|
||||||
|
"#size-cells" -> width,
|
||||||
|
"model" -> model,
|
||||||
|
"compatible" -> compat))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val soc = new Device {
|
||||||
|
def describe(resources: ResourceBindings): Description = {
|
||||||
|
val width = resources("width").map(_.value)
|
||||||
|
val compat = resources("compat").map(_.value) :+ ResourceString("simple-bus")
|
||||||
|
Description("soc", Map(
|
||||||
|
"#address-cells" -> width,
|
||||||
|
"#size-cells" -> width,
|
||||||
|
"compatible" -> compat,
|
||||||
|
"ranges" -> Nil))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val cpus = new Device {
|
||||||
|
def describe(resources: ResourceBindings): Description = {
|
||||||
|
val width = resources("width").map(_.value)
|
||||||
|
Description("cpus", Map(
|
||||||
|
"#address-cells" -> width,
|
||||||
|
"#size-cells" -> Seq(ResourceInt(0))))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -107,8 +107,8 @@ class RocketTile(val rocketParams: RocketTileParams)(implicit p: Parameters) ext
|
|||||||
"compatible" -> Seq(ResourceString("sifive,rocket0"), ResourceString("riscv")),
|
"compatible" -> Seq(ResourceString("sifive,rocket0"), ResourceString("riscv")),
|
||||||
"status" -> ofStr("okay"),
|
"status" -> ofStr("okay"),
|
||||||
"clock-frequency" -> Seq(ResourceInt(rocketParams.core.bootFreqHz)),
|
"clock-frequency" -> Seq(ResourceInt(rocketParams.core.bootFreqHz)),
|
||||||
"riscv,isa" -> ofStr(isa))
|
"riscv,isa" -> ofStr(isa),
|
||||||
++ dcache ++ icache ++ nextlevel ++ mmu ++ itlb ++ dtlb ++ dtim ++ itim ++ incoherent)
|
"timebase-frequency" -> Seq(ResourceInt(p(DTSTimebase)))) ++ dcache ++ icache ++ nextlevel ++ mmu ++ itlb ++ dtlb ++ dtim ++ itim ++ incoherent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val intcDevice = new Device {
|
val intcDevice = new Device {
|
||||||
|
Loading…
Reference in New Issue
Block a user