From 93fe30e843ef61847acbe0260ff7f864d12d9f32 Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Tue, 2 Apr 2024 14:53:22 -0700 Subject: [PATCH] Fix connection order of meip/seip to plic --- .../scala/subsystem/HasHierarchicalElements.scala | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/scala/subsystem/HasHierarchicalElements.scala b/src/main/scala/subsystem/HasHierarchicalElements.scala index ffb30d51e95..6251017776a 100644 --- a/src/main/scala/subsystem/HasHierarchicalElements.scala +++ b/src/main/scala/subsystem/HasHierarchicalElements.scala @@ -207,7 +207,7 @@ trait HasHierarchicalElementsRootContext outputRequiresInput = false, inputRequiresOutput = false)) val meipNodes: SortedMap[Int, IntNode] = (0 until nTotalTiles).map { i => - (i, IntEphemeralNode() := plicOpt.map(_.intnode).getOrElse(meipIONode.get)) + (i, IntEphemeralNode()) }.to(SortedMap) val seipIONode = Option.when(plicOpt.isEmpty)(IntNexusNode( @@ -216,7 +216,14 @@ trait HasHierarchicalElementsRootContext outputRequiresInput = false, inputRequiresOutput = false)) val seipNodes: SortedMap[Int, IntNode] = totalTiles.filter { case (_, t) => t.tileParams.core.hasSupervisorMode } - .mapValues( _ => IntEphemeralNode() := plicOpt.map(_.intnode).getOrElse(seipIONode.get)).to(SortedMap) + .mapValues( _ => IntEphemeralNode()).to(SortedMap) + + // meip/seip nodes must be connected in MSMSMS order + // TODO: This is ultra fragile... the plic should just expose two intnodes + for (i <- 0 until nTotalTiles) { + meipNodes.get(i).foreach { _ := plicOpt.map(_.intnode).getOrElse(meipIONode.get) } + seipNodes.get(i).foreach { _ := plicOpt.map(_.intnode).getOrElse(seipIONode.get) } + } val tileToPlicNodes: SortedMap[Int, IntNode] = (0 until nTotalTiles).map { i => plicOpt.map(o => (i, o.intnode :=* IntEphemeralNode()))