Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
767cb2a
refactor: CoupledL2
Yan-Yiming Mar 31, 2026
35c4fc0
feat(OpenLLC): initial module, channels, and parameters
Ivyfeather May 23, 2024
580b742
feat(OpenLLC): add TL-test framework and CHI downstream interface
sumailyyc Jun 5, 2024
36773db
feat(DummyLLC): initial implementation with TestTop
linjuanZ Jun 17, 2024
e0dfe5e
feat(OpenLLC): implement DataStorage, Directory, and data paths
sumailyyc Jun 20, 2024
d20e727
DummyLLC: set `aligned` to true in AXI4MasterParameters and add ReadN…
linjuanZ Jul 1, 2024
6b009dd
bump utility (OpenXiangShan/OpenLLC#3)
Tang-Haojin Jul 11, 2024
1480547
feat(OpenLLC): implement core modules (MainPipe, ResponseUnit, SnoopU…
sumailyyc Jul 3, 2024
d24b837
feat(OpenLLC): add CHI Issue E.b/B parameter support and display info
Kumonda221-CrO3 Jul 29, 2024
fc54c56
Opcode: use trait to inherit opcode width from `HasCHIMsgParameters` …
linjuanZ Aug 1, 2024
219476c
fix(DummyLLC): fix memory write-back behavior
linjuanZ Aug 1, 2024
9786653
DummyLLC: add system coherency interface (OpenXiangShan/OpenLLC#10)
linjuanZ Aug 9, 2024
9e869fa
OpenLLC: add CMO support and fix bug (OpenXiangShan/OpenLLC#11)
sumailyyc Aug 11, 2024
8df3c17
feat(OpenLLC): integrate OpenNCB, organize code structure, and add API
sumailyyc Aug 19, 2024
1888e2c
chore(TestTop): replace DummyLLC with OpenLLC + OpenNCB in TestTopSoC…
sumailyyc Oct 25, 2024
42a362b
chore(TestTop): set default CHI version to Issue E.b (OpenXiangShan/O…
Kumonda221-CrO3 Dec 2, 2024
f3f40db
feat(DataCheck): support dummy DataCheck and Poison (OpenXiangShan/Op…
Kumonda221-CrO3 Dec 4, 2024
0c2c1a0
feat(OpenLLC): add support for WriteCleanFull transaction (OpenXiangS…
sumailyyc Dec 9, 2024
82346e2
feat(OpenLLC): add support for ReadNoSnp transaction (OpenXiangShan/O…
sumailyyc Dec 16, 2024
d00b260
Revert "feat(OpenLLC): add support for ReadNoSnp transaction (OpenXia…
sumailyyc Dec 17, 2024
5bfe039
fix(CMO): fix bug where CleanShared prematurely responded before comp…
sumailyyc Dec 19, 2024
100e3b1
feat: add handling for non-cache requests (OpenXiangShan/OpenLLC#28)
sumailyyc Dec 20, 2024
fd087cb
feat(OpenLLC): add topDownMonitor (OpenXiangShan/OpenLLC#29)
sumailyyc Dec 29, 2024
ca77987
feat(MainPipe, ResponseUnit): support WriteEvictOrEvict transaction (…
sumailyyc Jan 7, 2025
5c1b673
style: more robust issue isolation (OpenXiangShan/OpenLLC#31)
linjuanZ Jan 8, 2025
686e595
feat(TopDown): add l3Miss IO for Top-Down (OpenXiangShan/OpenLLC#32)
sinceforYy Jan 8, 2025
2d2a509
fix(RefillUnit): modify cancel condition for refillEntry (OpenXiangSh…
sumailyyc Jan 10, 2025
2cccfb5
feat: add Issue C (OpenXiangShan/OpenLLC#35)
linjuanZ Jan 15, 2025
a65a8e3
fix(L2PF): add prefetch control from core (OpenXiangShan/OpenLLC#37)
Maxpicca-Li Jan 16, 2025
0144604
fix(Common): fix DataCheck assign (OpenXiangShan/OpenLLC#39)
Ma-YX Jan 18, 2025
b45aeb5
fix(Common): fix Poison assign (OpenXiangShan/OpenLLC#40)
Ma-YX Jan 18, 2025
2ae20e7
chore(OpenNCB): enable DataCheck and Poison by default
linjuanZ Jan 20, 2025
98c4fa7
feat(TestTop): support DataCheck and Poison parameterization (OpenXia…
Kumonda221-CrO3 Jan 20, 2025
fb4aec8
feat(TestTop): enable TL-UL ports (OpenXiangShan/OpenLLC#45)
Kumonda221-CrO3 Jan 21, 2025
e4c04cb
fix(PPA): Remove dontTouch in top module of OpenLLC (OpenXiangShan/Op…
good-circle Jan 25, 2025
86044b3
submodule(OpenNCB): support Issue C (OpenXiangShan/OpenLLC#47)
Kumonda221-CrO3 Feb 17, 2025
a1eb448
build: bump to chisel 6 and fix deprecation warning (OpenXiangShan/Op…
Tang-Haojin Feb 20, 2025
07feee0
feat(TestTop): embedded CHIron CLogB CHI loggers (OpenXiangShan/OpenL…
Kumonda221-CrO3 Apr 9, 2025
e7992a3
chore(TestTop): expose AXI port for Memory Backend (OpenXiangShan/Ope…
Kumonda221-CrO3 Apr 10, 2025
69e5b99
feat(LLCParam): fix `parseAddress` in case PAddrBits > CHI Addr width…
linjuanZ Apr 22, 2025
5e52429
feat(TestTop): world time passing IO for CLog.B recording (OpenXiangS…
Kumonda221-CrO3 Apr 24, 2025
7420c40
chore(LinkLayer): comment out effectless assignments (OpenXiangShan/O…
Tang-Haojin Sep 22, 2025
0e66b6b
chore(TestTop): disable layered generation for assertions (OpenXiangS…
Kumonda221-CrO3 Nov 28, 2025
21eae7c
feat(TestTop): export L2ToL1HInt port (OpenXiangShan/OpenLLC#72)
Kumonda221-CrO3 Nov 28, 2025
7389a8e
feat(TestTop): performance counter printing (OpenXiangShan/OpenLLC#73)
Kumonda221-CrO3 Dec 10, 2025
c371a59
fix(TestTop): add missing PerfCounterOptionsKey parameter (OpenXiangS…
Yan-Yiming Mar 17, 2026
8392893
refactor: OpenLLC
Yan-Yiming Mar 31, 2026
9ad2a6f
build: add openLLC support in Makefile, build.sc, common.sc
Yan-Yiming Mar 25, 2026
ecfd420
build: split openllc & coupledl2's .sv in build
Yan-Yiming Apr 1, 2026
46b4667
refactor: revert utility CHI
Yan-Yiming Apr 9, 2026
7fc302e
chore: update workflow
Yan-Yiming Apr 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,25 +80,20 @@ jobs:
# run: make checkformat

- name: Compile
run: make compile
run: make compile-coupledl2

# Clean artifacts folder (./tl-test-new/run) after successful run
- name: Unit test for CHI version
run: |
rm -rf tl-test-new
git clone https://github.com/OpenXiangShan/tl-test-new
git clone -b l2-llc-merge-0409 https://github.com/OpenXiangShan/tl-test-new
cd ./tl-test-new
sed -i 's/ari.target.*/ari.target = 240/g' ./configs/user.tltest.ini
sed -i 's/cmo.enable .*=.*/cmo.enable = 1/g' ./configs/user.tltest.ini
sed -i 's/cmo.enable.cbo.clean.*=.*/cmo.enable.cbo.clean = 1/g' ./configs/user.tltest.ini
sed -i 's/cmo.enable.cbo.flush.*=.*/cmo.enable.cbo.flush = 1/g' ./configs/user.tltest.ini
sed -i 's/cmo.enable.cbo.inval.*=.*/cmo.enable.cbo.inval = 1/g' ./configs/user.tltest.ini
cd ./dut
git clone https://github.com/OpenXiangShan/OpenLLC
cd OpenLLC && make init
rm -rf ./coupledL2 && ln -s ../../.. ./coupledL2
rm -rf ./utility && ln -s ../../../utility ./utility
cd ../..
rm -rf ./dut/CoupledL2 && ln -s ../.. ./dut/CoupledL2
make openLLC-test-l2l3l2 run THREADS_BUILD=4 CXX_COMPILER=clang++-17
rm -rf run/*.vcd run/*.fst run/*.log run/*.db

Expand All @@ -112,7 +107,7 @@ jobs:
- name: Unit Test for TileLink version
run: |
rm -rf tl-test-new
git clone https://github.com/OpenXiangShan/tl-test-new
git clone -b l2-llc-merge-0409 https://github.com/OpenXiangShan/tl-test-new
cd ./tl-test-new
sed -i 's/ari.target.*/ari.target = 240/g' ./configs/user.tltest.ini
rm -rf ./dut/CoupledL2 && ln -s ../.. ./dut/CoupledL2
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
[submodule "HuanCun"]
path = HuanCun
url = https://github.com/OpenXiangShan/HuanCun.git
[submodule "OpenNCB"]
path = OpenNCB
url = https://github.com/OpenXiangShan/OpenNCB.git
File renamed without changes.
36 changes: 25 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ init:
git submodule update --init
cd rocket-chip && git submodule update --init hardfloat cde

compile:
compile-coupledl2:
mill -i CoupledL2.compile

compile-openllc:
mill -i OpenLLC.compile

CHI_PASS_ARGS = ISSUE=$(ISSUE) NUM_CORE=$(NUM_CORE) NUM_TL_UL=$(NUM_TL_UL) NUM_SLICE=$(NUM_SLICE) \
WITH_CHISELDB=$(WITH_CHISELDB) WITH_TLLOG=$(WITH_TLLOG) WITH_CHILOG=$(WITH_CHILOG) \
BY_ETIME=$(BY_ETIME) BY_VTIME=$(BY_VTIME) \
Expand All @@ -26,32 +29,34 @@ CHI_TOP_ARGS = --issue $(ISSUE) --core $(NUM_CORE) --tl-ul $(NUM_TL_UL) --bank $
--chiseldb $(WITH_CHISELDB) --tllog $(WITH_TLLOG) --chilog $(WITH_CHILOG) \
--etime $(BY_ETIME) --vtime $(BY_VTIME) \
--fpga $(FPGA)
BUILD_DIR = ./build
TOP_V = $(BUILD_DIR)/$(TOP).sv
BUILD_DIR_L2 = ./build/coupledl2
BUILD_DIR_LLC = ./build/openllc
TOP_V_L2 = $(BUILD_DIR_L2)/$(TOP).sv
TOP_V_LLC = $(BUILD_DIR_LLC)/$(TOP).sv
MEM_GEN = ./scripts/vlsi_mem_gen
MEM_GEN_SEP = ./scripts/gen_sep_mem.sh

gen-test-top:
mill -i CoupledL2.test.runMain coupledL2.$(TOP)_$(SYSTEM) -td $(BUILD_DIR) --target systemverilog --split-verilog
$(MEM_GEN_SEP) "$(MEM_GEN)" "$(TOP_V).conf" "$(BUILD_DIR)"
mill -i CoupledL2.test.runMain coupledL2.$(TOP)_$(SYSTEM) -td $(BUILD_DIR_L2) --target systemverilog --split-verilog
$(MEM_GEN_SEP) "$(MEM_GEN)" "$(TOP_V_L2).conf" "$(BUILD_DIR_L2)"

gen-test-top-chi:
mill -i CoupledL2.test.runMain coupledL2.$(TOP)_$(SYSTEM) -td $(BUILD_DIR) $(CHI_TOP_ARGS) --target systemverilog --split-verilog
$(MEM_GEN_SEP) "$(MEM_GEN)" "$(TOP_V).conf" "$(BUILD_DIR)"
mill -i CoupledL2.test.runMain coupledL2.$(TOP)_$(SYSTEM) -td $(BUILD_DIR_L2) $(CHI_TOP_ARGS) --target systemverilog --split-verilog
$(MEM_GEN_SEP) "$(MEM_GEN)" "$(TOP_V_L2).conf" "$(BUILD_DIR_L2)"

test-top-l2:
$(MAKE) gen-test-top SYSTEM=L2

test-top-l2standalone:
$(MAKE) gen-test-top SYSTEM=L2_Standalone

test-top-l2l3:
test-top-l2l3-huancun:
$(MAKE) gen-test-top SYSTEM=L2L3

test-top-l2l3l2:
test-top-l2l3l2-huancun:
$(MAKE) gen-test-top SYSTEM=L2L3L2

test-top-fullsys:
test-top-fullsys-huancun:
$(MAKE) gen-test-top SYSTEM=fullSys

test-top-chi:
Expand All @@ -69,6 +74,15 @@ test-top-chi-quadcore-0ul:
test-top-chi-quadcore-2ul:
$(MAKE) gen-test-top-chi SYSTEM=CHIL2 $(CHI_PASS_ARGS) NUM_CORE=4 NUM_TL_UL=2

test-top-l3-openllc:
mill -i OpenLLC.test.runMain openLLC.TestTop_L3 -td build --target systemverilog --split-verilog

test-top-l2l3-openllc:
mill -i OpenLLC.test.runMain openLLC.TestTopSoC_SingleCore -td $(BUILD_DIR_LLC) --target systemverilog --split-verilog

test-top-l2l3l2-openllc:
mill -i OpenLLC.test.runMain openLLC.TestTopSoC_DualCore -td $(BUILD_DIR_LLC) --target systemverilog --split-verilog

clean:
rm -rf ./build

Expand All @@ -84,4 +98,4 @@ reformat:
checkformat:
mill -i __.checkFormat

.PHONY: init bsp checkformat clean compile idea reformat
.PHONY: init bsp checkformat clean compile-coupledl2 compile-openllc idea reformat
205 changes: 205 additions & 0 deletions OpenLLC/src/main/scala/openLLC/Common.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
/** *************************************************************************************
* Copyright (c) 2020-2021 Institute of Computing Technology, Chinese Academy of Sciences
* Copyright (c) 2020-2021 Peng Cheng Laboratory
*
* XiangShan is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
*
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
*
* See the Mulan PSL v2 for more details.
* *************************************************************************************
*/

package openLLC

import chisel3._
import chisel3.util._
import org.chipsalliance.cde.config.Parameters
import coupledL2.tl2chi._

abstract class LLCModule(implicit val p: Parameters) extends Module
with HasOpenLLCParameters
with HasCHIMsgParameters
abstract class LLCBundle(implicit val p: Parameters) extends Bundle
with HasOpenLLCParameters
with HasCHIMsgParameters

class ReplacerInfo(implicit p: Parameters) extends LLCBundle {
val opcode = UInt(REQ_OPCODE_WIDTH.W)
val refill = Bool()
}

class Task(implicit p: Parameters) extends LLCBundle {
val set = UInt(setBits.W)
val bank = UInt(bankBits.W)
val tag = UInt(tagBits.W)
val off = UInt(offsetBits.W)
val size = UInt(SIZE_WIDTH.W)

// Refill task
val refillTask = Bool() // is task from RefillUnit
val bufID = UInt(log2Ceil(mshrs.refill).W)

// Identify the transaction from LLC
val reqID = UInt(TXNID_WIDTH.W)

// Snoop Info
val replSnp = Bool() // indicates whether the snoop is caused by a replacement
val snpVec = Vec(numRNs, Bool())

// CHI
val tgtID = UInt(TGTID_WIDTH.W)
val srcID = UInt(SRCID_WIDTH.W)
val txnID = UInt(TXNID_WIDTH.W)
val homeNID = UInt(SRCID_WIDTH.W) // TODO: required?
val dbID = UInt(DBID_WIDTH.W)
val fwdNID = UInt(FWDNID_WIDTH.W)
val fwdTxnID = UInt(FWDTXNID_WIDTH.W)
val chiOpcode = UInt(OPCODE_WIDTH.W)
val resp = UInt(RESP_WIDTH.W)
val fwdState = UInt(FWDSTATE_WIDTH.W)
val pCrdType = UInt(PCRDTYPE_WIDTH.W)
val retToSrc = Bool() // only used in snoop
val doNotGoToSD = Bool() // only used in snoop
val expCompAck = Bool()
val allowRetry = Bool()
val order = UInt(ORDER_WIDTH.W)
val memAttr = new MemAttr
val snpAttr = Bool()

def toCHIREQBundle(): CHIREQ = {
val req = WireInit(0.U.asTypeOf(new CHIREQ()))
req.tgtID := tgtID
req.srcID := srcID
req.txnID := txnID
req.opcode := chiOpcode
req.size := size
req.addr := Cat(tag, set, bank, 0.U(offsetBits.W))
req.allowRetry := allowRetry //TODO: consider retry
req.pCrdType := pCrdType
req.expCompAck := expCompAck
req.memAttr := memAttr
req.snpAttr := snpAttr
req.order := order
req
}

def toCHISNPBundle(): CHISNP = {
val snp = WireInit(0.U.asTypeOf(new CHISNP()))
snp.srcID := srcID
snp.txnID := txnID
snp.fwdNID := fwdNID
snp.fwdTxnID := fwdTxnID
snp.opcode := chiOpcode
snp.addr := Cat(tag, set, bank, 0.U(offsetBits.W)) >> 3 // SNP channel: Addr[(MPA-1):3]
snp.doNotGoToSD := doNotGoToSD
snp.retToSrc := retToSrc
snp
}

def toCHIRSPBundle(): CHIRSP = {
val rsp = WireInit(0.U.asTypeOf(new CHIRSP()))
rsp.tgtID := tgtID
rsp.srcID := srcID
rsp.txnID := txnID
rsp.opcode := chiOpcode
rsp.resp := resp
rsp.dbID := dbID
rsp.pCrdType := pCrdType
rsp.fwdState := fwdState
rsp
}

}

class TaskWithData(implicit p: Parameters) extends LLCBundle {
val task = new Task()
val data = new DSBlock()

def toCHIDATBundle(beatId: Int): CHIDAT = {
val dat = WireInit(0.U.asTypeOf(new CHIDAT()))
dat.tgtID := task.tgtID
dat.srcID := task.srcID
dat.txnID := task.txnID
dat.homeNID := task.homeNID
dat.setFwdState(task.fwdState)
dat.opcode := task.chiOpcode
dat.resp := task.resp
dat.dbID := task.dbID
dat.be := Fill(BE_WIDTH, true.B)
dat.data := data.data(beatId).data
dat.dataID := (beatBytes * beatId * 8).U(log2Ceil(blockBytes * 8) - 1, log2Ceil(blockBytes * 8) - 2)
dat.dataCheck match {
case Some(x) =>
x := VecInit((0 until DATACHECK_WIDTH).map(i => data.data(beatId).data(8 * (i + 1) - 1, 8 * i).xorR ^ true.B)).asUInt
case None =>
}
dat.poison match {
case Some(x) =>
x := 0.U
case None =>
}
dat
}
}

class Resp(implicit p: Parameters) extends LLCBundle {
val txnID = UInt(TXNID_WIDTH.W)
val dbID = UInt(DBID_WIDTH.W)
val opcode = UInt(OPCODE_WIDTH.W)
val resp = UInt(RESP_WIDTH.W)
val srcID = UInt(SRCID_WIDTH.W)
}

class RespWithData(implicit p: Parameters) extends Resp {
val dataID = UInt(DATAID_WIDTH.W)
val data = new DSBeat()
}

class TaskEntry(implicit p: Parameters) extends LLCBundle {
val valid = Bool()
val task = new Task()
}

class PipeStatus(implicit p: Parameters) extends LLCBundle {
val tags = Vec(5, UInt(tagBits.W))
val sets = Vec(5, UInt(setBits.W))
val reqIDs = Vec(5, UInt(TXNID_WIDTH.W))
val valids = Vec(5, Bool())

def s2_tag = tags(0)
def s3_tag = tags(1)
def s4_tag = tags(2)
def s5_tag = tags(3)
def s6_tag = tags(4)

def s2_set = sets(0)
def s3_set = sets(1)
def s4_set = sets(2)
def s5_set = sets(3)
def s6_set = sets(4)

def s2_reqID = reqIDs(0)
def s3_reqID = reqIDs(1)
def s4_reqID = reqIDs(2)
def s5_reqID = reqIDs(3)
def s6_reqID = reqIDs(4)

def s2_valid = valids(0)
def s3_valid = valids(1)
def s4_valid = valids(2)
def s5_valid = valids(3)
def s6_valid = valids(4)
}

class BlockInfo(implicit p: Parameters) extends LLCBundle {
val set = UInt(setBits.W)
val tag = UInt(tagBits.W)
val opcode = UInt(REQ_OPCODE_WIDTH.W)
val reqID = UInt(TXNID_WIDTH.W)
}
Loading
Loading