A CPU with a One Track Mind

Hobbyist Michael Morton built an 8-bit CPU from 680 transistors using the subleq instruction set, running 170 ops/sec with 256B of RAM.

Nick Bild
6 minutes agoRetro Tech
Who needs breadboards when you've got cardboard? (📷: Michael Morton)

Computer engineering is one of the deepest rabbit holes that a person could ever go down. Someone just dipping their toes into the field might start by choosing the perfect motherboard, CPU, memory, hard disk, and so on, to assemble for their desktop computer. From there, it is only a matter of time until they have an old CPU from a simpler time free running on a breadboard. And if they make it past that stage, they might end up like Michael Morton, who spent his entire summer building a homemade CPU.

Once the decision has been made to design a CPU, one must first settle on an instruction set to use. This could be completely custom, or it could mimic an existing architecture. Either way, it is likely to fall into the RISC or CISC category. But Morton’s CPU is neither. It is an oddball called the sebleq instruction set that consists of only one instruction. Don’t let that simplicity fool you though — it is a Turing-complete processor.

The subleq (subtract and branch if less than or equal to zero) instruction performs a memory-based subtraction and conditional branching. This deceptively simple instruction can be used to simulate any other computational operation, such as arithmetic and memory manipulation. It is by no means efficient, and it does not offer great performance, but it can run any computational algorithm when sequences of subleq instructions are strung together with care.

Morton’s machine is an 8-bit CPU that he designed and built almost entirely from scratch over the course of four months. His goal was to minimize the use of integrated circuits and instead rely on discrete components. The result is a computer made up of a few hundred logic gates, built from over 680 individual 2N7000 NMOS transistors paired with pull-up resistors.

Running at just over 1 kHz, Morton’s CPU is far from breaking speed records. Each instruction requires six clock cycles to complete, which works out to about 170 operations per second. That is incredibly slow by today’s standards, but it is more than enough to run basic programs. And for a homemade machine assembled on cardboard with hand-wired connections, that is pretty impressive.

The CPU has a small set of functional blocks, including asynchronous registers for operands, a subtractor that handles the core instruction, a program counter, a branch unit, and a control sequencer based on a six-stage ring counter. The only integrated circuit onboard — aside from an optional LCD for output — is a small SRAM chip that provides 256 bytes of memory.

Let’s just say that programming the machine takes a lot of patience. Morton uses DIP switches to input code directly into memory, flipping bits one at a time. While tedious, it works, and the minimalist design is part of the charm. To make things more accessible, Morton also created a Logisim simulation and posted both the design and supporting files on GitHub, so anyone that is curious can tinker with the architecture virtually.

Future improvements could include designing printed circuit boards to replace the fragile point-to-point wiring and writing more complex programs for the system. Regardless of what comes next, building a homemade CPU is a great educational experience. If you are interested in learning more about computer engineering, you might want to try your own hand at it.

Nick Bild
R&D, creativity, and building the next big thing you never knew you wanted are my specialties.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles