Wait, Building a CPU?
Some time ago, I listened to one of Scott Hanselman’s podcasts, hanselminutes, and he was interviewing Ben Eater. This man was on the show because of his tutorial and project on how to build an 8-bit CPU from scratch. That caught my attention. After listening to the interview, I’ve added this to my list of future projects. Fast forward a few years, and it is time for me to give it a try!
Ben Eater has multiple tutorials for multiple electronic projects on his website, https://eater.net/. There are tutorials about building a PC from scratch, a video card from scratch, and a CPU from scratch, just to name a few. For all of these projects, you can buy all the necessary parts directly from the site. If you wish to buy all the parts separately, a list of the necessary components is provided. When it comes to the CPU building kit, there are four kits that you can buy separately or together to get a small discount.
The first kit is the clock module, the second is for the registers and the ALU, the third kit is for the RAM and the program counter, the last kit is for output and control logic.
The project is done on breadboards, which means no soldering is required. As for the tools that you will need to get on with this project, the list is pretty short:
- Nose pliers
- Wire cutter
- Wire stripper
An optional but highly recommended tool is a multimeter. You can check out Ben’s recommendations for all these tools on the CPU project page on his website.
There are no mandatory prerequisites to start this project in my opinion. You can jump in without any background in electronics. That being said, here are some things that you could look up to help you on your journey:
- Understand basic logic gates (e.g., AND, NAND, OR, etc.)
- Understand basic boolean algebra
- Understand how to read circuit diagrams
The only instructions you will get from the kits are the circuit diagrams. Those diagrams are easy to work with and you will often go back to them for quick references. To get the most out of this, you should follow along with the companion videos on Ben’s YouTube channel. Not only will you have detailed tutorials and instructions, but you will also get detailed explanations of how a CPU works, design choices, and more. One last thing, be aware that a 15-minute video can take an hour to go through. There is a lot of information packed in there. And once you understand what you have to do, why, and how it works, you have to make it yourself! That will be a multi-month project for me. That means I won’t work on this “full-time” until it is finished. I’ll take breaks to work on other things, especially between each kit.
At the end of this, I’ll have a fully working 8-bit CPU (hopefully) that I have built from the absolute ground up!
Building the Clock Module
You may have noticed from the previous section that even the CPU clock has to be built from scratch. The full first kit is dedicated to this. This makes sense, since the clock is the beating heart of the CPU (as you probably know, CPUs execute instructions on each clock tick).
As you can see, the clock module takes up an entire breadboard. This is mainly because the clock can be used in one of two different modes: continuous and manual. The continuous mode makes the clock tick at regular intervals, as one would expect. It is made possible via the 555 timer chip on the left. The clock speed can be adjusted with the nob. The clock ticks each time the capacitor discharges (this is all explained in great detail in the videos). The manual mode is possible via the second 555 timer. Each time you press the button, the clock will tick once. This will be useful for debugging issues and taking the time to understand how things work. Finally, you have a switch and a logic circuit to decide which mode is in use. The blue LED is flashing at each clock tick, regardless of what mode the clock is in. To finish, you might notice the purple wire. This will be used later to programmatically stop the clock for debugging purposes. For now, it is connected directly to the ground. That’s a very brief overview of what is going on here. As said earlier, thorough explanations are provided in the tutorials.
This is the beginning of a long, but exciting project. I expect to write one blog post per kit, maybe more. The next time I write on this project should be about completing the registers and the ALU!