未验证 提交 df65b390 编写于 作者: S Steve Gou 提交者: GitHub

calculate average for each histogram (#2151)

上级 14dc2851
......@@ -83,6 +83,20 @@ object XSPerfHistogram extends HasRegularPerfName {
ExcitingUtils.addSink(perfClean, "XSPERF_CLEAN")
ExcitingUtils.addSink(perfDump, "XSPERF_DUMP")
val sum = RegInit(0.U(64.W))
val nSamples = RegInit(0.U(64.W))
when (perfClean) {
sum := 0.U
nSamples := 0.U
} .elsewhen (enable) {
sum := sum + perfCnt
nSamples := nSamples + 1.U
}
when (perfDump) {
XSPerfPrint(p"${perfName}_mean, ${sum/nSamples}\n")
}
// drop each perfCnt value into a bin
val nBins = (stop - start) / step
require(start >= 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册