Show HN: Home-made 8bit CPU from scratch
github.comHello HN,
As a Computer Scientist and an electronic passionate, I was always intrigued by the complexity of computer architectures and I always wondered if I could build a CPU myself from scratch. There are so many smart devices and constantly increasingly complex circuits and computing devices coming out every day that we are now used to consider this technology as a black box, impossible to replicate or even understand at a fine level.
This is the motivation behind my home-made 8bit CPU project I designed and built during the past weeks as the COVID-19 situation gave me a bunch of spare time. Moreover, this is also the first time I designed my own PCB so it was a double fun experience.
The peculiarity of this project is that it is entirely composed of simple logic circuits (74HCT ICs), with no microprocessors or complex parts.
The key feature of this CPU is that it is fully debuggable and shows you what’s happening in the CPU at any time. You can input simple programs by hand and go through the execution step-by-step by manually pulsing the clock and see how the signals and data flow through the CPU to accomplish the given operation.
I think this is a quite powerful learning tool if you’re interested in how computers and computation work, especially because it turned out to be way more complicated once you face the implications of dealing with impedance, the inductance of the circuit and other basic electronic problems that were not addressed by the initial schematic.
At the moment I built the version 1 of the CPU, I have already fixed up some little problems I encountered on the way and improved the design with version 2, already available on GitHub. There you can find all the schematics and PCB layout in KiCad format, as well as the code, a demo video and a bit of explanation.
Here you can find a demo of the CPU in action solving a variety of problems such as the Fibonacci sequence, finding prime numbers and sorting.
https://www.youtube.com/watch?v=R_gflIunANo
Please star the repository and follow me on GitHub and Twitter (@fscozzafava) to stay tuned with the updates on the V2.0!
First of all, thanks for posting this - it's very impressive! Do you have any resource to suggest for digging a bit more in this topic?
Thank you for the questions, I would suggest you a couple of really good resources on YouTube that makes learning this kind of notions quite enjoyable and profitable.
If you already have some basics of electronics and you want to deepen the computational aspect, Ben Eater did an exceptional video series on how to build a Computer on a breadboard. You can check it out here:
https://www.youtube.com/playlist?list=PLowKtXNTBypGqImE405J2...
and here: https://eater.net/.
He goes through the definition of a logic gate, on how to build each module of the Computer, up to the meaning of computation and Turing completeness.
If you're more concerned on the electronic side you here are a couple of very good channels to start with:
Thanks for the prompt response! Book-wise do you have any suggestions? I would be interested in acquiring some more knowledge on circuit prototyping and so on. As a side, was this your first design / iteration?
A must-have book is "Computer Organization and Design" by Patterson. The board shown in the video is the very first iteration of the project. As you may see there are some patches and rewiring that I have fixed already. I also improved the design considerably in v2, the schematics and code on GitHub are up to date. This new version will include more general-purpose registers, improved stack pointer, and expansion bus, together with an LCD display interface.