1

I used to generate the vcd file through chiseltest like below.

import chisel3._
import chiseltest._
import org.scalatest.flatspec.AnyFlatSpec

class MyModuleSpec extends AnyFlatSpec with ChiselScalatestTester {
  behavior of "MyModule"
  it should "do something" in {
    test(new MyModule).withAnnotations(Seq(WriteVcdAnnotation)) { c =>
      c.io.in.poke(0.U)
      c.clock.step()
      c.io.out.expect(0.U)
      c.io.in.poke(42.U)
      c.clock.step()
      c.io.out.expect(42.U)
      println("Last output value : " + c.io.out.peek().litValue)
    }
  }
}

As far as i know keyword withAnnotations(Seq(WriteVcdAnnotation)) generates the vcd file

Modifying my code for newest version of Chisel, i edited my test code like below

import chisel3._
import chisel3.experimental.BundleLiterals._
import chisel3.simulator.EphemeralSimulator._
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.must.Matchers

class MyModuleSpec extends AnnFreeSpec with Matcher{

  " My module do something" in {
    simulate(new MyModule).withAnnotations(Seq(WriteVcdAnnotation)) { c =>
      c.io.in.poke(0.U)
      c.clock.step()
      c.io.out.expect(0.U)
      c.io.in.poke(42.U)
      c.clock.step()
      c.io.out.expect(42.U)
      println("Last output value : " + c.io.out.peek().litValue)
    }
  }
}

However, recent version of chisel which use svsim instead of chiseltest for test code cannot use this keyword withAnnotations(Seq(WriteVcdAnnotation)) with simulate function.

So, this code generates error.

I've been searching for the keywords that generate vcd in chisel test code.

Which keyword should i use for generating vcd file like older version of chisel in newest chisel?

Thank you.

3
  • 1
    I'm having the same issue, using the chisel-template project with chisel 6.2.0, have you found a solution? Commented Apr 19, 2024 at 9:50
  • As far as i know, there is no vcd generation in current version of chisel. However, i found the solution. See the details in this link github.com/rameloni/tywaves-chisel-demo. Thanks! Commented Apr 19, 2024 at 10:28
  • 1
    It turned out using chiseltest 6.0.0, vcd generation is also possible. Commented Apr 22, 2024 at 10:19

0

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.