Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Svpbmt): support WMO memory access and outstanding of NC #3900

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
34ada85
feat(LDU): add support for NC in LoadUnit
Maxpicca-Li Sep 3, 2024
5f270a8
feat(LQ,UB): add support for NC in load queue and uncache buffer
Maxpicca-Li Sep 5, 2024
4c1e0dd
feat(SQ,STU): add support for NC in store queue and storeunit
Maxpicca-Li Sep 17, 2024
60b230b
fix(PBMT): skip nc difftest and handle the conflict of nc and normal …
Maxpicca-Li Oct 10, 2024
6a7f018
fix(PBMT): nc st req is changed to a state machine execution
Maxpicca-Li Oct 14, 2024
41e1e86
fix(pbmt): fix typo and control error of nc ld
Maxpicca-Li Oct 15, 2024
ac5a3e4
fix(pbmt): nc data assignment error
Maxpicca-Li Oct 16, 2024
9952e4e
fix(pbmt): nc should be used to wakeup
Maxpicca-Li Oct 16, 2024
f231f4c
fix(pbmt): remove wrong assert
Maxpicca-Li Oct 17, 2024
eb57f0a
fix(pbmt): lots of bugs of nc st ld forward
Maxpicca-Li Oct 21, 2024
17d34ea
fix(pbmt): fix address align error
Maxpicca-Li Oct 23, 2024
2733352
chore(pbmt): add xsperf for nc ld statistic
Maxpicca-Li Oct 23, 2024
a10d648
feat(uncache): change queue to buffer to prepare for outstanding
Maxpicca-Li Nov 14, 2024
b16ca24
feat(uncache): optimize the buffer's pipeline to align with original …
Maxpicca-Li Nov 14, 2024
92af09c
feat(outstanding): support nc outstanding and remove mmio st outstanding
Maxpicca-Li Nov 19, 2024
188cce9
fix(uncache): delay flush until receiving uncache resp when state is …
Maxpicca-Li Nov 22, 2024
fce0f48
style(pbmt): remove some useless code and comments
Maxpicca-Li Nov 22, 2024
8719682
fix(uncache): not alloc and ready when existing same address entry
Maxpicca-Li Nov 22, 2024
c2d97df
perf(uncache): mmio and nc share LQUncache; nc data writeback to ldu …
Maxpicca-Li Nov 27, 2024
58f297f
style(pbmt): remove outstanding constant which is just for self-test
Maxpicca-Li Nov 27, 2024
73f086b
timing(uncache): match paddr in f1 during ubuffer forwarding
Maxpicca-Li Nov 27, 2024
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
3 changes: 3 additions & 0 deletions src/main/scala/xiangshan/Bundle.scala
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,12 @@ class ResetPregStateReq(implicit p: Parameters) extends XSBundle {

class DebugBundle(implicit p: Parameters) extends XSBundle {
val isMMIO = Bool()
val isNC = Bool()
val isPerfCnt = Bool()
val paddr = UInt(PAddrBits.W)
val vaddr = UInt(VAddrBits.W)

def isSkipDiff: Bool = isMMIO || isNC || isPerfCnt
/* add L/S inst info in EXU */
// val L1toL2TlbLatency = UInt(XLEN.W)
// val levelTlbHit = UInt(2.W)
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/xiangshan/XSCore.scala
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class XSCoreImp(outer: XSCoreBase) extends LazyModuleImp(outer)
memBlock.io.ooo_to_mem.tlbCsr := backend.io.mem.tlbCsr
memBlock.io.ooo_to_mem.lsqio.lcommit := backend.io.mem.robLsqIO.lcommit
memBlock.io.ooo_to_mem.lsqio.scommit := backend.io.mem.robLsqIO.scommit
memBlock.io.ooo_to_mem.lsqio.pendingUncacheld := backend.io.mem.robLsqIO.pendingUncacheld
memBlock.io.ooo_to_mem.lsqio.pendingMMIOld := backend.io.mem.robLsqIO.pendingMMIOld
memBlock.io.ooo_to_mem.lsqio.pendingld := backend.io.mem.robLsqIO.pendingld
memBlock.io.ooo_to_mem.lsqio.pendingst := backend.io.mem.robLsqIO.pendingst
memBlock.io.ooo_to_mem.lsqio.pendingVst := backend.io.mem.robLsqIO.pendingVst
Expand Down
18 changes: 11 additions & 7 deletions src/main/scala/xiangshan/backend/MemBlock.scala
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class ooo_to_mem(implicit p: Parameters) extends MemBlockBundle {
val lsqio = new Bundle {
val lcommit = Input(UInt(log2Up(CommitWidth + 1).W))
val scommit = Input(UInt(log2Up(CommitWidth + 1).W))
val pendingUncacheld = Input(Bool())
val pendingMMIOld = Input(Bool())
val pendingld = Input(Bool())
val pendingst = Input(Bool())
val pendingVst = Input(Bool())
Expand Down Expand Up @@ -823,6 +823,7 @@ class MemBlockInlinedImp(outer: MemBlockInlined) extends LazyModuleImp(outer)
// forward
loadUnits(i).io.lsq.forward <> lsq.io.forward(i)
loadUnits(i).io.sbuffer <> sbuffer.io.forward(i)
loadUnits(i).io.ubuffer <> uncache.io.forward(i)
loadUnits(i).io.tl_d_channel := dcache.io.lsu.forward_D(i)
loadUnits(i).io.forward_mshr <> dcache.io.lsu.forward_mshr(i)
// ld-ld violation check
Expand Down Expand Up @@ -908,6 +909,7 @@ class MemBlockInlinedImp(outer: MemBlockInlined) extends LazyModuleImp(outer)
loadUnits(i).io.lsq.uncache.bits := DontCare
}
lsq.io.ld_raw_data(i) <> loadUnits(i).io.lsq.ld_raw_data
lsq.io.ncOut(i) <> loadUnits(i).io.lsq.nc_ldin
lsq.io.l2_hint.valid := l2_hint.valid
lsq.io.l2_hint.bits.sourceId := l2_hint.bits.sourceId
lsq.io.l2_hint.bits.isKeyword := l2_hint.bits.isKeyword
Expand Down Expand Up @@ -965,6 +967,7 @@ class MemBlockInlinedImp(outer: MemBlockInlined) extends LazyModuleImp(outer)
hybridUnits(i).io.ldu_io.lsq.forward <> lsq.io.forward(LduCnt + i)
// forward
hybridUnits(i).io.ldu_io.sbuffer <> sbuffer.io.forward(LduCnt + i)
hybridUnits(i).io.ldu_io.ubuffer <> uncache.io.forward(LduCnt + i)
// hybridUnits(i).io.ldu_io.vec_forward <> vsFlowQueue.io.forward(LduCnt + i)
hybridUnits(i).io.ldu_io.vec_forward := DontCare
hybridUnits(i).io.ldu_io.tl_d_channel := dcache.io.lsu.forward_D(LduCnt + i)
Expand Down Expand Up @@ -1038,6 +1041,8 @@ class MemBlockInlinedImp(outer: MemBlockInlined) extends LazyModuleImp(outer)


// passdown to lsq (load s2)
hybridUnits(i).io.ldu_io.lsq.nc_ldin.valid := false.B
hybridUnits(i).io.ldu_io.lsq.nc_ldin.bits := DontCare
lsq.io.ldu.ldin(LduCnt + i) <> hybridUnits(i).io.ldu_io.lsq.ldin
// Lsq to sta unit
lsq.io.sta.storeMaskIn(StaCnt + i) <> hybridUnits(i).io.stu_io.st_mask_out
Expand Down Expand Up @@ -1077,7 +1082,7 @@ class MemBlockInlinedImp(outer: MemBlockInlined) extends LazyModuleImp(outer)
loadMisalignBuffer.io.redirect <> redirect
loadMisalignBuffer.io.rob.lcommit := io.ooo_to_mem.lsqio.lcommit
loadMisalignBuffer.io.rob.scommit := io.ooo_to_mem.lsqio.scommit
loadMisalignBuffer.io.rob.pendingUncacheld := io.ooo_to_mem.lsqio.pendingUncacheld
loadMisalignBuffer.io.rob.pendingMMIOld := io.ooo_to_mem.lsqio.pendingMMIOld
loadMisalignBuffer.io.rob.pendingld := io.ooo_to_mem.lsqio.pendingld
loadMisalignBuffer.io.rob.pendingst := io.ooo_to_mem.lsqio.pendingst
loadMisalignBuffer.io.rob.pendingVst := io.ooo_to_mem.lsqio.pendingVst
Expand All @@ -1090,7 +1095,7 @@ class MemBlockInlinedImp(outer: MemBlockInlined) extends LazyModuleImp(outer)
storeMisalignBuffer.io.redirect <> redirect
storeMisalignBuffer.io.rob.lcommit := io.ooo_to_mem.lsqio.lcommit
storeMisalignBuffer.io.rob.scommit := io.ooo_to_mem.lsqio.scommit
storeMisalignBuffer.io.rob.pendingUncacheld := io.ooo_to_mem.lsqio.pendingUncacheld
storeMisalignBuffer.io.rob.pendingMMIOld := io.ooo_to_mem.lsqio.pendingMMIOld
storeMisalignBuffer.io.rob.pendingld := io.ooo_to_mem.lsqio.pendingld
storeMisalignBuffer.io.rob.pendingst := io.ooo_to_mem.lsqio.pendingst
storeMisalignBuffer.io.rob.pendingVst := io.ooo_to_mem.lsqio.pendingVst
Expand Down Expand Up @@ -1291,7 +1296,7 @@ class MemBlockInlinedImp(outer: MemBlockInlined) extends LazyModuleImp(outer)
io.mem_to_ooo.lsqio.uop := lsq.io.rob.uop
lsq.io.rob.lcommit := io.ooo_to_mem.lsqio.lcommit
lsq.io.rob.scommit := io.ooo_to_mem.lsqio.scommit
lsq.io.rob.pendingUncacheld := io.ooo_to_mem.lsqio.pendingUncacheld
lsq.io.rob.pendingMMIOld := io.ooo_to_mem.lsqio.pendingMMIOld
lsq.io.rob.pendingld := io.ooo_to_mem.lsqio.pendingld
lsq.io.rob.pendingst := io.ooo_to_mem.lsqio.pendingst
lsq.io.rob.pendingVst := io.ooo_to_mem.lsqio.pendingVst
Expand All @@ -1313,7 +1318,7 @@ class MemBlockInlinedImp(outer: MemBlockInlined) extends LazyModuleImp(outer)
)).andR))
resultOnehot
}
val allRedirect = loadUnits.map(_.io.rollback) ++ hybridUnits.map(_.io.ldu_io.rollback) ++ Seq(lsq.io.nack_rollback) ++ lsq.io.nuke_rollback
val allRedirect = loadUnits.map(_.io.rollback) ++ hybridUnits.map(_.io.ldu_io.rollback) ++ lsq.io.nack_rollback ++ lsq.io.nuke_rollback
val oldestOneHot = selectOldestRedirect(allRedirect)
val oldestRedirect = WireDefault(Mux1H(oldestOneHot, allRedirect))
// memory replay would not cause IAF/IPF/IGPF
Expand Down Expand Up @@ -1344,8 +1349,7 @@ class MemBlockInlinedImp(outer: MemBlockInlined) extends LazyModuleImp(outer)
is (s_idle) {
when (uncacheReq.fire) {
when (lsq.io.uncache.req.valid) {
val isStore = lsq.io.uncache.req.bits.cmd === MemoryOpConstants.M_XWR
when (!isStore || !io.ooo_to_mem.csrCtrl.uncache_write_outstanding_enable) {
when (!lsq.io.uncache.req.bits.nc || !io.ooo_to_mem.csrCtrl.uncache_write_outstanding_enable) {
uncacheState := s_scalar_uncache
}
}.otherwise {
Expand Down
6 changes: 3 additions & 3 deletions src/main/scala/xiangshan/backend/rob/Rob.scala
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ class RobImp(override val wrapper: Rob)(implicit p: Parameters, params: BackendP
XSInfo(true.B,
p"writebacked pc 0x${Hexadecimal(debug_Uop.pc)} wen ${debug_Uop.rfWen} " +
p"data 0x${Hexadecimal(wb.bits.data(0))} ldst ${debug_Uop.ldest} pdst ${debug_Uop.pdest} " +
p"skip ${wb.bits.debug.isMMIO} robIdx: ${wb.bits.robIdx}\n"
p"skip ${wb.bits.debug.isSkipDiff} robIdx: ${wb.bits.robIdx}\n"
)
}
}
Expand Down Expand Up @@ -799,7 +799,7 @@ class RobImp(override val wrapper: Rob)(implicit p: Parameters, params: BackendP
io.lsq.lcommit := RegNext(Mux(io.commits.isCommit, PopCount(ldCommitVec), 0.U))
io.lsq.scommit := RegNext(Mux(io.commits.isCommit, PopCount(stCommitVec), 0.U))
// indicate a pending load or store
io.lsq.pendingUncacheld := RegNext(io.commits.isCommit && io.commits.info(0).commitType === CommitType.LOAD && robEntries(deqPtr.value).valid && robEntries(deqPtr.value).mmio)
io.lsq.pendingMMIOld := RegNext(io.commits.isCommit && io.commits.info(0).commitType === CommitType.LOAD && robEntries(deqPtr.value).valid && robEntries(deqPtr.value).mmio)
io.lsq.pendingld := RegNext(io.commits.isCommit && io.commits.info(0).commitType === CommitType.LOAD && robEntries(deqPtr.value).valid)
// TODO: Check if need deassert pendingst when it is vst
io.lsq.pendingst := RegNext(io.commits.isCommit && io.commits.info(0).commitType === CommitType.STORE && robEntries(deqPtr.value).valid)
Expand Down Expand Up @@ -1436,7 +1436,7 @@ class RobImp(override val wrapper: Rob)(implicit p: Parameters, params: BackendP
val isRVC = dt_isRVC(ptr)

val difftest = DifftestModule(new DiffInstrCommit(MaxPhyRegs), delay = 3, dontCare = true)
val dt_skip = Mux(eliminatedMove, false.B, exuOut.isMMIO || exuOut.isPerfCnt)
val dt_skip = Mux(eliminatedMove, false.B, exuOut.isSkipDiff)
difftest.coreid := io.hartId
difftest.index := i.U
difftest.valid := io.commits.commitValid(i) && io.commits.isCommit
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/xiangshan/backend/rob/RobBundles.scala
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class RobCSRIO(implicit p: Parameters) extends XSBundle {
class RobLsqIO(implicit p: Parameters) extends XSBundle {
val lcommit = Output(UInt(log2Up(CommitWidth + 1).W))
val scommit = Output(UInt(log2Up(CommitWidth + 1).W))
val pendingUncacheld = Output(Bool())
val pendingMMIOld = Output(Bool())
val pendingld = Output(Bool())
val pendingst = Output(Bool())
// set when vector store at the head of ROB
Expand Down
6 changes: 5 additions & 1 deletion src/main/scala/xiangshan/cache/dcache/DCacheWrapper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -513,11 +513,13 @@ class UncacheWordReq(implicit p: Parameters) extends DCacheBundle
{
val cmd = UInt(M_SZ.W)
val addr = UInt(PAddrBits.W)
val vaddr = UInt(VAddrBits.W) // for uncache buffer forwarding
val data = UInt(XLEN.W)
val mask = UInt((XLEN/8).W)
val id = UInt(uncacheIdxBits.W)
val instrtype = UInt(sourceTypeWidth.W)
val atomic = Bool()
val nc = Bool()
val isFirstIssue = Bool()
val replayCarry = new ReplayCarry(nWays)

Expand All @@ -531,7 +533,9 @@ class UncacheWordResp(implicit p: Parameters) extends DCacheBundle
{
val data = UInt(XLEN.W)
val data_delayed = UInt(XLEN.W)
val id = UInt(uncacheIdxBits.W)
val id = UInt(uncacheIdxBits.W) // resp identified signals
val nc = Bool() // resp identified signals
val is2lq = Bool() // resp identified signals
val miss = Bool()
val replay = Bool()
val tag_error = Bool()
Expand Down
Loading
Loading