Let's Make a CPU: Part 0 - Intro
Tue 07 of March, 2017
Ever had a thought "how does my computer work"? I sure did. And I wanted to understand how it does all the cool thing it does. How can I tell it to draw pixels on screen? How does it know what screen is? How does it know what's blue, or what's 'c' is, "this is a string"? How can it do multiple things at the same time? (Talking about single core here)
In this series of blog posts I will try to answer some of those questions by building my own, simple CPU, starting with just a transistor, Boolean logic and my google-fu.
The goal is simple really, build the simplest 8-bit CPU to understand how they work. Nothing fancy, no branch-prediction, not even any pipelining. Maybe even cheat somewhere, like not making all instructions for it, since some can be emulated with others.
If you don't know some of those terms, don't worry, I will introduce them later when they become relevant. It'll all make sense in the end.
"Wait, are you going to solder a giant CPU?" some of you might ask. And, no, no I won't. What we'll do, is we'll simulate it of course. There are many ways to do this, write an emulator in a programming language of your choice, implement an HDL (Hardware Description Language) module and either simulate it on existing sims, or actually flash it onto FPGA (Field Programmable Gate Array) and run real hardware, or... Or you could use something like Logisim.
Logisim is a free and open-source software to design and simulate logic-circuits. This is what we are going to use to create our CPU. Why Logisim though, why not do it on hardware?! Well, answer is pretty simple. To make it more visual. I think it's easy for us humans to process visual stimuli, so I think this is a good choice to start.
By all means though, if you feel inclined so, go look into HDLs, Simulators, and FPGAs!
Tune in next time, we will build out basic logic gates from mere transistors!