Skip to main content

AI-assisted hardware waveform debugging tool

Project description

Tsunami

AI-assisted hardware waveform debugging tool. Tsunami provides a Rust-powered query engine (using the wellen crate) exposed to Python via PyO3, with three entry points: a Python library, an MCP server for Claude Code, and a CLI.

Requirements

  • Python 3.12+
  • Rust toolchain (rustc, cargo)
  • uv for project management

Setup

uv sync                        # Install Python dependencies
uv run maturin develop         # Build the Rust extension

Usage

CLI

# Waveform metadata
tsunami info <file.fst>

# Signal discovery (glob patterns)
tsunami signals <file.fst> "*clk*"

# Browse hierarchy
tsunami scopes <file.fst> "tb.dut"

# Point query
tsunami value <file.fst> <signal> <time>

# Transitions in a time range
tsunami transitions <file.fst> <signal> <t0> <t1>

# Multi-signal snapshot at a single time
tsunami snapshot <file.fst> <time> <signal1> <signal2> ...

# Signal summary (period, duty cycle, anomalies)
tsunami summarize <file.fst> <signal> <t0> <t1>

# Anomaly detection (glitches, gaps, stuck signals)
tsunami anomalies <file.fst> <signal> <t0> <t1>

# Start MCP server for Claude Code
tsunami serve <file.fst>

Time values accept human-readable formats: 100ps, 1284ns, 1.284us, 642cyc, or raw integers (picoseconds).

Python Library

import tsunami

handle = tsunami.open("sim.fst")
info = tsunami.waveform_info(handle)

# Discover signals
signals = tsunami.list_signals(handle, "*valid*")

# Point query
val = tsunami.get_value(handle, "tb.dut.tl_a_valid", 1_284_000)

# Transitions in a window
result = tsunami.get_transitions(handle, "tb.dut.clk", 0, 10_000_000)

# Multi-signal snapshot
snap = tsunami.get_snapshot(handle, ["tb.dut.clk", "tb.dut.reset"], 1_000)

# Summarise a signal
summary = tsunami.summarize(handle, "tb.dut.clk", 0, 10_000_000)

Predicate DSL

Compose multi-signal conditions that evaluate entirely in Rust in a single pass:

from tsunami.predicate import Signal, scope

with scope("tb.dut") as s:
    # TileLink handshake with specific opcode
    handshake = s.tl_a_valid & s.tl_a_ready & (s.tl_a_opcode == 4)

    # Rising edge detection
    rising = s.clk.rise()

    # Sequence with time window
    roundtrip = handshake >> (s.tl_d_valid & s.tl_d_ready, 50_000)

    # Negated preceded-by (protocol violation)
    spurious = s.tl_d_valid.rise().preceded_by(handshake, within_ps=50_000).__invert__()

# Scan entirely in Rust
matches = tsunami.find_all(handle, handshake, t0_ps=0, t1_ps=10_000_000)
first = tsunami.find_first(handle, rising, after_ps=0)

MCP Server (Claude Code)

Start the server:

tsunami serve sim.fst

Add to your Claude Code MCP config:

{
  "mcpServers": {
    "tsunami": {
      "command": "tsunami",
      "args": ["serve", "sim.fst"]
    }
  }
}

Available tools: waveform_info, search_signals, browse_scopes, get_snapshot, get_signal_window, find_first_match, find_all_matches, find_anomalies.

Architecture

Claude Code
    |  MCP protocol (JSON, stdio)
Python MCP Server / CLI
    |  PyO3 direct function calls
Rust query engine (_engine.so)
    |  wellen crate
FST / VCD waveform files
Layer Technology Responsibility
MCP Server Python, FastMCP Tool definitions, time parsing, auto-summarisation
Query Engine Rust, PyO3 Signal access, predicate evaluation, summarisation
Waveform I/O wellen FST/VCD parsing, memory-mapped lazy loading

Testing

uv run pytest tests/ -v

Project Structure

