我正在尝试将BlackBox
连接到任意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
连接到任意捆绑包?
答案 0 :(得分:0)
现在我通过将bundle作为参数传递给BlackBox来解决这个问题:
mysql_install_db
我欢迎更清洁的解决方案。