Preview .sv

Preview .sv transforms your SystemVerilog code into clear schematic diagrams right inside VS Code. See your logic gates, wiring, and signal flow visualized side-by-side with your code—automatically staying in sync as you edit.

Highlights
- Side-by-side schematic preview that stays aligned with the active
.sv file.
- Single shared preview panel: switch files, the preview follows without cluttering the UI.
- Auto-refresh on save, with an optional (debounced) live mode while you type.
- Flexible CLI configuration, including exclusion patterns for testbenches.
Requirements
Preview .sv relies on tools that are not bundled with the extension. Make sure these commands work in the VS Code terminal:
| Tool |
Why it is needed |
Quick install |
| Python 3.9+ |
Runtime required by both uv and sv2svg. |
Use your package manager or the official installer. |
uv |
Provides the uvx helper that runs sv2svg straight from PyPI. |
pip install uv (or follow the uv docs for faster installers). |
Once uv is installed, uvx downloads and caches sv2svg automatically on first use. If you prefer a locally installed sv2svg, you can point the extension settings to that binary instead.
Getting Started
- Install the extension from the Visual Studio Code Marketplace.
- Open a SystemVerilog workspace (any
.sv not being a test bench file will do).
- Verify dependencies: run
uvx --version in the terminal. If this fails, install uv and ensure Python is on your PATH.
- Open the command palette (
Ctrl+Shift+P / ⇧⌘P) and run SV2SVG: Open Preview to the Side.
- Edit and save your file—Preview .sv will re-render the schematic automatically.
Tip: you can enable auto preview so every .sv file you activate updates the shared panel instantly.
Commands
| Command |
Description |
SV2SVG: Open Preview |
Opens/focuses the preview next to the current editor. |
SV2SVG: Open Preview to the Side |
Same as above, explicitly opening beside the editor group. |
SV2SVG: Refresh Preview |
Forces a re-render of the current document. |
SV2SVG: Toggle Auto Preview |
Automatically open/update the preview as you switch .sv files. |
Settings Overview
All settings live under Preview .sv.
| Setting |
Default |
Description |
sv2svgPreview.runner |
uvx |
Command that launches the toolchain. Point this to another wrapper if desired. |
sv2svgPreview.runnerArgs |
[] |
Extra arguments passed before the command (e.g. "--refresh"). |
sv2svgPreview.command |
sv2svg |
The subcommand executed by the runner. |
sv2svgPreview.args |
["-o", "-"] |
Arguments appended after the file path. Defaults pipe SVG to stdout. |
sv2svgPreview.onSave |
"refresh" |
Auto-refresh behaviour on save ("refresh" or "off"). |
sv2svgPreview.onChange |
false |
Experimental live preview (writes a temp file while typing). |
sv2svgPreview.excludePattern |
".*_tb\\.sv$" |
Regex of filenames that should not open in the preview (e.g. testbenches). |
sv2svgPreview.argsBeforeFile |
false |
Place CLI args before the file path if your tool expects that order. |
sv2svgPreview.autoOnOpen |
false |
Automatically open the preview when activating an .sv file. |
sv2svgPreview.renderTimeoutMs |
15000 |
Timeout for the render process in milliseconds. |
Render Options
Customize the appearance and layout of generated schematics. All settings live under Preview .sv > Render Options or sv2svgPreview.renderOptions.* in JSON.
Tip: Use the in-preview settings panel (⚙ icon) for interactive configuration.
| Setting |
Default |
Description |
sv2svgPreview.renderOptions.style |
classic |
Visual theme: classic, blueprint, midnight, mono, vibrant, or dark. |
sv2svgPreview.renderOptions.orientation |
horizontal |
Layout direction: horizontal (left-to-right) or vertical (top-to-bottom). |
sv2svgPreview.renderOptions.inputOrder |
alpha |
Order primary inputs: alpha (alphabetical), ports (module header order), or auto. |
sv2svgPreview.renderOptions.fontScale |
1.2 |
Text scale factor (range: 0.5-2.0). 1.2 = 20% larger than default. |
sv2svgPreview.renderOptions.gridX |
0 |
Snap X coordinates to this grid step (0 = disabled). |
sv2svgPreview.renderOptions.gridY |
0 |
Snap Y coordinates to this grid step (0 = disabled). |
sv2svgPreview.renderOptions.table |
false |
Include truth table in the diagram. |
sv2svgPreview.renderOptions.fillGates |
false |
Enable subtle fill colors for logic gates. |
sv2svgPreview.renderOptions.signalStyles |
false |
Use different line styles for signal types (solid = primary, dashed = intermediate). |
sv2svgPreview.renderOptions.fanoutWires |
false |
Use thicker wires for signals with higher fan-out. |
sv2svgPreview.renderOptions.noSymmetry |
false |
Disable symmetric sibling placement around shared driver centerlines. |
sv2svgPreview.renderOptions.noCaption |
false |
Suppress the module name caption. |
sv2svgPreview.renderOptions.noInternalLabels |
false |
Suppress internal signal labels (auto_, _expr). |
sv2svgPreview.renderOptions.noLabels |
false |
Hide all labels except input and output. |
Tips & Troubleshooting
- Preview shows an error? The webview displays stderr/stdout from
sv2svg. Check the message—often it means uvx could not find Python or the CLI emitted a syntax error.
- Need to pass custom flags? Use
sv2svgPreview.args or runnerArgs. For example, set runnerArgs to ["--refresh"] to force uvx to re-download the latest package.
- Workspace trust: VS Code must trust the workspace to execute external commands. Grant trust if prompted.
- Live preview performance: Debounced live rendering writes your unsaved buffer to a temp file. Disable it if you edit extremely large designs.
Building & Contributing
Clone the repository, then:
npm install
npm run compile
# Run the extension host
code --extensionDevelopmentPath=.
You can also use the provided Makefile to package and publish releases via make package or make publish-patch.
Found a bug or have an idea? Open an issue at easytocloud/preview-sv.
With gratitude to Antonia for introducing me to SystemVerilog and sparking the desire to build this preview.