I don’t mean to toot our own horn, but humans are remarkable for having created numerous numeral systems, each specialized in their own ways. Ask almost anyone and they will at least have heard of binary. Hackaday readers are deeper into counting systems and most of us have used binary, octal, and hexadecimal, often in conjunction, but those are just the perfectly standard positional systems.
If you want to start getting weird, there’s balanced ternary and negabinary, and we still haven’t even left the positional systems. There’s a whole host of systems out there, each with their own strengths and weaknesses. I happen to think seximal is the best. To see why, we have to explore the different creations that arose throughout the ages. As long as we’ve had sheep, humans have been trying to count them, and the systems that resulted have been quite creative, if inefficient.
There’s an old joke that there are 10 kinds of people in the world. Those who know binary, those who don’t, and those who didn’t see a base three joke coming. Perhaps [Dmitry Sokolov] heard that joke because he’s built a ternary (base 3) computer. He claims it is the first one to be built in the last 50 years. You can see a video about the device below. There’s also a video of the device with a nixie tube output.
You may not think of it often, but bit is a contraction of binary digit, so a ternary computer doesn’t have those. It has trits. The CPU operates on 3 trit words and uses nothing but multiplexers as building blocks. Instructions use 5 trits, some of which are a two-trit opcode and a 3 trit address of one of the 13 registers. The allure of using ternary, by the way, is that you can represent more numbers in fewer bits — um, trits, rather.
Your computer uses ones and zeros to represent data. There’s no real reason for the basic unit of information in a computer to be only a one or zero, though. It’s a historical choice that is common because of convention, like driving on one side of the road or having right-hand threads on bolts and screws. In fact, computers can be more efficient if they’re built using different number systems. Base 3, or ternary, computing is more efficient at computation and actually makes the design of the computer easier.
For the 2016 Hackaday Superconference, Jessie Tank gave a talk on what she’s been working on for the past few years. It’s a ternary computer, built with ones, zeros, and negative ones. This balanced ternary system is, ‘Perhaps the prettiest number system of all,’ writes Donald Knuth, and now this number system has made it into silicon as a real microprocessor.
When [Thundersqueak] was looking for a project for The Hackaday Prize, she knew it needed to be a special project. IoT devices and microcontrollers are one thing, but it’s not really something that will set you of from the pack. No, her project needed to be exceptional, and she turned to logic and balanced ternary computing.
[Thundersqueak] was inspired to design her ternary computer from a few very interesting and nearly unknown historical computing devices. The first was the [Thomas Fowler] machine, designed all the way back in 1838. It could count to several thousand using a balanced ternary mechanical mechanism. The [Fowler] machine was used to calculate logs, and the usual boring mathematical tasks of the time.
A bit more research turned up the Setun, an electronic computer constructed out of vacuum tubes in 1958. This computer could count up to 387,000,000 with eighteen ternary digits. On the binary machine you’re using right now, representing that would take twenty-nine binary digits. It’s about a 2.5 times more efficient way of constructing a computer, and when you’re looking for the right vacuum tubes in 1950s USSR, that’s a great idea.
[Thundersqueak] isn’t dealing with vacuum tubes – she has a world of semiconductors at her fingertips. After constructing a few truth tables for ternary logic, she began designing circuits to satisfy the requirements of what this computer should do. The design uses split rails – a negative voltage, a positive voltage, and ground, with the first prototype power supply made from a 741 Op-amp. From there, it was just breadboarding stuff and checking her gates, transistors, and truth tables to begin creating her ternary computer.
With the basic building blocks of a ternary computer done, [Thundersqueak] then started to design a basic ALU. Starting with a half adder, the design then expanded to a full adder with ripple carry. We’re sure there are plans for multiplying, rotating, and everything else that would turn this project into a CPU.
Bender: Ahhh, what an awful dream. Ones and zeroes everywhere… and I thought I saw a two. Fry: It was just a dream, Bender. There’s no such thing as two.
– Futurama: A Head In The Polls, S02E07
The computer you’re using right now is simply just a highly organized state of electrons, commonly expressed in states of zero and one. Two? What is two? A ternary, or base-3, computer would be odd, disturbing, but nevertheless extremely interesting, making it a great candidate for The Hackaday Prize.
A base-3 computer isn’t a new thing, despite how odd it sounds. Moscow State University built a few dozen ternary computers named Setun back in the late 50s, and some research is being done using quantum computers and ternary arithmetic. Still, building a ternary computer from first principles – gates, truth tables, and transistors – isn’t something that’s done nowadays.
[ThunderSqueak] has been hard at work over the last few months working out the basic building blocks of her ternary computer project. She’s already figured out the basic NAND, NOR, and inverter structure that could be easily translated into assemblies made of discrete components or an IC mask.
A iDevice app, iCircuit, is being used to test out some larger circuits, using +5, -5, and 0 Volts to represent 1, -1, and 0. Going further, there are a few academic resources for constructing a ternary ALU and even ternary SRAM. While a homebrew ternary computer has little practical use, it’s an awesome example of the, ‘because it’s there’ engineering we’re looking for in a great Hackaday Prize entry.
The project featured in this post is an entry in The Hackaday Prize. Build something awesome and win a trip to space or hundreds of other prizes.