openvlsi-cli

openvlsi-cli is the headless automation surface over the same openvlsilib operations used by the GUI, Python bindings, and MCP server. Successful commands print JSON to stdout; diagnostics and logs go to stderr.

Project

openvlsi-cli project-create <folder|project.ovpro> [name]
openvlsi-cli project-info [folder|project.ovpro]
openvlsi-cli project-validate <folder|project.ovpro>
openvlsi-cli project-trust <folder|project.ovpro> <pdk|package> [trusted|untrusted]
openvlsi-cli project-repair <folder|project.ovpro>
openvlsi-cli doctor [project] [--probe]
openvlsi-cli pdk-info [pdk] [--probe]

project-create initializes project.ovpro, sch/, lay/, sim/, scripts/, build/, .gitignore, and AGENTS.md. The generated AGENTS.md is written once when the project is created and is not rewritten on later saves. project-info can omit the path: OpenVLSI uses OPENVLSI_PROJECT or searches the current directory and its parents for a single project.ovpro.

openvlsi-cli --version prints the build fingerprint as JSON, including the git commit, build time, executable path, and feature flags.

project-trust stores the package name in project.ovpro so procedural layouts in that project may execute the package’s device generators without setting OPENVLSI_ALLOW_PACKAGE_CODE. Pass untrusted to remove the entry.

Project metadata and sidecar writes are atomic and guarded by a project lock and revision check. A CLI process that loaded an older revision fails with project.changed instead of overwriting a newer save from another process.

doctor reports Python, ngspice, installed PDKs, simulation model files, and Liberty timing libraries. pdks_ready means at least one installed PDK is ready; all_pdks_ready means every installed PDK is ready. Passing a project makes doctor fail when a PDK used by the project is not simulation-ready. --probe additionally runs a minimal transistor load check. pdk-info returns the recommended .lib line, sections, OSDI and package/OpenVAF status, plus implementation readiness (implementation_ready, implementation_engine, implementation_stack, implementation_missing); its --probe flag runs the same simulation check. doctor exits with status 1 when ok is false, so scripts and agents can fail fast on a broken PDK setup.

Schematic

openvlsi-cli schematic-add-cell <project> <name> [pdk]
openvlsi-cli schematic-add-text <project> <name> [pdk] [spice-file]
openvlsi-cli schematic-add-text <project> <name> --pdk <pdk> --file <spice-file>
openvlsi-cli schematic-add-sv <project> <name> [pdk] [source-file]
openvlsi-cli schematic-set-text <project> <cell> [--kind text|systemverilog] [--source-path <path>] [--convert] <file|->
openvlsi-cli schematic-list <project>
openvlsi-cli schematic-info <project> <cell>
openvlsi-cli schematic-remove <project> <cell> [--dry-run] [--cascade]
openvlsi-cli schematic-add-symbol <project> <cell> <name> [source-cell] [--blank]
openvlsi-cli schematic-add-pin <project> <cell> <symbol> <name> [x] [y] [direction]
openvlsi-cli schematic-add-instance <project> <cell> <symbol> <name> <x> <y>
openvlsi-cli schematic-add-component <project> <cell> <type> [name] [x] [y] [param=value ...]
openvlsi-cli schematic-list-symbols [pdk] [query]
openvlsi-cli schematic-add-circuit <project> <cell> <json-file|->
openvlsi-cli schematic-set-parameter <project> <cell> <instance> <name> <value>
openvlsi-cli schematic-set-cell-parameter <project> <cell> <name> <value>
openvlsi-cli schematic-remove-cell-parameter <project> <cell> <name>
openvlsi-cli schematic-add-net <project> <cell> <name> <pin> <pin> ...
openvlsi-cli schematic-wrap <project> <cell> <instance> <instance> ... [--name <name>]
openvlsi-cli schematic-validate <project> <cell>
openvlsi-cli schematic-import-spice <project> <name> [--pdk <pdk>] [--mode text|drawn|auto] <file|->
openvlsi-cli schematic-hdl-ports <project> <cell>
openvlsi-cli schematic-add-hdl-instance <project> <cell> <source-cell> <name> <x> <y> [--flatten-buses]
openvlsi-cli schematic-add-spice-instance <project> <cell> <source-cell> <name> <x> <y>
openvlsi-cli schematic-validate-hierarchy <project> <cell>
openvlsi-cli schematic-netlist <project> <cell>   # includes the subcircuit port order

Cells, symbols, pins, and instances may be referenced by name or id. Pins can use the <instance>.<pin> or <symbol>.<pin> form. schematic-add-pin adds a pin to an existing symbol; direction accepts left, right, up, or down. schematic-set-parameter creates or updates an instance parameter such as resistance, capacitance, or a source value. schematic-set-cell-parameter declares a parameter on the schematic cell itself; component values can then use SPICE brace expressions, and hierarchical instances can override the value:

