simuDAtor
Program for building and simulating processors. Build architectures easily with python scripts and run them in a intuitiv CLI!
Documentation
https://da.gitlab-pages.liu.se/simudator/
Installation
Create a virtual environments with:
python -m venv path/to/venv
Enter the virtual environments and run:
pip install -ve .
The project requires either pyqt5 or pyqt6. Install one of them.
Now run a processor such as mia, by running the command:
python src/simudator/processor/mia/mia.py
Implementation details
Modules and Signals
There are two main types of building blocks: signals and modules
A module has a number of input and output signals that it takes as arguments upon construction. In the constructor, it registers as destinations for the input signals and sources for the output signals.
The module has two primary methods: tick and update. tick corresponds to the clock and update to general logic.
A simulation cycle first executes the tick method of all modules (stored in some global/singleton list).
The tick method corresponds to the clock, so for a simple register, tick will propagate the input value (queried from the input signal) and send that to the output signal.
The output signal will, if the signal value changes, enqueue all the destination modules in a global/singleton update set.
Once all tick methods are executed, all modules in the update set starts executing the corresponding update methods. Similarly to the tick methods, this queries all input signals and computes new output values which are then sent to the output signals which again enqueues changes in the update set. The tick and update signals will typically query different signals, so if update require a signal value that is read during tick, it should store that value internally.
When the update set is empty, the execution of the clock cycle is over.
A block with a register at the output will hence only execute in the tick phase, while a pure combinatorial block will only execute in the update phase.