Skip to content

Commit a6b668e

Browse files
cailuoshanCai Luoshan
and
Cai Luoshan
authored
Fix some bugs for CPL2 (#99)
* SinkC: fix bug for regs Buf not init * MSHR: fix bug when L1_acquirePerm but L2_miss, L2 should acquireBlock to L3, not only acquirePerm * MainPipe: when L3_probetoB and L2=TIP, L2 donot need probetoB L1 * SinkB: cannot accept Probe when same-addr Release to L3 and have not receive ReleaseAck --------- Co-authored-by: Cai Luoshan <[email protected]>
1 parent 2a1d3b0 commit a6b668e

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

src/main/scala/coupledL2/Common.scala

+1
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ class MSHRInfo(implicit p: Parameters) extends L2Bundle {
185185
val s_refill = Bool()
186186
val param = UInt(3.W)
187187
val mergeA = Bool() // whether the mshr already merge an acquire(avoid alias merge)
188+
val w_releaseack = Bool()
188189
}
189190

190191
class RespInfoBundle(implicit p: Parameters) extends L2Bundle {

src/main/scala/coupledL2/MSHR.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class MSHR(implicit p: Parameters) extends L2Module {
125125
oa.off := req.off
126126
oa.source := io.id
127127
oa.opcode := Mux(
128-
req_acquirePerm,
128+
req_acquirePerm && dirResult.hit,
129129
req.opcode,
130130
// Get or AcquireBlock
131131
AcquireBlock
@@ -548,6 +548,7 @@ class MSHR(implicit p: Parameters) extends L2Module {
548548
io.msInfo.bits.s_refill := state.s_refill
549549
io.msInfo.bits.param := req.param
550550
io.msInfo.bits.mergeA := mergeA
551+
io.msInfo.bits.w_releaseack := state.w_releaseack
551552

552553
assert(!(c_resp.valid && !io.status.bits.w_c_resp))
553554
assert(!(d_resp.valid && !io.status.bits.w_d_resp))

src/main/scala/coupledL2/MainPipe.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class MainPipe(implicit p: Parameters) extends L2Module {
178178
val need_mshr_s3_a = need_acquire_s3_a || need_probe_s3_a || cache_alias
179179
// For channel B reqs, alloc mshr when Probe hits in both self and client dir
180180
val need_mshr_s3_b = dirResult_s3.hit && req_s3.fromB &&
181-
!(meta_s3.state === BRANCH && req_s3.param === toB) &&
181+
!((meta_s3.state === BRANCH || meta_s3.state === TIP) && req_s3.param === toB) &&
182182
meta_has_clients_s3
183183

184184
// For channel C reqs, Release will always hit on MainPipe, no need for MSHR

src/main/scala/coupledL2/SinkB.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ class SinkB(implicit p: Parameters) extends L2Module {
7575
s.valid && s.bits.set === task.set && s.bits.reqTag === task.tag && !s.bits.willFree && !s.bits.nestB
7676
)).asUInt.orR
7777

78-
// unable to accept incoming B req because same-addr as some MSHR replaced block and cannot nest
78+
// unable to accept incoming B req because same-addr Release to L3 and have not received ReleaseAck, and some MSHR replaced block and cannot nest
7979
val replaceConflictMask = VecInit(io.msInfo.map(s =>
80-
s.valid && s.bits.set === task.set && s.bits.metaTag === task.tag && s.bits.blockRefill
80+
s.valid && s.bits.set === task.set && s.bits.metaTag === task.tag && s.bits.blockRefill && !s.bits.w_releaseack
8181
)).asUInt
8282
val replaceConflict = replaceConflictMask.orR
8383

src/main/scala/coupledL2/SinkC.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ class SinkC(implicit p: Parameters) extends L2Module {
5050

5151
// dataBuf entry is valid when Release has data
5252
// taskBuf entry is valid when ReqArb is not ready to receive C tasks
53-
val dataBuf = Reg(Vec(bufBlocks, Vec(beatSize, UInt((beatBytes * 8).W))))
53+
val dataBuf = RegInit(VecInit(Seq.fill(bufBlocks)(VecInit(Seq.fill(beatSize)(0.U.asTypeOf(UInt((beatBytes * 8).W)))))))
5454
val beatValids = RegInit(VecInit(Seq.fill(bufBlocks)(VecInit(Seq.fill(beatSize)(false.B)))))
5555
val dataValids = VecInit(beatValids.map(_.asUInt.orR)).asUInt
56-
val taskBuf = Reg(Vec(bufBlocks, new TaskBundle))
56+
val taskBuf = RegInit(VecInit(Seq.fill(bufBlocks)(0.U.asTypeOf(new TaskBundle))))
5757
val taskValids = RegInit(VecInit(Seq.fill(bufBlocks)(false.B)))
5858
val taskArb = Module(new RRArbiter(new TaskBundle, bufBlocks))
5959
val bufValids = taskValids.asUInt | dataValids

0 commit comments

Comments
 (0)