openvlsi-cli schematic-set-cell-parameter project divider R 1k
openvlsi-cli schematic-set-parameter project divider R1 resistance '{R}'
openvlsi-cli schematic-set-parameter project top X1 R 2k

The child subcircuit is emitted with params: R=1k, and the parent instance is emitted as X1 ... divider R=2k. A top-level cell’s parameters are emitted as .param cards. schematic-remove-cell-parameter removes a declaration. schematic-add-symbol loads real artwork and pins for known library names (RES, NMOS, VDD, GND, IDC, …). Use --blank only for a custom symbol whose pins you will add with schematic-add-pin.

schematic-add-component creates a primitive with a generated symbol and returns its pin ids. schematic-list-symbols lists primitive and PDK symbols. The generic Ports library includes Input, Output, and the bidirectional Pin; add a pin with openvlsi-cli schematic-add-component project divider pin P1 0 0, then connect its P1.PIN pin to the desired net. schematic-add-circuit takes a JSON object such as {"components":[{"type":"resistor","name":"R1","parameters":{"resistance":"1k"}}], "nets":[{"name":"out","pins":["R1.1","C1.1"]}]} and commits the whole circuit atomically. schematic-validate checks connectivity, component values, PDK setup, and mixed-signal hierarchy. schematic-wrap takes one or more instance names or ids, creates a child schematic containing them, generates a hierarchical block symbol, and replaces the selection with one block instance. Internal nets move into the child; boundary nets become child port instances and matching block pins. The response reports the child cell, generated symbol, parent instance, and port instance ids. --name sets the child schematic name; an existing name gets a numeric suffix.

schematic-import-spice creates a text SPICE cell, or a drawn R/C/L/V/I/D schematic with --mode drawn. --mode auto chooses drawn only when the source is a flat supported netlist. Text imports retain parsed .subckt port and parameter declarations, so the cell can be placed as a hierarchical block. Relative .include, .inc, and .lib paths are resolved against the imported file and emitted as absolute paths, so simulation and LVS do not depend on the process working directory. schematic-add-spice-instance generates a symbol from a text SPICE subcircuit’s ports and places it; instance parameters such as R=2k override the subcircuit defaults. schematic-add-symbol with a text source cell uses the same generated pins. schematic-remove --dry-run lists dependencies; --cascade removes dependent simulations and hierarchical symbols too. A blocked deletion prints deleted: false and exits with status 1. schematic-set-text replaces a text SPICE or SystemVerilog cell’s source; use --convert only for an empty drawn cell. A source cell cannot switch between SPICE and SystemVerilog in place. Generated parent symbols are updated by pin name, and removing a connected pin fails instead of silently changing connectivity. --source-path retains the base path used by relative SPICE includes.

schematic-add-text accepts either the positional [pdk] [spice-file] form or the unambiguous --pdk <pdk> --file <spice-file> form. If a file path is passed where the PDK is expected, the command accepts it as a file but warns that the cell was stored with the generic PDK; pass --pdk to preserve the intended PDK. The MCP equivalent is schematic_create with kind: "text" or schematic_create_text.

schematic-add-sv creates a SystemVerilog source cell. The optional file is stored as its source; without a file, OpenVLSI inserts a small digital block template. schematic-info and schematic-list report the systemverilog flag for these cells. schematic-info also includes each cell’s parameters array and every instance’s parameters array, including hierarchical block overrides.

schematic-hdl-ports parses a SystemVerilog cell and returns its module name, port directions, and widths. schematic-add-hdl-instance generates a symbol whose pins match those ports and places it in a drawn schematic; use schematic-add-net with names such as U1.in and U1.out to wire it. schematic-validate-hierarchy checks the resulting hierarchy, port mapping, nets, buses, and mixed-signal support before simulation.

A pure SPICE netlist rejects hierarchical SystemVerilog blocks with an explicit error instead of silently skipping them. Use mixed-signal simulation for drawn schematics that contain HDL instances; HDL blocks nested inside drawn subcells are flattened into scoped nodes during mixed-signal planning.

Layout

Layouts are bound to one PDK and one stack variant. Pass the stack as the last argument when the package declares [[pdk.stack]] entries; omitting it selects the package’s default_stack. layout-list and layout-info include the resolved stack field, and layout-info also reports it for procedural layouts. A layout instance whose child uses a different PDK or stack is rejected.

