2

I have a ChiselTest tester written as follows:

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)
        }
      }
    }
  }
}

I am able to run the test in the shell with

testOnly chisel.lib.ecc.EccTester

But when I try to generate waveforms per the ChiselTest documentation,

testOnly chisel.lib.ecc.EccTester -- -DvwriteVcd=1

The test executes OK but does not dump a waveform.

Documentation I referenced is https://github.com/ucb-bar/chisel-testers2, and the full source code is at https://github.com/hutch31/ip-contributions/blob/ecc/src/test/scala/chisel/lib/ecc/EccTester.scala

1 Answer 1

3

I don’t think there is a formal answer to this yet, but here’s what I do. First I add the two following imports.

import chiseltest.experimental.TestOptionBuilder._
import chiseltest.internal.WriteVcdAnnotation

then add the annotation to the test like this

  it should "send data without errors" in {
    test(new EccPair(width=8)).withAnnotations(Seq(WriteVcdAnnotation)) {
      c => {

Note: there are two definitions of WriteVcdAnnotation, one is in package treadle and the other is in package chiseltest.internal. Use the latter, as it will work for both treadle and verilator backends.

Sign up to request clarification or add additional context in comments.

1 Comment

With chisel 3.5.0, chiseltest.experimental.TestOptionBuilder is gone. And WriteVcdAnnotation is now in simulator : import chiseltest.simulator.WriteVcdAnnotation is enough now. discussion in mailling list : groups.google.com/g/chisel-users/c/UGbBiN_VyHg

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.