NoteFirePhoenix

The Breadibus Breadboard Computer

That time I built a computer out of logic gates.

A photo of a breadboard computer. The board is covered in different colored wires.

This funny thing happens at the end of your junior year at my school. Your humanities teacher pulls you aside and says "If you want to graduate, you're going to need to spend your entire senior year making something."

You spend the next month or so deciding what exactly you're going to do and writing a proposal. Then it's summer, and you forget any of this ever happened until you sit down in the first class of your senior year and the teacher says, "So let's just go around and say what our projects are." Oh no.

Suddenly your once reasonable and perfectly doable project plan becomes incredibly daunting and ambitious. Past me wants me to do what now? Build a computer? Out of logic gates?

Nevertheless, you push on. I, in my infinite wisdom, wrote in my proposal that I would build a computer out of logic gates and wires on breadboards, similar to Ben Eater's and jdh's.

But What Does It Do?

I get asked this question a lot. The short answer is: not much. It has 64kb of memory and storage, no way to give it any input, and can only output a single number at a time. It can add and subtract any number between zero and 255 and is capable of basic conditional operations (like if this number is zero, output 12). Essentially, it is theoretically capable of any mathematical operation, but good luck calculating what 255+1 is (it's zero, obviously).

This is the part where you look at me all weird. "Now why would you build a computer so utterly useless?" you ask. It's simple: because it's cool. What makes this computer special isn't what it does (or more likely, doesn't), it's what this computer is made of: logic gates. This computer is only a few steps removed from being made out of transistors. My engineer friends look at it and go, "You probably did more building that then I had to do to get my degree." In that case I'll take my degree now.

Within this computer is the basic stuff that goes into all of our electronics. Somewhere in your microwave is a little tiny (and much more powerful) breadboard computer.

How It's Made

A photo of a powered yellow light in a breadboard.

The first wires of the computer. It's just a light.

On September 19th, 2023, I laid the first wires of my computer. I had originally planned to build the entire thing in my computer using a program called Logism before building the physical computer, but I pretty quickly decided, for efficiency, to combine the two steps, and build the parts I've designed while designing the next parts. This quickly devolved into me just ordering the parts I thought I needed, and placing them on the board without designing anything first. To this day, I have virtually no diagrams of the wiring for this reason, and that's only caused me pain a handful of times.

I decided to start with the clock module. Most modules of the computer rely on the clock in some way. The light blinks, and the various modules do things to the timing of the blinking. I purchased Ben Eater's clock module, as this ✨electrical engineering✨ stuff is way above my pay grade, even now at the time of writing this.

A photo of a breadboard with wires connecting between chips. There are three yellow lights.

The completed clock circuit on October 3, 2023.

Next up were the registers. The computer was originally only supposed to have two of them (I later added two more). You can think of a register as holding a number you are currently doing things with. Memory also holds numbers, but they aren't at your fingertips like numbers in registers are.

A photo of four breadboards covered in wire. They are loosely connected with wire.

November 7, 2023. The clock is to the left. Two registers sandwich a makeshift bus.

Work continued at a steady pace. By the end of November, I had physically connected the boards together, rewired everything to use spools of wire instead of jumper cables, and had started work on the arithmetic logic unit (also known as the ALU. It does math). In early December I had started the memory, which I would later put off finishing until early May.

A photo of the computer. It's taking shape. The wires look less messy.

January 3, 2024

This is where I stalled out for a while. It turns out taking on an ambitious photography project, peer reviewing theses, and finishing your own thesis doesn't leave a lot of room for wiring.

My next major update isn't until March, when I finally finished the registers and stack pointer. Then spring came and went, and I, along with many other seniors, realized we were running out of time.

Suddenly I was spending every moment I could wiring. I would go in early and wire before class, wire during study halls, and wire during lunch. My life revolved around wiring. In total I was logging around 10 hours per week wiring for about a month.

At the same time, I was spending a considerable amount of time at home writing software for the computer. After all, you need a way to program it. Over the course of 10 days (and nights), I wrote BreadLang, the programming language for the computer.

When I closed my eyes, I would see wires. I couldn't sleep because I was thinking about all the wires I had left to place, and if I would finish on time. When I did sleep, I dreamed of the computer. One night, I dreamed I turned on the computer and discovered an error. I then debugged and fixed the error in my sleep.

A photo of the computer. The bottom shows the beginnings of a new module. The rest of the computer is covered in wire.

