Skip to content

Simulators and waveform viewers

SystemVerilog Studio runs your tools from Run | Edit Configurations: click + and choose SystemVerilog Studio, then one of

Configuration What it runs
Verilator Lints the design, or builds a simulation and runs it
Icarus Verilog The same with iverilog and vvp
Waveform Viewer Opens a .vcd / .fst file in Surfer, GTKWave or another viewer
Emacs verilog-auto Expands the /*AUTO*/ comments of verilog-mode in a file

The output appears in the Run tool window. It starts with each command line the configuration runs, and ends with the exit code. Stop ends the tool (if it ignores that, Stop again offers to kill it); a run stopped between two steps (after the build, before the simulation) ends with exit code 130. Settings that cannot work — a tool that is not found, a missing file or directory — are reported in the configuration dialog before anything runs.

A location in the output — file:line or file:line:column — is a link: click it to open the file at that line and column. This covers the messages of Verilator (%Error: rtl/top.sv:12:5: …, %Warning-WIDTHEXPAND: rtl/counter.sv:18:17: … and the indented related locations below them), Icarus Verilog (rtl/top.sv:12: error: …) and most other tools.

  • A relative path starts at the directory the tool ran in.
  • In any other console of the IDE (a shell script or Makefile configuration, for example), absolute paths are links too.
  • Only files that exist are linked. Paths that contain spaces are not recognised.

Both run on a compile file (.f): the list of sources, +incdir+ and +define+ options that you also give the simulator on the command line. It is passed to the tool with -f.

Setting Meaning
Executable Empty: verilator / iverilog found on the PATH. A path (relative paths start at the project directory) or a name to look up on the PATH.
Action Lint, Build or Build and run.
Compile file (.f) Empty: the project’s compile file, as set (or picked automatically) in Settings | Languages & Frameworks | SystemVerilog — see Conditional compilation. The file must be on the local disk.
Working directory Where the tool runs, and where the relative paths in the compile file start. Empty: the working directory of those settings (when the project’s compile file is used), else the directory of the compile file.
Top module Verilator --top-module, Icarus -s. Empty: the tool finds it.
Options More options for the tool, e.g. -Wall or --trace.
Simulation arguments For Build and run: passed to the simulation, e.g. +seed=1.

The Extra defines of the SystemVerilog settings are passed as -DNAME[=value], so the tool sees the macros the editor uses.

What each action runs, in the working directory:

Action Verilator Icarus Verilog
Lint verilator --lint-only … -f sim.f iverilog -g2012 -t null … -f sim.f
Build verilator --binary -j 0 -o Vsim … -f sim.f iverilog -g2012 -o sim.vvp … -f sim.f
Build and run the build, then obj_dir/Vsim with the simulation arguments the build, then vvp -n sim.vvp with the simulation arguments
  • Icarus Verilog compiles SystemVerilog 2012 (-g2012) unless Options choose another language generation (the last -g wins). vvp is taken from the directory of iverilog, else from the PATH; with -n, Stop and $stop end the simulation instead of waiting at vvp’s prompt.
  • Build and run runs the simulation only if the build succeeds. Do not change Verilator’s -o or --Mdir for it: the simulation is expected at obj_dir/Vsim.
  • Build needs Verilator 5 (--binary); Verilator builds with the C++ compiler and make it finds, as on the command line.

Opens Waveform file (a .vcd, .fst, … file; a relative path starts at the project directory) with viewer [options] file. With Viewer executable empty, Surfer is used if it is on the PATH, else GTKWave; any other viewer that takes the file as its argument works too. Viewer options go before the file, e.g. --save session.gtkw for GTKWave.

Runs emacs --batch --no-site-file [-l verilog-mode.el] file -f verilog-batch-auto, which expands the AUTOs of the file and saves it.

Setting Meaning
Emacs executable Empty: emacs on the PATH.
File Empty: the SystemVerilog file selected in the editor.
verilog-mode.el Empty: the verilog-mode that comes with Emacs.
Emacs options After --batch; --no-site-file by default.

If the file has unsaved changes, the configuration does not run (Emacs would overwrite them): save first. When Emacs is done, the editor shows the expanded file.

  • Run only: the configurations cannot be debugged.
  • A compile file that is not on the local disk (e.g. in an archive) cannot be passed to a tool.
  • Tool output locations with spaces in the path are not links.
  • The configurations are tested on macOS and Linux only.

With Verilator on your PATH:

  1. Open the sample project. Choose Run | Edit Configurations, click +, choose SystemVerilog Studio | Verilator and click OK. The Action is Lint and Compile file (.f) is empty, so the project’s compile file, sim.f, is linted.
  2. Run the configuration. The Run tool window shows the command line, …/verilator --lint-only -f …/sim.f, then Verilator’s warnings, among them %Warning-WIDTHEXPAND: rtl/counter.sv:18:17: Operator EQ expects 32 bits …, and the exit code 1.
  3. Click rtl/counter.sv:18:17: rtl/counter.sv opens with the caret on the == of line 18.