未验证 提交 b6220f0d 编写于 作者: L Lemover 提交者: GitHub

Perf: add perf counter to record rs wake up source (#792)

上级 298e64c2
......@@ -32,6 +32,7 @@ case class ExuParameters
case class ExuConfig
(
name: String,
blockName: String, // NOTE: for perf counter
fuConfigs: Seq[FuConfig],
wbIntPriority: Int,
wbFpPriority: Int
......
......@@ -136,7 +136,7 @@ class ReservationStation
io.numExist := select.io.numExist
select.io.redirectVec := ctrl.io.redirectVec
select.io.readyVec := ctrl.io.readyVec
select.io.enq.valid := io.fromDispatch.valid && !(io.redirect.valid || io.flush)
select.io.enq.valid := io.fromDispatch.valid && !(io.redirect.valid || io.flush)
io.fromDispatch.ready := select.io.enq.ready
select.io.deq.ready := io.deq.ready
if (feedback) {
......@@ -404,7 +404,7 @@ class ReservationStationSelect
XSPerfAccumulate("exuBlockDeq", issueValid && !io.deq.ready)
XSPerfAccumulate("bubbleBlockEnq", haveBubble && !io.enq.ready)
XSPerfAccumulate("validButNotSel", PopCount(selectMask) - haveReady)
QueuePerf(iqSize, io.numExist, !io.enq.ready)
XSPerfAccumulate("validUtil", PopCount(validQueue))
XSPerfAccumulate("emptyUtil", io.numExist - PopCount(validQueue) - PopCount(stateQueue.map(_ === s_replay)) - PopCount(stateQueue.map(_ === s_wait))) // NOTE: hard to count, use utilization - nonEmpty
......@@ -413,7 +413,7 @@ class ReservationStationSelect
XSPerfAccumulate("waitUtil", PopCount(stateQueue.map(_ === s_wait)))
XSPerfAccumulate("replayUtil", PopCount(stateQueue.map(_ === s_replay)))
if (!feedback && nonBlocked) {
XSPerfAccumulate("issueValidButBubbleDeq", selectReg && bubbleReg && (deqPtr === bubblePtr))
XSPerfAccumulate("bubbleShouldNotHaveDeq", selectReg && bubbleReg && (deqPtr === bubblePtr) && io.deq.ready)
......@@ -426,7 +426,7 @@ class ReservationStationSelect
// NOTE: maybe useless, for logical queue and phyical queue make this no sense
XSPerfAccumulate(s"replayTimeOfEntry${i}", io.memfeedback.valid && !io.memfeedback.bits.hit && io.memfeedback.bits.rsIdx === i.U)
}
io.isFirstIssue := RegNext(ParallelPriorityMux(selectMask.asBools zip cntCountQueue) === 0.U)
io.isFirstIssue := RegNext(ParallelPriorityMux(selectMask.asBools zip cntCountQueue) === 0.U)
}
for(i <- 0 until iqSize) {
if (i == 0) XSPerfAccumulate("empty", io.numExist === 0.U)
......@@ -698,6 +698,22 @@ class ReservationStationCtrl
}
}
}
def updateFilterByBlock(blockName: String) = {
srcUpdateListen.map(a => a.map(b =>
b.zip(fastPortsCfg ++ slowPortsCfg)
.filter(
_._2.blockName == blockName
).map(_._1)
)).flatten.flatten
}
val intSrcUpdate = updateFilterByBlock("Int")
val memSrcUpdate = updateFilterByBlock("Mem")
val fpSrcUpdate = updateFilterByBlock("Fp")
XSPerfAccumulate(s"${exuCfg.blockName}_wakeup_by_Int", PopCount(Cat(intSrcUpdate)))
XSPerfAccumulate(s"${exuCfg.blockName}_wakeup_by_Mem", PopCount(Cat(memSrcUpdate)))
XSPerfAccumulate(s"${exuCfg.blockName}_wakeup_by_Fp", PopCount(Cat(fpSrcUpdate)))
}
class RSDataSingleSrc(srcLen: Int, numEntries: Int, numListen: Int, writePort: Int = 1) extends Module {
......@@ -860,4 +876,4 @@ class ReservationStationData
pcMem.get.io.raddr(0) := io.sel
io.pc := pcMem.get.io.rdata(0)
}
}
}
\ No newline at end of file
......@@ -487,15 +487,16 @@ package object xiangshan {
UncertainLatency()
)
val AluExeUnitCfg = ExuConfig("AluExeUnit", Seq(aluCfg), 0, Int.MaxValue)
val JumpExeUnitCfg = ExuConfig("JmpExeUnit", Seq(jmpCfg, csrCfg, fenceCfg, i2fCfg), 2, Int.MaxValue)
val MulDivExeUnitCfg = ExuConfig("MulDivExeUnit", Seq(mulCfg, divCfg), 1, Int.MaxValue)
val FmacExeUnitCfg = ExuConfig("FmacExeUnit", Seq(fmacCfg), Int.MaxValue, 0)
val AluExeUnitCfg = ExuConfig("AluExeUnit", "Int", Seq(aluCfg), 0, Int.MaxValue)
val JumpExeUnitCfg = ExuConfig("JmpExeUnit", "Int", Seq(jmpCfg, csrCfg, fenceCfg, i2fCfg), 2, Int.MaxValue)
val MulDivExeUnitCfg = ExuConfig("MulDivExeUnit", "Int", Seq(mulCfg, divCfg), 1, Int.MaxValue)
val FmacExeUnitCfg = ExuConfig("FmacExeUnit", "Fp", Seq(fmacCfg), Int.MaxValue, 0)
val FmiscExeUnitCfg = ExuConfig(
"FmiscExeUnit",
"Fp",
Seq(f2iCfg, f2fCfg, fdivSqrtCfg),
Int.MaxValue, 1
)
val LdExeUnitCfg = ExuConfig("LoadExu", Seq(lduCfg), wbIntPriority = 0, wbFpPriority = 0)
val StExeUnitCfg = ExuConfig("StoreExu", Seq(stuCfg, mouCfg), wbIntPriority = Int.MaxValue, wbFpPriority = Int.MaxValue)
}
val LdExeUnitCfg = ExuConfig("LoadExu", "Mem", Seq(lduCfg), wbIntPriority = 0, wbFpPriority = 0)
val StExeUnitCfg = ExuConfig("StoreExu", "Mem", Seq(stuCfg, mouCfg), wbIntPriority = Int.MaxValue, wbFpPriority = Int.MaxValue)
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册