openvlsi-cli layout-add-cell <project> <name> [pdk] [stack]
openvlsi-cli layout-add-procedural <project> <name> [pdk] [script-file] [stack]
openvlsi-cli layout-regenerate <project> <procedural> [timeout-seconds]
openvlsi-cli layout-set-parameter <project> <procedural> <name> <value>
openvlsi-cli layout-create-from-schematic <project> <schematic> [layout-name]
openvlsi-cli layout-list <project>
openvlsi-cli layout-info <project> <cell|procedural>
openvlsi-cli layout-review <project> <procedural> [--min-utilization <v>] [--max-gap-um <v>] [--require-composition] [--require-plan]
openvlsi-cli layout-get-script <project> <procedural>
openvlsi-cli layout-set-script <project> <procedural> <script-file|->
openvlsi-cli layout-remove <project> <cell|procedural> [--dry-run]
openvlsi-cli layout-add-layer <project> <name> <number> [datatype]
openvlsi-cli layout-add-rectangle <project> <cell> <layer> <x> <y> <width> <height>
openvlsi-cli layout-add-text <project> <cell> <layer> <x> <y> <text> [height]
openvlsi-cli layout-add-polygon <project> <cell> <layer> <x,y> <x,y> <x,y> ...
openvlsi-cli layout-add-port <project> <cell> <name> <layer> <x> <y> <width> <height> [port options]
openvlsi-cli layout-list-ports <project> <cell>
openvlsi-cli layout-update-port <project> <cell> <port> [port options]
openvlsi-cli layout-remove-port <project> <cell> <port>
openvlsi-cli layout-add-net <project> <cell> <name>
openvlsi-cli layout-assign-port-net <project> <cell> <port> <net|none>
openvlsi-cli layout-add-instance <project> <parent> <child> <name> <x> <y> [orientation]
openvlsi-cli layout-duplicate <project> <cell> <shape> <shape> ... [--dx <n>] [--dy <n>]
openvlsi-cli layout-array <project> <cell> <shape> <shape> ... --rows <n> --columns <n> [--x-pitch <n>] [--y-pitch <n>]
openvlsi-cli layout-arrange <project> <cell> <operation> <shape> <shape> ...
openvlsi-cli layout-bind-device <project> <layout> <layout-device> <schematic> <schematic-device>
openvlsi-cli layout-unbind-device <project> <layout> <layout-device>
openvlsi-cli layout-device-links <project> <layout> [--schematic <schematic>]
openvlsi-cli layout-link-schematic <project> <layout> <schematic>
openvlsi-cli layout-unlink-schematic <project> <layout>
openvlsi-cli layout-connectivity <project> <cell>
openvlsi-cli layout-export-gds <project> <cell> <output.gds|oas> [--flatten]
openvlsi-cli layout-export-lef <project> <cell> <output.lef>
openvlsi-cli layout-export-def <project> <cell> <output.def>
openvlsi-cli layout-import-gds <input.gds|oas> <project> [port-label-layer] [--top-cell <name>] [--force]
openvlsi-cli layout-import-lef <input.lef> <project> [--force]
openvlsi-cli layout-import-def <input.def> <project> [--force]

Port options are --direction input|output|inout|power|ground, --side left|right|top|bottom, --net <name-or-id>, --label <text>, --hidden, --locked, and for updates --layer, --unlocked, --visible, --name, --x, --y, --width, and --height. A port layer cannot be cleared. Coordinates are integer database units.

layout-duplicate copies shapes by name or id. Path copies retain their centerline, per-segment layers and widths, and point vias; automatically routed copies become standalone paths. Without offsets it places the copies one selection width plus one grid step to the right. layout-array repeats the selected shapes by row and column pitch, defaulting each pitch to the selection extent plus one grid step. layout-arrange accepts left, right, top, bottom, center-horizontal, center-vertical, distribute-horizontal, or distribute-vertical. These operations are also available in the GUI and Python, and are transactional when invoked through the CLI session.

layout-device-links lists the authored schematic-to-layout device links in a layout cell. A link may be stale when its schematic instance no longer exists, or duplicate when another device of the same kind in the cell points at the same schematic instance. layout-bind-device sets the link of a planned device or placed layout instance; layout-unbind-device clears it. Bind is a normal transaction and is undoable. The layout device argument accepts a name or id; use instance:<name> or planned:<name> when both kinds share a name. Bindings must target a real schematic device: input/output/pin symbols and supply or ground instances are rejected.

layout-link-schematic associates an existing layout cell with an existing schematic cell. This is a cell-level link, separate from per-device bindings. LVS and lvs-auto prefer it over name matching and planned-device inference, and the GUI shows the linked schematic in the layout hierarchy tooltip. layout-unlink-schematic removes it. The link is persisted in the .ovlay cell file.

layout-get-script and layout-set-script read and replace a procedural layout’s Python source without regenerating it. layout-remove accepts either a static layout cell or a procedural layout; removing a procedural layout also removes its generated static child. Removal is blocked when instances reference the layout, and library cells cannot be removed. --dry-run reports the references and blocking reason. layout-add-procedural generates the default script or the supplied script immediately and reports generated, generation_error, and needs_regeneration. layout-regenerate reruns an existing script and returns structured layout_quality, layout_plan, and layout_review objects; the generated child is read-only and layout-info reports the same metadata, generation hashes, parameter values, and stale state. layout-review applies optional utilization, row-gap, composition, and plan checks to that stored metadata without regenerating the layout. layout-set-parameter edits a declared parameter without regenerating. layout-export-gds projects each visible port as a boundary plus a TEXT label on the OpenVLSI annotation stream layer when the port has no process-layer hint, and preserves reachable cell hierarchy by default; --flatten writes one structure instead. The output extension selects GDSII (.gds/.gdsii) or OASIS (.oas/.oasis); both are written natively without KLayout or an intermediate file. The response reports the exported top_cell name for external DRC/P&R tools. layout-connectivity merges objects assigned to the same layout net and geometry that overlaps or touches on the same layer; via and contact layers also connect overlapping layers, and ports connect on their associated layers. Resistor bodies marked with a *.res purpose layer (or identified by planned-device metadata) are excluded from geometric net merging so their terminals do not alias. When other unlabeled geometry joins two explicitly named nets, the group keeps the first name and lists the rest under aliases instead of dropping them. layout-export-lef and layout-export-def write minimal port metadata for place-and-route exchange. layout-import-gds creates a new project from GDSII or OASIS and preserves structures as layout cells with instances. When a port-label layer is given, matching TEXT records become ports on their containing cells. --top-cell selects a specific top structure; otherwise the last unreferenced structure is used. The JSON response includes top_cell and any import warnings. layout-import-lef and layout-import-def create a new project from a macro or design’s ports and nets. All three import commands refuse to replace an existing project unless --force is passed.

Implementation runs

