# 🐙 TraceWeave
English · 简体中文
An MCP server for evidence-driven simulation debugging
TraceWeave is an MCP server for RTL / SoC debugging. It connects compile records, simulation logs, VCD/FSDB/FST waveforms, and RTL source to your AI assistant, helping you work from a failed simulation to the relevant time, signals, and driving logic.
Use it with Claude Code, Codex, Copilot, or another MCP client. Describe the problem in natural language and review the log lines, waveform transitions, and RTL locations the assistant finds.
The TraceWeave Premium HWE-Bench evaluation summary reports that the group with access to Premium MCP tools passed 213/240 tasks (88.75%) and the control group without those tools passed 188/240 (78.33%), a net gain of 25 tasks for the tool group. [Results by project](#traceweave-premium-on-hwe-bench)
[Use Cases](#use-cases) · [Runnable example](#try-the-axi-stream-fifo-pause-case) · [Installation](#installation) · [Client Setup](#client-setup) · [Tool Quick Reference](#tool-quick-reference) · [FAQ](#faq) · [Documentation and Feedback](#documentation-and-feedback)
## Use Cases
### Where did the simulation first go wrong, and which RTL drove it?
Start with a timeout, a scoreboard mismatch, or an X/Z value. TraceWeave uses logs and waveforms to narrow the time window, compare runs or check handshakes cycle by cycle, then follow the relevant signals back to their drivers. Review the observed transitions and available source locations to verify the explanation.
### What can I check before running a simulation?
Start with a compile log and the compiled sources. TraceWeave can flag tied ports, unconnected inputs, and constant comparisons for review. In a deep SoC hierarchy, you can look up the compiled instance and trace its drivers, loads, and connectivity paths on demand.
Supports VCS / Xcelium / Verilator simulation logs and VCD / FSDB / FST waveforms. Exported formal waveforms can also be queried; automatic artifact discovery currently supports JasperGold.
Trace signals from the waveform back to their driving logic with **Verdi NPI → Source Graph → basic static analysis**, according to available tools and query coverage. Source Graph provides semantic source analysis without a commercial license. Results retain source references, coverage gaps, and next steps so you can check the evidence before assigning a root cause.
## Try the AXI-Stream FIFO pause case
In a public `verilog-axis` FIFO revision, requesting a frame pause under backpressure makes `TVALID` drop before the receiver accepts the first beat. From the repository root, replay the original and repaired waveforms with the open-source TraceWeave tools and Python 3.11+ alone.
```bash
python3 examples/axis_fifo_pause/replay.py
```
The original trace shows the handshake violation at **75 ns**. With the example repair, the receiver accepts both beats of the first frame, the FIFO acknowledges the pause, and the second frame transfers after release. Try this prompt in an AI client connected to TraceWeave MCP.
> Use TraceWeave to debug `examples/axis_fifo_pause/recorded/before`. Which beat failed to transfer? Trace it to the RTL, fix a copy, and rerun the same testbench to verify your repair.
The repository includes the example patch. Run the command for your simulator to test the original and repaired RTL with the same self-checking testbench.
```bash
python3 examples/axis_fifo_pause/simulate.py verilator
python3 examples/axis_fifo_pause/simulate.py vcs
```
Add `--rtl /path/to/axis_fifo.v` to test your own repair. [Waveform walkthrough and upstream sources](https://github.com/gokeshenzhen/TraceWeave/blob/main/docs/workflow.md#axi-stream-fifo-pause-example)
## TraceWeave Premium on HWE-Bench
Pass counts and rates by project
| Project | Tasks | Passed without Premium MCP tools | Passed with Premium MCP tools | Gain (percentage points) | Net extra passes |
|---|---:|---:|---:|---:|---:|
| OpenTitan | 141 | 106/141 (75.18%) | 124/141 (87.94%) | +12.77 | +18 |
| XiangShan | 20 | 15/20 (75.00%) | 17/20 (85.00%) | +10.00 | +2 |
| Rocket Chip | 13 | 10/13 (76.92%) | 11/13 (84.62%) | +7.69 | +1 |
| Ibex | 26 | 24/26 (92.31%) | 25/26 (96.15%) | +3.85 | +1 |
| CVA6 | 27 | 22/27 (81.48%) | 24/27 (88.89%) | +7.41 | +2 |
| Caliptra RTL | 13 | 11/13 (84.62%) | 12/13 (92.31%) | +7.69 | +1 |
| **Total** | **240** | **188/240 (78.33%)** | **213/240 (88.75%)** | **+10.42** | **+25** |
Both groups worked on the same 240 tasks across six open-source hardware projects and could run simulations and write diagnostic scripts. HWE-Bench tests scored their final patches. [Benchmark](https://github.com/pku-liang/hwe-bench) · [Scoring protocol](https://arxiv.org/html/2604.14709v3#S4.SS1)
## Installation
Requires **Python 3.11+**. Choose the installation that fits your environment:
| Installation | Intended use |
|---|---|
| Repository | Simulation hosts with an existing Verdi installation, for FSDB, Source Graph, and optional NPI / LSF |
| PyPI | Log and VCD analysis, with optional FST and Source Graph |
### Repository Installation
```bash
git clone https://github.com/gokeshenzhen/TraceWeave.git
cd TraceWeave
export VERDI_HOME=/path/to/verdi
bash scripts/install.sh
```
The installer prepares the Python environment, Source Graph, and FSDB reader, then checks the runtime. It leaves shell startup files and MCP client configuration untouched. FSDB support builds against the Synopsys FSDB Reader SDK in `VERDI_HOME`; TraceWeave does not redistribute its headers or libraries. Use of the FSDB Reader is subject to the applicable VC Apps Access Program Agreement (or successor). NPI and KDB operations also require the appropriate EDA runtime and license from your site.
For an existing installation, start with a read-only check:
```bash
bash scripts/install.sh --check
```
### PyPI Installation
```bash
python3.11 -m pip install "traceweave-mcp[source-graph]"
traceweave-mcp --doctor
```
For logs, VCD, and basic static analysis only, install `traceweave-mcp` without `[source-graph]`. The PyPI package does not include the FSDB reader; use the repository installation for FSDB.
### Optional FST support
On Linux, install the `fst` extra in a PyPI environment and check the reader.
```bash
python3.11 -m pip install "traceweave-mcp[fst]>=2.1"
traceweave-mcp --doctor
```
For a repository installation, run these commands from the repository root using the server's Python environment.
```bash
.venv/bin/python -m pip install "pylibfst==0.2.1"
.venv/bin/python -m traceweave_mcp --doctor
```
Reconnect the MCP server and open a small `.fst` file with `get_waveform_summary`. The returned `fst_backend.version` identifies the loaded reader version. See [FST support and limits](https://github.com/gokeshenzhen/TraceWeave/blob/main/docs/architecture.md#fst-basic-reading).
## Client Setup
After a repository installation, generate a client configuration template with absolute paths:
| Client | Generate configuration template |
|---|---|
| Claude Code | `bash scripts/install.sh --print-config claude` |
| Codex | `bash scripts/install.sh --print-config codex` |
| Copilot | `bash scripts/install.sh --print-config copilot` |
These commands only print templates. Add the output to your client's MCP configuration, supply any required site EDA environment variables, and reconnect the server. See the [client configuration reference](https://github.com/gokeshenzhen/TraceWeave/blob/main/docs/architecture.md#client-configuration-reference) for complete examples.
Other MCP clients supporting stdio can use these connection settings:
| Installation | `command` | `args` |
|---|---|---|
| Repository | `/.venv/bin/python` | `["/server.py"]` |
| PyPI | `traceweave-mcp`, or its absolute path | `[]` |
If a proxy slows NPI SDK initialization and direct vendor access is available,
set `TRACEWEAVE_NPI_VENDOR_DIRECT=1` in the MCP server environment and reconnect.
[NPI proxy settings](https://github.com/gokeshenzhen/TraceWeave/blob/main/docs/architecture.md#npi-vendor-proxy-settings)
### LSF-only NPI licenses
If Verdi/NPI licenses are available only on LSF compute nodes, provide these settings to the MCP server process. Replace `digital` with your queue:
```bash
export TRACEWEAVE_NPI_EXECUTION=lsf
export TRACEWEAVE_NPI_LSF_QUEUE="digital"
```
The client must inherit or explicitly pass these variables. Project files, the TraceWeave installation, and cache directories must be visible at the same absolute paths on submission and compute nodes. See the [LSF configuration reference](https://github.com/gokeshenzhen/TraceWeave/blob/main/docs/architecture.md#lsf-only-npi-licenses) for bash / tcsh examples, client environment forwarding, and verification steps.
## Tool Quick Reference
Describe your debugging goal and let the assistant choose the tools. All tools are listed below; consult their MCP definitions for parameters and supported scope.
| Category | Tool | Purpose |
|---|---|---|
| Session and artifacts | `get_sim_paths` | Discover compile logs, simulation logs, and waveforms |
| | `get_formal_paths` | Discover JasperGold projects and exported waveforms |
| | `get_diagnostic_snapshot` | Review collected evidence and suggested steps |
| Design and source | `prepare_design_context` | Prepare a design context for on-demand queries |
| | `build_tb_hierarchy` | Explicitly build an RTL / testbench hierarchy view |
| | `get_tb_subtree` | Browse a selected instance subtree |
| | `find_tb_instance` | Find instances by path or module name |
| | `lookup_tb_files` | Find source files in the compiled input set |
| | `get_tb_file_detail` | Inspect module, interface, and class declarations |
| | `get_tb_class_hierarchy` | Browse SystemVerilog / UVM class inheritance |
| | `dump_tb_section` | Export a selected hierarchy or source section |
| | `explain_property` | Explain SVA matching, obligations, clocks, local state and directive roles |
| Logs and failures | `parse_sim_log` | Group runtime failures and extract times and summaries |
| | `get_error_context` | Read original log lines around an error |
| | `diff_sim_failure_results` | Compare failures between runs |
| | `analyze_failures` | Combine log and waveform evidence for a failure group |
| | `analyze_failure_event` | Correlate one failure with instance, signal, and source leads |
| | `recommend_failure_debug_next_steps` | Suggest investigation targets and next tool calls |
| Structure and tracing | `scan_structural_risks` | Scan text rules; check port facts and optional bit-level drivers with NPI / Slang |
| | `explain_signal_driver` | Find static drivers without a waveform. Add `wave_path` and `check_at_time_ps` for the active branch and observed values, or `state_observation` for a clocked update. Missing evidence appears in `gaps`. |
| | `find_signal_loads` | List static consumers without a waveform. Add `wave_path` and `check_at_time_ps` for active, inactive and unknown uses, or `state_observation` for sampling at a confirmed edge. |
| | `trace_signal_path` | Query structural connectivity between signals |
| | `trace_x_source` | Trace X/Z propagation and historical sampling |
| Waveform reads | `get_waveform_summary` | Inspect duration, signal counts, and timescale |
| | `search_signals` | Search for full signal paths |
| | `get_signal_at_time` | Read a value or expression at a selected time |
| | `get_signal_transitions` | Read transitions within a time window |
| | `get_signals_around_time` | Inspect multiple signals around a selected time |
| | `get_signals_by_cycle` | Sample signals or expressions on clock edges |
| Differences and timing | `diff_first_divergence` | Find per-signal first differences and ties across 2–16 dumps, or compare an explicit A/B pair |
| | `trace_divergence` | Backtrace data, control, and prior state on both sides of a difference |
| | `period` | Check periods and cadence anomalies |
| | `verify_window` | Check temporal conditions or replay a property plan at a logged failure |
| Protocols and transactions | `suggest_handshakes` | Discover valid/ready signal bundles |
| | `suggest_protocol_bundles` | Discover AHB / APB signal bundles |
| | `sweep_handshakes` | Sweep discovered AHB / valid-ready interfaces for anomalies |
| | `inspect_handshake` | Inspect stalls and hold behavior on one interface |
| | `reconstruct_transactions` | Reconstruct requests/responses, latency, and outstanding requests |
| | `resolve_packed_fields` | Resolve packed fields and verify waveform coordinates |
| | `inspect_tlul` | Inspect TL-UL handshakes and requests/responses |
| Time cursors | `cursor_set` | Name a key timestamp |
| | `cursor_list` | List session cursors |
| | `cursor_delete` | Delete a time cursor |
| EDA integration | `build_kdb` | Build and cache a Verdi KDB |
**Earlier simulation:** Save a design snapshot before updating the RTL, then trace signal connections using the historical waveform. [How to reopen it](https://github.com/gokeshenzhen/TraceWeave/blob/main/docs/workflow.md#reopen-connectivity-from-an-earlier-simulation)
## FAQ
**Can I use it without a commercial license?**
Log analysis, VCD, optional FST, lexical structural checks, and Slang / Source Graph analysis need no commercial license. Structural scans in `auto` / `deep` first try an existing KDB through NPI, which can request a license locally or through configured LSF. `fast` performs text checks only. FSDB uses your site's Verdi FSDB Reader under its applicable agreement; NPI and KDB builds require the corresponding EDA environment and license.
**Do I need simulation results for a structural scan?**
A compile or elaboration log and the RTL sources it references are enough to start scanning before simulation. Supply `top_hint` if the log does not identify a unique top. Review the reported coverage when interpreting findings such as constant tie-offs. [Scan modes and limits](https://github.com/gokeshenzhen/TraceWeave/blob/main/docs/architecture.md#structural-scan-invocation)
**Can it inspect formal waveforms?**
Yes, exported waveforms use the same readers, with automatic JasperGold artifact discovery. Property results and reachability semantics still come from your formal tool or verification context.
**Where is design data processed?**
File parsing and EDA queries run locally or on configured LSF nodes. Returned evidence enters your AI client's context. Usage telemetry is off by default and writes locally when enabled.
## Documentation and Feedback
| Learn more about | Resource |
|---|---|
| Debugging steps and tool cooperation | [Debug workflow](https://github.com/gokeshenzhen/TraceWeave/blob/main/docs/workflow.md) |
| Verifying a root cause with evidence | [Debug discipline](https://github.com/gokeshenzhen/TraceWeave/blob/main/docs/debug-discipline.md) |
| Architecture, backend capabilities, and resource limits | [Architecture](https://github.com/gokeshenzhen/TraceWeave/blob/main/docs/architecture.md) |
| Expression inputs and worked examples | [SV expressions](https://github.com/gokeshenzhen/TraceWeave/blob/main/docs/expressions.md) |
| Complete environment configuration and advanced settings | [Configuration reference](https://github.com/gokeshenzhen/TraceWeave/blob/main/docs/architecture.md#client-configuration-reference) |
| Contributing to TraceWeave | [Contributor guidelines](https://github.com/gokeshenzhen/TraceWeave/blob/main/AGENTS.md) · [Regression tests](https://github.com/gokeshenzhen/TraceWeave/blob/main/docs/architecture.md#repository-regression-tests) |
| Reporting a problem or suggesting a feature | [GitHub Issues](https://github.com/gokeshenzhen/TraceWeave/issues) |
TraceWeave is available under the [MIT License](https://github.com/gokeshenzhen/TraceWeave/blob/main/LICENSE).
## WeChat
Follow the WeChat public account for project updates and debugging examples: