SystemVerilog to SVG using Schemdraw (left-to-right logic diagrams)
Project description
sv2svg
Convert SystemVerilog modules into readable logic-diagram SVGs with a single CLI command. sv2svg parses structural HDL, places gates left-to-right, and outputs Schemdraw-based graphics that stay aligned and symmetric.
Highlights
- Deterministic left-to-right layout with minimal crossings
- Automatic input ordering (alphabetical, module ports, or auto)
- Optional grid snapping and symmetry controls
- CLI-first workflow with
--help,--version,--style, and--orientationdiscovery - Semantic-release driven SemVer tagging and automated PyPI publishing
Installation
Choose one of the following approaches:
- uvx (no install):
uvx sv2svg --help
- uv run:
uv run sv2svg --help
- Virtual environment:
python3 -m venv .venv source .venv/bin/activate pip install --upgrade pip pip install sv2svg
- Editable checkout:
python3 -m venv .venv source .venv/bin/activate pip install --upgrade pip pip install -e .
Quickstart
sv2svg --help
sv2svg --version
sv2svg examples/full_adder.sv --style blueprint --orientation vertical -o full_adder.svg
The last command renders examples/full_adder.sv into an SVG file in the working directory (falls back to full_adder_schemdraw.svg when -o is omitted) using the "blueprint" color preset and a vertical layout.
CLI reference
usage: sv2svg [-h] [-o OUTPUT] [--input-order {alpha,ports,auto}] [--grid-x GRID_X]
[--grid-y GRID_Y] [--no-symmetry]
[--style {classic,blueprint,midnight,mono}]
[--orientation {horizontal,vertical}] [-V]
input_file
input_file— source SystemVerilog file with the module to visualize-o / --output— target SVG file path (-writes SVG to stdout)--input-order— sort inputs alphabetically, preserve declaration order, or auto-detect--grid-x,--grid-y— snap coordinates to half-grid (0 disables snapping)--no-symmetry— disable mirrored placement for sibling signals--style— select a color/line-weight preset for the output (classic,blueprint,midnight,mono)--orientation— choosehorizontal(default left-to-right) orvertical(top-to-bottom) layout; vertical mode currently produces rotated SVG output only-V / --version— print the sv2svg version derived from git metadata
Tips for better diagrams
- Keep each module in its own file and ensure port declarations are explicit.
- The parser expects synthesizable structural constructs; unsupported statements raise errors during generation.
- Use the grid options to align gates when mixing manual annotations with generated drawings.
Development workflow
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -e .
python -m sv2svg.cli --version
Run the CLI against fixtures or your own modules; any Python exception surfaces with a clear message.
Testing
The CI workflow (.github/workflows/ci.yml) installs the package in editable mode and performs an import smoke test. Extend it with richer checks as the project grows.
Release automation
- Commits merged to
mainmust follow Conventional Commits so semantic-release can infer version bumps. - On qualifying commits, the Release workflow updates
CHANGELOG.md, tags the release, publishes GitHub release notes, and uploads the built artifacts to PyPI using trusted publishing. - Local builds without git metadata fall back to version
0.0.0; regular development builds look like0.2.1.dev0+g8733005aa.d20250922courtesy of hatch-vcs.
Contributing
Issues and pull requests are welcome. Please include reproduction snippets for parser bugs and respect the release automation by using Conventional Commit messages.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sv2svg-0.6.0.tar.gz.
File metadata
- Download URL: sv2svg-0.6.0.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b08310c043939c3e0e8967f39e96558f8e8d0ffe8feb4df2e67bfbf30f3d3e99
|
|
| MD5 |
11a5088242d066bcc211a51b94e09e90
|
|
| BLAKE2b-256 |
64ec28899cdf60c34c356ee53154509ae9df14ec4a5ac7e98285fc6329977841
|
Provenance
The following attestation bundles were made for sv2svg-0.6.0.tar.gz:
Publisher:
release.yml on ErikMeinders/sv2svg
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sv2svg-0.6.0.tar.gz -
Subject digest:
b08310c043939c3e0e8967f39e96558f8e8d0ffe8feb4df2e67bfbf30f3d3e99 - Sigstore transparency entry: 570322695
- Sigstore integration time:
-
Permalink:
ErikMeinders/sv2svg@d14c58a2bb706bd281c55a831e24ba4f65c8e4d0 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ErikMeinders
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d14c58a2bb706bd281c55a831e24ba4f65c8e4d0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sv2svg-0.6.0-py3-none-any.whl.
File metadata
- Download URL: sv2svg-0.6.0-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa77a1491e4923c01db54b4ad7d412d800055eb47f7a6890325960a07de27da8
|
|
| MD5 |
c83d9f304ddb877994c8045f226cb89f
|
|
| BLAKE2b-256 |
87e1acaa23e63af8729e9a21f58aaed47edcf35d32934fc2094e1b272903e389
|
Provenance
The following attestation bundles were made for sv2svg-0.6.0-py3-none-any.whl:
Publisher:
release.yml on ErikMeinders/sv2svg
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sv2svg-0.6.0-py3-none-any.whl -
Subject digest:
fa77a1491e4923c01db54b4ad7d412d800055eb47f7a6890325960a07de27da8 - Sigstore transparency entry: 570322711
- Sigstore integration time:
-
Permalink:
ErikMeinders/sv2svg@d14c58a2bb706bd281c55a831e24ba4f65c8e4d0 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ErikMeinders
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d14c58a2bb706bd281c55a831e24ba4f65c8e4d0 -
Trigger Event:
push
-
Statement type: