Skip to content

Commit

Permalink
Log: remove unexpected LogPerfHelper when RELEASE=1 (#2343)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang-Haojin authored Sep 27, 2023
1 parent 254e496 commit 34f3869
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion huancun
5 changes: 4 additions & 1 deletion src/main/scala/top/Top.scala
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ class XSTop()(implicit p: Parameters) extends BaseXSSoc() with HasSoCParameter

val l3cacheOpt = soc.L3CacheParamsOpt.map(l3param =>
LazyModule(new HuanCun()(new Config((_, _, _) => {
case HCCacheParamsKey => l3param.copy(hartIds = tiles.map(_.HartId))
case HCCacheParamsKey => l3param.copy(
hartIds = tiles.map(_.HartId),
FPGAPlatform = debugOpts.FPGAPlatform
)
})))
)

Expand Down
9 changes: 7 additions & 2 deletions src/main/scala/utils/LogUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@ object XSLogLevel extends Enumeration {

object XSLog {
val MagicStr = "9527"
def apply(debugLevel: XSLogLevel)(ctrlInfo: LogPerfIO)
def apply(debugLevel: XSLogLevel, ctrlInfoOpt: Option[LogPerfIO] = None)
(prefix: Boolean, cond: Bool, pable: Printable)(implicit p: Parameters): Any =
{
val debugOpts = p(DebugOptionsKey)
val enableDebug = debugOpts.EnableDebug && debugLevel != XSLogLevel.PERF
val enablePerf = debugOpts.EnablePerfDebug && debugLevel == XSLogLevel.PERF
if (!debugOpts.FPGAPlatform && (enableDebug || enablePerf || debugLevel == XSLogLevel.ERROR)) {
val ctrlInfo = ctrlInfoOpt.getOrElse(Module(new LogPerfHelper).io)
val logEnable = ctrlInfo.logEnable
val logTimestamp = ctrlInfo.timer
val check_cond = (if (debugLevel == XSLogLevel.ERROR) true.B else logEnable) && cond && RegNext(true.B, false.B)
Expand All @@ -55,6 +56,10 @@ object XSLog {
}
}
}
def apply(debugLevel: XSLogLevel, ctrlInfo: LogPerfIO)
(prefix: Boolean, cond: Bool, pable: Printable)(implicit p: Parameters): Any = {
apply(debugLevel, Some(ctrlInfo))(prefix, cond, pable)
}
}

sealed abstract class LogHelper(val logLevel: XSLogLevel){
Expand All @@ -68,7 +73,7 @@ sealed abstract class LogHelper(val logLevel: XSLogLevel){
def apply(prefix: Boolean, cond: Bool, fmt: String, data: Bits*)(implicit p: Parameters): Any =
apply(prefix, cond, Printable.pack(fmt, data:_*))
def apply(prefix: Boolean, cond: Bool, pable: Printable)(implicit p: Parameters): Any ={
XSLog(logLevel)(Module(new LogPerfHelper).io)(prefix, cond, pable)
XSLog(logLevel)(prefix, cond, pable)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/utils/PerfCounterUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ object XSPerfRolling extends HasRegularPerfName {

object XSPerfPrint {
def apply(pable: Printable)(ctrlInfo: LogPerfIO)(implicit p: Parameters): Any = {
XSLog(XSLogLevel.PERF)(ctrlInfo)(true, true.B, pable)
XSLog(XSLogLevel.PERF, ctrlInfo)(true, true.B, pable)
}
}

Expand Down

0 comments on commit 34f3869

Please sign in to comment.