Skip to content

Commit f2830c3

Browse files
committed
timing(MMIOBridge): optimize timing for io.chi.tx.req.valid
1 parent dafcf80 commit f2830c3

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/main/scala/coupledL2/tl2chi/MMIOBridge.scala

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ class MMIOBridgeEntry(edge: TLEdgeIn)(implicit p: Parameters) extends TL2CHIL2Mo
8989
val id = Input(UInt())
9090
val pCrd = new PCrdQueryBundle
9191
val waitOnReadReceipt = Option.when(needRR)(Output(Bool()))
92+
val isRead = Output(Bool()) // only for better timing
9293
})
9394

9495
val s_txreq = RegInit(true.B)
@@ -115,7 +116,7 @@ class MMIOBridgeEntry(edge: TLEdgeIn)(implicit p: Parameters) extends TL2CHIL2Mo
115116
val denied = Reg(Bool())
116117
val corrupt = Reg(Bool())
117118
val traceTag = Reg(Bool())
118-
val isRead = req.opcode === Get
119+
val isRead = RegEnable(io.req.bits.opcode === Get, false.B, io.req.fire)
119120
val isBackTypeMM = req.user.lift(MemBackTypeMM).getOrElse(false.B)
120121
val isPageTypeNC = req.user.lift(MemPageTypeNC).getOrElse(false.B)
121122

@@ -228,11 +229,7 @@ class MMIOBridgeEntry(edge: TLEdgeIn)(implicit p: Parameters) extends TL2CHIL2Mo
228229
txreq.bits.qos := Fill(QOS_WIDTH, 1.U(1.W)) - 1.U
229230
txreq.bits.tgtID := SAM(sam).lookup(txreq.bits.addr)
230231
txreq.bits.txnID := io.id
231-
txreq.bits.opcode := ParallelLookUp(req.opcode, Seq(
232-
Get -> ReadNoSnp,
233-
PutFullData -> WriteNoSnpPtl,
234-
PutPartialData -> WriteNoSnpPtl
235-
))
232+
txreq.bits.opcode := Mux(isRead, ReadNoSnp, WriteNoSnpPtl)
236233
txreq.bits.size := req.size
237234
txreq.bits.addr := req.address
238235
txreq.bits.ns := enableNS.B
@@ -325,6 +322,7 @@ class MMIOBridgeEntry(edge: TLEdgeIn)(implicit p: Parameters) extends TL2CHIL2Mo
325322
io.pCrd.query.bits.srcID := srcID
326323

327324
io.waitOnReadReceipt.foreach(_ := !w_readreceipt.get && s_txreq)
325+
io.isRead := isRead
328326

329327
/**
330328
* performance counters
@@ -384,12 +382,14 @@ class MMIOBridgeImp(outer: MMIOBridge) extends LazyModuleImp(outer)
384382
}
385383

386384
val txreqArb = Module(new RRArbiterInit(chiselTypeOf(io.tx.req.bits), mmioBridgeSize))
387-
for ((a, req) <- txreqArb.io.in.zip(entries.map(_.io.chi.tx.req))) {
388-
a <> req
389-
val isReadNoSnp = req.bits.opcode === ReadNoSnp
390-
val block = isReadNoSnp && waitOnReadReceipt
385+
for ((a, entry) <- txreqArb.io.in.zip(entries)) {
386+
val req = entry.io.chi.tx.req
387+
val isRead = entry.io.isRead
388+
val block = isRead && waitOnReadReceipt
389+
assert(!req.valid || !isRead || req.bits.opcode === ReadNoSnp)
391390
req.ready := a.ready && !block
392391
a.valid := req.valid && !block
392+
a.bits := req.bits
393393
}
394394
io.tx.req <> txreqArb.io.out
395395
// arb(entries.map(_.io.chi.tx.req), io.tx.req, Some("mmio_txreq"))

0 commit comments

Comments
 (0)