【发布时间】:2021-08-31 13:13:41
【问题描述】:
我正在尝试在 UInt 中减少 Vec 的 Bundle,但出现错误:
class DiffPair extends Bundle {
val p = Bool()
val n = Bool()
}
class TMDS extends Bundle {
val clk = new DiffPair()
val data = Vec(3, new DiffPair())
}
val io = IO(new Bundle {
//...
val tmds = Output(new TMDS())
})
val O_tmds_data_p = IO(Output(UInt(3.W)))
如果我使用这个reduce 代码:
O_tmds_data_p := gbHdmi.io.tmds.data.reduce((a,b) => Cat(a.p, b.p))
我遇到了这个错误:
[info] compiling 1 Scala source to /home/user/GbHdmi/target/scala-2.12/classes ...
[error] /home/user/GbHdmi/src/main/scala/topgbhdmi.scala:72:67: type mismatch;
[error] found : chisel3.UInt
[error] required: gbhdmi.DiffPair
[error] O_tmds_data_p := gbHdmi.io.tmds.data.reduce((a,b) => Cat(a.p, b.p))
[error] ^
[error] one error found
[error] (Compile / compileIncremental) Compilation failed
[error] Total time: 0 s, completed 31 août 2021, 15:04:08
我知道a 和b 是DiffPair,但a.p 和b.p 是Bool 不是吗?
【问题讨论】: