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(HPM): enable HPMs in CoupledL2 and print them #3708

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 11 additions & 0 deletions src/main/scala/xiangshan/L2Top.scala
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ class L2TopInlined()(implicit p: Parameters) extends LazyModule
val l2_tlb_req = new TlbRequestIO(nRespDups = 2)
val l2_pmp_resp = Flipped(new PMPRespBundle)
val l2_hint = ValidIO(new L2ToL1Hint())
val perfEvents = Output(Vec(numPCntHc * coreParams.L2NBanks + 1, new PerfEvent))
// val reset_core = IO(Output(Reset()))
})

Expand Down Expand Up @@ -203,6 +204,15 @@ class L2TopInlined()(implicit p: Parameters) extends LazyModule
io.l2_tlb_req.req.bits.kill := l2.io.l2_tlb_req.req.bits.kill
io.l2_tlb_req.req.bits.no_translate := l2.io.l2_tlb_req.req.bits.no_translate
io.l2_tlb_req.req_kill := l2.io.l2_tlb_req.req_kill
io.perfEvents := l2.io_perf

val allPerfEvents = l2.getPerfEvents
if (printEventCoding) {
for (((name, inc), i) <- allPerfEvents.zipWithIndex) {
println("L2 Cache perfEvents Set", name, inc, i)
}
}

l2.io.l2_tlb_req.resp.valid := io.l2_tlb_req.resp.valid
l2.io.l2_tlb_req.req.ready := io.l2_tlb_req.req.ready
l2.io.l2_tlb_req.resp.bits.paddr.head := io.l2_tlb_req.resp.bits.paddr.head
Expand Down Expand Up @@ -231,6 +241,7 @@ class L2TopInlined()(implicit p: Parameters) extends LazyModule
io.l2_tlb_req.req.bits := DontCare
io.l2_tlb_req.req_kill := DontCare
io.l2_tlb_req.resp.ready := true.B
io.perfEvents := DontCare
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/xiangshan/Parameters.scala
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ trait HasXSParameter {
def LFSTEnable = true

def PCntIncrStep: Int = 6
def numPCntHc: Int = 25
def numPCntHc: Int = 12
def numPCntPtw: Int = 19

def numCSRPCntFrontend = 8
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 @@ -84,7 +84,7 @@ class XSCoreImp(outer: XSCoreBase) extends LazyModuleImp(outer)
val cpu_halt = Output(Bool())
val resetInFrontend = Output(Bool())
val l2_pf_enable = Output(Bool())
val perfEvents = Input(Vec(numPCntHc * coreParams.L2NBanks, new PerfEvent))
val perfEvents = Input(Vec(numPCntHc * coreParams.L2NBanks + 1, new PerfEvent))
val beu_errors = Output(new XSL1BusErrors())
val l2_hint = Input(Valid(new L2ToL1Hint()))
val l2_tlb_req = Flipped(new TlbRequestIO(nRespDups = 2))
Expand Down
6 changes: 4 additions & 2 deletions src/main/scala/xiangshan/XSTile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ class XSTile()(implicit p: Parameters) extends LazyModule
l2top.module.io.hartIsInReset.resetInFrontend := core.module.io.resetInFrontend
io.hartIsInReset := l2top.module.io.hartIsInReset.toTile

core.module.io.perfEvents <> DontCare

l2top.module.io.beu_errors.icache <> core.module.io.beu_errors.icache
l2top.module.io.beu_errors.dcache <> core.module.io.beu_errors.dcache
if (enableL2) {
Expand All @@ -157,6 +155,8 @@ class XSTile()(implicit p: Parameters) extends LazyModule
l2top.module.io.debugTopDown.robTrueCommit := core.module.io.debugTopDown.robTrueCommit
l2top.module.io.l2_pmp_resp := core.module.io.l2_pmp_resp
core.module.io.l2_tlb_req <> l2top.module.io.l2_tlb_req

core.module.io.perfEvents <> l2top.module.io.perfEvents
} else {

l2top.module.io.beu_errors.l2 <> 0.U.asTypeOf(l2top.module.io.beu_errors.l2)
Expand All @@ -171,6 +171,8 @@ class XSTile()(implicit p: Parameters) extends LazyModule
core.module.io.l2_tlb_req.req.bits := DontCare
core.module.io.l2_tlb_req.req_kill := DontCare
core.module.io.l2_tlb_req.resp.ready := true.B

core.module.io.perfEvents <> DontCare
}

io.debugTopDown.robHeadPaddr := core.module.io.debugTopDown.robHeadPaddr
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/xiangshan/backend/fu/CSR.scala
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class PerfCounterIO(implicit p: Parameters) extends XSBundle {
val perfEventsFrontend = Vec(numCSRPCntFrontend, new PerfEvent)
val perfEventsBackend = Vec(numCSRPCntCtrl, new PerfEvent)
val perfEventsLsu = Vec(numCSRPCntLsu, new PerfEvent)
val perfEventsHc = Vec(numPCntHc * coreParams.L2NBanks, new PerfEvent)
val perfEventsHc = Vec(numPCntHc * coreParams.L2NBanks + 1, new PerfEvent)
val retiredInstr = UInt(7.W)
val frontendInfo = new Bundle {
val ibufFull = Bool()
Expand Down
Loading