digsim-native
The native simulation engine of DigSim, in Rust
(PyO3). DigSim uses it when it can import digsim_native, and simulates in Python when
it can't. Both engines give the same results (the settled values, the native engine has no
delays inside a Yosys component), the native one 45 to 100 times faster on Yosys netlists.
Install
The wheels are on PyPI and the releases, one per platform for every Python from 3.11: Linux x86_64 and aarch64 (glibc and musl), Windows x64 and arm64, macOS arm64 and x86_64.
pip install digsim-native
DIGSIM_ENGINE=python python ... # the Python engine, with the package installed
What it does
Rust runs the event loop and simulates every Yosys gate and functional cell, GND, VDD,
the bus ports up to 64 bits and one-bit ports with several drivers. Every other component
stays in Python and is called from the same event queue. When the wires change during a
simulation, the engine hands its state back to Python until the next init().
A Yosys component is one compiled block (src/block.rs), simulated like a compiled
simulator (Verilator) runs its logic: the cell outputs are slots of words (the bits and
the undefined bits), the combinational cells are evaluated in the order of their ranks,
once each when a bit they read changed, and the flip-flops update their outputs in the
next round, like non-blocking assignments. The common cells are computed on 64-bit
words (the others by the cells of src/word.rs, so the values are the same), the gates by
a table, and a block of gates evaluates all its gates in a sweep when most of them
changed. Inside a block there are no delays: its outputs change 1 ns after an input. A
netlist with a combinational loop, tristate buffers or inout ports keeps one native cell
for each of its cells, with events, and so do the native cells outside blocks (with
levels instead of delays between them, see src/levels.rs). With levels=False
(DIGSIM_BLOCKS=0 in DigSim) every cell has its delay and events, exactly like in Python.
Engine.deposit_port(), deposit_word() and deposit_block() are the deposits of DigSim
(YosysComponent.deposit(), like Verilog's vpi_put_value()): a cell output, or a slot
of a block, has a value now, and the cell keeps it until it drives again, a flip-flop at
its next active edge, a combinational cell when an input changes. A block with a deposit
on a gate evaluates only its dirty gates from then on, without sweeps.
VcdWriter (src/vcd.rs) writes the VCD files of DigSim, the same text as pyvcd. The
engine writes the changes of its ports to it without calling Python, a port's variables
next to each other in the writer.
cargo build --release --features prof adds time counters (Engine.profile()) and
Engine.block_replay(), which times the calls of a block again without Python.
Build
pip install maturin
maturin build --release # the wheel, in target/wheels/
pip install target/wheels/*.whl # into the environment of DigSim
cargo fmt --check && cargo clippy --release --all-targets -- -D warnings && cargo test --release
tests/ has the tests that don't need DigSim (pip install <wheel> pyvcd==0.5.0 pytest,
pytest tests), the CI runs them on every push. The tests of the engine are in DigSim
(its pytest, and tools/native/): sh tools/native/test_local_native.sh in DigSim builds
this folder (next to it) and runs them, before a push. The CI doesn't run DigSim, so a
push never depends on it.
A new version works with the DigSim that pins the version before it, and DigSim works
with both (it checks INTERFACE): either can be pushed first. A change that DigSim must
follow keeps the old interface until DigSim's pin has passed it.
Releases
- Bump
versioninCargo.tomlandpyproject.toml. - Push a tag
vX.Y.Z. TheWheelsworkflow builds and tests the wheels and attaches them to a release. - To upload them to PyPI:
gh workflow run pypi.yaml -f tag=vX.Y.Z. PyPI trusts the workflow (Trusted Publishing: publisherfreand76/digsim-native, workflowpypi.yaml, environmentpypi), so it needs no token. - Bump the pin in DigSim.
The interface to DigSim isn't stable, so DigSim pins the version it was written for.
Metadata
Release files for digsim-native 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 4.4 MB
Release files / digsim_native-0.6.0-cp311-abi3-win_arm64.whl
| Download URL | digsim_native-0.6.0-cp311-abi3-win_arm64.whl |
|---|---|
| Size | 413.9 kB |
| Tags | CPython 3.11 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
554f82c64e859e68b8dbf81220c78820b5378df6df439bff68f2e240319aa5ef
|
|
BLAKE2b-256 checksum How to use checksums |
9ed014b2e88e735738b0daf131f5cdd6d611ab84099c4e196d2046dd0e00d154
|
| 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 26, 2026.
Transparency logRelease files / digsim_native-0.6.0-cp311-abi3-win_amd64.whl
| Download URL | digsim_native-0.6.0-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 445.1 kB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
6495d4ea322f88dc2ae2b4238f89930c776d145be09821755a065a28d4c68dcd
|
|
BLAKE2b-256 checksum How to use checksums |
ad278d77ff87b14e68aa9598bc5499e38e63780141baf785952e0788636ca80f
|
| 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 26, 2026.
Transparency logRelease files / digsim_native-0.6.0-cp311-abi3-musllinux_1_2_x86_64.whl
| Download URL | digsim_native-0.6.0-cp311-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 753.1 kB |
| Tags | CPython 3.11 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
514fe102176f444c54c97ed5340c0e960d938b84aa5c4cd5919637a90132d288
|
|
BLAKE2b-256 checksum How to use checksums |
f8df871ba39d1c0a4afc60b030cf407b507c1fd58921e856b796827eea049a84
|
| 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 26, 2026.
Transparency logRelease files / digsim_native-0.6.0-cp311-abi3-musllinux_1_2_aarch64.whl
| Download URL | digsim_native-0.6.0-cp311-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 703.0 kB |
| Tags | CPython 3.11 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
befb9bc663e7f3e2e016d19728f58c611701740eff84e9f15f69e5dd2836a871
|
|
BLAKE2b-256 checksum How to use checksums |
54e2003b6f28dc50179c904b27bbb29e01d4d179cb92c1ef5563f4ee160cfefc
|
| 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 26, 2026.
Transparency logRelease files / digsim_native-0.6.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | digsim_native-0.6.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 541.6 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
e4ecb3eba1d10596234dc49319f10ea33ba98f9455fd9b13983173a7d782168b
|
|
BLAKE2b-256 checksum How to use checksums |
7a842273b56a65f62026350c943118e7b1c3c6a19b40d8062899aef112078b35
|
| 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 26, 2026.
Transparency logRelease files / digsim_native-0.6.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | digsim_native-0.6.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 524.0 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
7b036e7b172cebbeb457d914f4bd3142c00ceca7430604bc6158be20596163af
|
|
BLAKE2b-256 checksum How to use checksums |
ee207629134dd92da08bc780c8395c6079f710ac7474907796ad788ec41223fa
|
| 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 26, 2026.
Transparency logRelease files / digsim_native-0.6.0-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | digsim_native-0.6.0-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 496.6 kB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
25a3cee4224334883af5930e3c12c454fa928de0aca581efd231a3662e671048
|
|
BLAKE2b-256 checksum How to use checksums |
4801375728162e33f1e2df9ea6fcee72c4980dbc233e9e525081f5e11033f02b
|
| 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 26, 2026.
Transparency logRelease files / digsim_native-0.6.0-cp311-abi3-macosx_10_12_x86_64.whl
| Download URL | digsim_native-0.6.0-cp311-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 531.2 kB |
| Tags | CPython 3.11 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
a33cac53e97dd292f767272bf35bc1a60c8629d7c866afb4230fa24eb0781559
|
|
BLAKE2b-256 checksum How to use checksums |
5572fba0faf629d7c1756563d8a43781c133aef9bf5642fe71cc1f561534ad08
|
| 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 26, 2026.
Transparency logSecurity for digsim-native 0.6.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
All 8 files in this release have been uploaded with provenance metadata.
Attestation for digsim_native-0.6.0-cp311-abi3-win_arm64.whl
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 26, 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.