Properly assert ready/valid for all TL channels

This commit is contained in:
Hansung Kim
2023-03-10 00:21:06 -08:00
parent e523b4235a
commit 93b198e0f6

View File

@@ -43,15 +43,14 @@ class CoalescingUnit(numLanes: 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.
protected val clientParam = Seq( protected val coalParam = Seq(
TLMasterParameters.v1( TLMasterParameters.v1(
name = "CoalescerNode", name = "CoalescerNode",
sourceId = IdRange(0, 0xffff) sourceId = IdRange(0, 0x10)
// visibility = Seq(AddressSet(0x0000, 0xffffff))
) )
) )
protected val coalescerNode = TLClientNode( protected val coalescerNode = TLClientNode(
Seq(TLMasterPortParameters.v1(clientParam)) Seq(TLMasterPortParameters.v1(coalParam))
) )
// Connect master node as the first of the N+1-th inward edges of the // Connect master node as the first of the N+1-th inward edges of the
@@ -113,37 +112,52 @@ class CoalescingUnit(numLanes: Int = 1)(implicit p: Parameters)
dontTouch(tlOut.d) dontTouch(tlOut.d)
} }
// Generate coalesced requests. // Generate coalesced requests
// FIXME: currently generating bogus coalesced requests // FIXME: currently generating bogus coalesced requests
val coalSourceId = RegInit(0.U(4.W /* FIXME hardcoded */ ))
coalSourceId := coalSourceId + 1.U
val (tlCoal, edgeCoal) = coalescerNode.out(0) val (tlCoal, edgeCoal) = coalescerNode.out(0)
tlCoal.a.valid := true.B tlCoal.a.valid := true.B
val (legal, bits) = edgeCoal.Get( val (legal, bits) = edgeCoal.Get(
fromSource = 0.U, fromSource = coalSourceId,
// `toAddress` should be aligned to 2**lgSize // `toAddress` should be aligned to 2**lgSize
toAddress = 0xabcd00.U, toAddress = (0xabcd.U + coalSourceId) << 4,
// 64 bits = 8 bytes = 2**(3) bytes // 64 bits = 8 bytes = 2**(3) bytes
lgSize = 3.U lgSize = 3.U
) )
assert(legal, "unhandled illegal TL req gen") assert(legal, "unhandled illegal TL req gen")
tlCoal.a.bits := bits tlCoal.a.bits := bits
tlCoal.b.ready := true.B
tlCoal.c.valid := false.B
tlCoal.d.ready := true.B
tlCoal.e.valid := false.B
// Debug signals
val coalReqValid = Wire(Bool()) val coalReqValid = Wire(Bool())
coalReqValid := tlCoal.a.valid coalReqValid := tlCoal.a.valid
dontTouch(coalReqValid) dontTouch(coalReqValid)
val coalReqAddress = Wire(UInt(tlCoal.params.addressBits.W))
coalReqAddress := tlCoal.a.bits.address
dontTouch(coalReqAddress)
val coalRespData = Wire(UInt(tlCoal.params.dataBits.W)) val coalRespData = Wire(UInt(tlCoal.params.dataBits.W))
coalRespData := tlCoal.d.bits.data coalRespData := tlCoal.d.bits.data
dontTouch(coalRespData) dontTouch(coalRespData)
// Now, for the coalescer response flow, instantiate a reservation station dontTouch(tlCoal.a)
// that records for each unanswered coalesced requests which lane the dontTouch(tlCoal.d)
// request originated from, what were their original sourceIds, etc.
// Now, for the coalescer response flow, instantiate a reservation
// station-like structure that records for each unanswered coalesced
// requests which lane the request originated from, what were their
// original sourceIds, etc.
// FIXME: Reuse ShiftQueue(coalRegEntry) for now, but swap out to actual // FIXME: Reuse ShiftQueue(coalRegEntry) for now, but swap out to actual
// table structure // table structure
val responseQueue = Module( val responseQueue = Module(
new ShiftQueue(coalRegEntry, 4 /* FIXME hardcoded */ ) new ShiftQueue(coalRegEntry, 4 /* FIXME hardcoded */ )
) )
(node.in zip node.out)(0) match { (node.in zip node.out)(0) match {
case ((tlIn, edgeIn), (tlOut, edgeOut)) => case ((tlIn, edgeIn), (tlOut, _)) =>
assert( assert(
edgeIn.master.masters(0).name == "CoalescerNode", edgeIn.master.masters(0).name == "CoalescerNode",
"First edge is not connected to the coalescer master node" "First edge is not connected to the coalescer master node"
@@ -252,10 +266,12 @@ class MemTraceDriverImp(outer: MemTraceDriver, numLanes: Int)
val bits = Mux(req.is_store, pbits, gbits) val bits = Mux(req.is_store, pbits, gbits)
assert(legal, "unhandled illegal TL req gen") assert(legal, "unhandled illegal TL req gen")
tlOut.a.bits := bits tlOut.a.bits := bits
tlOut.b.ready := true.B
// tl_out.a.bits.mask := 0xf.U tlOut.c.valid := false.B
dontTouch(tlOut.a)
tlOut.d.ready := true.B tlOut.d.ready := true.B
tlOut.e.valid := false.B
dontTouch(tlOut.a)
} }
io.finished := sim.io.trace_read.finished io.finished := sim.io.trace_read.finished