Objective: Iverilog and Gtkwave in Ubuntu and Ubuntu on WSL (Ubuntu in Windows)
To Enable WSL first, do the following:
• Install Ubuntu 18.04 LTS from Windows App Store
• Install VcXsrv from this link https://sourceforge.net/projects/vcxsrv/ or https://wiki.ubuntu.com/WSL (Advanced Topic section)
• Open XLaunch (VcXsrv) and change the Display number to 0 then hit Next and Finish the setup without changing any other settings
Use the following commands in Ubuntu terminal
sudo apt update export DISPLAY=:0 sudo apt install x11-apps (installing xeyes) use xeyes (to see if the Xserver is working) sudo apt install emacs (text editor) sudo apt-get install -y iverilog sudo apt-get install -y gtkwave
• In Ubuntu terminal, you can access your windows drives using cd /mnt/<drive>
The commands follow commands can be used to compile, run, and examine saved waveforms if any
iverilog -o <compiled_output_filename> <verilog_input_file1.v> <verilog_input_file2.v> ... vvp <compiled_output_filename> # To run gtkwave <dumpfile.vcd> # To check the waveform
Iverilog and Gtkwave native for Windows
Can be downloaded from this link - https://bleyer.org/icarus/
While installing make sure that Gtkwave is selected
If running Linux on your own computer, install iverilog
For ubuntu:
sudo apt install iverilog
sudo apt install gtkwave
If running on lab computers you can use my installation of iverilog
alias iverilog /afs/umbc.edu/users/r/o/robucci/pub/iverilog/bin/iverilog
alias vvp /afs/umbc.edu/users/r/o/robucci/pub/iverilog/bin/vvp
create a file named hello_world.v, using your favorite editor
module hello_world; initial $display("hello world"); endmodule
Verilog Simulations works by compiling a host-native binary for simulation. Do this:
iverilog hello_world.v
That creates creates a.out. Verify this by listing the directory contents:
ls
In some environments you can directly run ./a.out,
./a.out
while for others you'll use vvp:
vvp ./a.out
modify hello_world.v
module hello_world; initial $display("hello world"); reg clk; initial clk=0; always #5 clk=~clk; initial #100 $finish; initial begin $dumpfile("hello_world.vcd"); $dumpvars; end endmodule // hello_world
rerun the simulation as before
you should get a message that a waveform file has been generated:
hello world
VCD info: dumpfile hello_world.vcd opened for output.
Run gtkwave:
gtkwave hello_world.vcd
At the end of the video, the right → and left ← arrow keyboard keys are used to move the time cursor to the next and previous transitions.