Skip to content

Commit 95e8de9

Browse files
authored
fix(AsyncBridge): revert (#433) (#446)
Revert "fix(AsyncBridge): add l-credit manager in AsyncBridge to fix performance (#433)" This reverts commit 4fc8217.
1 parent cfc9235 commit 95e8de9

File tree

2 files changed

+15
-77
lines changed

2 files changed

+15
-77
lines changed

src/main/scala/coupledL2/tl2chi/chi/AsyncBridge.scala

Lines changed: 7 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,15 @@ object FromAsyncBundle {
8181
def channel(
8282
async: AsyncBundle[UInt],
8383
params: AsyncQueueParams = AsyncQueueParams(),
84-
name: Option[String] = None,
85-
lcrdvReady: Option[Bool]= None
84+
name: Option[String] = None
8685
) = {
8786
val gen = chiselTypeOf(async.mem.head)
8887
val out = Wire(new ChannelIO(gen))
8988
val sink = Module(new AsyncQueueSink(gen, params))
9089
if (name.isDefined) { sink.suggestName("asyncQSink_" + name.get) }
9190
sink.io.async <> async
92-
sink.io.deq.ready := lcrdvReady.getOrElse(true.B)
93-
out.flitv := sink.io.deq.valid & sink.io.deq.ready
91+
sink.io.deq.ready := true.B
92+
out.flitv := sink.io.deq.valid
9493
out.flit := sink.io.deq.bits
9594
// flitpend and lcrdv are assigned independently
9695
out.flitpend := DontCare
@@ -188,12 +187,9 @@ class CHIAsyncBridgeSink(params: AsyncQueueParams = AsyncQueueParams())(implicit
188187
val resetFinish = Output(Bool())
189188
})
190189

191-
val txreq_lcrdvReady = Wire(Bool())
192-
val txrsp_lcrdvReady = Wire(Bool())
193-
val txdat_lcrdvReady = Wire(Bool())
194-
io.deq.tx.req <> FromAsyncBundle.channel(io.async.tx.req.flit, params, Some("txreq_flit"), Some(txreq_lcrdvReady))
195-
io.deq.tx.rsp <> FromAsyncBundle.channel(io.async.tx.rsp.flit, params, Some("txrsp_flit"), Some(txrsp_lcrdvReady))
196-
io.deq.tx.dat <> FromAsyncBundle.channel(io.async.tx.dat.flit, params, Some("txdat_flit"), Some(txdat_lcrdvReady))
190+
io.deq.tx.req <> FromAsyncBundle.channel(io.async.tx.req.flit, params, Some("txreq_flit"))
191+
io.deq.tx.rsp <> FromAsyncBundle.channel(io.async.tx.rsp.flit, params, Some("txrsp_flit"))
192+
io.deq.tx.dat <> FromAsyncBundle.channel(io.async.tx.dat.flit, params, Some("txdat_flit"))
197193

198194
io.async.tx.req.lcrdv <> ToAsyncBundle.bitPulse(io.deq.tx.req.lcrdv, params, Some("txreq_lcrdv"))
199195
io.async.tx.rsp.lcrdv <> ToAsyncBundle.bitPulse(io.deq.tx.rsp.lcrdv, params, Some("txrsp_lcrdv"))
@@ -244,57 +240,5 @@ class CHIAsyncBridgeSink(params: AsyncQueueParams = AsyncQueueParams())(implicit
244240
io.resetFinish := resetFinish
245241
}
246242

247-
248-
/*
249-
Duplicate Link Monitor tx/rx state FSM by using deq.rx deq.tx active signals which outuput to DownStream CHI
250-
*/
251-
val txState = RegInit(LinkStates.STOP)
252-
val rxState = RegInit(LinkStates.STOP)
253-
254-
Seq(txState, rxState).zip(MixedVecInit(Seq(io.deq.tx, io.deq.rx))).foreach { case (state, link) =>
255-
state := MuxLookup(Cat(link.linkactivereq, link.linkactiveack), LinkStates.STOP)(Seq(
256-
Cat(true.B, false.B) -> LinkStates.ACTIVATE,
257-
Cat(true.B, true.B) -> LinkStates.RUN,
258-
Cat(false.B, true.B) -> LinkStates.DEACTIVATE,
259-
Cat(false.B, false.B) -> LinkStates.STOP
260-
))
261-
}
262-
/*
263-
For rx channel, add l-credit manager module to generate lcrdv inside bridge
264-
a. Try to use io.deq.rx as LCredit interface to output lcrdv right after rx flit received.
265-
b. The maximum number of L-Credits that CoupledL2 can provide is 15.
266-
*/
267-
val rxsnpDeact, rxrspDeact, rxdatDeact = Wire(Bool())
268-
val rxin = WireInit(0.U asTypeOf(Flipped(new DecoupledPortIO()))) //fake Decoupled IO to provide ready
269-
rxin.rx.rsp.ready := true.B
270-
rxin.rx.dat.ready := true.B
271-
rxin.rx.snp.ready := true.B
272-
LCredit2Decoupled(io.deq.rx.rsp, rxin.rx.rsp, LinkState(rxState), rxrspDeact, Some("rxrsp"), 15, false)
273-
LCredit2Decoupled(io.deq.rx.dat, rxin.rx.dat, LinkState(rxState), rxdatDeact, Some("rxdat"), 15, false)
274-
LCredit2Decoupled(io.deq.rx.snp, rxin.rx.snp, LinkState(rxState), rxsnpDeact, Some("rxsnp"))
275-
/*
276-
For tx channel, add l-credit manager module to generate 'ready' to block tx flit to DownStream CHI
277-
a. The maximum number of L-Credits in tx channel is 4 inside bridge
278-
b. Use L-Credits number more than 4 in CoupledL2 to cover lcrdv sync delay from DownStream CHI to CoupledL2
279-
*/
280-
val txin = WireInit(0.U asTypeOf(Flipped(new DecoupledPortIO()))) //fake Decoupled IO to provide flitv
281-
val txout = WireInit(0.U asTypeOf(new PortIO))//fake LCredit IO to provide lcrdv
282-
txout.tx.req.lcrdv := io.deq.tx.req.lcrdv
283-
txout.tx.rsp.lcrdv := io.deq.tx.rsp.lcrdv
284-
txout.tx.dat.lcrdv := io.deq.tx.dat.lcrdv
285-
286-
txin.tx.req.valid := io.deq.tx.req.flitv
287-
txin.tx.rsp.valid := io.deq.tx.rsp.flitv
288-
txin.tx.dat.valid := io.deq.tx.dat.flitv
289-
290-
Decoupled2LCredit(txin.tx.req, txout.tx.req, LinkState(txState), Some("txreq"))
291-
Decoupled2LCredit(txin.tx.rsp, txout.tx.rsp, LinkState(txState), Some("txrsp"))
292-
Decoupled2LCredit(txin.tx.dat, txout.tx.dat, LinkState(txState), Some("txdat"))
293-
294-
txreq_lcrdvReady := txin.tx.req.ready
295-
txrsp_lcrdvReady := txin.tx.rsp.ready
296-
txdat_lcrdvReady := txin.tx.dat.ready
297-
298243
dontTouch(io)
299-
300-
}
244+
}

