Skip to content

+vcd writes an FST file named dump_file.vcd, ignores the documented =path argument, and the documented default filename does not match the code #12

Description

@badnikhil

README.md:88 documents:

+vcd[=path/to/waveform.vcd] Generates a waveform of the simulation. By default, it will save it as dump.vcd.

Three parts of that do not match the behaviour on 2528e7d (v3.1.0). Verified with the Verilator
flow on Ubuntu 24.04.1, Verilator 5.020.

1. The =path argument is ignored. simulator/sim_top.sv:522-523:

if ($test$plusargs("vcd")) begin
    $dumpfile("dump_file.vcd");

$test$plusargs is a boolean presence test, so +vcd=/tmp/foo.vcd enables tracing and then
discards the path. This differs from the two sibling options documented immediately below it, which
both use $value$plusargs and do honour their argument:

  • simulator/models/hdl/commit_log_behav.sv:21-23
    if (!$value$plusargs("commit_log=%s", logfile)) logfile = "signature.txt";
  • simulator/models/hdl/konata_behav.sv:122-124
    if (!$value$plusargs("konata_dump=%s", dumpfile)) dumpfile = "konata.txt";

2. The default filename is dump_file.vcd, not dump.vcd. Hardcoded at sim_top.sv:523.

3. The file is FST, not VCD. simulator/verilator/verilator.mk:21 builds with --trace-fst,
so $dumpfile produces an FST container regardless of the .vcd extension:

$ ./sim +max-cycles=100000 +load=tb/tb_isa_tests/build/isa/rv64ui-p-jalr +vcd
$ file dump_file.vcd
dump_file.vcd: data
$ xxd -l 16 dump_file.vcd
00000000: 0000 0000 0000 0001 4900 0000 0000 0000  ........I.......
$ fst2vcd dump_file.vcd -o /dev/null   # exit 0

A .vcd extension on FST content breaks tooling that dispatches on extension. GTKWave itself
sniffs the container and opens it either way, so this is easy to miss.

Also unlisted: +start-vcd-cycles=N (sim_top.sv:524) defers $dumpvars() until cycle N,
and it is not in the README's optional-parameters section.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions