Generate .vcd File for Verilog w/ GTKwave

  • Thread starter Thread starter Molecular
  • Start date Start date
AI Thread 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
 
Very basic question. Consider a 3-terminal device with terminals say A,B,C. Kirchhoff Current Law (KCL) and Kirchhoff Voltage Law (KVL) establish two relationships between the 3 currents entering the terminals and the 3 terminal's voltage pairs respectively. So we have 2 equations in 6 unknowns. To proceed further we need two more (independent) equations in order to solve the circuit the 3-terminal device is connected to (basically one treats such a device as an unbalanced two-port...
suppose you have two capacitors with a 0.1 Farad value and 12 VDC rating. label these as A and B. label the terminals of each as 1 and 2. you also have a voltmeter with a 40 volt linear range for DC. you also have a 9 volt DC power supply fed by mains. you charge each capacitor to 9 volts with terminal 1 being - (negative) and terminal 2 being + (positive). you connect the voltmeter to terminal A2 and to terminal B1. does it read any voltage? can - of one capacitor discharge + of the...

Similar threads

Back
Top