GR8CPU

overview

GR8CPU Rev2, an 8-bit breadboard computer.

GR8CPU Rev2, an 8-bit breadboard computer.

GR8CPU is my project to build a fully functional computer on breadboards. The first version i built, GR8CPU revision 2, has easily over 600 wires, 74 integrated circuits and 79 LED lights. It is an 8-bit architecture with simplicity and processing power in mind. The CPU has access to 256 bytes of RAM, and i have written a fully functional Tic-Tac-Toe for it.

As of now, I'm working on building my second one, GR8CPU Rev3. The first CPU was loads of fun to work on, but my ambitions are higher: with 65536 bytes of memory, improved arithmetic and a much higher speed by design, this CPU is a contender for the most complex breadboard CPU ever made.

Whereas the flagship program for GR8CPU Rev2 is a game of Tic-Tac-Toe, the flagship program I'm working on now is a functional operating system inspired by the original unix, which is the grandfather of modern Linux, MacOS, BSD and android.
More about that here.

building

One of the first photos made of the building of GR8CPU Rev2.

One of the first photos made of the build.

The building of GR8CPU isn't just copying from the design to breadboards. For practically all modules (except maybe the registers), I took the effort of transferring the design to paper, with all the logic gates and combinations laid out. With my design and datasheets as my guide, I start building. Here you see one of the first photos of the build i made, the RAM module. The RAM module contains all of the memory for the CPU, both data and program. The blue lights indicate the selected address and the yellow lights indicate the data at that address (here not hooked up yet).

The RAM module, finished.

The RAM module, finished.

Here you see the RAM module, finished. I added some batteries to keep the RAM's content when the CPU is off. I also added an arduino used to load programs made on my computer into memory. This arduino would turn out to be a great idea, given the complexity of some of my programs.
Later, I would go to make a game of Tic-Tac-Toe, a prime calculator and the Fibonacci sequence, among other programs. I even had ambitions to hook a simple TTY screen and a controller up to this very limited CPU. After the making of the RAM, i would go to take a break from building on the CPU.

The beginnings of the ALU.

The beginnings of the ALU.

The ALU, finished and everything connected to the bus.

The ALU, finished and connected to the bus.

The next thing i started work on is the ALU. The Arithmetic and Logic Unit is the part of a CPU that does all the calculations. The ALU has four basic operations:
- Add / Subtract,
- Shifting left / right,
- XOR,
- AND / OR.
Add and subtract are what you expect, with the limit of 255 that an 8-bit number imposes. AND, OR and XOR are bitwise operations, which means the operation is performed separately on every bit. From here it's pretty obvious: AND turns the output on if both inputs are on, OR if at least one is on, XOR when exactly one input is on (for two inputs).
With all of these calculations and some optimisations, I was just barely able to fit a complete game of Tic-Tac-Toe in memory. However, there was not enough memory to add an enemy AI, so you'll just have to play a two-player game.

GR8CPU, finished.

GR8CPU, finished.

Here is a picture of GR8CPU, finished.

the screen

Finishing up the video generation circuitry.

Finishing up the video generation circuitry.

Now, i didn't build my CPU just to look at it, because it can do more than that! The image shows the video card with the video generation circuitry working, the point at which a monitor recognises the signal.
The screen is a character display, written one at a time, displaying up to 18 rows and 24 columns. The screen can accept up to 37.680 characters per second, at a steady rate. This is one character per row of pixels on screen.
The color of the character on screen can be set to Red, Green, Blue, Yellow, Purple, Light blue or white. The background is always black.

Early work on the TTY functionality.

Early work on the TTY functionality.

Over time, more circuitry gets added. This image shows the video card with some testing circuitry, so i can figure out how i would like to write characters to video memory.

Demonstration of the TTY screen in action.

Demonstration of the TTY screen in action.

Just for fun, here is a picture created by the video card. The font would later be changed.

GR8CPU Rev3

The first register of the new design.

The first register of the new design.

Right now I'm building GR8CPU Rev3. It is also an 8-bit CPU, with a 16-bit address space, interrupts and position-independent execution. It will likely have over twice the integrated circuits, and be approximately 50% bigger. The improved architecture allows the new version to be much faster than the old one, sometimes as extreme as increasing speed by over 300%.
Shown here is one 8-bit register, finished and tested. It works. I would go to build three additional registers right after this.

Two of the four registers, finished.

Two of the four registers, finished.

Shown here is more progress on the registers. The registers store values for calculations and moving data. More specifically, the "A" register stores values and can have all operations performed with it. This includes bitwise AND, OR and XOR, arithmetic addition of numbers, any number of bytes long and comparisons. The X and Y registers take on a more utilitarian role. They function the same way in most cases: as an optional offset to memory addresses, to store more data temporarily, and having an instruction to compare them to the A register.

where i'm now

The ALU, with the B register connected th the input.

The ALU, with the B register connected th the input.

Right now, i'm starting to build the actual calculating part of the ALU, responsible for adding, subtracting, AND, OR, and XOR. Now, i have the B register connected to the ALU's inputs, and merely 16 more wires before i can start building the calculation bits.
My next step is to connect the registers to the ALU's inputs, and then to build the individual calculation bits.


the future

As a general overview, after completing the ALU, i will:

  • Build the program counter, which keeps track of what part of the program is running.
  • Build the address post-processing unit, which makes the final calculations on which address to access.
  • Build the flags register, which stores the result of comparisons as well as the state of various things in the CPU.
  • Build the stack pointer, a 16-bit register. The stack is very useful in computer science.
  • Build the three 16-bit registers, used for configuring interrupts and to store addresses temporarily.
  • Build the control unit, the master of the operation. The control unit decodes instructions and figures out what the hardware must do to execute said instructions.