The Hackaday Prize: A Ternary Computer

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.

SpaceWrencherThe 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.

32 thoughts on “The Hackaday Prize: A Ternary Computer

    1. True hardware ternary computer. Forget about silicone base possessor. Think think 3 dim clear hard Crystal that flow lights instead of electron in 3 sending unit and 3 receiving unit. Lights on =1 light of =0 light that clashes inside Crystal is 2 or logic . We can build a.I. in mater of days. Calculation will be done in log2^3 base. Reg 2 g hz pc wil be enormous cause information will process by light not electricity.

          1. Yes, but wouldn’t you be more likely to organize your trits into 9-trit words (or some other power of 3)? That would allow you to use two trits to address the individual trits within the word.

            OK, it’s true that binary computers have been built with 60 bit words, and other word lengths that were not powers of two (my first programming experience was on a CDC Cyber with 60 bit word length, 18 bit addresses, instructions of 15, 30, or 60 bits). But having the word length be a power of your fundamental base seems to be so much more elegant, and that’s what we’ve mostly settled on these days.

            Of course, we’ve mostly settled on binary, too, but…

          2. Josh, does that mean a group of 3 bits is called a tribble?

            Ta-da-daaah, that was it, ladies and gentlemen, 3 1/2 years in the making, it was a pun on “trinary” and “nibble”, “tribble”! Like “tribbles” off Star Trek if you’re not an English-speaking geek.

            So, there it goes, my joke. I’d like you to imagine trumpety kind of Hollywood music now, like the end of an awards ceremony, cameras flashing, as my joke gets in it’s expensive car, back home to obscurity. Half a trinary byte is a “tribble”.

    1. Trinary maths has been worked out, and it’s logic gates have had truth tables mapped, and descriptions made, for every possible gate, ie every possible combination of inputs and outputs.

      There are websites where people design simple adders etc. And of course the Russian computers, since trinary has the small advantage of saving on components, useful when we were stuck with thermionic valves, not so much now there’s FPGAs and billions of transistors in a CPU.

      It’s interesting for a while. Then it starts to look quite annoying, then you become grateful you’re not Russian and having to work on this 50 years ago. If you have to pick a base, stick with 2 or 10, really can’t see the point. I don’t think you can achieve much without a massive headache, or going native and seeing everything in threes.

      It’s the sort of thing’d make you nostalgic for Octal.

      1. It’s interesting you mention the number of transistors available. Aren’t modern chip dies beginning to use old transistor tricks of yore to squeeze more into the same space?

        There’s a hard limit to what can fit into limited space. One can only lower voltages so often or so far. Software writers aren’t trimming their fat. So something has to give.

        I could be wrong but couldn’t ternary logic potentially give computing the same boost as multiplecores? Hypothetically, could a ternary computer still have legacy support while giving an extra logic level to code that require it? Meh… just a thought.

        1. In the case of Flash memory, they already are doing this, each cell can hold a number of voltages, so can store more than one bit. I think they’re working on using 8 different levels at the moment.

      2. Binary is good for simple circuits but twelve is more sensible than all of them for ease of calculations. Ten is just antiquated and is about mainly because the French shout loud and still use their fingers and toes to count. :)

      3. Ternary logic has the advantage that its information encoding is as optimal as you can get (base ‘e’ obviously would be better, but 3 is the closest you get to ‘e’ with integers).

      4. Why would using trits be a problem on any level except the hardware one?
        Some early programming systems used negative, zero and positive cases for conditionals and there trinary logic would be a good fit anyway.

  1. That ternary NAND gate looks a lot like a CMOS NAND gate, except with -VE instead of GND, and with JFETs instead of enhancement-mode MOSFETs.

    Except that he appears to be basing his logic on enhancement-mode FETs instead of the normal depletion-mode JFETs.

    With normal JFETs, the NAND gate as he has drawn would work as an OR gate, the NOR gate as he has drawn would work as an AND gate, and the inverter as he has drawn would act as a buffer.

    To get a NOT gate, one would need to combine JFETs with MOSFETs – having the pJFET drive the pMOSFET, and having the nJFET drive the nMOSFET.

    Unless one wants to rely on the off resistance of the JFETs, one would also need a resistor from the output to halfway between +VE and -VE (or one resistor from output to each of +VE and -VE) in order to hold the output at a known “maybe” value when not driven.

  2. ok The Maya used ternary variables two fluctuating and one solid for zero. They added many numbers in a stack that started with 20^0 and added across to the right on each stack. the next stack up was 20^1 …20^n so ONLY at the end they multiplied to the stack level ie. 1234*20^3. Their base20 number system, very similar to Morse code where zero is completeness or a space in Morse. So language can be expressed lifting letter equivalents off Morse tables and just have a slammin’ stick to type, do math or sext…
    Maybe the compiler can convert the base10 scientific to or, if you care to learn the peasant enabled maya math, base20 down to the three variables? the zero variable is used only once to define absolutely zero not a part of 10,20… so this zero operation can have a small circuit or a iterative guess code take care of that operation when zero rarely comes up? This might “upgrade” current technology and not start from scratch? I want to learn EE & computers but here’s my dumb question: Can +, – be a fluctuating numbers or is it absolute in current binary?? All three be a sort of variable for 3D applications amplitude/Z/phi? (period, amplitude, time/x, y, z/r, theta, phi systems) So say it would be niche computing for…?

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.