Note: this package was implemented with Claude Code, and its results were validated against a commercial SVA simulator.
SystemVerilog-style immediate and concurrent (temporal) assertions for cocotb testbenches, written in SVA syntax. Works with VHDL and Verilog designs.
Status: alpha (0.1.0, the first release). Requires cocotb 2.x and Python 3.10+.
import cocotb
from cocotb.clock import Clock
from cocotbext.sva import Assertions, checked, posedge
@cocotb.test()
@checked # collect failures, fail the test at its end
async def test_handshake(dut):
Clock(dut.clk, 10, unit="ns").start()
a = Assertions(dut, clock=posedge(dut.clk), disable_iff="!rst_n", name="hs")
a.assert_property("req |-> ##[1:3] ack", name="req_gets_ack")
a.assert_property("(req, t = tag) |-> ##[1:8] (rsp && rsp_tag == t)", name="tag_returns")
a.cover_property("req ##1 req ##1 req", name="three_reqs")
... # drive the design
A failure is logged at the time it happens, with the attempt's start time and the sampled values:
150.00ns ERROR sva.hs.req_gets_ack FAILED attempt started 120 ns
req |-> ##[1:3] ack
sampled: req=0 ack=0
Features
- The SVA property language: sequences, implications, local variables,
$pastand the other sampled-value functions,always/eventually/until,disable iff,accept_on,cover,expect, immediate assertions (full list). - Several clocks: clocks generated or derived in the HDL (exact SVA
sampling), and multi-clock properties (
req |=> @(posedge clk_b) ack_b). - Reuse: parameterised properties, named sequences, checkers bound to several instances.
- Speed: all attempts of an assertion are merged and evaluated together; an optional compiled kernel makes a busy assertion cost about 0.05 µs per cycle; idle clocks are not followed at all.
Probe: an optional generated HDL module that samples the signals inside the simulator and buffers them, for the lowest overhead.- Offline checking: the same assertions on a VCD or FST dump after the
simulation (
TraceSampler).
Install
pip install cocotbext-sva # pure Python
pip install cocotbext-sva[fast] # with the compiled kernel (same results, faster)
Validation
- Tested on nvc, GHDL, Icarus Verilog and Verilator, and on a commercial simulator (VHDL and SystemVerilog).
- Results checked against a golden corpus of about 1,200 cases recorded from a commercial SVA implementation, and fuzzed against a reference interpreter of the IEEE 1800 formal semantics. Where the commercial tool and the standard disagree, the package follows the standard; the cases are listed in the notes.
Documentation
The full documentation is at https://cocotbext-sva.readthedocs.io:
- Getting started: a first test with assertions, in five minutes.
- User guide: writing assertions,
clocks and sampling,
Probe, offline checking, semantics notes, speed. - API reference: every class and function.
- Notes: differences from the reference implementation, simulator-specific behaviour, measurements.
- Design: architecture. Releasing.
Development
pip install -r requirements.txt
nox -s kernel # build and install the compiled kernel (needs Rust)
nox -s tests # unit tests, fuzzing, golden corpus (no simulator)
nox -s simtests # end-to-end tests on every simulator found
CI runs on GitHub Actions (.github/workflows).
License: MIT (see LICENSE).
Metadata
Release files for cocotbext-sva 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cocotbext_sva-0.1.0.tar.gz | 124.6 kB | With provenance | Details for cocotbext_sva-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cocotbext_sva-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for cocotbext_sva-0.1.0-py3-none-any.whl |
Total release size: 229.2 kB
Release files / cocotbext_sva-0.1.0.tar.gz
| Download URL | cocotbext_sva-0.1.0.tar.gz |
|---|---|
| Size | 124.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e7c2da9b9908d5556b7a87b7d49f94a3770cd9b82c07af4dd19d851967a1ab1e
|
|
BLAKE2b-256 checksum How to use checksums |
9cc35170006751d98031de2338cce7626afdef4053118f5db9f1aa4f4b6e874e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.
Transparency logRelease files / cocotbext_sva-0.1.0-py3-none-any.whl
| Download URL | cocotbext_sva-0.1.0-py3-none-any.whl |
|---|---|
| Size | 104.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
188706875d76367ab699c24e0dee9663ed6e945e81ac06e8858d77735b218116
|
|
BLAKE2b-256 checksum How to use checksums |
ed23042e704cc8cb6d975df81459e38ff242c3b1f4ee67ecdf34e663c094d81d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.
Transparency logSecurity for cocotbext-sva 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for cocotbext_sva-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.