我在模块接口中声明了MixedVec:
class WbInterconOneMaster(val awbm: WbMaster,
val awbs: Seq[WbSlave]) extends Module {
val io = IO(new Bundle{
val wbm = Flipped(new WbMaster(awbm.dwidth, awbm.awidth))
val wbs = MixedVec(awbs.map{i => Flipped(new WbSlave(i.dwidth, i.awidth, i.iname))})
})
可以正确编译,并且可以正确生成Verilog。但是我不能像这样戳信号:
for(wbs <- dut.io.wbs) {
poke(wbs.ack_o, 0)
}
在执行时收到此错误(验证程序后端):
[info] java.util.NoSuchElementException: head of empty list
[info] at scala.collection.immutable.Nil$.head(List.scala:420)
[info] at scala.collection.immutable.Nil$.head(List.scala:417)
[info] at scala.collection.mutable.Stack.top(Stack.scala:132)
[info] at chisel3.internal.naming.NamingStack.pop_return_context(Namer.scala:133)
[info] at chisel3.util.MixedVec.length(MixedVec.scala:81)
[info] at scala.collection.IndexedSeqLike$class.iterator(IndexedSeqLike.scala:90)
[info] at chisel3.util.MixedVec.iterator(MixedVec.scala:81)
[info] at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
[info] at chisel3.util.MixedVec.foreach(MixedVec.scala:81)
[info] at wbplumbing.TestWbInterconDualSlave.<init>(testwbplumbing.scala:61)
[请注意,凿子版本3.1.6已在github project上询问了该问题,但将其标记为已关闭。我正在使用3.1.8版本,但似乎已经坏了。
我不确定发生了什么,但是我能够在当前的chisel3版本中重现您的错误,但是相同的代码似乎可以在chisel 3.2版本的候选快照下正常运行。您可以在那里尝试代码吗?希望它会更好。该问题似乎并不直接在MixedVec
中,而必须在基础代码中。