Skip to content

Commit 30a4cb1

Browse files
committed
Bump coupledL2 upstream at Mar 5, 2026
Merge coupledL2 commits from 95e8de to 727a04c (xs/master), which is the latest on xs/master as of Mar 5, 2026. Squashed commit of the following: commit 62195c6 Author: zhanglinjuan <zhanglinjuan16@mails.ucas.ac.cn> Date: Mon Dec 01 17:59:00 2025 +0800 timing(MainPipe): fix critical path from Dir error to GrantBuffer (OpenXiangShan#448) commit fffb491 Author: Ding Haonan <kumonda@kucro3.org> Date: Thu Dec 04 11:36:48 2025 +0800 timing(TL2CHICoupledL2): 2-stage cap P-Credit Queue (OpenXiangShan#449) commit f118bca Author: Yanqin Li <maxpicca@qq.com> Date: Tue Dec 16 21:26:05 2025 +0800 refactor: refine prefetch statistics in topdown monitor (OpenXiangShan#452) commit b40da89 Author: Ma-YX <71326427+Ma-YX@users.noreply.github.com> Date: Wed Dec 17 18:58:51 2025 +0800 fix(TXDAT): fix wrong DataCheck generation when data invalid (OpenXiangShan#455) commit e4fd161 Author: Ma-YX <71326427+Ma-YX@users.noreply.github.com> Date: Wed Dec 17 21:36:01 2025 +0800 fix(CoupledL2): fix l2MissMatch io compilation error (OpenXiangShan#456) commit 4e4a6aa Author: Kunlin You <youkunlin20@mails.ucas.ac.cn> Date: Thu Dec 18 19:13:20 2025 +0800 feat(clockGate): support disable ClockGate with parameters (OpenXiangShan#451) commit feacfb5 Author: zhaohong1988 <156632870+zhaohong1988@users.noreply.github.com> Date: Fri Dec 19 00:24:20 2025 +0800 fix(MMIOBridge): modify TIMERRange from fix value to soc parameter (OpenXiangShan#453) commit c5ad8f4 Author: Yanqin Li <maxpicca@qq.com> Date: Fri Dec 19 00:24:53 2025 +0800 ci: add submodule check and remove the dependency of utility in OpenLLC (OpenXiangShan#454) commit ea0c313 Author: Ding Haonan <kumonda@kucro3.org> Date: Fri Dec 26 09:41:32 2025 +0800 fix(MMIOBridge): remove redundant BEU range exclusion in L2 (OpenXiangShan#457) commit f292774 Author: Ding Haonan <kumonda@kucro3.org> Date: Thu Jan 08 10:15:15 2026 +0800 fix(Opcode): missing SnpPreferUniqueFwd in SnpXFwd (OpenXiangShan#460) commit 59f3025 Author: Ma-YX <71326427+Ma-YX@users.noreply.github.com> Date: Wed Jan 14 15:59:43 2026 +0800 fix(MainPipe): fix l2Error_s3 generation logic (OpenXiangShan#463) commit 3c9525f Author: Haoyuan Feng <fenghaoyuan19@mails.ucas.ac.cn> Date: Mon Feb 02 10:17:49 2026 +0800 fix(ClockGate): fix bug that ICG is invalid when disable mbist (OpenXiangShan#470) commit 0d20557 Author: yulightenyu <145419941+yulightenyu@users.noreply.github.com> Date: Tue Mar 03 14:26:16 2026 +0800 fix(AsyncBridge): restore performance considering async depth is 4 (OpenXiangShan#472) commit ef2deb5 Author: Ding Haonan <kumonda@kucro3.org> Date: Wed Mar 04 16:20:19 2026 +0800 fix(MSHR): hold LikelyShared on retried writes (OpenXiangShan#474) commit 727a04c Author: Haoyuan Feng <fenghaoyuan19@mails.ucas.ac.cn> Date: Wed Mar 04 17:01:33 2026 +0800 feat(mmioBridge): increase mmioBridgeSize to 16 for better NC perf (OpenXiangShan#475)
1 parent 56f1078 commit 30a4cb1

25 files changed

+446
-253
lines changed

.github/workflows/main.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,23 @@ on:
1515

1616
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1717
jobs:
18+
check-submodules:
19+
runs-on: ubuntu-22.04
20+
continue-on-error: false
21+
timeout-minutes: 5
22+
name: Check Submodules
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
submodules: 'true'
27+
fetch-depth: '0'
28+
- name: check rocket-chip
29+
run: cd rocket-chip && git fetch --all && git merge-base --is-ancestor `git rev-parse HEAD` origin/master
30+
- name: check HuanCun
31+
run: cd HuanCun && git fetch --all && git merge-base --is-ancestor `git rev-parse HEAD` origin/master
32+
- name: check utility
33+
run: cd utility && git fetch --all && git merge-base --is-ancestor `git rev-parse HEAD` origin/master
34+
1835
# This workflow contains a single job called "build"
1936
tl-test_L2:
2037
# The type of runner that the job will run on
@@ -78,6 +95,7 @@ jobs:
7895
git clone https://github.com/OpenXiangShan/OpenLLC
7996
cd OpenLLC && make init
8097
rm -rf ./coupledL2 && ln -s ../../.. ./coupledL2
98+
rm -rf ./utility && ln -s ../../../utility ./utility
8199
cd ../..
82100
make openLLC-test-l2l3l2 run THREADS_BUILD=4 CXX_COMPILER=clang++-17
83101
rm -rf run/*.vcd run/*.fst run/*.log run/*.db

src/main/scala/coupledL2/BaseSlice.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,17 @@ abstract class BaseSliceIO[T_OUT <: BaseOuterBundle](implicit p: Parameters) ext
3434
val matrixDataOut = DecoupledIO(new MatrixDataBundle())
3535
val l1Hint = DecoupledIO(new L2ToL1Hint())
3636
val prefetch = prefetchOpt.map(_ => Flipped(new PrefetchIO))
37-
// val msStatus = topDownOpt.map(_ => Vec(mshrsAll, ValidIO(new MSHRStatus)))
3837
val dirResult = topDownOpt.map(_ => ValidIO(new DirResult))
39-
val latePF = topDownOpt.map(_ => ValidIO(UInt(PfSource.pfSourceBits.W)))
38+
val hitPfInMSHR = topDownOpt.map(_ => ValidIO(UInt(PfSource.pfSourceBits.W)))
39+
val pfSent = topDownOpt.map(_ => ValidIO(UInt(MemReqSource.reqSourceBits.W)))
40+
val pfLateInMSHR = topDownOpt.map(_ => ValidIO((UInt(MemReqSource.reqSourceBits.W))))
4041
val error = DecoupledIO(new L2CacheErrorInfo())
4142
val l2Miss = Output(Bool())
4243
val l2Flush = Option.when(cacheParams.enableL2Flush) (Input(Bool()))
4344
val l2FlushDone = Option.when(cacheParams.enableL2Flush) (Output(Bool()))
45+
// statistics
46+
val msStatus = topDownOpt.map(_ => Vec(mshrsAll, ValidIO(new MSHRStatus)))
47+
val msAlloc = topDownOpt.map(_ => Vec(mshrsAll, ValidIO(new MSHRAllocStatus)))
4448
}
4549

4650
abstract class BaseSlice[T_OUT <: BaseOuterBundle](implicit p: Parameters) extends L2Module with HasPerfEvents {

src/main/scala/coupledL2/Common.scala

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,48 @@ class PipeEntranceStatus(implicit p: Parameters) extends L2Bundle {
225225
def g_set = sets(3)
226226
}
227227

228+
/* MSHR info */
229+
230+
// MSHR exposes signals about allocation to Topdown
231+
class MSHRAllocStatus()(implicit p: Parameters) extends L2Bundle with HasTLChannelBits{
232+
val is_miss = Bool()
233+
val is_prefetch = Bool()
234+
}
235+
236+
// MSHR exposes signals to MSHRCtl and Topdown
237+
class MSHRStatus(implicit p: Parameters) extends L2Bundle
238+
with HasTLChannelBits
239+
with HasCHIChannelBits
240+
{
241+
val set = UInt(setBits.W)
242+
val reqTag = UInt(tagBits.W)
243+
val metaTag = UInt(tagBits.W)
244+
val expectProbeAck = Bool()
245+
val w_c_resp = Bool()
246+
val w_d_resp = Bool()
247+
val will_free = Bool()
248+
249+
/*
250+
val way = UInt(wayBits.W)
251+
val off = UInt(offsetBits.W)
252+
val opcode = UInt(3.W)
253+
val param = UInt(3.W)
254+
val size = UInt(msgSizeBits.W)
255+
val source = UInt(sourceIdBits.W)
256+
val alias = aliasBitsOpt.map(_ => UInt(aliasBitsOpt.get.W))
257+
val aliasTask = aliasBitsOpt.map(_ => Bool())
258+
val needProbeAckData = Bool() // only for B reqs
259+
val fromL2pft = prefetchOpt.map(_ => Bool())
260+
val needHint = prefetchOpt.map(_ => Bool())
261+
*/
262+
263+
// for TopDown usage
264+
val reqSource = UInt(MemReqSource.reqSourceBits.W)
265+
val is_miss = Bool()
266+
val is_prefetch = Bool()
267+
268+
}
269+
228270
// MSHR Task that MainPipe sends to MSHRCtl
229271
class MSHRRequest(implicit p: Parameters) extends L2Bundle {
230272
val dirResult = new DirResult()

src/main/scala/coupledL2/CoupledL2.scala

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ trait HasCoupledL2Parameters {
3939
val p: Parameters
4040
// val tl2tlParams: HasTLL2Parameters = p(L2ParamKey)
4141
def enableCHI = p(EnableCHI)
42+
def enableClockGate = p(EnableL2ClockGate)
4243
def cacheParams = p(L2ParamKey)
43-
def EnablePrivateClint = cacheParams.EnablePrivateClint
44+
def PrivateClintRange = cacheParams.PrivateClintRange
4445

4546
def XLEN = 64
4647
def blocks = cacheParams.sets * cacheParams.ways
@@ -574,18 +575,13 @@ abstract class CoupledL2Base(implicit p: Parameters) extends LazyModule with Has
574575
})))
575576
topDown match {
576577
case Some(t) =>
577-
t.io.msStatus.zip(slices).foreach {
578-
case (in, s) =>
579-
s match {
580-
case slice: tl2tl.Slice => in := slice.io_msStatus.get
581-
case slice: tl2chi.Slice => in := slice.io_msStatus.get
582-
}
583-
}
584-
t.io.dirResult.zip(slices).foreach {
585-
case (res, s) => res := s.io.dirResult.get
586-
}
587-
t.io.latePF.zip(slices).foreach {
588-
case (in, s) => in := s.io.latePF.get
578+
for ((s, i) <- slices.zipWithIndex) {
579+
t.io.msStatus(i) := s.io.msStatus.get
580+
t.io.msAlloc(i) := s.io.msAlloc.get
581+
t.io.dirResult(i) := s.io.dirResult.get
582+
t.io.hitPfInMSHR(i) := s.io.hitPfInMSHR.get
583+
t.io.pfLateInMSHR(i) := s.io.pfLateInMSHR.get
584+
t.io.pfSent(i) := s.io.pfSent.get
589585
}
590586
t.io.debugTopDown <> io.debugTopDown
591587
case None => io.debugTopDown.l2MissMatch := false.B

src/main/scala/coupledL2/DataStorage.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ class DataStorage(implicit p: Parameters) extends L2Module {
7575
readMCP2 = true,
7676
hasMbist = p(L2ParamKey).hasMbist,
7777
hasSramCtl = p(L2ParamKey).hasSramCtl,
78-
extraHold = true
78+
extraHold = true,
79+
withClockGate = true
7980
))
8081
array.io_en := io.en
8182
private val mbistPl = MbistPipeline.PlaceMbistPipeline(1, "L2DataStorage", p(L2ParamKey).hasMbist)

src/main/scala/coupledL2/L2Param.scala

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@ package coupledL2
1919

2020
import chisel3._
2121
import chisel3.util.log2Ceil
22-
import freechips.rocketchip.diplomacy.{BufferParams, AddressSet}
22+
import freechips.rocketchip.diplomacy.{AddressSet, BufferParams}
2323
import freechips.rocketchip.tilelink._
2424
import freechips.rocketchip.util._
2525
import org.chipsalliance.cde.config.Field
2626
import huancun.{AliasKey, CacheParameters, IsHitKey, PrefetchKey}
2727
import coupledL2.prefetch._
28-
import utility.{MemReqSource, ReqSourceKey, Code}
28+
import utility.{Code, MemReqSource, ReqSourceKey}
2929

3030
case object EnableCHI extends Field[Boolean](false)
31+
case object EnableL2ClockGate extends Field[Boolean](true)
3132

3233
// L1 Cache Params, used for TestTop generation
3334
case class L1Param
@@ -91,7 +92,7 @@ case class L2Param(
9192
* 2 for all except prefetch & !accessed
9293
* 3 for all
9394
*/
94-
mmioBridgeSize: Int = 8,
95+
mmioBridgeSize: Int = 16,
9596

9697
// Client
9798
echoField: Seq[BundleFieldBase] = Nil,
@@ -115,6 +116,8 @@ case class L2Param(
115116
prefetch: Seq[PrefetchParameters] = Nil,
116117
// L2 Flush
117118
enableL2Flush: Boolean = false,
119+
// AsyncBridge
120+
enableCHIAsyncBridge: Option[Boolean] = None,
118121
// Performance analysis
119122
enablePerf: Boolean = true,
120123
// RollingDB
@@ -147,8 +150,8 @@ case class L2Param(
147150
hasMbist: Boolean = false,
148151
hasSramCtl: Boolean = false,
149152

150-
// Enable new clint
151-
EnablePrivateClint: Boolean = false
153+
// both EnablePrivateClint and PrivateClintRange are from soc parameters.
154+
PrivateClintRange: Option[AddressSet] = None
152155
) {
153156
def toCacheParams: CacheParameters = CacheParameters(
154157
name = name,

src/main/scala/coupledL2/RequestBuffer.scala

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ class RequestBuffer(flow: Boolean = true, entries: Int = 4)(implicit p: Paramete
8787
val set = UInt(setBits.W)
8888
}))
8989

90-
val hasLatePF = ValidIO(UInt(PfSource.pfSourceBits.W))
90+
val hasHitPfInMSHR = ValidIO(UInt(PfSource.pfSourceBits.W))
91+
val hasPfLateInMSHR = ValidIO(UInt(MemReqSource.reqSourceBits.W))
9192
val hasMergeA = Output(Bool())
9293
})
9394

@@ -177,10 +178,6 @@ class RequestBuffer(flow: Boolean = true, entries: Int = 4)(implicit p: Paramete
177178
val canFlow =flow.B && !full && !conflict(in) && !chosenQValid && !Cat(io.mainPipeBlock).orR && !noFreeWay(in)
178179

179180
val doFlow = canFlow && io.out.ready
180-
val latePrefetchRes = latePrefetch(in)
181-
io.hasLatePF.valid := latePrefetchRes._1 && io.in.valid && !sameAddr(in, RegNext(in))
182-
io.hasLatePF.bits := latePrefetchRes._2
183-
io.hasMergeA := mergeA && io.in.valid && !sameAddr(in, RegNext(in))
184181

185182
// val depMask = buffer.map(e => e.valid && sameAddr(io.in.bits, e.task))
186183
// remove duplicate prefetch if same-addr A req in MSHR or ReqBuf
@@ -194,6 +191,14 @@ class RequestBuffer(flow: Boolean = true, entries: Int = 4)(implicit p: Paramete
194191
).asUInt
195192
val dup = isPrefetch && dupMask.orR
196193

194+
// statistics io
195+
val latePrefetchRes = latePrefetch(in)
196+
io.hasHitPfInMSHR.valid := latePrefetchRes._1 && io.in.valid && !sameAddr(in, RegNext(in))
197+
io.hasHitPfInMSHR.bits := latePrefetchRes._2
198+
io.hasPfLateInMSHR.valid := io.in.valid && dup
199+
io.hasPfLateInMSHR.bits := io.in.bits.reqSource
200+
io.hasMergeA := mergeA && io.in.valid && !sameAddr(in, RegNext(in))
201+
197202
//!! TODO: we can also remove those that duplicate with mainPipe
198203

199204
/* ======== Alloc ======== */

0 commit comments

Comments
 (0)