The final project for the 'Management and Analysis of Physics Dataset (MOD. A)' course in the 'Physics of Data' master program, University of Padua.
Group 7: Paolo Lapo Cerni , Emanuele Quaglio , Lorenzo Vigorelli
A Python object-oriented high-level emulator for a simple 8-bit CPU, inspired by the project of Ben Eater .
The code is organized into three different files:
utils.py
: the definition of the classes of the components (registers, clock, ...) and some helper functionsCPU.py
: the main class with all the logic functions to handle every microinstruction flexibly and scalably. Inside the class, there are also the functionsload()
(the RAM) to read an ASSEMBLY code from a .txt file, andrun()
. By default, the state of the CPU after every micro-instruction will be saved into a log file.main.py
: to load the RAM and start the emulator.
At the moment, our instruction set is composed of LDA, ADD, SUB, STA, LDI, JMP, JC, JZ, OUT, HLT. Thus, this CPU is slightly more complicated than a SAP 1.
As a reference, here are the high-level schematics of the Ben Eater CPU: