Getting Around GTKWave
GTKWave is an open-source graphical waveform viewer. It opens quickly, operates on multiple operating systems, and renders multi-million-cycle simulation traces efficiently. Learning its interface commands helps engineers isolate design errors rapidly.
Launching GTKWave
Open a trace file from the command line:
gtkwave simulation.vcd
gtkwave simulation.vcd simulation.gtkw # Open with a saved configuration
The GTKWave interface contains three primary sections:
- Hierarchy Tree: Displays the module hierarchy defined by
$scopestatements in the VCD file. - Signal List: Shows the signals currently selected for display and their values at the active cursor position.
- Waveform Canvas: Displays signal transitions over time. Single-bit wires appear as square-wave traces. Multi-bit buses appear as formatted blocks containing numerical values.
To display a signal, locate it in the hierarchy tree and double-click its name.
Engineers can also drag selected signals into the signal list.
Use Shift and Ctrl keys to select multiple signals simultaneously.
Begin by adding top-level design interface ports.
Inspect internal registers only when output values show errors.
Navigating the Simulation Timeline
| Keyboard Shortcut | Operation |
|---|---|
+ or = |
Zoom in on time axis |
- |
Zoom out on time axis |
Ctrl + Scroll Wheel |
Zoom centered at mouse pointer |
Ctrl + A or F |
Zoom fit to complete simulation run |
Shift + Arrow Keys |
Scroll horizontally across timeline |
Zoom to fit the full window if the canvas view becomes disoriented.
Use Ctrl and the scroll wheel to zoom into specific clock cycles.
To jump to an exact timestamp reported by an automated test failure, type the numerical value into the top time input box and press Enter.
Measuring Intervals with Dual Cursors
Click the left mouse button to position the primary cursor.
The signal list updates to display signal values at that exact timestamp.
Hold Ctrl and click the left mouse button to position the secondary cursor.
The bottom status bar displays the time difference ($\Delta t$) between both cursors.
Use these cursors to measure critical circuit metrics:
- Clock Period: Measure the time between adjacent rising clock edges.
- Latency: Measure the interval between input changes and corresponding output responses. Divide this time by the clock period to calculate cycle latency.
- Pulse Width: Measure the active duration between the rising and falling edges of a reset pulse or control strobe.
- Setup Margin: Measure the time between data bus transitions and sampling clock edges.
Dual cursor measurements allow quick verification of timing hypotheses.
Signal Groups, Aliases, and Numerical Radix
Long hierarchical signal names clutter the waveform display. Right-click any signal name to create a short alias. GTKWave saves these aliases in the layout configuration file without modifying the underlying VCD file. Select related signals, right-click, and group them under functional labels, such as “ALU Operands” or “FSM State”. Groups can collapse into single rows to optimize screen space.
Right-click a multi-bit bus to select its numerical display radix:
- Hexadecimal: Standard format for data paths, instructions, and memory buses.
- Decimal: Recommended for counters and arithmetic addresses.
- Binary: Useful when inspecting individual control flags or one-hot vectors.
- Signed Decimal: Required when evaluating two’s-complement arithmetic.
- ASCII: Displays decoded character strings for communication protocols.
Set bus radices to hexadecimal immediately upon adding them to the display.
Saving Layout Configurations
Save organized display views using File -> Write Save File.
Store the resulting .gtkw file in the source repository beside the testbench:
project/
tb_counter.v
counter.v
Makefile
counter_sim.vcd # Generated build artifact
counter_sim.gtkw # Committed layout configuration
The save file preserves signal ordering, groupings, custom aliases, radices, and zoom settings.
Launch GTKWave with both files: gtkwave counter_sim.vcd counter_sim.gtkw.
Version-controlling layout files ensures all engineering team members inspect identical debug views.
Standard Waveform Inspection Procedure
Follow this systematic procedure when debugging a simulation failure:
- Fit the entire simulation trace to verify total run duration.
- Add clock and reset signals to confirm initialization behavior.
- Add top-level DUT output signals.
- Configure bus signals to hexadecimal radix.
- Jump to the timestamp reported by the failing test assertion.
- Zoom in to inspect the failure window.
- Add internal module registers related to the failing output.
- Measure timing intervals using primary and secondary cursors.
- Save the GTKWave layout configuration file.