openvlsi-mcp server¶
openvlsi-mcp is OpenVLSI’s Model Context Protocol server. It speaks newline-delimited
JSON-RPC over stdio using the agentsdk-cpp MCP server implementation and calls
the same openvlsilib operations as the GUI and CLI.
Build and run¶
xmake build openvlsi-mcp
Run without a project and open/create one through tools:
openvlsi-mcp
After building, run the MCP tool smoke test:
python3 tests/mcp_tools_smoke.py
It exercises drawn-schematic creation with pins and nets, parameter editing, SystemVerilog source and port inspection, mixed-signal co-simulation, simulation diagnostics, and doctor/PDK discovery.
The MCP server exposes simulation_create, simulation_update,
simulation_run, and simulation_experiment, so a client can create,
configure, sweep/corner, and run simulations without switching to openvlsi-cli. project_reload explicitly refreshes an open
project (discard=true throws unsaved in-memory changes away first); the server
also detects changes made by another OpenVLSI client before a mutation. A mutation
whose automatic save fails is rolled back to the on-disk state and reported, so
a read-only call afterwards still works. Existing text SPICE and SystemVerilog
cells can be edited with schematic_set_text.
Or open a project at startup:
openvlsi-mcp --project design/project.ovpro
openvlsi-mcp --project design/project.ovpro --recover
If the startup project has a malformed sidecar, the server starts in a degraded
state instead of exiting, reports the warning in openvlsi_version/openvlsi_doctor, and
still exposes project_open(recover=true) and project_repair. --recover
quarantines the invalid file immediately.
The process is silent on stdout except for JSON-RPC messages; diagnostic logs go to stderr.
Build fingerprint and restarting¶
openvlsi_version returns the version, git commit, build time, build type,
executable path, and feature flags. The same fingerprint is included in the MCP
instructions. Restart the MCP client after installing or rebuilding OpenVLSI:
a long-lived server keeps the binary code it loaded at process start, even when
~/.local/bin/openvlsi-mcp has been replaced.
At the start of a session, call openvlsi_version and confirm features such as
project_repair, simulation_metrics, and pdk_status.
Call openvlsi_help(topic="overview") or one of its topic variants to discover the
current workflow and exact tool names. If a required feature is missing, stop
and ask the user to rebuild/restart OpenVLSI.
Tools¶
Tool |
Purpose |
|---|---|
|
Return the OpenVLSI build fingerprint and feature flags. |
|
Return workflow topics, common tools, and example payloads. |
|
Inspect OpenVLSI PDK packages, ngspice models, OSDI setup, sections, and optional transistor probe. |
|
Build an OpenVLSI PDK package’s Verilog-A sources into the OSDI cache. |
|
Create and open a project file. Refuses to replace an existing project unless |
|
Open a project; without |
|
Reload the current project from disk; requires |
|
List schematics, layouts, layers, simulations, simulation scripts, and trusted packages. |
|
Return validation diagnostics. |
|
Add or remove a project-local package trust entry. Trusted packages may execute package-owned code such as procedural-layout device generators. |
|
Recover a project and save it after quarantining invalid files. |
|
Move through project history. |
|
Inspect Python, ngspice, PDK readiness, model libraries, and optional schematic/simulation model includes. |
|
Create a schematic cell; use |
|
List schematic cells and their symbol/instance/net counts. |
|
Read cell parameters, symbols, pins, instances, instance parameters, and nets. |
|
Set or create a drawn-schematic parameter used by |
|
Remove a schematic cell parameter by name. |
|
Create a text SPICE schematic. |
|
Replace a text SPICE or SystemVerilog cell source and reconcile placed hierarchical symbols. |
|
Create a SystemVerilog source cell for digital HDL simulation. |
|
Parse a SystemVerilog cell and return its module name, port directions, widths, and real flags. |
|
Create a resistor, capacitor, source, ground, or device with a generated symbol and pins. |
|
List primitive and PDK symbols with pins and defaults. |
|
Add multiple components and nets atomically. |
|
Validate connectivity, values, PDK setup, and mixed-signal hierarchy. |
|
Create a text SPICE cell or a drawn R/C/L/V/I/D schematic from SPICE. Text imports retain subcircuit ports and parameter defaults. |
|
Generate a symbol from a text SPICE subcircuit’s ports and place it. |
|
Inspect or delete a schematic; |
|
Add a symbol; known library names auto-load artwork and pins. Custom symbols may pass |
|
Add a pin to an existing symbol. |
|
Connect two or more pin ids or |
|
Return the SPICE netlist generated from a schematic. |
|
Wrap selected instances into a generated hierarchical child block. |
|
Place a symbol instance by id or symbol name. |
|
Generate a symbol from a SystemVerilog module’s ports and place it. Use |
|
Set or create an instance parameter such as |
|
Validate HDL instances, pin/port mapping, nets, buses, and mixed-signal support. |
|
Introspect the live Python layout API: classes, methods, signatures, docs, examples, and PDK device names. |
|
Preflight-validate a procedural script without executing package code; reports API and workflow errors. |
|
Create a static layout cell; accepts optional |
|
Create a procedural layout and optionally generate it immediately. |
|
Run a procedural layout script and replace its read-only generated child. |
|
Read a procedural layout script and its generation hashes/stale state. |
|
Review stored quality, plan, and review metadata against optional utilization, gap, composition, and plan requirements. |
|
Replace a procedural layout script without regenerating. |
|
Set a procedural layout parameter value without regenerating. |
|
Generate a layout from a schematic; accepts an optional |
|
List static and procedural layouts; supports |
|
Import and merge a GDSII/OASIS stream into the open project. |
|
Import and merge a LEF macro into the open project. |
|
Delete a static or procedural layout, blocked when referenced; |
layout_regenerate returns structured layout_quality, layout_plan, and
layout_review objects in addition to generation_log. Procedural scripts use
layout.plan(...) and layout.finish_placement() to make the compaction target
a hard pre-routing gate, and layout.review(...) for the independent review
step. layout_review applies optional thresholds to the stored metadata without
regenerating. Use openvlsi_help(topic="analog-layout") for the full workflow.
| layout_add_layer | Add a layout layer with optional GDS datatype/purpose. |
| layout_add_rectangle | Add a rectangle shape. |
| layout_add_text | Add text to a layout cell on a layer. |
| layout_add_polygon | Add a polygon shape. |
| layout_add_port | Add a layout port with required layer, direction/side/label metadata, and optional net. The layer drives routing. |
| layout_list_ports | List ports and nets for a layout cell. |
| layout_update_port | Update port geometry, direction, label, visibility, lock state, or net. |
| layout_remove_port | Remove a layout port. |
| layout_add_net | Create a layout net. |
| layout_assign_port_net | Assign or clear a port’s net. |
| layout_add_instance | Instance another layout cell. |
| layout_duplicate | Duplicate layout shapes with optional offsets while preserving path segments and vias. |
| layout_array | Repeat layout shapes by row/column pitch. |
| layout_arrange | Align or distribute layout shapes. |
| layout_bind_device | Bind a planned device or layout instance to a schematic instance. |
| layout_unbind_device | Clear a layout device’s schematic link. |
| layout_device_links | List authored schematic-to-layout device links, including stale and duplicate status. |
| layout_link_schematic | Link an existing layout cell to an existing schematic cell. |
| layout_unlink_schematic | Remove the cell-level schematic link from a layout. |
| layout_info | Read a layout cell’s ports, nets, instances, and shape count. |
| layout_connectivity | Extract nets from explicit layout nets, same-layer geometry, and via/contact overlaps. |
| layout_export_gds | Export a layout cell to GDSII or OASIS, including ports and labels. Instance hierarchy is preserved unless flatten=true; GDSII and OASIS are written natively. |
| layout_export_lef | Export ports as a minimal LEF macro. |
| layout_export_def | Export ports and nets as a minimal DEF design. |
| layout_import_def | Import a routed DEF into the open project as a layout cell. |
| implementation_create | Create an RTL-to-GDS run for a PDK/stack with sources, source cells, SDC, floorplan, and execution policy. |
| implementation_update | Edit a run’s configuration and invalidate the selected and later stage checkpoints. |
| implementation_list | List implementation runs with stage status and result layout ids. |
| implementation_status | Return stage states, artifacts, tool versions, and metrics. |
| implementation_toolchain | Report the resolved OpenROAD, Yosys, and KLayout executables. |
| implementation_prepare | Prepare the run directory, copied RTL/SDC, Yosys scripts, and stage scripts. |
| implementation_run | Execute Yosys/OpenROAD stages synchronously; supports from/to and a per-stage timeout. |
| implementation_map | Technology-map the synthesized netlist with Yosys and Liberty files. |
| implementation_log | Return the bounded log for a stage, optionally as the last N lines. |
| implementation_cancel | Signal the OpenROAD/Yosys process recorded for a run. |
| implementation_import_layout | Create a reusable read-only digital device from the final GDS/OASIS, including top-level DEF pins and pin nets when available; a missing stream is an error. |
| implementation_export_gds | Stream the newest DEF plus standard-cell GDS decks to a merged final GDS through KLayout. |
| implementation_delete | Delete a run and optionally purge its build/impl/<run> directory. |
| drc_run | Export a layout, run the package DRC deck (KLayout or gdscheck), and return normalized DRC violations. |
| lvs_run | Compare a layout against a drawn, text SPICE, or SystemVerilog schematic and return device, net, and port correspondence plus mismatches. |
| pex_run | Extract planned, placed, and PDK-rule polygon devices plus first-order parasitics, then create or update a text SPICE schematic named <layout> PEX. |
| simulation_create | Create a simulation and its first graph; supports transient, DC, AC, OP, noise, transfer-function, mixed, and digital analyses. |
| simulation_update | Update analysis fields, corners, sweeps, Monte Carlo settings, capture signals, and declarative measurements. |
| simulation_run | Run the nominal simulation and store a run artifact. |
| simulation_experiment | Run configured sweeps, corners, and Monte Carlo samples and return one result per variant. |
| simulation_corner_defaults | Populate TT/FF/SS-style corners declared by the active PDK. |
| simulation_trace | Return decimated waveform samples for named signals. |
| simulation_result | Read the latest stored run with trace statistics and signal diagnostics. |
| simulation_signals | List available signals and trace sizes from the latest stored run. |
| simulation_measure | Measure crossings, frequency, amplitude, RMS, settling time, or evaluate gain, bandwidth, phase_margin, slew_rate, settling_time, and power. |
| simulation_graph_create | Add a graph definition to a simulation; accepts view, derived traces, overlays, and markers. |
| simulation_graph_list | List graph definitions. |
| simulation_graph_info | Read one graph definition. |
| simulation_graph_update | Update axes, signals, limits, FFT/dB/phase view, derived traces, run overlays, or markers. |
| simulation_graph_delete | Delete a graph while keeping the last one. |
| simulation_runs | List stored runs with run id, variant, and creation time for overlay selection. |
| simulation_waveform | Return analyzed series for a stored run, including derived expressions, dB/phase view, or FFT spectra. |
| simulation_delete | Delete a simulation and all its graph definitions. |
| simulation_script_create | Create a simulation script from a template or supplied source. |
| simulation_script_list | List project-level simulation scripts. |
| simulation_script_read | Read simulation script metadata and Python source. |
| simulation_script_write | Replace simulation script source. |
| simulation_script_run | Run a script and return output plus generated graphs. |
| simulation_script_delete | Delete script metadata; the file remains. |
project_summary, schematic_info, and layout_list accept optional limit
and offset arguments. Each returned collection reports its total and whether
another page exists. The openvlsi://project/summary resource accepts the same query
parameters, and openvlsi://project/json accepts ?offset=&limit= for byte-range
chunks with total_bytes and next_offset.
Destructive tools accept dry_run where applicable: schematic_delete,
layout_delete, simulation_delete, simulation_script_delete, and
implementation_delete report what would be removed without changing the
project. A blocked layout or schematic delete returns deleted: false,
blocked: true, and the referencing instances.
Cells, layers, simulations, graphs, and simulation scripts may be referenced by
name or numeric id. Coordinates are integer database units. Layout tools expose
the cell’s pdk and stack; layout_create and
layout_create_from_schematic accept an optional stack (for example
"3LM_1TM"), defaulting to the package’s default_stack. Instances must use
the same PDK and stack as their parent layout. lvs_run accepts a
layout name or id and an optional schematic; when the schematic is omitted, OpenVLSI
infers it from planned-device links or matching layout/schematic names. The
schematic may be drawn, text SPICE, or a structural SystemVerilog source cell.
Parsed SPICE subcircuits and includes are flattened recursively. Gate-level
SystemVerilog instances and primitives are compared device by device;
behavioral RTL is rejected rather than compared as ports only. Layout
connectivity combines planned metadata with shapes, routed paths, vias, and
placed-device port overlaps, and m= multiplicity is expanded before matching.
lvs_run returns summary, devices, nets, and ports arrays. Device
matches report linked, name, or topology, include both typed object refs,
parameter comparisons, and pin-to-net mappings. Mismatches carry typed
schematic_ref/layout_ref, an optional hint, and up to three candidate
objects. layout_device_links lists the authored links and marks stale or
duplicate ones; layout_bind_device and layout_unbind_device edit them.
layout_link_schematic associates an existing layout with an existing
schematic cell and layout_unlink_schematic removes that cell-level link.
layout_info reports the linked schematic as schematic_cell and schematic.
pex_run accepts a layout plus optional coefficient overrides
(metal_sheet_resistance, poly_sheet_resistance,
diffusion_sheet_resistance, via_resistance, area_capacitance,
perimeter_capacitance) and an optional name for the generated text cell.
It extracts placed device-library instances by default; set
extract_placed_devices=false to skip them. It also recognizes polygon devices
through the PDK’s technology/extraction.json; set extract_polygon_devices=false
to disable that pass, or extraction_rules_path to override the package file.
Net resistance is an effective value from a series/parallel conductor graph;
parallel conductors and via arrays at one location combine instead of adding
in series. If no layout devices are recognized, it copies the inferred source schematic
netlist by default; set include_linked_schematic=false to emit only the
extracted RC network. The response includes devices, devices_from_layout,
and devices_from_schematic.
A drawn schematic can be created and connected entirely through MCP:
schematic_add_symbol can create a symbol with its pins, schematic_add_instance
accepts either symbol_id or symbol, and schematic_add_net accepts pin ids
or readable names such as I1.Y and I2.A. Use schematic_info to inspect the
result and schematic_netlist to check the generated SPICE. Duplicate symbol
names and duplicate pin names are rejected.
simulation_run returns the state, error, netlist context, x-axis, scalars,
trace statistics, declarative measurement results, and available signal names.
Configure AC/DC/noise/TF analysis fields, corners, sweeps, Monte Carlo, and
measurements with simulation_update, then use simulation_experiment to run
every variant. simulation_corner_defaults reads the active PDK’s declared
TT/FF/SS sections. simulation_runs lists stored run ids for comparison;
simulation_graph_update can set view (linear, db, phase), fft,
derived_traces, overlays, and markers on a graph. simulation_waveform
returns the same analysis numerically, including FFT magnitude/phase and
derived math channels, without rerunning the circuit. A simulation that points
at a SystemVerilog cell uses the iverilog simulator and digital analysis
automatically; the result
traces come from the generated VCD, and empty capture/graph selections are
filled from the first traces and saved. If ngspice or a PDK library cannot initialize, run
openvlsi_doctor with the schematic or simulation name to validate model includes
and PDK readiness before editing the circuit. simulation_result and
simulation_signals read the latest stored run without requiring shell access
to build/. simulation_measure computes min/max/mean/RMS, zero crossings,
rising crossings, period, frequency, amplitude, and settling time for one or all
captured signals. Pass metric="gain", "bandwidth", "phase_margin",
"slew_rate", "settling_time", or "power" for a one-off declarative check.
Measurements declared on the simulation are evaluated automatically after every
run.
A successful transient run is not proof of oscillation. Use
simulation_measure and report the measurements before claiming that an
oscillator works.
PDK readiness¶
Simulation PDKs come from OpenVLSI packages only. Volare, CIEL, PDK_ROOT, PDK,
and global ~/.spiceinit files are not used.
openvlsi_doctor now includes per-PDK readiness, and pdk_info returns the package
name/version, exact ngspice model directory, .lib sections, OSDI files,
OpenVAF availability, ordered recommended_setup lines, and example devices.
pdks_ready is true when at least one installed PDK package is ready;
all_pdks_ready is true only when every installed package is ready. When a
project uses a PDK that is not simulation-ready, openvlsi_doctor returns ok: false
with a pdk_hint naming the missing pieces. Pass probe: true to openvlsi_doctor
to run a minimal transistor load check. Do not replace a transistor-level
request with a behavioral model silently; report the blocker and ask the user.
OSDI PDKs need a one-time local build:
pdk_build pdk="ihp-sg13g2"
This compiles the package Verilog-A sources into the OpenVLSI OSDI cache. OpenVLSI then
loads those files explicitly for each simulation; no global .spiceinit is
needed.
For IHP SG13G2, the correct model entry is a top-level call such as:
.lib "<package>/simulation/ngspice/models/cornerMOSlv.lib" mos_tt
not .include cornerMOSlv.lib. Sky130 and GF180 use different layouts
(sky130.lib.spice with .option scale=1u, and design.ngspice plus
sm141064.ngspice); pdk_info returns the ordered recommended_setup lines and
example device names. Use pdk_info with probe: true for an explicit
transistor-level load check.
Source schematics¶
Use schematic_create with kind: "text" (or schematic_create_text) when a
text SPICE cell is intended. Use
kind: "systemverilog" or schematic_create_systemverilog for a digital HDL
cell. Do not create a drawn cell and then write its sidecar by hand.
schematic_set_text replaces the source of an existing text SPICE or
SystemVerilog cell; pass kind only when its language must be explicit. It can
also convert an empty drawn cell when called with convert: true; non-empty
drawn cells are rejected. A source cell cannot switch between SPICE and
SystemVerilog in place. Parent symbols generated from that cell are reconciled
by pin name; removing a pin that is still connected fails instead of changing
connectivity silently. Pass source_path to retain relative SPICE include
resolution.
SystemVerilog cells are simulated with Icarus Verilog and the digital
analysis. simulation_create selects those defaults for such a cell, and
simulation_run returns VCD-derived traces. If the testbench does not create a
VCD, OpenVLSI adds a wrapper that dumps the design. Source-level $dumpfile and
$dumpvars calls are respected.
Mixed-signal schematics¶
kind: "systemverilog" cells are digital blocks. Place one in a drawn
schematic with schematic_add_hdl_instance; OpenVLSI parses the module ports and
generates a box symbol with matching pins. schematic_add_symbol also
auto-generates pins and artwork when it is given a SystemVerilog source_cell
without an explicit pins array. HDL instances may be nested inside drawn
subcells; mixed-signal planning flattens those drawn blocks and gives nested
signals scoped node names. Connect pins with readable names such as
U1.in and U1.out via schematic_add_net. Set analog instance values with
schematic_set_parameter, for example resistance="1k" or
value="PULSE(0 1 5n 1n 1n 20n 40n)". A drawn cell can also declare parameters
with schematic_set_cell_parameter; components use them as {R} values. When
the cell is placed as a hierarchical block, its parameters become subcircuit
params: defaults and matching parameters on the block instance override them:
schematic_set_cell_parameter(cell="divider", name="R", value="1k")
schematic_set_parameter(cell="divider", instance="R1", name="resistance", value="{R}")
schematic_set_parameter(cell="top", instance="X1", name="R", value="2k")
schematic_info returns both parameters on the cell and each instance’s
parameters.
Call schematic_hdl_ports to inspect the parsed module and
schematic_validate_hierarchy to check pin/port names, missing nets, bus
widths, inout ports, and duplicate output drivers. HDL instances may be
nested in drawn subcells; mixed-signal planning flattens the drawn path and
reports scoped instance names. Pure SPICE netlisting (schematic_netlist, or
analog simulation_run) rejects hierarchical SystemVerilog blocks explicitly
instead of silently dropping them.
A drawn schematic containing HDL blocks is detected as mixed-signal.
simulation_create selects simulator="mixed" and transient analysis
automatically. Mixed simulation iterates ngspice and Icarus Verilog:
digital outputs drive PWL sources in the analog deck, analog input nodes are
sampled through a logic threshold, and the loop stops when sampled input bits
stabilize. Results contain analog node traces plus <instance>.<port> digital
traces. real input/output ports are bridged without thresholding, and buses
can be flattened into pins such as data[0] with bus_mode="flatten". HDL
instances may be nested inside drawn subcells; planning flattens the drawn
hierarchy and uses scoped instance names such as U1_U2. inout ports and
unflattened buses are rejected explicitly.
simulation_run returns analog_signals, digital_signals, the applied
pdk_setup, current graphs, hints, and suggested_calls. If a requested
probe uses analog syntax for a digital port, for example v(U1.pwm_out), the
hint tells you to use U1.pwm_out instead.
Digital RTL-to-GDS flow¶
Use schematic_create_systemverilog (or schematic_create with
kind: "systemverilog") for RTL and testbench cells. A cell may contain both a
design and its testbench; the module containing $dumpfile/$dumpvars is
preferred as the simulation top. A testbench cell may also instantiate modules
defined in other project SystemVerilog cells; simulation_run follows those
references and compiles the combined source. simulation_create selects
iverilog and the digital analysis for these cells, and simulation_run
returns VCD-derived traces.
An implementation run drives the same project model through elaboration, synthesis, floorplan, placement, CTS, routing, and final:
implementation_create(name="top_impl", top="top", pdk="sky130",
source_cells=["top"], sdc="constraints/top.sdc",
utilization=0.45, timing_driven=true)
implementation_run(run="top_impl")
implementation_status(run="top_impl")
implementation_log(run="top_impl", stage="routing", tail=80)
implementation_import_layout(run="top_impl") # adds "top_impl device" under Layout > Devices
implementation_export_gds(run="top_impl")
# Create a layout and instance the device before running DRC.
implementation_run defaults to synthesis through final. If the mapped
netlist is missing when floorplan starts, OpenVLSI runs the Yosys technology map
automatically; implementation_map remains available for an explicit export.
implementation_status returns stage states, artifacts, tool versions, and
metrics, including OpenROAD timing and power keys. implementation_update
edits a run and invalidates the selected from stage and every later stage.
The final stage attempts a KLayout merge of the routed DEF with the platform
standard-cell GDS decks and records final/6_final.gds; the package
layer_map keeps DEF geometry on the PDK’s real GDS layers. Missing KLayout or
GDS decks produce a warning, and implementation_export_gds can rerun the
export.
drc_run exports the layout, invokes the deck or declared gdscheck process in
<package>/technology/drc.json, and returns normalized violations. Packages
without a DRC configuration fall back to a generic identifier normalization,
not a PDK-specific process table. Optional engine and deck arguments
override the package deck, and suite selects a named variant. The response
includes engine, deck, and suite. DRC and LVS results are
separate from physical-flow route DRC metrics in implementation_status.
Resources¶
URI |
Contents |
|---|---|
|
JSON summary of the open project. |
|
Simulation script metadata and Python sources. |
|
Canonical serialized project JSON. |
|
Validation diagnostics. |
Dependencies¶
openvlsi-mcp is built against the bundled third_party/agentsdk-cpp submodule as a
shared libagentsdk library. Initialize the submodule with
git submodule update --init --recursive; the installed executable loads the
library from the installation’s lib directory.