MCP server for simulation-failure debug through log parsing and waveform analysis
- An MCP server with session state, workflow gates, and recommended tool ordering
- Path discovery for compile logs, simulation logs, and waveform artifacts
- Compile-log-driven hierarchy building and source-aware driver correlation
- VCD and FSDB waveform backends with signal search
- Failure-centric recommendations, structural risk scanning, and X/Z propagation tracing
- Structured output schemas designed for MCP clients
Architecture ยท Installation ยท Client Setup ยท Standard MCP Workflow ยท Tool Quick Reference ยท Testing ยท WeChat
- Architecture map:
docs/architecture.md - New-session bootstrap: read
AGENTS.mdfirst, then follow its first-read file list - Fast path for code understanding:
server.pyconfig.pysrc/analyzer.pysrc/log_parser.pysrc/fsdb_parser.py
TraceWeave/
โโโ config.py # Environment-sensitive constants and discovery rules
โโโ server.py # MCP entry point, session state, and workflow gating
โโโ custom_patterns.yaml # User-extensible log patterns
โโโ fsdb_wrapper.cpp # Native FSDB wrapper source
โโโ build_wrapper.sh # Builds libfsdb_wrapper.so
โโโ scripts/ # Utility scripts such as link_verdi_runtime.sh
โโโ tests/ # Unit and integration tests
โโโ src/
โโโ path_discovery.py
โโโ compile_log_parser.py
โโโ tb_hierarchy_builder.py
โโโ vcd_parser.py
โโโ fsdb_parser.py
โโโ fsdb_signal_index.py
โโโ log_parser.py
โโโ analyzer.py
โโโ signal_driver.py
โโโ structural_scanner.py
โโโ x_trace.py
โโโ cycle_query.py
โโโ schemas.py
โโโ problem_hints.py
TraceWeave requires Python 3.11+.
pip install mcp pyyaml --userFor FSDB support, one of these runtime sources must be available:
- Repo-local runtime:
third_party/verdi_runtime/linux64/libnsys.soandlibnffr.so - External Verdi installation exposed via
VERDI_HOME/share/FsdbReader/linux64
If neither is available, TraceWeave still works, but FSDB parsing is disabled and the workflow should prefer .vcd waveforms.
Prepare the repo-local runtime:
export VERDI_HOME=/tools/synopsys/verdi/O-2018.09-SP2-11
bash scripts/link_verdi_runtime.shVerify the runtime can be loaded:
python3 -c "
import ctypes
d = 'third_party/verdi_runtime/linux64'
ctypes.CDLL(d + '/libnsys.so', ctypes.RTLD_GLOBAL)
ctypes.CDLL(d + '/libnffr.so')
print('FSDB runtime load OK')
"Any MCP client that supports stdio transport can connect to this server. The minimum configuration is:
- command:
python3.11 - args:
["/home/robin/Projects/mcp/TraceWeave/server.py"] - env: provide either repo-local
third_party/verdi_runtime/linux64orVERDI_HOMEif FSDB support is required
If the client supports server instructions, it can follow the built-in workflow directly. Otherwise, use the workflow below.
Add this to ~/.claude.json:
{
"mcpServers": {
"TraceWeave": {
"command": "python3.11",
"args": ["/home/robin/Projects/mcp/TraceWeave/server.py"],
"env": {
"VERDI_HOME": "/tools/synopsys/verdi/O-2018.09-SP2-11",
"VCS_HOME": "/tools/synopsys/vcs/O-2018.09-SP2-11",
"XLM_ROOT": "/tools/cadence/XCELIUM1803",
"PATH": "/tools/synopsys/verdi/O-2018.09-SP2-11/bin:/tools/synopsys/vcs/O-2018.09-SP2-11/bin:/tools/cadence/XCELIUM1803/tools/bin:/usr/local/bin:/usr/bin:/bin"
}
}
}
}Environment variables must be set explicitly in the config. Claude Code does not automatically source your shell profile.
Verify the connection:
claude mcp list
# Should show TraceWeave (connected)Add this to ~/.codex/config.toml:
[mcp_servers.TraceWeave]
command = "python3.11"
args = ["/home/robin/Projects/mcp/TraceWeave/server.py"]
cwd = "/home/robin/Projects/mcp/TraceWeave"
[mcp_servers.TraceWeave.env]
VERDI_HOME = "/tools/synopsys/verdi/O-2018.09-SP2-11"
VCS_HOME = "/tools/synopsys/vcs/O-2018.09-SP2-11"
XLM_ROOT = "/tools/cadence/XCELIUM1803"
PATH = "/tools/synopsys/verdi/O-2018.09-SP2-11/bin:/tools/synopsys/vcs/O-2018.09-SP2-11/bin:/tools/cadence/XCELIUM1803/tools/bin:/usr/local/bin:/usr/bin:/bin"If the file already contains other configuration, append this block instead of overwriting it.
Verify the connection:
codex mcp list
# Should show TraceWeave with Status: enabledAfter connecting either client, run a quick end-to-end smoke test:
- Start
codexorclaudeinside a project directory that contains a sim log and waveform files. - Submit a direct waveform-debug request, for example: "Call the TraceWeave MCP. Start with
get_sim_pathsto list the logs and waves for this case." - Confirm that the execution log shows actual MCP tool calls such as
get_sim_paths,parse_sim_log, andsearch_signalsโ not just shell commands reading files manually.
This is the default workflow for simulation-log and waveform debug:
- Call
get_sim_paths(verif_root, case_name?). - Choose the
phase == "elaborate"compile log. - Run
build_tb_hierarchyandscan_structural_risksin parallel on that same compile log. - If a sim log is present, call
parse_sim_log. - Use
recommend_failure_debug_next_stepsoranalyze_failure_event. - Use
search_signalsandanalyze_failureswhen you need waveform snapshots for explicit signals. - Use
explain_signal_driver,trace_x_source, orget_signals_by_cyclefor deeper investigation. - Use
get_diagnostic_snapshotat any time to inspect reusable cached session state.
Important workflow rules:
scan_structural_risksis part of the default workflow and should not be skipped unless the user explicitly asks to skip it.- Use the same
compile_logfor bothbuild_tb_hierarchyandscan_structural_risks. - Prefer
failure_events[].time_psfromparse_sim_logas the waveform time anchor. - If
fsdb_runtime.enabled == false, prefer.vcdover.fsdb.
get_diagnostic_snapshot: Read-only summary of cached session data and suggested next calls
get_sim_paths: Discover compile logs, sim logs, waveforms, simulator, and casesbuild_tb_hierarchy: Build testbench hierarchy, source grouping, and interface metadatascan_structural_risks: Scan compiled RTL/TB sources for structural risk patterns
parse_sim_log: Parse and normalize runtime failures into grouped summaries andfailure_eventsdiff_sim_failure_results: Compare two simulation runsget_error_context: Extract raw log context around a specific line
search_signals: Resolve full hierarchical signal pathsget_signal_at_time: Query a signal value at a specific timestampget_signal_transitions: Retrieve transitions for a signal over timeget_signals_around_time: Retrieve context around a failure timestampget_signals_by_cycle: Sample signals cycle-by-cycle on a clock edgeget_waveform_summary: Return waveform metadata
analyze_failures: Focus on one grouped failure and return log plus waveform contextanalyze_failure_event: Rank likely instances, source files, and signals for a specificfailure_eventrecommend_failure_debug_next_steps: Return the default next debug targetexplain_signal_driver: Trace a waveform signal back to likely RTL driver logictrace_x_source: Trace X/Z propagation upstream
Run the full test suite from the repo root:
python3.11 -m pytestRun a single file:
python3.11 -m pytest tests/test_server.pyRun a single test:
python3.11 -m pytest tests/test_server.py -k diagnostic_snapshotRecommended change flow:
- Make the code change.
- Run the relevant tests first.
- Run the full suite if the change affects shared behavior.
- Restart the MCP client so it reconnects to the updated server.
Follow the WeChat public account:


