gpt4 book ai didi

riscv - 如何在 Chisel 中做出断言只是警告而不是停止模拟

转载 作者:行者123 更新时间:2023-12-04 15:52:32 29 4
gpt4 key购买 nike

我们已将断言添加到我们的 Chisel 代码中,但我们只希望它们发出警告,而不是停止模拟。有没有办法告诉 Chisel 这样做?

例如:

断言(x(1)=/= nxt_val(1))

我们希望这只是给我们一个警告,这样我们就可以收集日志,找到时钟门控最有效的地方。

最佳答案

你能不能只写一个传递条件和行为标志的方法。

object warnAssert {
def apply(condition: Bool, message: String = "", isFatal: Boolean = false) {
(isFatal, message.isEmpty) {
case (true, true) => assert(condition)
case (true, false) => assert(condition, message)
case (false, _) => when(bool) { printf("Warning: %s\n", message) // line number should get included here
}
}
}

关于riscv - 如何在 Chisel 中做出断言只是警告而不是停止模拟,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53267994/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com