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.2.0.tar.gz (234.4 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.2.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (658.8 kB view details)

Uploaded PyPymanylinux: glibc 2.17+ ARM64

tsunami_wave-0.2.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (661.1 kB view details)

Uploaded PyPymanylinux: glibc 2.17+ ARM64

tsunami_wave-0.2.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (655.8 kB view details)

Uploaded CPython 3.12+manylinux: glibc 2.17+ ARM64

tsunami_wave-0.2.0-cp312-abi3-macosx_11_0_arm64.whl (597.3 kB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

tsunami_wave-0.2.0-cp312-abi3-macosx_10_12_x86_64.whl (614.7 kB view details)

Uploaded CPython 3.12+macOS 10.12+ x86-64

tsunami_wave-0.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (669.1 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

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

File metadata

  • Download URL: tsunami_wave-0.2.0.tar.gz
  • Upload date:
  • Size: 234.4 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.2.0.tar.gz
Algorithm Hash digest
SHA256 0a31ad7f26bc05797856790e636c8bbdbbfafba09217184c39e37448debf54fc
MD5 cfe7e4a916fe2a3998f1f88a1592727c
BLAKE2b-256 309208db74824fd8e6f7b73ccd5f5ff7b1a07ecd4a54b02aa4497a01d45943e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for tsunami_wave-0.2.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.2.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for tsunami_wave-0.2.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a7917ad2772142eeb7e46c73ab5f15522411a7399d59a19ef1ffcf33a62dfd40
MD5 a7f02de96f1312f3d6de363bf7f741ce
BLAKE2b-256 70711963a17a9cd3661b62c3b30041380f63b8c6c2fb3c2f263ffa0e768931df

See more details on using hashes here.

Provenance

The following attestation bundles were made for tsunami_wave-0.2.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.2.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for tsunami_wave-0.2.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9aacb5163a34c13d88247434c35be876edf3aa41250575f204451da23885d466
MD5 d76a4eac3fe262fca1c75a5352ca6b42
BLAKE2b-256 eea1653cffdda158686457ad10fa8f3a41b934ea45f103741dcc41f49502c392

See more details on using hashes here.

Provenance

The following attestation bundles were made for tsunami_wave-0.2.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.2.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for tsunami_wave-0.2.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8249082094570e810d1f4f96f1bc9ae04047a12669cf283a37e050cd75394cd1
MD5 87757ab2b57a9b479f5f359f90276166
BLAKE2b-256 e48c66f216be7af92e2f0692f8fbdf2a0c62cd3e95f6826ed3285b6e503800f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for tsunami_wave-0.2.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.2.0-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for tsunami_wave-0.2.0-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a694a515264672087e9692dd5d43782cc6fb161dd44a8ca9a51f38805554c0f2
MD5 36557f7f19370e0ba11417672b266081
BLAKE2b-256 60bb19641b79c3e1592582817a0ec3e2646ab0f949f0c11e73a91ad7abf98569

See more details on using hashes here.

Provenance

The following attestation bundles were made for tsunami_wave-0.2.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.2.0-cp312-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for tsunami_wave-0.2.0-cp312-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c97e5451375c506b4a068c9263858b1f6d6edf19cf5334176f7bb6c4a827022c
MD5 89a760173e5033b51044039b6427e266
BLAKE2b-256 aeac93cc8db847badec21fbddca34c8ce825a9d9d29613411bc1acfab53df975

See more details on using hashes here.

Provenance

The following attestation bundles were made for tsunami_wave-0.2.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.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tsunami_wave-0.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d74f51c309506b991c0343567b892a202c5bc879d1fd5b660be34d977d7c8fb6
MD5 05cd8c327d4e2580029eec880ee81ce9
BLAKE2b-256 fd4f5a9bce3d272daa6677a017e690867f688042d9c12844009b992ae36d9acb

See more details on using hashes here.

Provenance

The following attestation bundles were made for tsunami_wave-0.2.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