Interactive Digital Logic Simulator
Project description
DigSim - Interactive Digital Logic Simulator
Introduction
DigSim is a python based framework for digital circuit simulation. The main purpose of the software is to, in an educational way, play around with digital logic (simple gates and verilog designs).
When working with block design in Verilog/VHDL the simulation tools are normally fed with test stimuli (a very non-interactive way of working...) A block design can be synthesized and tested on an FPGA (where there are possibilities for interactivity if buttons and LED/Hex digits are available), but that often has a great cost in time (and sometimes money) leading to long turnaround time.
I started developing DigSim to make it easy to implement and visualize the functionality of simple verlog modules. During development I tried to synthesize larger verilog designs, such as the classic 6502 CPU, and even if it is slower than many other simulators it is not entirely useless.
Features
- Create and simulate a circuit using python code
- Create and simulate a circuit interactively using the GUI
- Create new components using synthesized verilog code
- Save simulation results in VCD files, which can be opened in for example GTKWave.
Quickstart
Install from PyPi
pip3 install digsim-logic-simulator
Install from GitHub
> git clone https://github.com/freand76/digsim.git
> cd digsim
> python3 -m pip install .
Start Interactive GUI
> python3 -m digsim.app
Note: Ubuntu
If your Ubuntu installation gives the folloing error message:
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found. This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: vnc, wayland, wayland-egl, eglfs, offscreen, xcb, minimal, linuxfb, vkkhrdisplay, minimalegl.
Then the following package must be installed:
> apt install libxcb-cursor0
Start with example circuit (example circuits are available in the github repository)
> python3 -m digsim.app --load example_circuits/counter_yosys_netlist.circuit
Run example (examples are available in the github repository)
> python3 examples/example_sr.py
Look at waveforms
> python3 examples/example_sr.py
> gtkwave sr.vcd
Examples of writing pytest/python test benches for synthesized verilog code
> pytest examples/pytest_tb
Yosys synthesis helper tool
> python3 -m digsim.synth synth -i <verilog file 1> <optional verilog file 2> -o <output_file.json> -t <verilog top_module>
Documentation
Documentation on GitHub
Star History
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file digsim_logic_simulator-0.6.0-py3-none-any.whl
.
File metadata
- Download URL: digsim_logic_simulator-0.6.0-py3-none-any.whl
- Upload date:
- Size: 285.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e202aa25688394ce9eca6215118e991c904f6f84873d2f30d51ec928a5625007 |
|
MD5 | cec7a9c5d48ae0e6d1af61050c5ba2b2 |
|
BLAKE2b-256 | a0e1c1b4f1684a529b0ec05b87d1ab59ebd84b79d294e7bb0441af585574bf9c |