Skip to content

A virtual CPU, mini Operating System and Assembler.

License

Notifications You must be signed in to change notification settings

itaysaadia/OLAFv2-CPU

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OLAFv2 Processor

OLAFv2 is a virtual CPU, emulated over a program called Logisim, running a custom Operating System that compiled with a special Assembler.

This project is an educational project, which is used to give an intuition on how CPUs could work. Note: this chip is differently from other (and real) CPUs. when I did my research around this project, I tried to only get an intuition about how a processor could work, and I tried to design a CPU that will work internally different from other real life CPUs.

I hope you will find this project entertaining and educational as much as I did.

OLAFv2CPU

Overview

The code is divided to 3 parts:

  • The CPU itself
  • Am assembler for OLAFv2's assembly
  • Basic Operating System written in OLAFv2's assembly

How to run

Compile the OS

from the top folder, run python3 ./Assembler/assembler.py the output should go to OS/BOOT.rom and OS/initram.ram

Alternatively, you can use start.sh to compile the OS and load it to the CPU.

Loading the OS into the machine

To emulate the CPU, you should download Logisim. Once downloaded, load the CPU/olaf2.circ to Logisim with File->Open.

Then, press with the right click on the ROM (the block behind the CPU) and press Load Image... and select the newly compiled OS/BOOT.rom. The rom should be filled with hexadecimal numbers. Load the RAM (the block behind the ROM) the same way, but now load the file OS/initram.ram

Starting the CPU

So everything is loaded now and it's time to start the simulation. In Logisim, under Simulate (on the top bar), change the Tick frequency to 256Hz or above.

Then Press Ctrl+K or Simulation -> Ticks Enabled

Good Luck!