src/main/scala/coupledL2/tl2chi/chi/LinkLayer.scala

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,7 @@ object LCredit2Decoupled {
254254
}
255255
}
256256

257-
class Decoupled2LCredit[T <: Bundle](
258-
gen: T,
259-
overlcreditNum: Option[Int] = None,
260-
)(implicit p: Parameters) extends Module {
257+
class Decoupled2LCredit[T <: Bundle](gen: T)(implicit p: Parameters) extends Module {
261258
val io = IO(new Bundle() {
262259
val in = Flipped(DecoupledIO(gen.cloneType))
263260
val out = ChannelIO(gen.cloneType)
@@ -273,11 +270,9 @@ class Decoupled2LCredit[T <: Bundle](
273270

274271
// The maximum number of L-Credits that a receiver can provide is 15.
275272
val lcreditsMax = 15
276-
// overlcreditNum: the number more than the receiver can provide, use to cover lcrdv sync delay from AsyncBridge
277-
val overlcreditVal = overlcreditNum.getOrElse(0)
278-
val lcreditPool = RegInit(overlcreditVal.U(log2Up(lcreditsMax).W))
273+
val lcreditPool = RegInit(0.U(log2Up(lcreditsMax).W))
279274

280-
val returnLCreditValid = !io.in.valid && state === LinkStates.DEACTIVATE && lcreditPool =/= overlcreditVal.U
275+
val returnLCreditValid = !io.in.valid && state === LinkStates.DEACTIVATE && lcreditPool =/= 0.U
281276
val flitv = io.in.fire || returnLCreditValid
282277

283278
when (acceptLCredit) {
@@ -309,10 +304,9 @@ object Decoupled2LCredit {
309304
left: DecoupledIO[T],
310305
right: ChannelIO[T],
311306
state: LinkState,
312-
suggestName: Option[String] = None,
313-
overlcreditNum: Option[Int] = None
307+
suggestName: Option[String] = None
314308
)(implicit p: Parameters): Unit = {
315-
val mod = Module(new Decoupled2LCredit(left.bits.cloneType, overlcreditNum))
309+
val mod = Module(new Decoupled2LCredit(left.bits.cloneType))
316310
suggestName.foreach(name => mod.suggestName(s"Decoupled2LCredit_${name}"))
317311

318312
mod.io.in <> left
@@ -345,9 +339,9 @@ class LinkMonitor(implicit p: Parameters) extends L2Module with HasCHIOpcodes {
345339
/* IO assignment */
346340
val rxsnpDeact, rxrspDeact, rxdatDeact = Wire(Bool())
347341
val rxDeact = rxsnpDeact && rxrspDeact && rxdatDeact
348-
Decoupled2LCredit(setSrcID(io.in.tx.req, io.nodeID), io.out.tx.req, LinkState(txState), Some("txreq"), Some(4))
349-
Decoupled2LCredit(setSrcID(io.in.tx.rsp, io.nodeID), io.out.tx.rsp, LinkState(txState), Some("txrsp"), Some(4))
350-
Decoupled2LCredit(setSrcID(io.in.tx.dat, io.nodeID), io.out.tx.dat, LinkState(txState), Some("txdat"), Some(4))
342+
Decoupled2LCredit(setSrcID(io.in.tx.req, io.nodeID), io.out.tx.req, LinkState(txState), Some("txreq"))
343+
Decoupled2LCredit(setSrcID(io.in.tx.rsp, io.nodeID), io.out.tx.rsp, LinkState(txState), Some("txrsp"))
344+
Decoupled2LCredit(setSrcID(io.in.tx.dat, io.nodeID), io.out.tx.dat, LinkState(txState), Some("txdat"))
351345
LCredit2Decoupled(io.out.rx.snp, io.in.rx.snp, LinkState(rxState), rxsnpDeact, Some("rxsnp"))
352346
LCredit2Decoupled(io.out.rx.rsp, io.in.rx.rsp, LinkState(rxState), rxrspDeact, Some("rxrsp"), 15, false)
353347
LCredit2Decoupled(io.out.rx.dat, io.in.rx.dat, LinkState(rxState), rxdatDeact, Some("rxdat"), 15, false)

0 commit comments

Comments
 (0)