@@ -77,6 +77,7 @@ private[utility] trait XSLogTap {
7777object XSLog extends XSLogTap {
7878 private val logInfos = ListBuffer .empty[LogPerfParam ]
7979 private val callBacks = ListBuffer .empty[(LogPerfIO ) => Unit ]
80+ private val callBacksWithClock = ListBuffer .empty[(LogPerfIO , Reset , Clock ) => Unit ]
8081 private val logModules = ListBuffer .empty[BaseModule ]
8182
8283 private def unpackPrintable (pable : Printable ): (String , Seq [Data ]) = {
@@ -158,7 +159,9 @@ object XSLog extends XSLogTap {
158159 // As XSPerf depends on LogPerfIO, their apply will be buffered until collection
159160 // Register collect() method from Callers when first apply, then call that during collection
160161 def registerCaller (caller : LogPerfIO => Unit ): Unit = callBacks += caller
162+ def registerCallerWithClock (caller : (LogPerfIO , Reset , Clock ) => Unit ): Unit = callBacksWithClock += caller
161163 def invokeCaller (ctrl : LogPerfIO ): Unit = callBacks.foreach(caller => caller(ctrl))
164+ def invokeCallerWithClock (ctrl : LogPerfIO , reset : Reset , clock : Clock ) = callBacksWithClock.foreach(caller => caller(ctrl, reset, clock))
162165
163166 // Should only be called during firrtl phase(ChiselStage)
164167 // PathName can not be accessed until circuit elaboration
@@ -205,6 +208,7 @@ private class LogPerfEndpoint()(implicit p: Parameters) extends Module {
205208 }
206209
207210 // To collect deferred call from XSPerf/..., invoke all registered caller
211+ XSLog .invokeCallerWithClock(io, reset, clock)
208212 XSLog .invokeCaller(io)
209213 // Group printfs with same cond to reduce system tasks for better thread schedule
210214 XSLog .tapInfos.groupBy(_.cond).values.foreach { infos =>
0 commit comments