我有一个ChiselTest测试器,代码如下:
class EccTester extends FlatSpec with ChiselScalatestTester with Matchers {
behavior of "Testers2"
it should "send data without errors" in {
test(new EccPair(width=8)) {
c => {
val rnd = new Random()
for (i <- 0 to 20) {
val testVal = rnd.nextInt(1 << c.getWidthParam)
c.io.dataIn.poke(testVal.U)
c.io.errorLocation.poke(0.U)
c.io.injectError.poke(false.B)
c.io.injectSecondError.poke(false.B)
c.clock.step(1)
c.io.dataOut.expect(testVal.U)
c.io.outputNotEqual.expect(false.B)
}
}
}
}
}我可以使用下面的命令在shell中运行测试
testOnly chisel.lib.ecc.EccTester
但是当我尝试根据ChiselTest文档生成波形时,
testOnly chisel.lib.ecc.EccTester -DvwriteVcd=1
测试执行正常,但不转储波形。
我引用的文档是https://github.com/ucb-bar/chisel-testers2,完整的源代码在https://github.com/hutch31/ip-contributions/blob/ecc/src/test/scala/chisel/lib/ecc/EccTester.scala
发布于 2020-02-15 03:19:43
我认为这个问题还没有一个正式的答案,但我会这样做。首先,我添加以下两个导入。
import chiseltest.experimental.TestOptionBuilder._
import chiseltest.internal.WriteVcdAnnotation然后将注释添加到测试,如下所示
it should "send data without errors" in {
test(new EccPair(width=8)).withAnnotations(Seq(WriteVcdAnnotation)) {
c => {注意: WriteVcdAnnotation有两种定义,一种在treadle包中,另一种在chiseltest.internal包中。使用后者,因为它既适用于踏板也适用于verilator后端。
https://stackoverflow.com/questions/60232257
复制相似问题