printf("Hello, world");⠀⠀⠀⠀⠀

I'm Anthony, a computer science student

Projects

🛠️ This website is still under construction 🛠️

8-Bit CPU Project

2023-Present

Over the summer of 2023, I become inspired through a series by Youtuber Sebastian Lague where he explores how computer logic and memory operate, starting from gates and latches to ALUs. These videos are by far the best resource that I've ever found explaining these fundamentals, I would recommend to anyone who's interested or are studying the subject. He also has a cool cat.

Adder diagram image
Ripple-carry 8 bit Adder in Minecraft

Surprised by how easy it is to make a basic ALU, I decided to start replicating it in Minecraft. The game as a pseudo electronics system that lets you build all the logic gates you need to make a complete computer. Starting from a D latch and a 1 bit full adder, I eventually worked my way to a full 8 bit adder.

Here, you can see that both Register A and B have 00000100 (4), the circuit is adding and so the output is 00001000 (8).

The parity flag is on meaning that the value is even.

Eventually I became interested in replicating this on a breadboard and watched around Ben Eater's youtube series on it.

In this 44 part series, Ben goes over the design and construction of an 8 bit processor on breadboards. Aquiring all the equipment would be expensive and a long endeavour. Nevertheless, I still was inspired by the idea of being able to design my own cpu. I started looking around the internet about CPU design, knowing virtually nothing about it. I stumbled upon a blog by Ken Shirriff on his project on reverse engineering the Intel 8008 chip. Seeing a real chip implement a similar kind of ALU, it made the prospect of doing it all myself even more real.

Another video that gave me insight to the design process was jdh's video: I designed my own 8-bit computer just to play PONG.

Seeing how he went from a plain text file with the specification to a full working simulation (he later ended up doing on a breadboard), gave me the confidence to start throwing together something myself. My initial ideas were pretty dodgy and often fell apart after some critical thinking, but I was enjoying the process nonetheless.

Seeing as building a whole breadboard computer would take up too much space, time and money, I figured that I would try the software that I had seen on the university computers: Logisim.

1 Bit Adder Circuit image
1 bit Adder in Logisim

A and B are the 2 numbers that you want to add together; Ci is the carry in; Y is the output; Co is the carry out.

8 Bit Adder Circuit Image
8 bit ALU in Logisim

This is an 8 bit ALU capable of adding, subtracting and comparing. Currently it is adding 64 + 64 and is outputting 128 (80 in hexadecimal).

Op is the Op Code; A is the A register input; B is the B register input; Ci is the carry in; O is the overflow flag; Y is the output; Co is the carry out flag.

8 Bit Adder Circuit Image 2
8 bit ALU Flag Logic in Logisim

This is the bottom half of the ALU and shows the logic for each of the flags.

Z is the zero flag and denotes whether or not the value is zero. G is the greater than flag and denotes whether or not A is greater than B (given a comparison operation). Finally, L is the lesser than flag and denotes whether or not A is less than B (given a comparison operation).

High Level CPU Architectuer
The Planned High Level Look

This is the current plan for the high level architecture for the whole CPU.

High Level CPU Architectuer
The Planned Instruction Set

Since the first 4 bits are reserved for instructions and the last 4 bits are reserved for addresses, I only have 16 instructions to play with. This means I had to cut off a lot of instructions that are normally seen on a CPU to maintain this very simple system. Normally, more bits are used for an instruction and the target address is simply stored in the next memory. However, since I want to make this as simple as possible, I will have it all at once.

This is mostly my project so far, I will write about updates over time.

This Website

2023-Present

I started this website mid 2023 and have been adding to it intermittently since. I plan on adding more in the near future.

My Interests

🎧 🖌️ Things I like to do 📚 🎮

Music

that I like.

If you're not signed in on Spotify on your browser then you'll have to put up with low quality previews.

Books

that I've been reading.