Making an 8-Bit Computer
by spiceylizard in Circuits > Electronics
3153 Views, 6 Favorites, 0 Comments
Making an 8-Bit Computer
In this instructable, I will be showing you how to make an 8-Bit computer using microchips, breadboards, and wires.
This is not an original project, however I will be covering my trial and errors when it comes to troubleshooting and building the overall computer.
Additional Helpful links are provided below:
Ben Eater's Website (Provides a full walk through with pairing videos)
Corresponding Reddit (Helpful for troubleshooting)
Supplies
A complete part list is provided via This Link
or you can buy complete kits of all the parts -- Click Here
Additional parts that you may find helpful are as follows:
A small Philips head screwdriver (like the one provided in this iFix-It kit) -- Click Here
A set of small needle-nose pliers -- Click Here
Wire stripper that works for 22 gauge wire -- Click Here
A logic probe (needed for troubleshooting)-- Click Here
Helpful Tips and Tricks (#1 Reddit Links)
Here are several posts from Reddit written by people who have finished the 8-Bit CPU and are providing tips, tricks, and overall guidance.
Click Here for u/nonsequitr's post. The information I found helpful was in the "Lessons Learned / Advice" section.
Click Here for u/CalliGuy's post. The information I found most helpful was the "LEDs" section.
Click Here for u/lordmonoxide. I didn't find anything particularly useful in this post, but I'm linking it in case you find it helpful.
I will cover the tips I found the most helpful in the coming steps.
Helpful Tips and Tricks (#2 Reading Schematics)
Learn to read schematics, and then always double- triple- maybe even quadruple- check your work against the schematics, regardless of what's going on in the videos.
We can quickly fall down rabbit holes, but schematics mainly use logic gates. I think this comic by XKCD sums up logic gates pretty nicely.
Once you familiarize yourself with logic gates, the rest of the schematic comes relatively easy. The giant square/rectangles are chips. You'll need to reference the Data Sheets (provided on Ben Eaters Website & in the kits) for each individual chip to understand what it does.
Other important things to know is that VCC is the positive side, and GND is ground, and familiarize your self with capacitors and resistors.
Helpful Tips and Tricks (#3 LEDs)
Throughout the build you often use LEDs to show bit status. The LEDs included in the kits have no embedded resistor. This can cause them to draw to much power from the chips resulting in power issues/fluctuations.
The kits include enough resistor to solder them to the LEDs. This (although doable) is a giant pain for those who are not experienced with soldering.
I found it extremely helpful to buy LEDs with built in resistors. (Links Below)
Helpful Tips and Tricks (#4 Assembling the Computer)
Throughout the build, each module is built into its surrounding modules.
As long as you keep the separate modules organized and attach the incoming modules to there respective partners you should have no problem.
I found it incredibly helpful (especially towards the end when you start wiring up the Control Logic module) to place little guide wires over top of other wires to help keep them organized.
You may also find it helpful to place capacitors periodically around the board on the +5V & GND rails to ensure power delivery is smooth across the entire board.
Building the Clock Module
The first step in making a fully functioning 8-Bit computer is making the clock module.
This is by far the easiest part in the whole building process.
The problems I faced while building this module were very minimal
This module is really cool in the sense that you switch between manual clock (which comes in handy when trouble shooting later) and an automatic clock mode and you can adjust the clock hertz by spinning the potentiometer.
**You'll see this module in most of the other steps. Its incredibly helpful when it comes to troubleshooting each module. As you can run them each independently of each other to ensure they work.**
Here's the corresponding Ben Eater link -- Click Here
Building the Registers (a)
In this step we are making the Registers.
You have to make 3 registers in total. A Register, B Register, and the Instruction Register.
Both the A Register & the B Register are identical. The instruction register is a little different. (We'll cover that next step)
As long as you follow the schematic you shouldn't have any trouble. This project gets more difficult as it progresses. This is definitely a good stepping stone for the coming steps.
A tip that I found useful is to first lay the wires according to the schematic, than go back though and organize them. (Demonstrated in the pictures)
Here's the corresponding Ben Eater link -- Click Here
Building the Registers (b)
In this step we will be building the instruction Register.
This is a little trickier than the first two registers but only because its mirrored.
We wont need the Instruction Register for a little while, so its ok to set it aside for a while.
Here's the corresponding Ben Eater link -- Click Here
Building the ALU
In this step we will be combining the A Register and the B Register together to create the ALU. (Arithmetic Logic Unit)
The ALU contains both the A Register and the B Register. The ALU gives the computer the ability to add or subtract values stored in the A Register against values stored in the B Register.
Admittedly the ALU was my trial by fire for learning how to read schematics. I had to rebuild the the ALU 3 separate times. You can make along fine for the previous steps without knowing how to read schematics and just by watching the videos, but the ALU is a different story.
Don't be discouraged if when testing it it doesn't work as planned. I found it helpful to break the ALU down into 3 separate pieces and try again.
Here's the corresponding Ben Eater link -- Click Here
Building the MAR
In this step we will be building the MAR (Memory Address Register)
Before we build the RAM, we to construct the MAR. The MAR allows us to read/write to/from specific RAM addresses.
Without the MAR we have no way of telling the RAM which address we want to access.
Building the MAR was pretty easy, as long as you follow the schematic you shouldn't have nay troubles.
Here's the corresponding Ben Eater link -- Click Here
Building the RAM
In this step we will be building the RAM. (Random Access Memory)
The RAM is a little complicated to explain (there's hours of internet for that) but I'll give a brief description for those less knowledgeable.
Ram acts as short term memory for computers/phones. Imagine playing a Mario game on a Nintendo device. As you move onto the next level, there is a brief moment where the device is loading. This loading time is where the device removes the first level from RAM and replaces it with the Second level (stored in long term storage).
For our purposes (because my build has no long term storage) the RAM is the only place to store data.
This build uses 4-bit addresses which means it will only have 16 bytes of RAM, limiting the size and complexity of programs it can run. This is by far its biggest limitation.
Here's the corresponding Ben Eater link -- Click Here
Building the Program Counter
In this step we will be building Program Counter.
The program counter counts in binary (1's & 0's) to keep track of which instruction the computer is currently executing.
On the surface this is a relatively an easy step, however I had quite a bit of difficulty. In the schematic the 'clear pin' for chip 74LS161 is pin 1. This clears when the input is high.
I had wired the reset pin high and hadn't realized my mistake until I posted a video on Reddit asking for help.
Here's the corresponding Ben Eater link -- Click Here
Building the Output Register
The output register is similar to the A & B Registers except rather than displaying its contents in binary on 8 LEDs, it displays its contents in decimal on a 7-segment display.
Converting binary to decimal requires complex logic. We'll use EEPROMs to help us. (more on them next step)
Building the Output Register wasn't to complicated. The most tedious part was getting the combination of resistors and capacitors just right in order to have the display show all the values.
The Output Register can only display one digit at a time, this means you have to arrange the resistors and capacitors in such a way where the clock speed for that particular register is much faster than the rest of the computer.
Here's the corresponding Ben Eater link -- Click Here
What Are EEPROMs?
An EPROM is an Erasable Programmable Read Only Memory chip where its memory can be erased and reprogrammed.
The most common type of EPROM have UV light sensitive receptors that when exposed to UV rays, erases all data on the chip.
An EEPROM is an Electronically Erasable Programmable Read Only Memory chip where its memory can be erased and reprogrammed all electronically.
Here's the corresponding Wikipedia link -- Click Here
Bringing It All Together
This is the step where it all comes together. This is the only step where were not messing with wires or chips. Just bread boards.
We still have to add a Reset Button, the Control Logic, and the Control Output (covered in later steps)
When assembling modules that are sandwiched in between other modules, they share the +5v & GND rails. To ensure the boards fit properly you have to remove one of the +5v & GND rails from the middle modules.
All of the extra +5v & GND rails will eventually become your bus. (the common communication link between all of your modules)
**Reference Helpful Tips and Tricks (#4 Assembling the Computer) **
Here's the corresponding Ben Eater link -- Click Here
Building the Control Logic
As the end nears the horizon, we need some way to control all of our individual modules from one central place. The Control Logic is that place.
Before We build the control logic we need to wire all of the inputs from each individual module to one place and add LED's to allow us to see what command each module is receiving.
Once all of the Module inputs are routed to the bottom right corner we can build the Control Logic in the bottom left corner.
Here's the corresponding Ben Eater link -- Click Here
Programming the Computer (a)
Once you have completed the build phase the best way to trouble shoot the computer is by giving it different instructions and running through them step by step using manual mode of the Clock module.
Due to the fact that this build has no permanent storage you have to program it every time you power it on.
When you first power on the computer random bits are assigned to every RAM memory address.
Ben Eater has a much more in depth explanation of the Assembly language, how it works closely with the control logic, and how it incorporates all of the different modules into a fully working turing machine (or computer).
In the next step we will cover how to program the computer to multiply two numbers. As long as the product is less then 255.
Here's the corresponding Ben Eater link -- Click Here
Programming the Computer (b)
To run a program you have to input the Assembly values into the RAM module
When running the program more than once you'll have to reset the Product-Value and the X-Value.
The picture above is the Assembly Language used to multiply 2 numbers together
--Steps to run a program-- (Color Coded)
1: Reset the computer (Red)
2a: Flip the RAM/MAR switch to ‘manual input’ so the Red LED is on (Blue)
2b: Make sure the clock module is on ‘manual mode’ so the far right LED is on (Green)
3a: Manipulate the MAR and RAM to store the correct values in the RAM (Yellow)
3b: Double check your RAM values (Purple)
4a: Flip the RAM/MAR switch back to automatic (Blue)
4b: Put the clock module back into automatic (Green)
As soon as the Clock is back on automatic, the computer starts working through the code. To speed up or slow down the computer twist the potentiometer in the Clock Module. (Orange)
Running a Program (a)
In this example the computer multiplying is two numbers, 15 and 7 for a product of 105
or in Binary 00001111 and 00000111 for a product of 11110000
Ignore the sound on the video :)
Running a Program (b)
In this example the computer is multiplying is two numbers, 3 and 5 for a product of 15
or in Binary the numbers are 00000011 and 00000101 for a product of 00001111
I start the computer on a lower clock speed than the previous example to show the effect of speeding it up.
Ignore the sound on the video :)
Closing
This build is much more detailed than I could ever convey in a mid-sized instructable.
There are hours of Ben Eater videos detailing the in depth working of each individual module and chip.
It took me a rough estimate of 6 months of moderate building (After school, On the weekends etc) to complicate this build.
I learned a lot about Computer Science, including but not limited to:
How to read Schematics
The absurd complexity of larger computers
A further understanding of LEDs and Capacitors, and Resistors