Viewing waveforms
Generate waveforms
Waveforms are automatically generated when you run any test:waveforms/ directory:
Open waveforms
There are two ways to open waveforms:- Automatically loads the VCD file
- Applies saved signal configurations from
.gtkwfiles - Ensures consistent viewing settings
Makefile show target
Theshow_% target in the Makefile is defined as:
Configuring GTKwave for fixed-point
Tiny TPU uses Q8.8 fixed-point format (8 integer bits, 8 fractional bits). To view signals correctly in GTKwave, you need to configure the display format.Fixed-point configuration steps
Set fractional bits
Enter
8 in the dialog box and click OK.This tells GTKwave that 8 bits represent the fractional part.Set signed decimal
Navigate to: Data Format → Signed DecimalThis displays values as signed decimal numbers instead of hexadecimal.
Understanding the fixed-point format
The Q8.8 format divides a 16-bit value:- Bits [15:8] - Integer part (8 bits)
- Bits [7:0] - Fractional part (8 bits)
- Bit [15] - Sign bit
0x0100= 1.0 (256 in decimal, shifted right by 8 bits)0x0280= 2.5 (640 in decimal, 640/256 = 2.5)0xFF00= -1.0 (two’s complement)
GTKwave configuration files
What is a .gtkw file?
A.gtkw file stores your GTKwave session configuration, including:
- Which signals are displayed
- Signal grouping and hierarchy
- Display formats (hex, decimal, fixed-point, etc.)
- Time markers and zoom level
- Color schemes
Creating a .gtkw file
Configure your view
- Add the signals you want to monitor
- Set display formats (fixed-point, decimal, etc.)
- Organize signals into groups
- Adjust zoom and markers
You only need to create the
.gtkw file once per module. The make show_<MODULE_NAME> command will use it automatically.Common waveform analysis tasks
Inspecting signal values
View signal at specific time
View signal at specific time
- Click on the waveform at the desired time
- The value appears in the signal list
- Use markers (right-click → Insert Marker) for precise positioning
Measure timing
Measure timing
- Insert a primary marker (right-click → Insert Primary Marker)
- Insert a secondary marker at another time
- The time difference appears in the status bar
Compare multiple signals
Compare multiple signals
- Add all signals to the viewer
- Align them vertically
- Use the same time markers to compare values
Trace signal changes
Trace signal changes
- Right-click a signal
- Select “Search” → “Next Edge”
- GTKwave jumps to the next value change
Signal organization
For complex modules, organize signals into logical groups:- Inputs - All input signals
- Outputs - All output signals
- Control - Control signals (valid, enable, switch, etc.)
- Data Path - Data flowing through the module
- Internal State - Registers and internal signals
Debugging with waveforms
When debugging a failing test:Navigate to failure point
- Use time markers to jump to the failure time
- Examine signal values before and after the failure
- Trace backwards to find the root cause
GTKwave tips and tricks
Zoom controls
Zoom controls
- Zoom In: Click and drag right
- Zoom Out: Click and drag left
- Zoom Fit: View → Zoom → Zoom Fit
- Zoom Full: View → Zoom → Zoom Full
Signal display formats
Signal display formats
Right-click a signal and choose Data Format:
- Binary - Show individual bits
- Hexadecimal - Compact view of values
- Signed Decimal - For fixed-point values
- ASCII - For character data
- Analog - Show as analog waveform
Color coding
Color coding
- Right-click a signal
- Select “Highlight” → Choose color
- Useful for tracking specific signals
Search and navigation
Search and navigation
Example: Viewing PE waveforms
Let’s walk through viewing waveforms for the Processing Element:clk- System clockrst- Reset signalpe_input_in- Input data (configure as fixed-point)pe_weight_in- Weight data (configure as fixed-point)pe_psum_in- Partial sum input (configure as fixed-point)pe_psum_out- Partial sum output (configure as fixed-point)pe_valid_in- Valid signalpe_switch_in- Weight buffer switch
- Weights loading during setup phase
- Input data flowing through on valid cycles
- Correct multiply-accumulate results
- Proper propagation of control signals
Cleanup
To remove generated waveform files:- All
.vcdfiles inwaveforms/ - The
sim_build/directory - Test cache files in
test/__pycache__/
Next steps
Testing
Learn more about writing tests
Adding modules
Add new modules to the project