Skip to content

Commit 2810760

Browse files
IvyfeathercailuoshanCai Luoshan
authored
Fix some bugs for CPL2 (#99) (#100)
* 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: Luoshan Cai <[email protected]> Co-authored-by: Cai Luoshan <[email protected]>
1 parent f3bb47a commit 2810760

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
@@ -182,6 +182,7 @@ class MSHRInfo(implicit p: Parameters) extends L2Bundle {
182182
val s_refill = Bool()
183183
val param = UInt(3.W)
184184
val mergeA = Bool() // whether the mshr already merge an acquire(avoid alias merge)
185+
val w_releaseack = Bool()
185186
}
186187

187188
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
@@ -541,6 +541,7 @@ class MSHR(implicit p: Parameters) extends L2Module {
541541
io.msInfo.bits.s_refill := state.s_refill
542542
io.msInfo.bits.param := req.param
543543
io.msInfo.bits.mergeA := mergeA
544+
io.msInfo.bits.w_releaseack := state.w_releaseack
544545

545546
assert(!(c_resp.valid && !io.status.bits.w_c_resp))
546547
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
@@ -74,9 +74,9 @@ class SinkB(implicit p: Parameters) extends L2Module {
7474
s.valid && s.bits.set === task.set && s.bits.reqTag === task.tag && !s.bits.willFree && !s.bits.nestB
7575
)).asUInt.orR
7676

77-
// unable to accept incoming B req because same-addr as some MSHR replaced block and cannot nest
77+
// 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
7878
val replaceConflictMask = VecInit(io.msInfo.map(s =>
79-
s.valid && s.bits.set === task.set && s.bits.metaTag === task.tag && s.bits.blockRefill
79+
s.valid && s.bits.set === task.set && s.bits.metaTag === task.tag && s.bits.blockRefill && !s.bits.w_releaseack
8080
)).asUInt
8181
val replaceConflict = replaceConflictMask.orR
8282

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)