The Simplest CPU
Let’s imagine the simplest version of something that has the ability to calculate. If we break down a calculation into its simplest components, we will need: inputs, operations, and outputs.
We want input data to compute against, some raw material to convert into something else, some kind of operation or operations to do said converting, and finally some way to decipher and store the outputs, and convert those into inputs to continue the process.
The simplest tool-less version of this is to use our own dextrous human hands. Feel free to try this experiment, or skip it!
Put both of your hands into a fists, showing zero fingers. Lay your right hand down on a table or your lap. Next, stick out your index finger on your right hand, and place your thumb finger of your left hand over it. Your thumb will serve as the “counter”. Next, count the finger (1) and raise one finger one your left hand. The four fingers on your left hand will serve as storage. Now close your right hand again and raise any number of fingers from 1-3. Remember, as you count one with your left thumb, raise a finger on your left hand. Now, use your right thumb to “read” from storage and count how many fingers you have up on your left hand. Amazing! We’ve created a simple adder without talking about adding, just counting one at a time and storing what we’ve counted. We can do the same with subtraction, if we want, the only change will be to put a finger away on our left hand for every finger we count on our right.
Now there are some clearly obvious limitations to this method. Despite obviously being very physically uncomfortable, we have some serious mathematical barriers that cannot be overcome. For one, if we reserve our thumbs as counters, we can only store four numbers total, since our right hand is busy introducing new numbers to be stored on the left. Secondly, the only operations we can conduct are based around simple counting, we cannot even access the other elementary math operations of multiplication and division (well technically, we could do division on our fingers, but trust me, we do not want to do that).
Even as we introduce more complex technologies to the table the general principle of what we did on our fingers: reading the fingers up on our right hand, executing a count using our thumb counter, and writing them to the left hand every time we counted one is the basis for all computation. Modern day computers do this loop we just did in our heads really, really, really fast.
Let’s imagine one more simple technology (this one will only be a thought experiment, no need to worry about contorting your hands). In addition to the operations of reading, writing and executing above, what other simple operations might prove helpful?
Perhaps we realize that we can repeat certain parts of the counting process over and over while in the “write” step instead of stopping to read every time. To multiply is to add something over and over (2 x 3 = 2 + 2 + 2) so a looping operation would help us unlock multiplication from addition. Division is the same as repeated subtraction into groups, so we can use the looping function here as well.
What happens when we decide to stop the adding operation count the number of fingers on our left hand? Or what happens when our four left fingers “overflow” from counting on the right hand? We need some way of being able to stop the count, or more accurately modify our decision making based on what we see on our fingers. We can call this a conditional operation. With our conditional operation, we open up an infinite list of sub operations. Let’s say that if two fingers are up on your left hand are up, you do ten jumping jacks or five burpees, or if three fingers are up you do ten pushups and dance in place for 30 seconds. The options are limitless! We see our trigger, validate it, and then do something else.
So loops and conditionals have been added to our list of operations. We can now read and write to storage, execute on what we read, loop to repeat some helpful block of logic, and jump conditionally to some other process if some condition is met.
bramadams.dev is a reader-supported published Zettelkasten. Both free and paid subscriptions are available. If you want to support my work, the best way is by taking out a paid subscription.