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

标签 riscv chisel

我们已将断言添加到我们的 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/

相关文章:

scala - 凿子测试 : Cast a signed int to unsigned int for an expected value

Chisel 测试台 : controlling multiple ports independently

objdump - 了解 RiscV objdump

scala - 控制数据流图或中间表示

scala - Chisel 中的 <> 运算符是什么?

chisel - 如何获取 UInt Vec 中 Max 元素的索引,Chisel

multithreading - 是否可以在 riscv 中的两个锁上构建原子 "release-and-acquire"操作?

RISCV RV32IM : MULHSU - which operand is the signed one?

riscv - 解释 Chisel3 <> vs := ?

go - Go编译器产生奇怪的加载到x0中