paololapo / 8-bit-CPU-emulator

8-bit CPU emulator for running simple ASSEMBLY code, final project for the 'Management and Analysis of Physics Dataset (MOD. A)' course.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

8-bit CPU emulator

The context

The final project for the 'Management and Analysis of Physics Dataset (MOD. A)' course in the 'Physics of Data' master program, University of Padua.
Authors: Paolo Lapo Cerni , Emanuele Quaglio , Lorenzo Vigorelli

The project

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 functions
  • CPU.py : the main class with all the logic functions to handle every microinstruction flexibly and scalably. Inside the class, there are also the functions load() (the RAM) to read an ASSEMBLY code from a .txt file, and run() . 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:

schematics

About

8-bit CPU emulator for running simple ASSEMBLY code, final project for the 'Management and Analysis of Physics Dataset (MOD. A)' course.


Languages

Language:Python 100.0%