简体   繁体   English

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

[英]Chisel runtime error in test harness

This Chisel code works ok: 凿子代码可以正常工作:

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

However this one - a small variation - produces run-time error: 但是,这个(很小的变化)会产生运行时错误:

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)

Any instantiation of a module must be wrapped with "Module()". 模块的任何实例化都必须用“ Module()”包装。

This is just a guess, but give this a try: 这只是一个猜测,但是尝试一下:

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

The reason for this, IIRC, is that "Module()" helps Chisel understand the parentage of wires/objects created within your Cache object (essentially pushing and popping the Module stack as the graph is constructed). IIRC之所以如此,是因为“ Module()”可帮助Chisel了解在Cache对象中创建的电线/对象的亲缘关系(实质上是在构建图形时推动和弹出Module堆栈)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM