我正在尝试将 aBlackBox
连接到任意Bundle
,但宽度推断似乎不适用于 fromBits 函数。以下编译良好:
class testBundle extends Bundle {
val io1 = Bool(INPUT)
val io2 = UInt(INPUT,10)
}
class testBox extends BlackBox {
val io = new Bundle {
val in = Bits(INPUT) # Width inference works fine here
val out = Bits(OUTPUT,(new testBundle).getWidth) # But it doesn't work here!
}
}
class test extends Module {
val io = new Bundle {
val in = new testBundle
val out = (new testBundle).flip()
}
val testbox = Module(new testBox)
testbox.io.in := io.in.toBits
io.out := io.out.fromBits(testbox.io.out)
}
但是如果我删除这个(new testBundle).getWidth
参数,Chisel 就无法推断出输出端口的宽度并且会出错。如何testBox
连接到任意捆绑包?