implementation-* commands manage RTL-to-GDS runs. A run stores its configured top module, PDK, stack, RTL sources, constraints, and physical policy in impl/*.ovimpl; generated configuration and stage scripts are written under build/impl/<run>/.

openvlsi-cli implementation-create <project> <name> --top <module> --pdk <pdk> \
  [--stack <stack>] [--source <file>]... [--source-cell <cell>]... \
  [--sdc <file>] [--std-cell-lib <name>] [--corner <corner>] \
  [--utilization <value>] [--aspect-ratio <value>] \
  [--placement-density <value>] [--threads <n>] [--backend <name>] \
  [--die-area x,y,w,h] [--core-area x,y,w,h] [--site <name>] \
  [--io-horizontal-layers <a,b>] [--io-vertical-layers <a,b>] \
  [--macro cell,x,y[,orientation]]... \
  [--timing-driven] [--routability-driven] [--no-cts] \
  [--cts-root-buffer <cell>] [--cts-buffers <a,b>] \
  [--routing-min-layer <layer>] [--routing-max-layer <layer>] [--no-antenna-repair] \
  [--seed <n>] [--timeout <seconds>]
openvlsi-cli implementation-update <project> <run> [--from <stage>] [implementation options]
openvlsi-cli implementation-list <project>
openvlsi-cli implementation-status <project> <run>
openvlsi-cli implementation-prepare <project> <run>
openvlsi-cli implementation-run <project> <run> [--from <stage>] [--to <stage>] [--timeout <seconds>] [--verbose]
openvlsi-cli implementation-map <project> <run> [--output <path>] [--verbose]
openvlsi-cli implementation-log <project> <run> [--stage <stage>] [--tail <lines>]
openvlsi-cli implementation-cancel <project> <run>
openvlsi-cli implementation-import <project> <run> [--layout-name <name>] [--replace]
openvlsi-cli implementation-export-gds <project> <run> [--output <path>]
openvlsi-cli implementation-toolchain
openvlsi-cli implementation-delete <project> <run> [--purge] [--dry-run]

implementation-create resolves the package default stack when --stack is omitted. --source-cell refers to an existing SystemVerilog source cell in the project; --source refers to an external Verilog/SystemVerilog file. --utilization is a fraction of the core area (0.5 means 50%). --die-area and --core-area take x,y,width,height in database units; --macro may be repeated. implementation-update edits an existing run and invalidates --from (default elaboration) and every later stage. Run implementation-prepare to inspect the resolved platform, copied RTL, and generated scripts without executing an external tool. The preparation generates:

  • scripts/00-synth.ys for Yosys synthesis;

  • scripts/01-techmap.ys for technology mapping (implementation-map);

  • scripts/01-floorplan.tcl;

  • scripts/02-place.tcl;

  • scripts/03-cts.tcl;

  • scripts/04-route.tcl;

  • scripts/05-final.tcl.

implementation-run executes Yosys synthesis and then runs every physical stage through the required openvlsi-openroad helper (next to openvlsi-cli, or set through OPENVLSI_OPENROAD_HELPER), which uses the OpenROAD C++ APIs instead of generated Tcl. The Tcl stage scripts are still written for inspection, but they are not executed. The same helper provides read-only ODB tooling (openvlsi-openroad odb-info, openvlsi-openroad odb-preview) and native heat-map CSV export (openvlsi-openroad heatmap --kind placement|routing|power|pin|rudy|irdrop). It is built with xmake build openvlsi-openroad (also pulled in by openvlsi, openvlsi-cli, and openvlsi-mcp on Linux) from the pinned OpenROAD/OpenSTA revisions; use scripts/build-openvlsi-openroad.sh --sdk-install <prefix> for an SDK install. See openroad_sdk/README.md. The helper is Linux-only by default; on Windows and macOS build with OPENVLSI_ENABLE_OPENROAD=0, which leaves the physical implementation commands unavailable but keeps schematics, layout editing, simulation, packages, and MCP fully functional. Yosys synthesis is technology-independent and writes the generic synth/1_synth.v netlist. implementation-map then maps it to the platform standard cells with dfflibmap/abc, writes synth/2_tech_map.v, records logs/01-techmap.log and scripts/01-techmap.ys, and copies the result to --output when provided. Floorplan consumes synth/2_tech_map.v; if the mapped netlist is missing when the floorplan stage starts, implementation-run maps it automatically after a successful synthesis, so a full run does not require a separate manual export. Re-running synthesis deletes the stale mapped netlist. When Graphviz (dot) is available, Yosys also writes reports/elaboration.svg and reports/synthesis.svg. Each stage records start/finish timestamps, status, merged log, artifact paths, and OpenROAD -metrics JSON. Yosys statistics are stored as synth.cells, synth.wires, synth.chip_area_um2, and related keys. A failed stage keeps the preceding ODB checkpoint intact, and rerunning from a stage resets only that stage and the stages after it.

After final, OpenVLSI attempts to stream def/6_final.def plus the platform standard-cell GDS decks to final/6_final.gds with KLayout. Package stacks can declare a merged gds file and a layer_map that maps LEF/DEF layer names to the PDK’s real GDS numbers; OpenROAD-flow-scripts platform fallbacks discover gds/*.gds automatically. If the map is omitted, KLayout assigns sequential numbers to DEF layers instead of the PDK numbering. If KLayout or standard-cell GDS decks are missing, the final stage still succeeds and records a warning. Use implementation-export-gds to rerun or redirect the export explicitly.

--from defaults to synthesis, --to defaults to final, and --timeout sets the per-stage timeout. HDL runs may start at elaboration; when Graphviz is available that stage writes reports/elaboration.svg. Ctrl-C cancels the child process group and records the stage as cancelled. From another terminal, implementation-cancel reads the PID recorded under build/impl/<run>/run.pid and sends SIGTERM after checking that the process is OpenROAD or Yosys.

implementation-log prints the bounded merged log for one stage; --tail keeps only the last N lines. implementation-import looks for a final GDS/OASIS stream (final/6_final.gds, .gdsii, .oas, or .oasis) and flattens it into a read-only digital device cell. When the run has a DEF checkpoint, its top-level pins and pin nets are copied onto the device so layouts can place and route to them. The device appears under Layout > Devices > Digital; create a layout and place instances of it. No top-level layout is created. Missing streams are an error; run implementation-export-gds or complete the final stage first. --layout-name names the device and --replace updates the previously imported device instead of creating another cell. The JSON response reports the imported shape, port, net, and instance counts plus any pin extraction warnings.

implementation-toolchain reports the resolved openroad, yosys, and klayout executables. Set OPENVLSI_OPENROAD, OPENVLSI_YOSYS, or OPENVLSI_KLAYOUT to override discovery.

When a package declares [pdk.implementation.orfs], OpenVLSI resolves missing LEF, Liberty, site, IO-layer, routing, and OpenRCX rule defaults from OPENROAD_FLOW_SCRIPTS/OPENVLSI_OPENROAD_FLOW_SCRIPTS. The helper falls back to $HOME/repositories/OpenROAD-flow-scripts for local development.

Verification

openvlsi-cli lvs <project> <schematic> <layout>
openvlsi-cli lvs-auto <project> <layout>
openvlsi-cli pex <project> <layout> [schematic-name]
openvlsi-cli drc <project> <layout> [--no-flatten] [--output <dir>] [--suite <name>] \
  [--top-cell <name>] [--timeout <seconds>]

project-repair loads a project with recovery enabled: malformed sidecar files are moved under build/recovery/, the valid cells are kept, and the project is saved again. Use it when a hand-edited or partially written sch/, lay/, impl/, or sim/ file prevents normal loading. Strict load errors now include the exact repair/recovery hint instead of requiring the user to guess.

openvlsi-mcp --project <path> --recover provides the same recovery at MCP startup. Without --recover, a malformed startup project leaves the server running in a degraded state so project_repair and project_open(recover=true) remain callable.

lvs compares a schematic against a layout and prints the LVS report as JSON. The schematic may be drawn, text SPICE, or a structural SystemVerilog source cell. Parsed SPICE subcircuits and .include/.lib files are flattened recursively with parameter defaults applied. Gate-level SystemVerilog module instances and primitives are compared device by device; behavioral RTL is rejected instead of being compared as ports only. lvs-auto infers the schematic from planned-device links, then prefers a <layout>_lvs, <layout>_dut, or <layout>_layout cell before a plain name match, so a testbench named after the block does not hide its DUT view. Both commands exit with status 0 for a match and 1 when the report contains errors or warnings. The comparison covers device presence, reference names, device types, shared device parameters including parameters missing from the layout, net topology, and top-level ports. The report also contains devices, nets, and ports correspondence arrays with match methods (linked, name, topology), typed object references, layout bounds, parameter comparisons, and per-terminal net mappings. Mismatches include schematic_ref, layout_ref, hint, and up to three candidate objects to make debugging easier. Device matching expands m= multiplicity and falls back to topology when names change. Port results include direction and net status. The JSON report includes summary, ports_matched, and the missing-port, extra-port, port-direction, and port-net mismatch categories.

drc exports the layout to a temporary GDS and runs the DRC deck declared by the layout’s PDK package. A package technology/drc.json can select a KLayout deck or a gdscheck process; SKY130 resolves the SkyWater KLayout deck from $PDK_ROOT, $SKY130_ROOT, or Volare. --engine klayout|gdscheck and --deck <path> override the package deck, and --suite selects a named deck variant when the package declares one. The work directory defaults to build/drc/<layout>/ and contains layout.gds, drc.lyrdb, and drc.log. The JSON result reports engine, deck, suite, and normalized violations. The command exits with status 1 when the report cannot be produced, when the deck process times out, crashes, or exits nonzero without a clean report, or when the report contains error-severity violations. A truncated report database is rejected; warnings alone keep status 0.

pex extracts placed device-library instances, PDK-rule polygon devices, and first-order per-net resistance and capacitance from layout geometry, then creates or updates a text SPICE schematic in the project hierarchy. Net resistance is an effective value from a series/parallel conductor graph; parallel wires and via arrays at one location combine instead of adding in series. Capacitance remains a lumped area/perimeter estimate to ground. Polygon device rules come from the installed package’s technology/extraction.json. When no layout devices are recognized it falls back to the inferred source schematic device netlist. The report JSON includes the layout and schematic ids, per-net area, perimeter, resistance, capacitance, extracted devices, and the complete generated SPICE source. An optional third argument overrides the generated cell name.

PDK setup

openvlsi-cli doctor [project] reports installed PDK packages and whether each one is simulation-ready. openvlsi-cli pdk-info <pdk> --probe shows the exact package model directory, section names, OSDI/OpenVAF status, recommended setup lines, example device names, and runs a minimal transistor load check.

Simulation PDKs come from OpenVLSI packages only. Volare, CIEL, PDK_ROOT, PDK, and global ~/.spiceinit files are not used. Install a PDK package with openvlsi-pkg; if it uses Verilog-A models, build the OSDI cache once:

openvlsi-cli pdk-build ihp-sg13g2

PDKs use different ngspice layouts: IHP has models/cornerMOSlv.lib, Sky130 has sky130.lib.spice at the ngspice root, and GF180 has .ngspice files at the root. The probe handles all three:

  • Sky130: .option scale=1u and .lib ".../sky130.lib.spice" tt; devices such as sky130_fd_pr__nfet_01v8.

  • GF180: .include ".../design.ngspice" then .lib ".../sm141064.ngspice" typical; devices such as nfet_03v3.

  • IHP SG13G2: .lib ".../cornerMOSlv.lib" mos_tt; devices such as sg13_lv_nmos. Do not .include cornerMOSlv.lib; its internal .LIB sections must be selected by a .lib call. PSP devices also need the package’s OSDI models; pdk-build compiles them and OpenVLSI loads them explicitly for each simulation.

If doctor reports pdk_ready: false, install or build the OpenVLSI PDK package before trying to simulate a transistor-level circuit.

Simulation

openvlsi-cli simulation-add <project> <name> <schematic> [analysis] [stop] [step] [signals]
openvlsi-cli simulation-list <project>
openvlsi-cli simulation-remove <project> <simulation> [--dry-run]
openvlsi-cli simulation-configure <project> <simulation> [analysis options]
openvlsi-cli simulation-run <project> <simulation> [timeout-ms] [output.json]
openvlsi-cli simulation-experiment <project> <simulation> [timeout-ms] [--no-store] [--output file]
openvlsi-cli simulation-corner-defaults <project> <simulation>
openvlsi-cli simulation-corner-add <project> <simulation> <name> [--section s] [--temperature c] [--supply n=v]...
openvlsi-cli simulation-corner-list <project> <simulation>
openvlsi-cli simulation-corner-remove <project> <simulation> <name>
openvlsi-cli simulation-sweep-add <project> <simulation> <parameter> <value...>
openvlsi-cli simulation-sweep-list <project> <simulation>
openvlsi-cli simulation-sweep-remove <project> <simulation> <parameter>
openvlsi-cli simulation-monte-carlo <project> <simulation> [--samples n] [--temperature-sigma c] ...
openvlsi-cli simulation-measure-add <project> <simulation> <name> <metric> [--signal s] [--input s] ...
openvlsi-cli simulation-measure-list <project> <simulation>
openvlsi-cli simulation-measure-remove <project> <simulation> <name>
openvlsi-cli simulation-trace <project> <simulation> [signals] [max-points]
openvlsi-cli simulation-measure <project> <simulation> [signal] [threshold] \
  [--metric gain|bandwidth|phase_margin|slew_rate|settling_time|power] \
  [--signal s] [--input s] [--voltage v] [--tolerance v]
openvlsi-cli simulation-graph-add <project> <simulation> <name> [x-axis] [y-signals]
openvlsi-cli simulation-graph-list <project> <simulation>
openvlsi-cli simulation-graph-info <project> <simulation> <graph>
openvlsi-cli simulation-graph-update <project> <simulation> <graph> [name] [x-axis] [y-signals] \
  [--view linear|db|phase] [--fft on|off] [--fft-window w] [--fft-points n] \
  [--show-measurements on|off] [--derived name=expr] [--overlay run-id[=label]] \
  [--clear-derived] [--clear-overlays] [--clear-markers]
openvlsi-cli simulation-graph-derive <project> <simulation> <graph> <name> <expression>
openvlsi-cli simulation-graph-derive-remove <project> <simulation> <graph> <name>
openvlsi-cli simulation-graph-overlay <project> <simulation> <graph> <run-id> [label]
openvlsi-cli simulation-graph-overlay-remove <project> <simulation> <graph> <run-id>
openvlsi-cli simulation-graph-marker-add <project> <simulation> <graph> <label> <x> [--y v] [--signal s]
openvlsi-cli simulation-graph-marker-remove <project> <simulation> <graph> <label>
openvlsi-cli simulation-runs <project> [simulation]
openvlsi-cli simulation-graph-limits <project> <simulation> <graph> [x-min] [x-max] [y-min] [y-max]
openvlsi-cli simulation-graph-delete <project> <simulation> <graph>
openvlsi-cli simulate <project> <schematic> [stop] [step] [timeout-ms] [signals] [output.json]
openvlsi-cli simulate-netlist <netlist-file> [stop] [step] [timeout-ms] [signals] [output.json]

Time values accept SPICE-style engineering suffixes such as 1u, 100n, and 2m. Signals may be comma- or whitespace-separated, for example 1,2, out,v(out), or IN N1 N2. Analysis aliases such as tran are stored as transient.

For simulation-add, signals may be comma-separated or passed as multiple trailing arguments; both forms are stored as a comma-separated capture list.

simulation-run uses the stored simulation definition and writes its result under the simulation’s build directory, so the GUI can load it as the latest run. When the run succeeds, empty capture-signal and graph Y selections are filled from the returned traces and the project is saved. simulate runs a schematic directly without a simulation definition. simulation-remove deletes the simulation and its graph definitions; stored build runs remain on disk.

simulation-measure reads the latest stored run and reports min, max, amplitude, mean, RMS, first/last values, zero and rising crossings, period, frequency, and settling time. Use it to validate oscillator startup and frequency instead of treating state: succeeded as proof that the circuit oscillates. A threshold overrides the default midpoint crossing level. Pass --metric gain|bandwidth|phase_margin|slew_rate|settling_time|power for a declarative check, or declare metrics once with simulation-measure-add; they are then evaluated and stored after every run.

simulation-configure edits analysis-specific fields such as AC points/range, DC source/range, noise output/input, transfer-function source/output, temperature, model section, .param values, and source overrides. simulation-experiment runs the configured sweeps, corners, and Monte Carlo samples. Each point is written to its own run file with a variant label unless --no-store is used. simulation-corner-defaults populates the TT/FF/SS sections declared by the active PDK; simulation-corner-add can add any explicit section, temperature, supply override, or parameter set.

Without an explicit output path, the simulation writes a stored run under:

build/simulations/<simulation-id>-<name>/runs/<timestamp>-<suffix>.json

An explicit output path is still accepted but always uses the stored-run schema. The result includes the request netlist, simulator provenance, graphs, and trace data.

Drawn SPICE, text SPICE, and SystemVerilog schematics can all be used. For text schematics the stored SPICE source is the circuit netlist; analysis-control directives (.tran, .dc, .ac, .op, .noise, .tf) and .end are removed because the simulation definition supplies the analysis.

simulation-add on a SystemVerilog cell stores the iverilog simulator and digital analysis automatically. simulation-run compiles the source with iverilog, runs vvp, and returns VCD-derived traces. The selected cell may instantiate modules defined in other project SystemVerilog cells; OpenVLSI follows those references and compiles the combined source. digital is accepted as an analysis alias when creating a simulation explicitly. Direct simulate on a SystemVerilog cell, and simulate-netlist on a .sv file, use the same backend. If the source has no $dumpfile/$dumpvars, OpenVLSI adds a wrapper module that dumps the design; a testbench that never calls $finish is stopped after 10 seconds and the partial VCD is kept.

A drawn schematic that instantiates SystemVerilog blocks is a mixed-signal schematic. simulation-add automatically stores the mixed simulator and transient analysis for it, with 1 µs stop and 1 ns step defaults when no explicit times are given. simulation-run then iterates between 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 the sampled input bits stabilize. Results contain both analog node traces and <instance>.<port> digital traces. HDL instances may be top-level or nested inside drawn subcells; nested instances get scoped names such as U1_U2; schematic-validate-hierarchy reports inout ports, buses, missing connections, and duplicate output drivers. Use schematic-add-hdl-instance ... --flatten-buses for scalar mixed simulation of a bus; pins become data[0], data[1], … and are concatenated in the generated testbench. real ports are bridged without logic thresholding.

simulation-trace returns decimated waveform samples for the latest stored run, which avoids writing a script just to inspect v(out) or a digital port.

Simulation graphs are presentation definitions over captured signals. simulation-add creates a default Graph 1 using the captured signals, and simulation-graph-add also defaults to time on X and the simulation’s captured signals on Y. In simulation-graph-update, - keeps a field unchanged. In simulation-graph-limits, - clears a limit. Deleting the last graph is rejected.

Graphs can also be analyzed without rerunning the circuit. --view db and --view phase transform the Y axis, --fft on switches to a spectrum, and --derived name=expression adds a math channel such as out - in, db(v(out)), or derivative(i(v1)). simulation-runs lists stored run ids for --overlay/simulation-graph-overlay, which compares corners or Monte Carlo samples on the same axes. simulation-graph-marker-add stores a labelled point annotation. All settings live on the graph in the project, so the GUI, CLI, and MCP display the same analysis.

Simulation scripts

openvlsi-cli script-add <project> <name> [source-file]
openvlsi-cli script-list <project>
openvlsi-cli script-info <project> <script>
openvlsi-cli script-read <project> <script>
openvlsi-cli script-write <project> <script> <source-file|->
openvlsi-cli script-run <project> <script> [timeout-ms]
openvlsi-cli script-delete <project> <script> [--purge] [--dry-run]

script-add creates a new Python file under scripts/ from the built-in template, records it in project.ovpro, and saves the project. An optional source file replaces the template. Use - to read the source from stdin.

script-write replaces an existing simulation script’s source without changing project metadata. script-read returns the source, and script-run returns JSON with the process exit code, timeout state, stdout, stderr, and generated graph data. Script runs use the stored simulation runs under build/simulations/. script-delete removes only the project association; the Python file remains on disk.

The typical agent feedback loop is:

openvlsi-cli schematic-add-cell project top
openvlsi-cli simulation-add project tran1 top transient 1m 1u 'v(n1)'
openvlsi-cli simulation-graph-add project tran1 "Response" time 'v(n1)'
openvlsi-cli simulation-run project tran1
openvlsi-cli script-add project "RLC Comparison"
openvlsi-cli script-write project "RLC Comparison" script.py
openvlsi-cli script-run project "RLC Comparison"