提交 c038d5eb 编写于 作者: L LinJiawei

Log: use implict module name instead implict module

上级 3434ab78
......@@ -62,7 +62,7 @@ trait HasXSParameter {
}
trait HasXSLog { this: Module =>
implicit val _implict_module = this
implicit val moduleName: String = this.name
}
abstract class XSModule extends Module
......
......@@ -35,8 +35,8 @@ object XSLog {
def apply(debugLevel: XSLogLevel)
(cond: Bool, pable: Printable)
(implicit m: Module): Any = {
val commonInfo = p"[$debugLevel][time=${GTimer()}] ${m.name}: "
(implicit name: String): Any = {
val commonInfo = p"[$debugLevel][time=${GTimer()}] $name: "
when (debugLevel.id.U >= xsLogLevel && cond && displayLog) {
printf(commonInfo + pable)
}
......@@ -45,12 +45,12 @@ object XSLog {
sealed abstract class LogHelper(val logLevel: XSLogLevel) extends HasXSParameter {
def apply(cond: Bool, fmt: String, data: Bits*)(implicit m: Module): Any =
def apply(cond: Bool, fmt: String, data: Bits*)(implicit name: String): Any =
apply(cond, Printable.pack(fmt, data:_*))
def apply(cond: Bool, pable: Printable)(implicit m: Module): Any = XSLog(logLevel)(cond, pable)
def apply(fmt: String, data: Bits*)(implicit m: Module): Any =
def apply(cond: Bool, pable: Printable)(implicit name: String): Any = XSLog(logLevel)(cond, pable)
def apply(fmt: String, data: Bits*)(implicit name: String): Any =
apply(true.B, Printable.pack(fmt, data:_*))
def apply(pable: Printable)(implicit m: Module): Any = XSLog(logLevel)(true.B, pable)
def apply(pable: Printable)(implicit name: String): Any = XSLog(logLevel)(true.B, pable)
// Do not use that unless you have valid reasons
def apply(cond: Bool = true.B)(body: => Unit): Any =
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册