April 9, 2024. Starting work on the final module of the computer: the brain.

The brain was the hardest part of the computer. Its job is to connect every part of the computer together. It has to orchestrate the computer actually doing things by sending various signals to each module. It takes 18 different signals as input and converts it into 32 different control signals that go all throughout the computer. I wrote a program that could be put across four chips to handle this. I had no real way to test the program on my desktop, since I didn't have a full simulator like junior year me said I would. Instead I looked over each section of the code three times for errors, and I caught the majority of errors this way. Keyword: majority.

The rest of the errors would be caught one by one as I attempted to get the computer working. This became more and more upsetting, as each time I would have to reprogram the chips, which took about four hours. I would turn the computer on, run my test program, and it would get just slightly further than last time. Then I would have to fix the program, rip the four chips out of the computer (they are the hardest chips to remove on the computer), and spend the next four hours reprogramming them with a fix.

With all this downtime between attempts, I would try to fix other errors in the wiring. Namely, an error where one of my counting chips would count twice when it was only supposed to count once. I had tried everything, everything that I could think of. I was so desperate I started asking my friend who is more knowledgeable with electricity than me for help, and he said "Classic electrical engineering problems. Can't help you". W-Why not?

I spent a week just trying stuff to no avail. Finally, in my desperation, I turned to Reddit.

There is a subreddit dedicated to making these sorts of computers, where people who are like me ask questions and people who are smart give answers. And let me tell you, some of those people are too smart for their own good. One user, going only off my very in-depth explanation of the wrong component, was able to identify the problem and offer a fix. It's quite technical, but essentially the count signals were fluctuating for a handful of nanoseconds (billionths of a second) and it was causing the counters to count twice. This marked a rare Reddit win. At least in my book.

After this fix, it was a game of getting those four chips programmed correctly. After three long days of programming and reprogramming, it finally happened.

May 5, 2024. The finished computer computing the fibonacci sequence.

It... works? Weird. It feels surreal to be finished with it. I've spent eight months working on this, and a year imagining it, and now it's done.

It's surprising just how precise computers really are. If you remove just a single wire, the computer breaks. If a count signal turns on when it's not supposed to for just a few nanoseconds, the computer breaks. If this is how precise my computer has to be, imagine the precision of an actual computer.

When I turn it on, and the lights blink, it's like magic. Knowing how it's built and the purpose of every little wire and chip only adds to the magic.

Dear Future Breadboard Computer Builder

Building a computer like this is a balancing act between low-levelness and functionality. Sure, you could build a computer purely out of transistors, but will it do anything? Or you could go one step up, as I have, and build it out of 74 series logic chips, sacrificing a little purity for functionality.

I will keep this brief so as to not repeat what you will hear so many times in your future (and not bore those of us who aren't planning a build but are reading this anyways).

My advice is:

  1. Watch all of (or most of) Ben Eater's 8-bit breadboard computer build series. r/beneater is also a great resource for finding advice and help.
  2. Keep your friends close, and keep your data sheets closer.
  3. Decide how low level you want to go. Do you want to use purely logic gates, or are you content with using register chips? Do you want to wire your own ALU or are you content with an ALU chip? Do you want to use a 6502 CPU and wire the surrounding circuitry?
  4. Know what you're getting yourself into. Building a breadboard computer is a long and expensive endeavor. If you're not prepared to take that on, this might not be the right project for you.

When I first imagined this project, I asked one of my friends who work in programming if it was possible.

"You're crazy," he said. Feeling dejected, I turned to another friend with a similar background,
"It'll be hard, but I think you can do it," he said. That was all that I needed.

I was probably going to build the computer regardless of what they said. Despite me having never written a word of assembly, having no idea how computers actually work, having never wired a simple LED, and having never made a programming language.

My lack of experience didn't matter to me. In the words of my friends, I was "crazy enough to do it." When describing why I built a darkroom in my attic, my mother said "When he's into something, he's goes all in." Perhaps I have a bit of an obsessive personality.

The difference between us normal people and a child prodigy is time and dedication. I didn't come out of the womb programming, I nurtured the skill over many years. PewDiePie dedicated himself to drawing for 100 days and made monumental progress. Every pianist has a moment where they sit down to play hot crossed buns and think "this is hard". I'm getting ahead of myself aren't I.

My point is: you are capable of great things. We all are. You just need to keep putting one foot in front of the other.

Until next time~