Check legal from Get and Put

This commit is contained in:
Hansung Kim
2023-03-09 22:55:38 -08:00
parent 46d3109e82
commit 13552593c8

View File

@@ -77,12 +77,11 @@ class CoalescingUnit(numLanes: Int = 1)(implicit p: Parameters)
// See IdentityNode definition in `diplomacy/Nodes.scala`. // See IdentityNode definition in `diplomacy/Nodes.scala`.
(node.in zip node.out).zipWithIndex.foreach { (node.in zip node.out).zipWithIndex.foreach {
case (((_, edgeIn), _), 0) => case (((_, edgeIn), _), 0) =>
// First node is coalescerNode; do nothing // No need to do anything on the edge from coalescerNode
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"
) )
0
case (((tlIn, _), (tlOut, edgeOut)), i) => case (((tlIn, _), (tlOut, edgeOut)), i) =>
val fifo = fifos(i - 1) val fifo = fifos(i - 1)
val newReq = Wire(coalRegEntry) val newReq = Wire(coalRegEntry)
@@ -99,17 +98,17 @@ class CoalescingUnit(numLanes: Int = 1)(implicit p: Parameters)
tlOut.a.valid := fifo.io.deq.valid tlOut.a.valid := fifo.io.deq.valid
// FIXME: generate Get or Put according to read/write // FIXME: generate Get or Put according to read/write
tlOut.a.bits := edgeOut val (legal, bits) = edgeOut.Get(
.Get( fromSource = head.source,
fromSource = head.source, // `toAddress` should be aligned to 2**lgSize
// `toAddress` should be aligned to 2**lgSize toAddress = head.address,
toAddress = head.address, // 64 bits = 8 bytes = 2**(3) bytes
// 64 bits = 8 bytes = 2**(3) bytes lgSize = 0.U
lgSize = 0.U // data = (i + 100).U
// data = (i + 100).U // data = tlIn.a.bits.data + 0xFF.U
// data = tlIn.a.bits.data + 0xFF.U )
) assert(legal, "unhandled illegal TL req gen")
._2 tlOut.a.bits := bits
tlIn.d <> tlOut.d tlIn.d <> tlOut.d
dontTouch(tlIn.a) dontTouch(tlIn.a)
@@ -121,15 +120,15 @@ class CoalescingUnit(numLanes: Int = 1)(implicit p: Parameters)
// FIXME: currently generating bogus coalesced requests // FIXME: currently generating bogus coalesced requests
tlCoal.a.valid := true.B tlCoal.a.valid := true.B
tlCoal.a.bits := edgeCoal val (legal, bits) = edgeCoal.Get(
.Get( fromSource = 0.U,
fromSource = 0.U, // `toAddress` should be aligned to 2**lgSize
// `toAddress` should be aligned to 2**lgSize toAddress = 0xabcd00.U,
toAddress = 0xabcd00.U, // 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")
._2 tlCoal.a.bits := bits
val coalRespValid = Wire(Bool()) val coalRespValid = Wire(Bool())
coalRespValid := tlCoal.a.valid coalRespValid := tlCoal.a.valid
@@ -205,31 +204,26 @@ class MemTraceDriverImp(outer: MemTraceDriver, numLanes: Int)
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 val (plegal, pbits) = edge.Put(
tlOut.a.bits.data := 0.U fromSource = sourceIdCounter,
when(req.is_store) { toAddress = req.address,
tlOut.a.bits := edge // Memory trace addresses are not aligned in word addresses (e.g.
.Put( // read of size 1 at 0x1007) so leave lgSize to 0.
fromSource = sourceIdCounter, // TODO: We need to build an issue logic that aligns addresses at
toAddress = req.address, // word boundaries and uses masks.
// Memory trace addresses are not aligned in word addresses (e.g. // NOTE: this is in byte size, not bits
// read of size 1 at 0x1007) so leave lgSize to 0. lgSize = 0.U,
// TODO: We need to build an issue logic that aligns addresses at data = req.data
// word boundaries and uses masks. )
// NOTE: this is in byte size, not bits val (glegal, gbits) = edge.Get(
lgSize = 0.U, fromSource = sourceIdCounter,
data = req.data toAddress = req.address,
) lgSize = 0.U
._2 )
}.otherwise { val legal = Mux(req.is_store, plegal, glegal)
tlOut.a.bits := edge val bits = Mux(req.is_store, pbits, gbits)
.Get( assert(legal, "unhandled illegal TL req gen")
fromSource = sourceIdCounter, tlOut.a.bits := bits
toAddress = req.address,
lgSize = 0.U
)
._2
}
// tl_out.a.bits.mask := 0xf.U // tl_out.a.bits.mask := 0xf.U
dontTouch(tlOut.a) dontTouch(tlOut.a)