1
0

rocket: split the interrupt controller into its own node

This commit is contained in:
Wesley W. Terpstra 2017-03-29 23:51:59 -07:00 committed by Andrew Waterman
parent a2fc51d65e
commit 2f2b472098

View File

@ -29,9 +29,10 @@ class RocketTile(val rocketParams: RocketTileParams, val hartid: Int)(implicit p
nDCachePorts += 1 // core TODO dcachePorts += () => module.core.io.dmem ?? nDCachePorts += 1 // core TODO dcachePorts += () => module.core.io.dmem ??
val device = new Device { private def ofInt(x: Int) = Seq(ResourceInt(BigInt(x)))
def ofInt(x: Int) = Seq(ResourceInt(BigInt(x))) private def ofStr(x: String) = Seq(ResourceString(x))
def ofStr(x: String) = Seq(ResourceString(x))
val cpuDevice = new Device {
def describe(resources: ResourceBindings): Description = { def describe(resources: ResourceBindings): Description = {
val block = p(CacheBlockBytes) val block = p(CacheBlockBytes)
val m = if (rocketParams.core.mulDiv.nonEmpty) "m" else "" val m = if (rocketParams.core.mulDiv.nonEmpty) "m" else ""
@ -85,21 +86,28 @@ class RocketTile(val rocketParams: RocketTileParams, val hartid: Int)(implicit p
"compatible" -> ofStr("riscv"), "compatible" -> ofStr("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))
"interrupt-controller" -> Nil,
"#interrupt-cells" -> ofInt(1))
++ dcache ++ icache ++ nextlevel ++ mmu ++ itlb ++ dtlb) ++ dcache ++ icache ++ nextlevel ++ mmu ++ itlb ++ dtlb)
} }
} }
val intcDevice = new Device {
def describe(resources: ResourceBindings): Description = {
Description(s"cpus/cpu@${hartid}/interrupt-controller", Map(
"compatible" -> ofStr("riscv,cpu-intc"),
"interrupt-controller" -> Nil,
"#interrupt-cells" -> ofInt(1)))
}
}
ResourceBinding { ResourceBinding {
Resource(device, "reg").bind(ResourceInt(BigInt(hartid))) Resource(cpuDevice, "reg").bind(ResourceInt(BigInt(hartid)))
Resource(intcDevice, "reg").bind(ResourceInt(BigInt(hartid)))
intNode.edgesIn.flatMap(_.source.sources).map { case s => intNode.edgesIn.flatMap(_.source.sources).map { case s =>
for (i <- s.range.start until s.range.end) { for (i <- s.range.start until s.range.end) {
csrIntMap.lift(i).foreach { j => csrIntMap.lift(i).foreach { j =>
s.resources.foreach { r => s.resources.foreach { r =>
r.bind(device, ResourceInt(j)) r.bind(intcDevice, ResourceInt(j))
} }
} }
} }