测试工具中的凿子运行时错误

时间:2013-09-11 18:27:27

标签: scala hardware synthesis digital-logic chisel

Chisel代码可以正常运行:

chiselMainTest(Array[String]("--backend", "c", "--genHarness"), () => Module( new Cache(nways = 16, nsets = 32)  )){c => new CacheTests(c)}

然而,这一个 - 一个小的变化 - 产生运行时错误:

val cache_inst = new Cache(nways = 16, nsets = 32)
chiselMainTest(Array[String]("--backend", "c", "--genHarness"), () => Module(cache_inst)){c => new CacheTests(c)}


[error] (run-main) java.util.NoSuchElementException: head of empty list
java.util.NoSuchElementException: head of empty list
    at scala.collection.immutable.Nil$.head(List.scala:337)
    at scala.collection.immutable.Nil$.head(List.scala:334)

1 个答案:

答案 0 :(得分:1)

模块的任何实例化都必须用“Module()”包装。

这只是猜测,但试一试:

val cache_inst = Module(new Cache(nways = 16, nsets = 32))
ChiselMainTest(.....),() => (cache_inst){....}

IIRC的原因是“Module()”帮助Chisel理解在Cache对象中创建的连线/对象的父级(实际上在构建图形时推送和弹出模块堆栈)。