我正在尝试编写一个缓存内存,所以我创建了一个Seq类型,Mem因为我试图同时访问一组缓存中的所有元素。
val metaMem = Seq.fill(nWays) (Mem((nSets), new MetaData))
Run Code Online (Sandbox Code Playgroud)
然后我想有如下索引:
metaMem(way).write(set, MD)
Run Code Online (Sandbox Code Playgroud)
但是,因为方式UInt在我的代码中,并且 seq 只接受Int索引,所以会导致编译错误。有没有人对如何解决这个问题有任何建议?非常感谢
我有一个如下所示的模块:
class ComputationIO[T <: Data](val OperandType: T) extends Bundle {
val data = OperandType.cloneType
}
class Computation [T <: Data] (OperandType: T) extends Module {
val io = IO( new Bundle {
val in = Input(new ComputationIO(OperandType))
})
// REST OF THE CODE HERE...
}
Run Code Online (Sandbox Code Playgroud)
而且,我正在实例化Computation以下内容:
val compUnit = for (i <- 0 until nParal) yield {
val Comp = Module(new Computation(UInt(32.W)))
Comp
}
Run Code Online (Sandbox Code Playgroud)
但是,虽然我传递UInt(32.W)给构造函数,但它给了我以下错误:
firrtl.passes.CheckInitialization$RefNotInitializedException:Reference compUnit is not fully initialized.
[error] : compUnit.io.in.OperandType …Run Code Online (Sandbox Code Playgroud)