Building an 8-bit Computer From Scratch: Part 1 of ?
It was really cold this winter in Chicago. For a few days, the wind chill was around -50F. Which is pretty crazy. To pass the time, I decided to start a new electronics hardware project. The past year or two I’ve mostly been doing hardware projects in my spare time because I never have to chance to any at work. This project is going to take a long time.
Inspiration for this project came from an amazing Youtube Channel by Ben Eater. One of the big series he has on his channel is a step by step guide to building a computer using logic integrated circuits. He goes through all the steps needed to build the CPU clock, registers, arithmetic logic unit, system bus, RAM, ROM logic for displaying numbers and loads of other neat stuff. Ben’s personal website has a full list of parts you can get online and circuit schematics for each of the modules.
The basic structure of the planned computer is pretty simple. As a result it isn’t able to do much. In the end, I want it to add/subtract 8 bit numbers. Use 2’s complement to work with negative integers. It will have about 5 or 6 assembly instructions and be able to run programs that are around 14 instructions long.
Saying it is an 8-bit computer is somewhat misleading because the memory address space will only be 4-6 bits depending on how things are built. The clock speed maxes out at a few hertz so you’re not going to be calculating too fast.
At this point, I have a pretty basic binary adder/subtractor built. It has 5 modules. It can added 2 8-bit numbers and that is about it.
- System Clock
- A Register
- B Register
- Instruction Register
- Arithmetic Logic Unit
The system clock is made up of a few 555 timer chips setup in their various operating states (astable, monostable, and bi-stable). They are set up to blink an LED at a rate that is adjustable with a variable pot. It runs in two modes. A simple latch system is built with some logic chips.
- Auto-mode (clock signal runs over and over again at a set rate)
- Manual mode (clock signal sent every time you click a button)
It runs at a few hertz. You can overclock it by turning the pot to adjust the timer circuit……
Here’s the schematic from Ben’s website:
The registers are built using 2 4-bit flip-flops to hold values loaded onto them. There is a lock and clock signal fed in to store the values. You can read them by toggling a read/write pin. Theses are using SN74LS173 chips from Texas Instruments. One of many logic chips from TI that were used.
Each register holds an 8 bit value you can load onto it.
I built A and B registers to load up values to add/subtract. And then an instruction register to store instructions/memory addresses. The instruction register hasn’t been used yet because I don’t have anything to control CPU logic yet.
Arithmetic Logic Unit
The ALU can add/subtract two 8 bit numbers. It makes use of twos-complement to handle negative values. Normally a computers ALU would handle some bitwise operations but this one is only going to add/subtract.
There is still a ton of work left to do to get this working decently. I need to work on the system bus, hooking up RAM/ROM and something to keep track of CPU instructions. Also memory management with will be kind of difficult. Planning out the next steps now. I wanted to try and do some stuff outside of Ben’s plans but am not sure what yet.
Here is everything hooked up in all its’ messy glory: