我正在尝试将 RegInit 部署在具有参数化数据类型的模块中。通常,对于 Chisel 中的简单端口,我会执行以下操作:
val myReg = RegInit (0.U(32.W))
在我的代码中,我有以下内容:
import dsptools._
import dsptools.numbers._
class Acc[A <: Data:Ring, B <: Data:Ring] (inType:A, outType:B,
mulPipeLen:Int = 1, addPipeLen:Int = 1) extends Module {
...
def zero = dsptools.numbers.Ring[B].zero
val mres = Reg(outType.cloneType) // this works, no initialization
val ares = RegInit(zero(outType.cloneType.getWidth.W)) // this fails trying to zero init in the parametrized Ring
...
}
返回编译错误:
[error] Acc.scala:43:27: B does not take parameters
[error] val mres = RegInit(zero(outType.cloneType.cloneType.getWidth.W))
我该如何解决?谢谢!