Generate .vcd File for Verilog w/ GTKwave

  • Thread starter Thread starter Molecular
  • Start date Start date
Click For Summary
SUMMARY

The discussion focuses on generating a .vcd file for Verilog simulations using GTKwave with Icarus Iverilog. The user initially faced challenges in producing the .vcd file despite implementing the correct Verilog commands, specifically $dumpfile("file.vcd"); and $dumpvars(0);. The solution was discovered when the user realized that the .vcd file is only created after executing the simulation, not during the compilation phase. A working example of a test module was provided, demonstrating the correct usage of these commands to successfully generate the .vcd file.

PREREQUISITES
  • Understanding of Verilog syntax and simulation flow
  • Familiarity with GTKwave for waveform analysis
  • Knowledge of Icarus Iverilog version for simulation
  • Basic concepts of signal monitoring in Verilog
NEXT STEPS
  • Learn how to use GTKwave for analyzing .vcd files
  • Explore advanced Verilog features for signal dumping
  • Investigate Icarus Iverilog command-line options for simulation
  • Study Verilog testbench design patterns for effective simulation
USEFUL FOR

Verilog developers, FPGA engineers, and anyone involved in digital design who needs to generate and analyze waveform data using GTKwave.

Molecular
Messages
28
Reaction score
0
Hey guys, I've recently started poking around with verilog code and I've made a few programs now and I really want to get a .vcd file or something similar out of my programs so that I can use gtkwave to analyze the program flow.

The thing is, no matter what I do, no .vcd file is generated anywhere. As far as my understanding there are two ways I can do this, by either

a) Adding

initial begin
$dumpfile("file.vcd");
$dumpvars(0);
end

in my code, something which first gave a bunch of errors and suddenly the errors stopped, but no .vcd file was generated, or

b) running the vvp file like so:

$ vvp testbenchfile -vcd

which again, gave me no vcd file to run with gtkwave.

At one point I even found some guys code on the internet and copypasted it to make sure I wasn't doing something wrong, but this didn't give me any vcd file either even though it appearantly did for him. I'm using icarus iverilog, if that makes any difference. Any help would be greatly appreciated, as I have nobody else to ask.
 
Engineering news on Phys.org
Nevermind figured it out, didn't realize the vcp file wouldn't be dumped until I actually run the output from the first simulation.

I feel stupid now ^^
 
Here's an example test module that generates the .vcd file. Took we a while to figure out that these:
$dumpfile("test.vcd");
$dumpvars(0,test);
produce the output, and the simulation must be run (see the finished keyword).

module test;

/* Make a reset that pulses once. */
reg reset = 0;
initial begin
$dumpfile("test.vcd");
$dumpvars(0,test);

# 17 reset = 1;
# 11 reset = 0;
# 29 reset = 1;
# 5 reset =0;
# 513 $finish;
end

/* Make a regular pulsing clock. */
reg clk = 0;
always #1 clk = !clk;

wire [7:0] value;
counter c1 (value, clk, reset);

initial
$monitor("At time %t, value = %h (%0d)",
$time, value, value);
endmodule // test
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
7K
  • · Replies 15 ·
Replies
15
Views
4K
Replies
1
Views
6K
  • · Replies 33 ·
2
Replies
33
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
Replies
1
Views
3K
  • · Replies 23 ·
Replies
23
Views
3K
Replies
7
Views
3K
  • · Replies 29 ·
Replies
29
Views
4K