Connect coal master node to identitynode internally
Instead of exposing master node to downstream, wrap everything inside the IdentityNode with N+1:N+1 edges. The inward edges exposed to the upstream nodes are only N edges. Needs more testing.
This commit is contained in:
@@ -43,17 +43,20 @@ class CoalescingUnit(numThreads: Int = 1)(implicit p: Parameters)
|
|||||||
// Master node that actually generates coalesced requests.
|
// Master node that actually generates coalesced requests.
|
||||||
// This and the IdentityNode will be the two outward-facing nodes that the
|
// This and the IdentityNode will be the two outward-facing nodes that the
|
||||||
// downstream, either L1 or the system bus, will connect to.
|
// downstream, either L1 or the system bus, will connect to.
|
||||||
val clientParam = Seq(
|
protected val clientParam = Seq(
|
||||||
TLMasterParameters.v1(
|
TLMasterParameters.v1(
|
||||||
name = "CoalescerNode",
|
name = "CoalescerNode",
|
||||||
sourceId = IdRange(0, 0xFFFF)
|
sourceId = IdRange(0, 0xffff)
|
||||||
// visibility = Seq(AddressSet(0x0000, 0xffffff))
|
// visibility = Seq(AddressSet(0x0000, 0xffffff))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
val coalescerNode = TLClientNode(
|
protected val coalescerNode = TLClientNode(
|
||||||
Seq(TLMasterPortParameters.v1(clientParam))
|
Seq(TLMasterPortParameters.v1(clientParam))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Connect master node as the N+1-th inward edge of the IdentityNode
|
||||||
|
node :=* coalescerNode
|
||||||
|
|
||||||
lazy val module = new Impl
|
lazy val module = new Impl
|
||||||
class Impl extends LazyModuleImp(this) {
|
class Impl extends LazyModuleImp(this) {
|
||||||
// Per-lane FIFO that buffers incoming requests
|
// Per-lane FIFO that buffers incoming requests
|
||||||
@@ -66,6 +69,8 @@ class CoalescingUnit(numThreads: Int = 1)(implicit p: Parameters)
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
println(s"============= node edges: ${node.in.length}")
|
||||||
|
|
||||||
// Override IdentityNode implementation so that we wire node output to the
|
// Override IdentityNode implementation so that we wire node output to the
|
||||||
// FIFO output, instead of directly passing through node input.
|
// FIFO output, instead of directly passing through node input.
|
||||||
// See IdentityNode definition in `diplomacy/Nodes.scala`.
|
// See IdentityNode definition in `diplomacy/Nodes.scala`.
|
||||||
@@ -103,6 +108,9 @@ class CoalescingUnit(numThreads: Int = 1)(implicit p: Parameters)
|
|||||||
dontTouch(tlOut.d)
|
dontTouch(tlOut.d)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// val (tlIn, edgeIn) = coalescerNode.in(0)
|
||||||
|
// tlIn.d.bits.data := 0.U
|
||||||
|
|
||||||
val (tlCoal, _) = coalescerNode.out(0)
|
val (tlCoal, _) = coalescerNode.out(0)
|
||||||
dontTouch(tlCoal.a)
|
dontTouch(tlCoal.a)
|
||||||
}
|
}
|
||||||
@@ -115,7 +123,7 @@ class MemTraceDriver(numThreads: Int = 1)(implicit p: Parameters)
|
|||||||
val clientParam = Seq(
|
val clientParam = Seq(
|
||||||
TLMasterParameters.v1(
|
TLMasterParameters.v1(
|
||||||
name = "MemTraceDriver" + i.toString,
|
name = "MemTraceDriver" + i.toString,
|
||||||
sourceId = IdRange(0, 0xFFFF)
|
sourceId = IdRange(0, 0xffff)
|
||||||
// visibility = Seq(AddressSet(0x0000, 0xffffff))
|
// visibility = Seq(AddressSet(0x0000, 0xffffff))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -132,7 +140,6 @@ class MemTraceDriver(numThreads: Int = 1)(implicit p: Parameters)
|
|||||||
lazy val module = new MemTraceDriverImp(this, numThreads)
|
lazy val module = new MemTraceDriverImp(this, numThreads)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class TraceReq extends Bundle {
|
class TraceReq extends Bundle {
|
||||||
val valid = Bool()
|
val valid = Bool()
|
||||||
val address = UInt(64.W)
|
val address = UInt(64.W)
|
||||||
@@ -172,15 +179,15 @@ class MemTraceDriverImp(outer: MemTraceDriver, numThreads: Int)
|
|||||||
sourceIdCounter := sourceIdCounter + 1.U
|
sourceIdCounter := sourceIdCounter + 1.U
|
||||||
|
|
||||||
// Connect each thread to its respective TL node.
|
// Connect each thread to its respective TL node.
|
||||||
(outer.threadNodes zip threadReqs).zipWithIndex.foreach {
|
(outer.threadNodes zip threadReqs).foreach { case (node, req) =>
|
||||||
case ((node, req), i) =>
|
val (tlOut, edge) = node.out(0)
|
||||||
val (tlOut, edge) = node.out(0)
|
tlOut.a.valid := req.valid
|
||||||
tlOut.a.valid := req.valid
|
|
||||||
|
tlOut.a.bits := DontCare
|
||||||
tlOut.a.bits := DontCare
|
tlOut.a.bits.data := 0.U
|
||||||
tlOut.a.bits.data := 0.U
|
when(req.is_store) {
|
||||||
when (req.is_store) {
|
tlOut.a.bits := edge
|
||||||
tlOut.a.bits := edge.Put(
|
.Put(
|
||||||
fromSource = sourceIdCounter,
|
fromSource = sourceIdCounter,
|
||||||
toAddress = req.address,
|
toAddress = req.address,
|
||||||
// Memory trace addresses are not aligned in word addresses (e.g.
|
// Memory trace addresses are not aligned in word addresses (e.g.
|
||||||
@@ -190,18 +197,21 @@ class MemTraceDriverImp(outer: MemTraceDriver, numThreads: Int)
|
|||||||
// NOTE: this is in byte size, not bits
|
// NOTE: this is in byte size, not bits
|
||||||
lgSize = 0.U,
|
lgSize = 0.U,
|
||||||
data = req.data
|
data = req.data
|
||||||
)._2
|
)
|
||||||
}.otherwise {
|
._2
|
||||||
tlOut.a.bits := edge.Get(
|
}.otherwise {
|
||||||
|
tlOut.a.bits := edge
|
||||||
|
.Get(
|
||||||
fromSource = sourceIdCounter,
|
fromSource = sourceIdCounter,
|
||||||
toAddress = req.address,
|
toAddress = req.address,
|
||||||
lgSize = 0.U
|
lgSize = 0.U
|
||||||
)._2
|
)
|
||||||
}
|
._2
|
||||||
|
}
|
||||||
// tl_out.a.bits.mask := 0xf.U
|
|
||||||
dontTouch(tlOut.a)
|
// tl_out.a.bits.mask := 0xf.U
|
||||||
tlOut.d.ready := true.B
|
dontTouch(tlOut.a)
|
||||||
|
tlOut.d.ready := true.B
|
||||||
}
|
}
|
||||||
|
|
||||||
io.finished := sim.io.trace_read.finished
|
io.finished := sim.io.trace_read.finished
|
||||||
@@ -209,7 +219,7 @@ class MemTraceDriverImp(outer: MemTraceDriver, numThreads: Int)
|
|||||||
// Clock Counter, for debugging purpose
|
// Clock Counter, for debugging purpose
|
||||||
val clkcount = RegInit(0.U(64.W))
|
val clkcount = RegInit(0.U(64.W))
|
||||||
clkcount := clkcount + 1.U
|
clkcount := clkcount + 1.U
|
||||||
dontTouch(clkcount)
|
dontTouch(clkcount)
|
||||||
}
|
}
|
||||||
|
|
||||||
class SimMemTrace(val filename: String, numThreads: Int)
|
class SimMemTrace(val filename: String, numThreads: Int)
|
||||||
@@ -259,8 +269,7 @@ class CoalConnectTrace(implicit p: Parameters) extends LazyModule {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
// Connect all (N+1) outputs of coal to separate TestRAM modules
|
// Connect all (N+1) outputs of coal to separate TestRAM modules
|
||||||
(0 until numThreads).foreach { i => rams(i).node := coal.node }
|
rams.foreach { r => r.node := coal.node }
|
||||||
rams(numThreads).node := coal.coalescerNode
|
|
||||||
|
|
||||||
lazy val module = new Impl
|
lazy val module = new Impl
|
||||||
class Impl extends LazyModuleImp(this) with UnitTestModule {
|
class Impl extends LazyModuleImp(this) with UnitTestModule {
|
||||||
|
|||||||
Reference in New Issue
Block a user