Verilator MCP Server
An intelligent Model Context Protocol (MCP) server for Verilator that provides RTL simulation, automatic testbench generation, and natural language query capabilities. This tool bridges the gap between AI assistants and hardware verification, making RTL simulation more accessible and intelligent.
Features
🚀 Core Capabilities
Automatic Testbench Generation: Intelligently generates testbenches when none exist
Smart Simulation: Compile and run simulations with automatic dependency management
Natural Language Queries: Ask questions about your simulation in plain English
Waveform Analysis: Generate and analyze simulation waveforms
Coverage Collection: Track code coverage metrics
Protocol-Aware: Built-in support for standard protocols (AXI, APB, etc.)
🤖 Natural Language Examples
Simulation Control
"Run simulation on counter.v"
"Simulate my design with waveform capture"
"Execute the CPU testbench with coverage enabled"
"Compile and run my ALU module"
Testbench Generation
"Generate a testbench for my FIFO module"
"Create an AXI testbench for the memory controller"
"Make a testbench with random stimulus for my ALU"
"Generate a protocol-aware testbench for my APB slave"
Debugging & Analysis
"Why is data_valid low at 1000ns?"
"What caused the assertion failure at time 5000?"
"Show me when the reset signal changes"
"Why is my output signal X?"
"Debug the state machine transitions"
Coverage & Verification
"Show me the coverage report"
"Which code blocks are not tested?"
"How can I improve coverage for the controller?"
"Generate tests for uncovered scenarios"
Design Understanding
"Explain how the CPU module works"
"What are the inputs and outputs of the ALU?"
"Analyze timing performance"
"Show the module hierarchy"
"What's the maximum operating frequency?"
Installation
Prerequisites
Node.js 16+
Verilator 5.0+ installed and in PATH
Git
Step 1: Install Verilator
Verilator must be installed before using this MCP server.
macOS (Homebrew)
Ubuntu/Debian
From Source
Verify Installation
Step 2: Install Verilator MCP
Step 3: Configure Claude Desktop
Add to your Claude Desktop configuration file (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
Step 4: Restart Claude Desktop
After updating the configuration, restart Claude Desktop to load the MCP server.
Environment Variables
LOG_LEVEL: Set logging level (debug, info, warn, error)VERILATOR_PATH: Override Verilator installation path
Available Tools
1. verilator_compile
Compile Verilog/SystemVerilog designs to C++.
Parameters:
files(required): Array of design filestopModule: Top module nameoptimization: Optimization level (0-3)trace: Enable waveform generationcoverage: Enable coverage collection
Example:
2. verilator_simulate
Run RTL simulation with automatic testbench generation.
Parameters:
design(required): Design file or directorytestbench: Testbench file (auto-generated if missing)autoGenerateTestbench: Enable auto-generation (default: true)enableWaveform: Generate waveforms (default: true)simulationTime: Override simulation duration
Example:
3. verilator_testbenchgenerator
Generate intelligent testbenches for modules.
Parameters:
targetFile(required): Verilog file containing moduletargetModule(required): Module nametemplate: Template style (basic, uvm, cocotb, protocol)protocol: Protocol type (axi, apb, wishbone, avalon)stimulusType: Stimulus generation (directed, random, constrained_random)
Example:
4. verilator_naturallanguage
Process natural language queries about simulation.
Parameters:
query(required): Natural language questioncontext: Current simulation contexthistory: Previous query history
Example:
Resources
The server provides access to simulation artifacts through MCP resources:
simulation://[project]/logs/[sim_id]- Simulation output logssimulation://[project]/waves/[sim_id]- Waveform datasimulation://[project]/coverage/[sim_id]- Coverage reportsdesign://[project]/hierarchy- Module hierarchydesign://[project]/interfaces- Interface definitions
Testbench Generation Features
Automatic Detection
Clock and reset signal identification
Port direction and width analysis
Protocol recognition
Parameter extraction
Generated Components
Clock generation with configurable frequency
Reset sequences with proper polarity
Directed and random stimulus
Basic assertions and checkers
Coverage points
Waveform dumping
Protocol Support
Built-in templates for:
AXI (AXI4, AXI4-Lite, AXI-Stream)
APB (APB3, APB4)
Wishbone
Avalon
Custom protocols
Natural Language Query Categories
Debug Queries
Signal value analysis
Assertion failure investigation
X/Z propagation tracking
Timing relationship analysis
Analysis Queries
Performance metrics
Resource utilization
Critical path analysis
Power estimation
Coverage Queries
Coverage statistics
Uncovered code identification
Test scenario suggestions
Generation Queries
Testbench creation
Stimulus pattern generation
Assertion generation
Coverage point creation
Examples
Basic Simulation Flow
Natural Language Workflow Examples
Example 1: Complete Design Verification
Example 2: Debug Simulation Failure
Example 3: Coverage Improvement
Example 4: Design Understanding
Protocol-Based Testing
Multi-Step Conversation Example
Development
Building from Source
Running Tests
Debug Mode
Troubleshooting
Quick Diagnostics
Run the diagnostic script to check your setup:
Common Issues
Verilator not found
# Install Verilator first! brew install verilator # macOS sudo apt-get install verilator # Ubuntu/Debian # Verify installation verilator --versionServer not starting in Claude Desktop
Ensure Verilator is installed (see above)
Check paths in Claude Desktop config are absolute
Restart Claude Desktop after configuration changes
Run
./diagnose.shto check setup
Compilation errors
Check file paths are correct
Verify SystemVerilog syntax
Review error messages in logs
Testbench generation fails
Ensure module has standard port declarations
Check for unsupported constructs
Try simpler template options
For detailed troubleshooting, see TROUBLESHOOTING.md
Contributing
Contributions are welcome! Please:
Fork the repository
Create a feature branch
Add tests for new features
Submit a pull request
License
MIT License - see LICENSE file for details
Acknowledgments
Built on the Model Context Protocol by Anthropic
Powered by Verilator open-source simulator
Natural language processing using Natural library