tsunami/
├── pyproject.toml                  # maturin build backend, uv managed
├── Cargo.toml                      # wellen + pyo3 deps
├── src/                            # Rust crate (PyO3 cdylib)
│   ├── lib.rs                      # PyO3 module entry
│   ├── query.rs                    # Core signal queries
│   ├── predicate.rs                # Expr enum, evaluation engine
│   └── summarise.rs                # Anomaly detection, period inference
├── python/tsunami/
│   ├── __init__.py                 # Public API re-exports
│   ├── _engine.pyi                 # Type stubs for Rust module
│   ├── predicate.py                # Python DSL (Expr dataclasses + operators)
│   ├── time_parse.py               # ns/us/cyc -> ps normalisation
│   ├── server.py                   # MCP server (FastMCP)
│   └── cli.py                      # CLI entry point
└── tests/
    ├── test_engine.py              # Rust engine integration tests
    ├── test_predicate.py           # DSL unit tests
    └── test_time_parse.py          # Time parser tests

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tsunami_wave-0.1.0.tar.gz (286.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

tsunami_wave-0.1.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (658.6 kB view details)

Uploaded PyPymanylinux: glibc 2.17+ ARM64

tsunami_wave-0.1.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (661.0 kB view details)

Uploaded PyPymanylinux: glibc 2.17+ ARM64

tsunami_wave-0.1.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (655.7 kB view details)

Uploaded CPython 3.12+manylinux: glibc 2.17+ ARM64

tsunami_wave-0.1.0-cp312-abi3-macosx_11_0_arm64.whl (597.2 kB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

tsunami_wave-0.1.0-cp312-abi3-macosx_10_12_x86_64.whl (614.6 kB view details)

Uploaded CPython 3.12+macOS 10.12+ x86-64

tsunami_wave-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (668.9 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

Details for the file tsunami_wave-0.1.0.tar.gz.

File metadata

  • Download URL: tsunami_wave-0.1.0.tar.gz
  • Upload date:
  • Size: 286.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tsunami_wave-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7ab4472c4e7a4a368b28de414c6507387673ba8a87110f1e7da92dde1af56ad1
MD5 9c98bee0b07346b7cd70b382b55e02e1
BLAKE2b-256 349c0ecd81cbcede6caee8f64a88795869e78c6a9bbf746e86292a96966dfa63

See more details on using hashes here.

Provenance

The following attestation bundles were made for tsunami_wave-0.1.0.tar.gz:

Publisher: release.yml on zarubaf/tsunami

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tsunami_wave-0.1.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for tsunami_wave-0.1.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c1a67c27132a4394224e3df77f43950fdb38936deebb14860c22eafd2b79de2f
MD5 d87222e4919fbe26b7569789cc928b97
BLAKE2b-256 3574d19917e83a0a0641bb88a7b827fa6351aed899d722e0c9eed285ecce6383

See more details on using hashes here.

Provenance

The following attestation bundles were made for tsunami_wave-0.1.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on zarubaf/tsunami

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tsunami_wave-0.1.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for tsunami_wave-0.1.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3d1a0c948e84558a038ac1ba2711af41b4abf2e0dcea5a1a5f4aae3155fef3c4
MD5 7a4411a0128835c90507e7ae429bdbf9
BLAKE2b-256 9872001b3ec6ead3afda479e932ee8ada8d90b5cc7c535f12cec6bcdbc0c75b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for tsunami_wave-0.1.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on zarubaf/tsunami

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tsunami_wave-0.1.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for tsunami_wave-0.1.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 47077b03e3a4bbfdac1b6c798c7042b69890473ff6914a30eb1acbe63773f463
MD5 847c1c9146b924401a08c1b5fe29fc6c
BLAKE2b-256 5e3542005437ae79bf39691070e3a0266fe145466ae7d17d5f5e13efd1b1878a

See more details on using hashes here.

Provenance

The following attestation bundles were made for tsunami_wave-0.1.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on zarubaf/tsunami

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tsunami_wave-0.1.0-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for tsunami_wave-0.1.0-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a8cb0cd9980214418b676962f41b8ff73ef3e03559077f22834d1ca707bc0aca
MD5 3dffacfd55a6f2731767c0ff0b65d985
BLAKE2b-256 f8dd3c41513929d952a7ddbe5b223d9536f34b73cc3f0f645f58203879bf76c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for tsunami_wave-0.1.0-cp312-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on zarubaf/tsunami

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tsunami_wave-0.1.0-cp312-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for tsunami_wave-0.1.0-cp312-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9403d708afe18aef2db949bfa52db7a222483ef17ef7f74cb4e3fa76d28fc135
MD5 fd1de86b1cfb9023f54272b93bd94e8b
BLAKE2b-256 fa8f03e1d77d653ccdae49e6ef9cfe05912c8b31c6e748133c62fd506460026e

See more details on using hashes here.

Provenance

The following attestation bundles were made for tsunami_wave-0.1.0-cp312-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on zarubaf/tsunami

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tsunami_wave-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tsunami_wave-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 38e5f2f7532fbdda8bb392ce29cf9a4467b94402b74fd124dc3762095f5a097f
MD5 2c5bb4e9a9cbeeab142ba9ffdc0a4c2a
BLAKE2b-256 b44b59d5f117c616f0914a6a5cfdfc7beaf10ae0a90216adcb8929d290f3c920

See more details on using hashes here.

Provenance

The following attestation bundles were made for tsunami_wave-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on zarubaf/tsunami

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page