Generate .vcd File for Verilog w/ GTKwave

  • Thread starter Thread starter Molecular
  • Start date Start date
Click For Summary
To generate a .vcd file for Verilog simulations using GTKwave, it's essential to include the correct commands in the code. The commands `$dumpfile("filename.vcd");` and `$dumpvars(0);` must be placed within an initial block to ensure the file is created during simulation. The simulation must be executed for the .vcd file to be generated; it won't appear until the simulation runs to completion. A sample test module demonstrates how to implement these commands effectively, including a reset and clock signal. Understanding this process is crucial for analyzing Verilog program flow with 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
 
Thread 'I thought it was only Amazon that sold unsafe junk'
I grabbed an under cabinet LED light today at a big box store. Nothing special. 18 inches in length and made to plug several lights together. Here is a pic of the power cord: The drawing on the box led me to believe that it would accept a standard IEC cord which surprised me. But it's a variation of it. I didn't try it, but I would assume you could plug a standard IEC cord into this and have a double male cord AKA suicide cord. And to boot, it's likely going to reverse the hot and...

Similar threads

  • · Replies 4 ·
Replies
4
Views
7K
  • · Replies 15 ·
Replies
15
Views
4K
Replies
1
Views
5K
  • · 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 29 ·
Replies
29
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K