Most of us will be familiar at some level with the operation of a basic CPU, usually through exposure to microprocessors of the type that find their way into our projects. We can look at its internal block diagram and get how it works, see the registers and ALU, follow the principles of a von Neumann architecture, and understand that it has an instruction set with different instructions for each of its functions. We all know that this only describes one type of CPU though, and thus it’s always interesting to see alternatives. [Ike Jr] then has a project that should provide a lot of interest, it’s a CPU that only has a single instruction. It can only move data from one place to another, which seems to preclude any possibility of computation. How on earth can it work?
The machine has a set of registers as well as memory, and it achieves computation by having specific registers where we might expect to see instructions. For example the AND register is a two-position stack, that when it is full computes the AND of its two pieces of data and places the result in a general purpose register. The write-up goes into significant detail on the CPU’s operation, and while it’s unlikely the world will move en masse to this architecture it’s still a very interesting read. For now this is a machine that exists in software simulation rather than in silicon, and he’s working to release it so enthusiasts for unusual CPUs can have a go.
The idea of having registers that compute reminds us of a transport triggered architecture machine, being not the same as a one instruction CPU with a more conventional computing instruction.
Abstract PCB header image: Harland Quarrington/MOD [OGL v1.0].
Today’s computers are unimaginably complex, and so complicated it’s nearly impossible for anyone to comprehend everything a CPU can do in excruciating detail. It wasn’t always like this – the early CPUs of the 70s and 80s were relatively simple and can easily be recreated at the individual gate level. CPUs can be even simpler, as [Jack Eisenmann] demonstrates with a single instruction computer, the DUO Compact 2, made entirely out of 74-series logic chips and a bunch of memory.
[Jack] has a long history of building strange computers out of individual chips, including a TTL logic CPU and a significantly more complicated single instruction computer. The latest, though, is as simple as it gets. It’s just twenty chips, capable of calculating prime numbers, sorting strings, and everything else a computer is able to do.
With every one-instruction computer, there is the obvious question of what instruction this computer uses. For the DUO Compact 2 it’s a single instruction that accepts three arguments, A, B, and C. The instruction copies a byte from A to B, then jumps to the instruction at C. Is it even possible for a computer to add two numbers with this instruction? Yes, if you have massive look up tables stored in 2 Megabytes of Flash and 512 kB of RAM.
In the video below, [Jack] goes over how his tiny computer works and demonstrates prime number generation (it’s slow), string sorting (also slow), and displaying ’99 bottles of beer on the wall’ on the computer’s LCD. All the files to replicate this computer are available on [Jack]’s webpage, along with an emulator in case you don’t want to break out a breadboard for this one.
Continue reading “Designing A Single Instruction Computer”
[Jeff Laughton] was contacted by a customer that was interested in adding some automated functions to a printing press. Before eventually settling on a microcontroller for the job, [Jeff] went old school and started looking at logic gates, counters, and flip-flops. This lead him to the Motorola 14500 industrial control unit, a minimal processor with only 16 instructions. After a few ‘back of the napkin’ sketches, he came up with an extremely minimal computer that doesn’t use a microprocessor. It’s an interesting design notable not only for its electronic brevity, but also because it only uses one instruction.
The only instruction this computer will ever execute is an input test, the result of which controls a two-way branch. Instructions consist of an input address, output address, and a single bit of data. If the data bit is true, the computer jumps to one location in ROM, and if the data bit is false, a jump to another location is executed.
A computer really isn’t a computer without some form of memory, and this design is no exception. [Jeff] managed to add two bits of data between the 8-bit latch and 8-bit multiplexer in the design. This is enough to call a few subroutines which test the I/O-mapped memory to decide what the next instruction should be.
It’s a truly bizarre design, but actually much closer to a true Turing machine than the computers in your pocket, on your wrist, on your desk, and in your car.
Thanks [James] for the tip!
[Tomáš], a.k.a. [Frooxius] is playing around with computational theory and processor architectures – a strange hobby in itself, we know – and has created the strangest CPU we’ve ever seen described.
The Weird Processing Unit, or WPU, isn’t designed like the Intel or ARM CPU in your laptop or phone. No, the WPU is a thought experiment in computer design that’s something between being weird for the sake of being weird and throwing stuff at the wall and seeing what sticks.
The WPU only has four instructions, or attoinstructions, to change the state of one of the 64 pins on the computer – set to logical 1, set to logical 0, invert current state, and halt. These instructions are coded with two bits, and the operand (i.e. the wire connected to the computer) is encoded in another six bits.
These 64 wires are divided up into several busses – eight bit address and control busses make up the lowest 16 bits, a 32-bit data bus has a function akin to a register, and a 16-bit ‘Quick aJump bus’ provides the program counter and attocode memory. The highest bit on the WPU is a ‘jump bit’, implemented for unconditional jumps in code.
We’re not even sure the WPU can even be considered a computer. We realize, though, that’s probably not the point; [Tomáš] simply created the WPU to do something out of the ordinary. It’s not meant to be a real, or even useful, CPU; it’s simply a thought experiment to see what is possible by twiddling bits around.
Tip ‘o the hat to [Adam] for sending this one in.
If you’re going to build your own computer, it probably wouldn’t do you well to exactly emulate the computer you’re looking at right now. The modern x86 and x64 chips that power your desktop or laptop contain hundreds of individual instructions, and the supposed RISC CPUs found in ARM-powered devices contain nearly as many. No, if you’re going to build your own computer you should make it easy on yourself, just as [Jack Eisenmann] did when he built the DUO Compact, a one-instruction set computer made on a breadboard.
Instead of dozens or hundreds of individual instructions, a one instruction computer has – like its name implies – only one way of manipulating bits. For the DUO Compact, [Jack] chose a NOR and fork conditionally instruction. Each line of assembly written for the DUO Compact has four memory instructions: a source address, destination address, skip address 1, and skip address 2. [Jack] explains exactly how this operation can allow him to compute everything:
Three steps occur when executing the instruction:
- Load the byte at the first and second address. NOR these bytes together.
- Store the result of step 1 in the second address.
- If the result of step 1 was zero, then skip to the instruction at the fourth address; otherwise, skip to the instruction at the third address.
As if designing a one instruction computer built using only basic logic and memory chips wasn’t impressive enough, [Jack] went as far as writing an emulator for his system, a compiler, an operating system, and even a few programs such as a square root calculator and a text-based adventure game.
By any measure, [Jack] has finished an amazing build, but we’re blown away by the sheer amount of documentation he’s made available. He’s even gone so far as to write a tutorial for building your own DUO Compact.
You can check out a few videos of the DUO Compact after the break. Of course, if you’re looking for a project to tackle, you’re more than welcome to design a PCB from the DUO Compact schematic. We’d certainly buy one.
Continue reading “Mess Of Wires Is Actually A One Instruction Computer”
[Hasith] sent in this project where he goes through the process of designing a one instruction CPU in Verilog. It may not win a contest for the coolest build on Hack A Day, but we really do appreciate the “applied nerd” aspect of this build.
With only one instruction, an OISC is a lot simpler than the mess we have to deal with today. There are a few instructions that by themselves are Turing-complete (like Subtract and branch if negative, and Move). Designing an OISC with one of these instructions means it can also emulate a Turing machine.
Continue reading “Building A One-instruction Computer”