SystemVerilog simulator: pyslang frontend + Rust runtime + time-travel + RTL-as-Python-callable + compiled-Python monitors + semantic waveform search + cocotb adapter
Project description
svling
SystemVerilog compiler + runtime + time-travel debugger + RTL-as-Python-callable — in one package.
svling bundles:
sling— a SystemVerilog → VVP compiler frontend built on pyslang (full IEEE 1800-2023 LRM coverage).evvp— a Rust reimplementation of Icarus Verilog'svvpruntime, exposed to Python via pyo3 and invoked in-process.sling.Simulator— time-travel-capable Python wrapper:.checkpoint() / .restore() / .fork()for parallel-universe debugging.sling.Design— pyslang AST access,.compile_as_function()to turn combinational modules into Python callables,.compile_as_object()for stateful ones, auto-generated PythonIntEnum/dataclassfrom RTLtypedefs.sling.features— protocol detection (AXI4-Lite, APB, etc.), FSM identification, auto-assertion synthesis, mutation testing, coverage, recorder→pandas/numpy, counterfactual sim, invariant discovery, differential testing, git-bisect-RTL, design space sweep, and more.
The whole stack ships as a single wheel containing the Python compiler
sources and one sling/_native.abi3.so carrying the entire runtime.
Highlights
Time-travel debugging
import sling
sim = sling.Simulator.from_sv("counter.sv")
sim.step_cycles(50)
cp = sim.checkpoint() # O(N) deep clone
sim.step_cycles(50)
print(sim.read_int("tb.count")) # value at t=100
sim.restore(cp) # rewind
print(sim.read_int("tb.count")) # value at t=50
fork = sim.fork(cp) # independent timeline
RTL module as a Python callable
d = sling.Design.from_sv("alu.sv")
alu = d.compile_as_function("alu")
print(alu(a=42, b=17, op=0)) # → {'result': 59}
counter = d.compile_as_object("counter", clock="clk", reset="rst_n")
counter.reset()
print(counter.cycle(en=1)) # → {'count': 1}
Auto-generated Python types from RTL
d = sling.Design.from_string("""
typedef enum logic [1:0] {IDLE, RUN, DONE} state_t;
typedef struct packed { logic [7:0] addr; logic [3:0] cmd; } pkt_t;
module top (output state_t s, output pkt_t p); ... endmodule
""")
State = d.py_enums()["state_t"]
Pkt = d.py_structs()["pkt_t"]
print(State.RUN.value) # → 1
print(Pkt(addr=0xAB, cmd=0x3).to_bits())
Verification features
f = sling.features
f.find_state_machines(d) # AST-detected FSMs
f.detect_protocols(d, "axi_dut") # AXI4-Lite/APB/SPI/I2C/UART/...
f.synthesize_assertions(d) # enum-legality SVA strings
f.counterfactual(sim, until=100, overrides={"signal": 0xFF})
f.discover_invariants(recorder)
f.bisect_regression("rtl/alu.sv", test_fn, ...)
f.mutate(sv_source, test_fn) # mutation testing
Compiled Python monitors (spec §53)
Write monitors as Python lambdas; sling compiles them to a typed IR and runs them at every sim time-step. Python is only called when the predicate transitions.
import sling
from sling.monitors import compiled_trigger, compiled_monitor, until, capture
sim = sling.Simulator.from_sv("design.sv")
# Single-cycle predicate. The decorator returns the Monitor itself.
@compiled_trigger(sim, dut="top", edge="rising")
def overflow(dut):
return (dut.cnt > 250) & (dut.enable == 1)
# Multi-cycle sequence monitor.
@compiled_monitor(sim, dut="top")
def axi_write(dut):
yield until(lambda d: d.awvalid == 1)
yield capture(lambda d: d.awaddr)
yield until(lambda d: d.awready == 1)
sim.run_until(10_000)
print(f"overflow fired {overflow.fire_count}x, last at t={overflow.last_fire_time}")
for h in axi_write.history[:5]:
print(f" AXI write at t={h.time} addr={h.captures['awaddr']:#x}")
Supported Python subset in predicates: comparisons (==, !=, <,
<=, >, >=), bitwise (&, |, ^, ~, <<, >>), arithmetic
(+, -, *), boolean (and, or, not), ternary (X if C else Y),
attribute chains rooted at the DUT parameter, integer/boolean literals.
Function calls are rejected with a helpful diagnostic.
Time-travel workflows (built on Simulator.checkpoint/fork)
Higher-level helpers in sling.timetravel:
from sling.timetravel import run_universes, diff_timelines, AutoCheckpointer
sim.run_until(1000)
cp = sim.checkpoint()
results = run_universes(
cp, sim_template=sim, until_time=2000,
sample_signals=["top.result", "top.error"], sample_period=50,
stimulus_callbacks={
"normal": lambda u: u.write("top.in", 0x42),
"fuzzed": lambda u: u.write("top.in", 0xFF),
},
)
for d in diff_timelines(results["normal"], results["fuzzed"])[:5]:
print(f"t={d.time}: {d.signal} normal={d.value_a} fuzzed={d.value_b}")
# Ring-buffer of periodic checkpoints — rewind past an unknown failure.
with AutoCheckpointer(sim, period=100, keep=20) as auto:
for cycle in range(5000):
sim.run_until((cycle + 1) * 10)
auto.tick()
if sim.read_int("top.error_flag"):
sim.restore(auto.rewind(steps_back=5))
break
Semantic waveform search (spec §44)
Beyond name-grep — search by structure (AST), behavior (recorded samples), or both:
from sling import features as f
from sling.wavesearch import WaveformSearch, Pattern
rec = f.Recorder(sim, ["top.valid", "top.ready", "top.state"])
for _ in range(2000):
sim.run_until(sim.now + 5)
rec.sample()
ws = WaveformSearch(sim, design=design, recorder=rec)
# Behavior: handshakes on a valid/ready pair.
hs = ws.find_handshake("top.valid", "top.ready")
# Structure × behavior: state-machine transitions by enum name.
errs = ws.find_transition("top.state", from_val="IDLE", to_val="ERROR")
# Custom temporal pattern.
pulses = ws.find_pattern("top.req", Pattern.pulse(min_width=3))
Install
pip install svling
# or
uv tool install svling
Use
# Compile and run in one go:
svling design.sv tb.sv
# Compile only (write a .vvp file):
sling -o design.vvp design.sv
# Run a pre-compiled .vvp through the Rust runtime in-process:
python -c "from sling._native import run_cli; run_cli(['evvp', '-N', 'design.vvp'])"
Anything that starts with + on the svling command line is forwarded
to the runtime as a Verilog plusarg (e.g. +verbose, +seed=42). Use
-- to forward arbitrary extra flags to the runtime.
Layout
svling/
├── sling/ Python frontend (pyslang → VVP)
├── evvp/ Rust crate: VVP runtime; produces both a standalone
│ `evvp` binary and a pyo3 cdylib for the wheel
├── tests/ Sample SystemVerilog used by the docs
└── pyproject.toml maturin build, project metadata, console scripts
License
GPL-2.0-or-later. evvp is a clean-room reimplementation of Icarus
Verilog's vvp, which is GPL-2.0; this package keeps the same license.
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 Distributions
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 svling-0.11.0.tar.gz.
File metadata
- Download URL: svling-0.11.0.tar.gz
- Upload date:
- Size: 593.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90bf2d75b84e1a610ffdf5eaed706ce5526f16f20300e00d0e823929cf13e066
|
|
| MD5 |
df051566c591a1f680893a1169d2abeb
|
|
| BLAKE2b-256 |
e194aebf41604b1113a084ae0b91ab66078f580e3199bccc4bb3b8d48c6becb1
|
Provenance
The following attestation bundles were made for svling-0.11.0.tar.gz:
Publisher:
svling-publish.yml on CheeksTheGeek/svling
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
svling-0.11.0.tar.gz -
Subject digest:
90bf2d75b84e1a610ffdf5eaed706ce5526f16f20300e00d0e823929cf13e066 - Sigstore transparency entry: 1714567451
- Sigstore integration time:
-
Permalink:
CheeksTheGeek/svling@2bd486f15e8924e8d36497e6c043a33c5d3bdc63 -
Branch / Tag:
refs/tags/v0.11.0 - Owner: https://github.com/CheeksTheGeek
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
svling-publish.yml@2bd486f15e8924e8d36497e6c043a33c5d3bdc63 -
Trigger Event:
push
-
Statement type:
File details
Details for the file svling-0.11.0-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: svling-0.11.0-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f5ce0dde0e0798f94e29ea74cdfabd4c65b96146c8bd84cd05691b6753cc256
|
|
| MD5 |
4da876c8c94a0d05976718ef9af72bb0
|
|
| BLAKE2b-256 |
b41875b1e239797790de4139c1689e294bbe905ac4bee5443f140121adb1ba82
|
Provenance
The following attestation bundles were made for svling-0.11.0-cp310-abi3-win_amd64.whl:
Publisher:
svling-publish.yml on CheeksTheGeek/svling
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
svling-0.11.0-cp310-abi3-win_amd64.whl -
Subject digest:
8f5ce0dde0e0798f94e29ea74cdfabd4c65b96146c8bd84cd05691b6753cc256 - Sigstore transparency entry: 1714567734
- Sigstore integration time:
-
Permalink:
CheeksTheGeek/svling@2bd486f15e8924e8d36497e6c043a33c5d3bdc63 -
Branch / Tag:
refs/tags/v0.11.0 - Owner: https://github.com/CheeksTheGeek
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
svling-publish.yml@2bd486f15e8924e8d36497e6c043a33c5d3bdc63 -
Trigger Event:
push
-
Statement type:
File details
Details for the file svling-0.11.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: svling-0.11.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
017cccb0bced3bec5f5f2d08519d8a6e95ea95dd13793288f8e86a722ee5e1b5
|
|
| MD5 |
8f3566f6d0e4ef157c060676afd4e716
|
|
| BLAKE2b-256 |
c17126576c7332f5e5a65320dd16e98c62d5e7574c13ce6743ee1e9b481db866
|
Provenance
The following attestation bundles were made for svling-0.11.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
svling-publish.yml on CheeksTheGeek/svling
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
svling-0.11.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
017cccb0bced3bec5f5f2d08519d8a6e95ea95dd13793288f8e86a722ee5e1b5 - Sigstore transparency entry: 1714567511
- Sigstore integration time:
-
Permalink:
CheeksTheGeek/svling@2bd486f15e8924e8d36497e6c043a33c5d3bdc63 -
Branch / Tag:
refs/tags/v0.11.0 - Owner: https://github.com/CheeksTheGeek
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
svling-publish.yml@2bd486f15e8924e8d36497e6c043a33c5d3bdc63 -
Trigger Event:
push
-
Statement type:
File details
Details for the file svling-0.11.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: svling-0.11.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ba87e22ad3695a0ac5400804c7b486f4de6d5b4579344a42458056ecdbf058d
|
|
| MD5 |
ae09c18762e6948cc252c5473f9e9bd9
|
|
| BLAKE2b-256 |
00444d3754e654ea2e886a8e081eff7c6462d5817ed334d58ef7bcd5b4e28131
|
Provenance
The following attestation bundles were made for svling-0.11.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
svling-publish.yml on CheeksTheGeek/svling
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
svling-0.11.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
8ba87e22ad3695a0ac5400804c7b486f4de6d5b4579344a42458056ecdbf058d - Sigstore transparency entry: 1714567675
- Sigstore integration time:
-
Permalink:
CheeksTheGeek/svling@2bd486f15e8924e8d36497e6c043a33c5d3bdc63 -
Branch / Tag:
refs/tags/v0.11.0 - Owner: https://github.com/CheeksTheGeek
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
svling-publish.yml@2bd486f15e8924e8d36497e6c043a33c5d3bdc63 -
Trigger Event:
push
-
Statement type:
File details
Details for the file svling-0.11.0-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: svling-0.11.0-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
171b79fb209e67b9b708cafe3ed7afaf1223e0a9dac94392790e8d16e71e3489
|
|
| MD5 |
b13fc5c6366e35508c744388804612ce
|
|
| BLAKE2b-256 |
d0afabd6d50908b36c1796eb2cbe1f8c2f82535cc21d92a5dc96708c3244b002
|
Provenance
The following attestation bundles were made for svling-0.11.0-cp310-abi3-macosx_11_0_arm64.whl:
Publisher:
svling-publish.yml on CheeksTheGeek/svling
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
svling-0.11.0-cp310-abi3-macosx_11_0_arm64.whl -
Subject digest:
171b79fb209e67b9b708cafe3ed7afaf1223e0a9dac94392790e8d16e71e3489 - Sigstore transparency entry: 1714567599
- Sigstore integration time:
-
Permalink:
CheeksTheGeek/svling@2bd486f15e8924e8d36497e6c043a33c5d3bdc63 -
Branch / Tag:
refs/tags/v0.11.0 - Owner: https://github.com/CheeksTheGeek
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
svling-publish.yml@2bd486f15e8924e8d36497e6c043a33c5d3bdc63 -
Trigger Event:
push
-
Statement type:
File details
Details for the file svling-0.11.0-cp310-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: svling-0.11.0-cp310-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.10+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2f677436bdadce6f102483503560e3089df826f21766bb9a6c5808f4448505d
|
|
| MD5 |
c5a8a7c301c78e7f1223b61881f56051
|
|
| BLAKE2b-256 |
49289aa872099430610c472c90fa7493c720653c4086edaa68b9e1fb1e7ef89d
|
Provenance
The following attestation bundles were made for svling-0.11.0-cp310-abi3-macosx_10_12_x86_64.whl:
Publisher:
svling-publish.yml on CheeksTheGeek/svling
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
svling-0.11.0-cp310-abi3-macosx_10_12_x86_64.whl -
Subject digest:
a2f677436bdadce6f102483503560e3089df826f21766bb9a6c5808f4448505d - Sigstore transparency entry: 1714567785
- Sigstore integration time:
-
Permalink:
CheeksTheGeek/svling@2bd486f15e8924e8d36497e6c043a33c5d3bdc63 -
Branch / Tag:
refs/tags/v0.11.0 - Owner: https://github.com/CheeksTheGeek
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
svling-publish.yml@2bd486f15e8924e8d36497e6c043a33c5d3bdc63 -
Trigger Event:
push
-
Statement type: