>:_ 8 bit computer from scratch_

Intro

Hello all, this webpage will showcase an 8 bit computer build that I'm currently working on with my son. This project follows the series by Ben Eater where he works through building the various subsystems needed as separate components in the von Neuman architecture model. It will eventually be a fully functional computer that can be programmed in assembly language and add things! (although the assembly will have to be translated by hand to machine code). Here is an example of what the final product should look like:

Completed 8 bit cpu
Ben Eaters completed 8 bit computer.

Ours won't look exactly like this one above, but pretty close.

First Up: CPU Clock Module

A computer operates on clock cycles. The various components all do something (or nothing) with each cycle of the clock. The clock cycle is what signals to the CPU to load an instruction, execute an instruction, increment a program counter, or do nothing for a cycle. Modern computers operate in the gigahertz range, which means Billions of cycles per second. The module we're building doesn't need to be as fast. The chip that we'll be working with most is the 555 timer and it will allow us to generate clock pulses in different modes.

Clock Module Part 1: The 555 timer in astable mode

Today we built a circuit that puts one 555 timer into astable mode which makes it a square waveform generator. What this means is that we get a constant clock pulse at a predictable interval. Kind of like a watch ticking. The timing of the period and the duty cycle is controlled by a capacitor and a variable resistor, i.e, the length of time the LED is on and off is controlled by how much charge is held in the capacitor and how much resistance is applied to the flow of electrons. Being able to alter this is what will allow us to control how fast the computer runs through its set of instructions. The instructions called for a 1MOhm variable resistor and 2.2 nano farad capacitor. I didn't have the resistor on hand but I did have a 10KOhm, so we used that with a 100nf capacitor to stretch the duty cycle just to test things for now. Those parts will be replaced when they come in the mail.

555 Timer in Astable Mode

It's pretty neat how this works. The 555 timer output being on or off depends on the voltage of the capacitor and the capacitor charges and discharges depending on the state of the 555 timers S/R latch. When the capacitor is below 1.67v the S/R latch is 'set' the red LED lights up and current is allowed to flow into the capacitor. When the capacitor charge exceeds 3.3v the S/R latch resets, turning the red LED off and discharges the capacitor. Once voltage sinks back below 1.67v the S/R latch sets, starting the process over again. With variable resistor controlling current flow in and out of the capacitor, we can now control how fast the capacitor charges and discharges and that means that means we can control the frequency of the output. In the video below I turn the resistor knob to demo the change in output speed.

Clock Module Part 2: The 555 timer in monostable mode

At certain times, we will want to be able to move a program forward one step at a time and pause. This allows us to examine the computers state at any given point in a program and we can examine what happens from one state to the next. This is useful in debugging so we can figure out why a program isn't giving us the expected result. To make this happen, we added a second 555 timer to our clock module and set it into monostable mode. In this mode each pulse of the clock is controlled by a button that applies voltage to the 555 trigger pin when pressed. This means that the program doesn't advance and holds whatever state it's in until the button is pressed.

555 Timer in monostable Mode

In monostable mode the 555 output also depends on the voltage of the capacitor. In the base state in this configuration the capacitor is uncharged and the 555 output is off, nothing happens until the button is pressed. When the button is pressed, the S/R latch is set causing the output to be on, and the capacitor to charge. When the capacitor exceeds 3.3v then the S/R latch reset is triggered, causing the output to turn off, and the capacitor to discharge. Nothing happens again until the button is pressed. This basically allows for the output to be on for a small amout of time and then turn off again automatically, which means one clock pulse per button press.

You may have also noticed that the breadboard is bigger. Well, that is becuase Knox wanted to use the little breadboard last time. So after the last step was finished I moved everything over to a new breadboard to make room for the next few steps. Of course after that was done, he wanted a 555 timer that he could play with in the exact same configuration on the little breadboard. So I ended up building the astable timer for a third time on the board that I had just moved it off of.

Clock Module Part 3: The 555 timer in bistable mode

The last two posts were about building clock modes that allow us to advance a program in two different ways. The CPU can't run in both modes at the same time, so both timer circuits can't be allowed to output pulses simultaniously. We need a way to switch between modes. There's actually a few ways to do this but following along with Ben Eater's series lets us use the 555 timer again in its third mode: bistable. Bistable essentially means that the output is stable to two modes: stable on / stable off, or stable output A / stable outputB ...etc. This is perfect because we want this bistable circuit to throughput the pulse from either the astable circuit, or the monostable circuit but not both. Our bistable circuit is the chip and LED located at the bottom. I didn't have a push button switch like in the instructions, but I did have a two way switch on hand that I pilfered from some other parts box. This should be fine becuase we're using the SR latch in the 555 timer so the output should stay latched until the switch is completely moved in either direction.

555 Timer in bistable Mode

On another note, our set of proper variable resistors arrived so we switched the 10KOhm with a 1MOhm and changed the 100nf capacitor to a 2.2nf capacitor. Now we can get same clock frequency range as Ben Eater gets in his videos.

Clock Module Part 4: Clock Logic

In the clock module so far we have two possible clock pulses to send out: a constant intermittent pulse, and an on-demand single pulse. For the clock to be complete, we needed a way to have both clock pulses linked to the same output, but only allow one or the other to be providing the final output at any given time. The way to to do this was to use AND gates, OR gates, and NOT gates to build logic to provide the output while also preventing overlap. The integrated circuits used in this section were the 74LS04 (NOT gates), 74LS08 (AND gates), and the 74LS32 (OR gates). It was really difficult to try and get all three chip IDs visible in one picture, but each can be seen in the shot below.

Clock logic

The completed clock module is below. The red led is the astable output indicator, left yellow led indicates monostable output. The right yellow LED indicates the status of the bistable switch: on is astable out, and off is monostable out. The blue led shows the final clock output to the rest of the system.