Ben1152000 / sootty

A command-line tool for displaying vcd waveforms.
BSD 3-Clause "New" or "Revised" License
46 stars 12 forks source link

Sootty

Sootty is a graphical command-line tool for visualizing waveforms from hardware simulations, as a substitute for waveform visualizers like Verdi and GTKWave. It is designed with a focus on being lightweight and easy to use, and takes advantage of modern terminals’ capabilities to provide a clean graphical display. Current features include:

And here's an example of how sootty can be used directly from the terminal:

Screenshot of sootty in action

Getting Started

  1. Install sootty using pip:
pip install sootty
  1. Display a waveform file to the terminal:
sootty "waveform.vcd" -o > image.svg

Optional arguments include:

*Note: For more detailed information on the query language, check out syntax.md

Examples

Below are some more examples that take advantage of some of the features sootty has to offer:

sootty "example/example3.vcd" -s "time 4" -e "acc clk == const 10" -w "clk,rst_n,pc,inst"
sootty "example/example1.vcd" -l 8 -s "Data == const 20" -w "D1,Data"
sootty "example/example2.vcd" -s "rdata && wdata == const 22" -l 10 -w "rdata, wdata" -S "save.txt"
sootty -R "save.txt"
sootty "example/example5.evcd" -b "time 9 || time 11 || after time 15 && before time 18" --btable

Running with python

Sootty can also be run from within a python program:

from sootty import WireTrace, Visualizer, Style
from sootty.utils import evcd2vcd

# Create wiretrace object from vcd file:
wiretrace = WireTrace.from_vcd_file("example/example1.vcd")

# Convert wiretrace to svg:
image = Visualizer(Style.Dark).to_svg(wiretrace, start=0, length=8)

# Display to stdout:
image.display()

# Manually convert EVCD file to VCD file:
with open('myevcd.evcd', 'rb') as evcd_stream:
    vcd_reader = evcd2vcd(evcd_stream)
    with open('myvcd.vcd', 'wb') as vcd_stream:
        vcd_stream.write(vcd_reader.read())

Note: You can view and modify the save files for the queries in the ~/.config/sootty/save directory.

Dependencies

As of the current release, Sootty can only display images in certain terminals with builtin graphics support. This currently includes the following terminal replacements:

The following external dependencies are also needed to properly display images within the terminal:

Contributing

If you are interested in contributing to this project, feel free to take a look at the existing issues and submit a PR. Beginners are encouraged to focus on issues with the "good first issue" label. This project has also been involved with Google Summer of Code through the FOSSi Foundation. Check out our project idea for GSoC '23: https://www.fossi-foundation.org/gsoc23-ideas#enhancing-the-sootty-terminal-based-graphical-waveform-viewer