【发布时间】:2023-03-06 06:42:01
【问题描述】:
谁能解释这个结构的问题是什么?我有一个带有 IO Vec 的子模块,我试图将其附加到父模块中的等效 IO。
仅使用 Seq 就可以正常工作,但是在使用 Vec 进行详细说明时,我遇到了异常。 Vec 是必需的,因为在我的实际情况下,它会在子模块中使用硬件信号进行索引。
错误:
[error] chisel3.internal.ChiselException: Connection between left (MyBundle[3](Wire in Lower)) and source (MyBundle[3](Wire in Upper)) failed @(0).out: Left or Right unavailable to current module.
代码:
package Testcase
import chisel3._
import chisel3.util._
import chisel3.stage.ChiselStage
import amba._
class MyBundle extends Bundle {
val out = Output(UInt(32.W))
}
class Upper (n : Int) extends RawModule {
val io = VecInit(Seq.fill(n)(IO(new MyBundle)))
val lower = Module(new Lower(n))
// This should word in the Vec case but gets the same error
// lower.io <> io
// This works for non Vec case
(lower.io, io).zipped map (_ <> _)
}
class Lower (n : Int) extends RawModule {
val io = VecInit(Seq.fill(n)(IO(new MyBundle)))
for (i <- 0 to n - 1) {
io(i).out := 0.U
}
}
object VerilogMain extends App {
(new ChiselStage).emitVerilog(new Upper(3), Array("--target-dir", "generated"))
}
【问题讨论】:
标签: chisel