Chisel3:如何在 RawModule 中创建没有复位信号的寄存器?

Chisel3: How to create a register without reset signal in RawModule?

我想借助 withClock 在 RawModule 中创建一个 RegNext。但是,当错误信息显示缺少隐式重置时,它无法工作。所以我必须这样写:

class Test extends RawModule {
  ...
  val nothing = Wire(Bool())
  nothing := DontCare
  val a = withClockAndReset(io.ui_clk, nothing) {
    RegNext(~io.in)
  }
  ...
}

有没有更好的解决方案?

您可以使用

将其缩短一点
withClockAndReset(io.ui_clk, false.B)

但我想不出别的办法。 withClock 在内部使用 withClockAndReset,这就是错误的原因。也许其他人有更好的答案。