Skip to main content

DigSim - Interactive Digital Logic Simulator

Python Version from PEP 621 TOML PyPI - Version PyPI - Downloads Documentation

The DigSim Application

DigSim is an interactive digital logic simulator written in Python. It is made for learning and experimenting with digital logic, from single gates to complete Verilog designs: build a circuit on the canvas, start the simulation, and press buttons, flip switches and watch LEDs and hex displays react in real time.

Simulating Verilog normally means writing test stimuli and reading waveforms afterwards. Testing on an FPGA is interactive, but every change means a slow synthesis and programming cycle. DigSim sits in between: load a Verilog module, wire it to buttons and displays, and play with it right away. It is even fast enough to run a synthesized 6502 CPU.

📖 Documentation: https://freand76.github.io/digsim/

Features

  • Interactive GUI: build and simulate circuits with buttons, switches, clocks, LEDs, LED bars, hex digits, 7-segment displays, a buzzer and a logic analyzer.
  • Python API: create and simulate circuits in Python, for scripts or pytest testbenches.
  • Verilog support: turn Verilog into components with a bundled WebAssembly build of Yosys. Nothing extra to install.
  • Waveforms: save simulation results as VCD files and view them in GTKWave.

Installation and running

DigSim requires Python 3.11 or newer and is published on PyPI as digsim-logic-simulator. Choose the option that fits what you want to do. See the installation guide for more details.

Option 1: Run without installing (uvx)

With uv installed, this downloads and starts DigSim in a temporary environment:

uvx digsim-logic-simulator

Option 2: Install as an application

Installs DigSim in its own isolated environment and adds the digsim-logic-simulator command to your PATH:

uv tool install digsim-logic-simulator    # or: pipx install digsim-logic-simulator
digsim-logic-simulator

Option 3: Install as a Python package

Use this to import digsim in your own scripts and tests. Install it into a virtual environment:

python3 -m venv .venv
source .venv/bin/activate                 # Windows: .venv\Scripts\activate
pip install digsim-logic-simulator
python -m digsim.app                      # start the GUI

Option 4: Run from source

Clone the repository to get the example circuits and Python examples, or to work on DigSim itself:

git clone https://github.com/freand76/digsim.git
cd digsim
uv sync                                   # or: pip install -e . (in a virtual environment)
uv run -m digsim.app

Command-line options

digsim-logic-simulator --load example_circuits/counter_yosys_netlist.circuit   # open a circuit
digsim-logic-simulator --version                                               # show version

Linux: Qt "xcb" plugin error

If startup fails with Could not load the Qt platform plugin "xcb", install the missing library (Ubuntu/Debian):

sudo apt install libxcb-cursor0

If that doesn't help, see troubleshooting for how to find other missing libraries.

Using DigSim

The commands below are run from the repository root (Option 4).

Simulate a circuit in Python and view the waveforms:

uv run python examples/example_sr.py
gtkwave sr.vcd

Test a Verilog design with pytest:

uv run --with pytest pytest examples/pytest_tb

Synthesize Verilog into a netlist for DigSim:

uv run -m digsim.synth synth -i <file1.v> [<file2.v> ...] -o <netlist.json> -t <top_module>

Read more in the documentation:

Contributions are welcome, see Contributing.

Development

uv tool run ruff format && uv tool run ruff check   # format and lint
uv run --with pytest pytest                         # run the tests
uv run --with mypy mypy                             # type check
uv tool run --with mkdocs-material --with mkdocstrings-python --with ruff mkdocs serve  # preview the docs

Star History

Star History Chart

Metadata

Release files for digsim-logic-simulator 1.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for digsim-logic-simulator 1.5.0
File Size Uploaded Provenance Actions
digsim_logic_simulator-1.5.0.tar.gz 326.8 kB Without provenance Details for digsim_logic_simulator-1.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for digsim-logic-simulator 1.5.0
File Interpreter ABI Platform Actions
digsim_logic_simulator-1.5.0-py3-none-any.whl Python 3 none any Details for digsim_logic_simulator-1.5.0-py3-none-any.whl

Total release size: 678.6 kB

Release files / digsim_logic_simulator-1.5.0.tar.gz

Download URL digsim_logic_simulator-1.5.0.tar.gz
Size 326.8 kB
Tags Source
SHA-256 checksum
How to use checksums
454f7cbe13756fe777535caea1f095156e58f35a1f10d31b77ddb5d4dda0105b
BLAKE2b-256 checksum
How to use checksums
566d8d4738d9604ed1a9b86f6d9082c67b9ed27e98a766c96b8586c994480f57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / digsim_logic_simulator-1.5.0-py3-none-any.whl

Download URL digsim_logic_simulator-1.5.0-py3-none-any.whl
Size 351.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4109555f6bb7e77005bee3c08e8ec21338df7769a3b129d50310d91af1d269ab
BLAKE2b-256 checksum
How to use checksums
a6e35631bb17668553304746d5e1f6efed903f22f930a7998258a3745eb702eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Security for digsim-logic-simulator 1.5.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Release history Release notifications | RSS feed

This release

1.5.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page