Skip to content

Frequently Asked Questions

Jim Lawson edited this page Oct 19, 2017 · 3 revisions

How can I see a VCD output from the tutorial circuits

Here is the quick way. We'll take advantage of the fact that the verilator backend creates a vcd output file by default, so we'll make it run instead of the default interpreter backend.
Let's use the example of running the examples.Adder tutorial. Run it as follows from the command line prompt.

./run-examples.sh Adder --backend-name verilator

The vcd file will appear here

ls -l test_run_dir/examples.Launcher.*/*.vcd

It is also possible to add your own Driver call which would allow you access to a whole slew of options that are hidden by the tutorials Launchers. Once again with examples.Adder, modify the test harness file src/test/scala/examples/AdderTests.scala Add a new tester class to the end the file so it looks like this

class MyAdderTester extends ChiselFlatSpec {
  behavior of "Adder"
  it should "run while creating a vcd" in {
    Driver.execute(Array("-fiwv"), () => new Adder(10)) { c =>
      new AdderTests(c)
    }
  }
}

You can now run the test from the command line as follows

sbt 'test-only examples.MyAdderTester'

You'll get a vcd output from the interpreter due to the -fiwv flag being passed to the backend. The output is in a different directory when run this way. It should be here

ls -ltr test_run_dir/examples.MyAdderTester*/*.vcd

For fun, try changing the -fiwv flag to --help and see a comprehensive list of options