提交 b31c62ab 编写于 作者: W wangkaifan

perf: support external intervened pf-cnt clean & dump

上级 8da1d657
......@@ -120,6 +120,13 @@ object XSPerf extends HasXSParameter {
if (!env.FPGAPlatform && !env.DualCore) {
ExcitingUtils.addSink(xstrap, "XSTRAP", ConnectionType.Debug)
}
val perfClean = WireInit(false.B)
val perfDump = WireInit(false.B)
ExcitingUtils.addSink(perfClean, "XSPERF_CLEAN")
ExcitingUtils.addSink(perfDump, "XSPERF_DUMP")
when (perfClean) {
counter := 0.U
}
when (printEnable) { // interval print
if (acc) {
XSLog(XSLogLevel.PERF)(true, true.B, p"$perfName, $next_counter\n")
......@@ -127,7 +134,7 @@ object XSPerf extends HasXSParameter {
XSLog(XSLogLevel.PERF)(true, true.B, p"$perfName, $perfCnt\n")
}
}
when (xstrap) { // summary print
when (xstrap || perfDump) { // summary print
// dump acc counter by default
XSLog(XSLogLevel.PERF)(true, true.B, p"$perfName, $next_counter\n")
}
......
......@@ -515,4 +515,9 @@ class TrapIO extends XSBundle {
val pc = Output(UInt(VAddrBits.W))
val cycleCnt = Output(UInt(XLEN.W))
val instrCnt = Output(UInt(XLEN.W))
}
class PerfInfoIO extends XSBundle {
val clean = Input(Bool())
val dump = Input(Bool())
}
\ No newline at end of file
......@@ -109,7 +109,9 @@ case class XSCoreParameters
PtwL1EntrySize: Int = 16,
PtwL2EntrySize: Int = 2048, //(256 * 8)
NumPerfCounters: Int = 16,
NrExtIntr: Int = 150
NrExtIntr: Int = 150,
PerfRealTime: Boolean = false,
PerfIntervalBits: Int = 15
)
trait HasXSParameter {
......@@ -192,6 +194,8 @@ trait HasXSParameter {
val PtwL2EntrySize = core.PtwL2EntrySize
val NumPerfCounters = core.NumPerfCounters
val NrExtIntr = core.NrExtIntr
val PerfRealTime = core.PerfRealTime
val PerfIntervalBits = core.PerfIntervalBits
val instBytes = if (HasCExtension) 2 else 4
val instOffsetBits = log2Ceil(instBytes)
......
......@@ -127,6 +127,7 @@ class XSSimSoC(axiSim: Boolean)(implicit p: config.Parameters) extends LazyModul
val difftest = new DiffTestIO
val difftest2 = new DiffTestIO
val logCtrl = new LogCtrlIO
val perfInfo = new PerfInfoIO
val trap = new TrapIO
val trap2 = new TrapIO
val uart = new UARTIO
......@@ -135,6 +136,7 @@ class XSSimSoC(axiSim: Boolean)(implicit p: config.Parameters) extends LazyModul
dontTouch(io.difftest)
dontTouch(io.logCtrl)
dontTouch(io.perfInfo)
dontTouch(io.trap)
dontTouch(io.uart)
......@@ -225,6 +227,13 @@ class XSSimSoC(axiSim: Boolean)(implicit p: config.Parameters) extends LazyModul
ExcitingUtils.addSource(timer, "logTimestamp")
}
if (env.EnablePerfDebug) {
val clean = io.perfInfo.clean
val dump = io.perfInfo.dump
ExcitingUtils.addSource(clean, "XSPERF_CLEAN")
ExcitingUtils.addSource(dump, "XSPERF_DUMP")
}
// Check and dispaly all source and sink connections
ExcitingUtils.fixConnections()
ExcitingUtils.checkAndDisplay()
......@@ -252,6 +261,7 @@ class XSSimTop(axiSim: Boolean)(implicit p: config.Parameters) extends LazyModul
val difftest = new DiffTestIO
val difftest2 = new DiffTestIO
val logCtrl = new LogCtrlIO
val perfInfo = new PerfInfoIO
val trap = new TrapIO
val trap2 = new TrapIO
val uart = new UARTIO
......@@ -261,6 +271,7 @@ class XSSimTop(axiSim: Boolean)(implicit p: config.Parameters) extends LazyModul
io.difftest <> dut.module.io.difftest
io.logCtrl <> dut.module.io.logCtrl
io.perfInfo <> dut.module.io.perfInfo
io.trap <> dut.module.io.trap
io.uart <> dut.module.io.uart
if (!env.FPGAPlatform && env.DualCore) {
......@@ -269,8 +280,7 @@ class XSSimTop(axiSim: Boolean)(implicit p: config.Parameters) extends LazyModul
}
if (axiSim) {
io.memAXI <> axiSimRam.module.io
}
else {
} else {
io.memAXI <> DontCare
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册