The Register Home Page

back to article It's not a binary choice. Independent boffin builds a ternary CPU on an FPGA

The 5500FP is a ternary CPU implemented on an FPGA. It's not very fast, but it makes it easier to experiment with computers that don't use binary. Independent researcher Claudio Lorenzo La Rosa recently published 5500FP: A 24-Trit Balanced Ternary RISC Processor. The paper is quite technical, but it's only seven pages long. It …

  1. KittenHuffer Silver badge
    Joke

    I'm of three minds as to whether this is a good thing or not!

    To be, or maybe, or not to be! That is the ternary!

    I'm sure this would be welcomed by all the non-binary people of this world!

    1. Liam Proven (Written by Reg staff) Silver badge

      On the one hand, it's slightly more complicated.

      On the other hand, for some things, it's more efficient.

      https://en.wikipedia.org/wiki/1.58-bit_large_language_model

      On the gripping hand, it's interesting and different and fun.

      ;-)

      https://scifi.stackexchange.com/questions/392/what-is-the-origin-of-the-phrase-on-the-gripping-hand

      1. KittenHuffer Silver badge

        I have to ask if you're a Motie fan? Or a moaty fan?

        I was always more of a Motie fan!

        I always wanted a watchmaker .... but ended up with a cat instead! Ultimately, just as dangerous and destructive!

      2. Dizzy Dwarf

        The gripping hand is an Action Man thing, duh.

        1. KittenHuffer Silver badge

          Nah, "On the gripping hand" came from the Motie books as the 'third option'.

          Action man may have had gripping hands, but he never had a third hand.

          1. captain veg Silver badge

            he never had a third hand

            A shame, because then he could have operated the eagle-eye gizmo by himself.

            -A.

      3. Bebu sa Ware Silver badge
        Coat

        On the gripping hand, it's interesting and different and fun.

        Not having previously encountered that reference my imagination boggled what exactly this supernumerary appendage might be gripping for interestingly different fun.

        1. midgepad Bronze badge

          Re: On the gripping hand, it's interesting and different and fun.

          The book is worth reading. SF, First Contact.

          1. KittenHuffer Silver badge

            Re: On the gripping hand, it's interesting and different and fun.

            And the 'twist' being that mankind is making the contact, yet the 'aliens' are more advanced than we are (apart from one critical piece of technology).

            And with that technology (or without the need for it) then the Moties would have been contacting (and wiping out) mankind several thousand years ago!

            .

            The other great thing from the Motie books is the introduction of 'Crazy Eddie'!

      4. midgepad Bronze badge

        Niven's Chirpsithtra

        had a trinary counting system. IIRC that included computing hardware.

        (Draco Tavern stories)

    2. swm

      Division

      But how do you efficiently do division?

  2. alain williams Silver badge

    Surely a TrInary digIT should be called ...

    a "tit" ?

    1. Luiz Abdala Silver badge
      Joke

      Re: Surely a TrInary digIT should be called ...

      I'm sure there is a BOFH somewhere mentioning that. I've read that before.

    2. b0llchit Silver badge
      Coat

      Re: Surely a TrInary digIT should be called ...

      Making a balanced ternary system out of tits may prove provocatively difficult and can only run in non-prude countries allowing tits in more than two positions.

      1. Liam Proven (Written by Reg staff) Silver badge

        Re: Surely a TrInary digIT should be called ...

        > Making a balanced ternary system out of tits may prove provocatively difficult

        The result would be "Eccentric" -- er -- but could result in the best bang since the big one.

      2. MiguelC Silver badge
        Coat

        Re: Surely a TrInary digIT should be called ...

        Total Recall manage to balance that

        [NSFW]

        1. I could be a dog really Silver badge
          Facepalm

          Re: Surely a TrInary digIT should be called ...

          What, they remade yet another classic ?

    3. Doctor Syntax Silver badge

      Re: Surely a TrInary digIT should be called ...

      As it's ternary, maybe it should be called a tern. A very well cooled ternary computer would be full of arctic terns.

      1. Anonymous Coward
        Anonymous Coward

        Re: Surely a TrInary digIT should be called ...

        It would confuse the heck out of interns, though.

        :)

      2. Neil Barnes Silver badge

        Re: Surely a TrInary digIT should be called ...

        In search, they should leave no stone unturned. Or no terns unstoned...

      3. captain veg Silver badge

        Re: Surely a TrInary digIT should be called ...

        Blasphemy! Stone them!

        Leave no tern unstoned.

        -A.

    4. Simon Harris Silver badge

      Re: Surely a TrInary digIT should be called ...

      In traditional computers, BRA is often an assembly code mnemonic for Branch.

      In base-3 computers, presumably it would be a container class for a pair* of trinary digits.

      * or otherwise if one is to include MiguelC's Total Recall, or Liam's example.

    5. Sorry that handle is already taken. Silver badge
      Joke

      Re: Surely a TrInary digIT should be called ...

      A non-binary computer with tits is presumably good at calculating Modulation Transfer Functions

    6. JLV Silver badge
      Coat

      Re: Surely a TrInary digIT should be called ...

      I thought those usually came in twos.

      Sorry, could not resist, out the door I go.

  3. s151669

    So instead of ternary operator we are going to get what ? quaternary ? Something completely different ?

    1. b0llchit Silver badge

      It goes something like this: value ? -'never : 0'dontcare : +'seeya where the tags are labels to jump to in the program. And, you can change the order anyway you like. It will cause a crash when value has binary content. Note that base π systems will always run the program in circles.

    2. Red Ted
      Coat

      Multi level cells

      It has occurred to me that modern NAND Flash encodes several different levels in to one cell, these could be the basis of a trit storage system.

      As development progresses, you could increase the base of the system by going to Pentary {-2, -1, 0, +1, +2} and then Heptary {-3, -2, -1, 0, +1, +2, +3}.

      <one quick search later> Someone appears to be looking in to: Pentary!

      I should probably get my coat...

      1. Simon Harris Silver badge

        Re: Multi level cells

        I believe Quinary is the more generally used term for a base 5 counting system.

        (only pointing this out because otherwise my 'Quit' joke elsewhere on here wouldn't work!)

      2. phuzz Silver badge
        Boffin

        Re: Multi level cells

        I can't remember any of the proofs, but apparently the most mathematically efficient system would be base-e (ie Euler's number) which is 2.718, so ternary is the closest system we could physically build.

        At least, I can't think of a way you could have a number system with a non-integer base, but who knows what mathematicians can imagine.

  4. JimmyPage Silver badge
    Boffin

    See also: analogue computers

    Which can piss all over the biggest fastest most badass supercomputer at some quite niche tasks.

    I really hope none of this is news to people who claim to have studied computers.

    1. I could be a dog really Silver badge
      Boffin

      Re: See also: analogue computers

      Ah, that takes me back to labs at ... hmm, where was it ... oh yes, day release at college when I was an apprentice. IIRC every programme I built very quickly ran out of headroom and hit one or other of the supply rails, I don't think I ever got my integrators configured right.

  5. Simon Harris Silver badge
    Joke

    I tried devising a logic system using base 5 digits...

    but I QuiT.

  6. elsergiovolador Silver badge

    Trit or tryst?

    That is the question.

  7. An_Old_Dog Silver badge
    Joke

    All Your (Heptavintimal) Base

    Are Belong to Us!

  8. Anonymous Coward
    Anonymous Coward

    Confused Old Bunny Here!

    Alan Turing's "Turing Machine" can emulate ANY COMPUTER AT ALL.

    Or, putting it another way, all computing devices can be thought of as equivalent to some Turing Machine.

    I really can't see why the details of ANY HARDWARE AT ALL makes ANY DIFFERENCE AT ALL!

    1. Androgynous Cupboard Silver badge

      Re: Confused Old Bunny Here!

      the Turing Machine was a thought experiment involving "tokens" on an infinitely long rolls of paper tape, as I recall.

      When you come to implement that in hardware, for at least seventy years that's involved binary signals - a high signal on a pin for one, a low signal for zero (other option is also available).

      So there's your challenge: go out and find me a chip - any chip (RAM, CPU, Bus arbiter, clock) that operates on a ternary signal. Hell, I'll even accept a transistor - yes, I realise BJTs can operate as amplifiers within a limited voltage range, but FETs not so much and semi-conduction leads to heat.

      1. Arthur the cat
        Headmaster

        Re: Confused Old Bunny Here!

        the Turing Machine was a thought experiment involving "tokens" on an infinitely long rolls of paper tape, as I recall.

        The tape merely has to be long enough, as all computations that halt have a finite number of steps. You can even do the CS theoretical equivalent of paging - if you're about to move off the end of the tape, suspend operation until you've spliced more tape on the end and then resume.

      2. It's just me
        WTF?

        Re: Confused Old Bunny Here!

        Many microcontrollers have tri-state I/O pins (High, Low, High-Impedance), although they are (usually) implemented with multiple binary gates.

        Icon represents third state.

        1. Martin an gof Silver badge

          Re: Confused Old Bunny Here!

          Common way to drive a shared bus. See, as just one example of likely hundreds, the 74373 tri-state latch (PDF).

          M.

        2. Simon Harris Silver badge
          Meh

          Re: Confused Old Bunny Here!

          It's a pity one can only choose one icon for a post.

          High: happy face.

          Low: sad face.

          Third state: meh face.

          1. It's just me
            Go

            Re: Confused Old Bunny Here!

            Or

            1. Stop

            2. Go

            3. WTF?

      3. Liam Proven (Written by Reg staff) Silver badge

        Re: Confused Old Bunny Here!

        > When you come to implement that in hardware, for at least seventy years that's involved binary signals

        I decided not to go there but I was going to mention the Harwell WITCH.

        https://en.wikipedia.org/wiki/Harwell_computer

        This, of course, used dekatrons.

        https://en.wikipedia.org/wiki/Dekatron

        These store a decimal value in each component: it's able to store 0-9, directly.

        1. dmesg Bronze badge

          Re: Confused Old Bunny Here!

          The Harvard Mark I had rows of decade switches for manual entry of constants, one constant per row, each row having 24 switches. Twenty four decimal digits of precision -- not bad for the 1940s! Operators would manually set the switches before a program run. There's a detail photo in the Wikipedia article on the Mark I.

    2. doublelayer Silver badge

      Re: Confused Old Bunny Here!

      A ternary computer is not capable of any computation that a binary computer is not. What it might be, with sufficient effort used to develop it, is more efficient, generally meaning faster, on some types of computations. That's essentially what we've been doing for the history of computers. Every instruction set is equally able to implement any program, but some make it easier to do by providing facilities to writers of compilers or assembly and some can run things more quickly.

  9. Anonymous Coward
    Anonymous Coward

    Oh...About Cloudflare.............

    ....why has Cloudflare started checking up on me when I log out of The Register?

    More snooping?

    I think we should be told!!

    1. IGotOut Silver badge

      Re: Oh...About Cloudflare.............

      They've been using Cloudflare for years.

      1. An_Old_Dog Silver badge

        Re: Oh...About Cloudflare.............

        .. but only within the past few days has Cloudflare been challenging me to "Prove you are a human" by clicking a check box.

        This started shortly after TheReg was temporarily broken for me (DDoS?).

  10. An_Old_Dog Silver badge

    Ternary is Perfect ...

    ... for implementing a Magic 8-Ball.

    Values: "NO", "TRY AGAIN LATER", and "YES".

    1. Liam Proven (Written by Reg staff) Silver badge

      Re: Ternary is Perfect ...

      > ... for implementing a Magic 8-Ball.

      Try Googling:

      chatgpt magic 8 ball

    2. Dizzy Dwarf

      Re: Ternary is Perfect ...

      Or a Windows dialogue

      1. Bebu sa Ware Silver badge
        Happy

        Re: Ternary is Perfect ...

        "Or a Windows dialogue"

        A:\> Abort, Retry, Fail? _

  11. An_Old_Dog Silver badge

    Busy, Busy NSA

    ABSTRACT

    "An alternative basis for development of a completely incompatible digital infrastructure is presented here. This minimizes the potential for leakage of information, particularly malware and other covert content from our existing digital infrastructure. This effort can be described as taking security through obscurity as a fundamental design principle. ..."

    The NSA and other such TLAs have likely already been doing research into this area to compromise the supposed security-through-obscurity of these systems, as well as the earlier duodecimal systems.

    1. Martin an gof Silver badge
      Happy

      Re: Busy, Busy NSA

      Back in the day at the radio station, the remote link to our transmitter monitoring kit was one of those diddy Epson computers and its tri-tone modem. Used to be fun to leave the speaker on and listen to people "war dialling" in with their convenional modems.

      M.

  12. Anonymous Coward
    Anonymous Coward

    At risk of bringing down the tone of the conversation, why does BIT take the I from digIT and TRIT take the I from TRInary. Typo or something else. Yes, I'm aware this is probably not that important but I'm curious.

    1. Simon Harris Silver badge

      Interesting question. This doesn't exactly answer the question, but it turned out to be an interesting article from the Annals of the History of Computing from 1984

      https://cse.buffalo.edu/~rapaport/Papers/Papers.by.Others/bit.pdf

      The only place I've found it explicitly stated that it's Binary DigIT has been Google's AI summary pulling up a couple of Reddit posts by people who are presumably not the great names of information theory.

  13. David Hicklin Silver badge

    So they have discovered the -5v power rail ?

  14. NXM Silver badge

    ternary?

    My brain has just panicked and run off down the street on its own, gibbering and shrieking. Where will this stop - 5 states? 13? Infinity-1?

    1. bob, mon!

      Re: ternary?

      From a purely theoretical point of view, the most information-dense number base would be "e" (2.78128etc.) --- but a non-integer number base presents some challenges. The integer "3", being closer to "e" than "2", is thereby closer to optimal for information density.

      However, circuits that can distinguish between "nothing/0/False" and "saturation/1/True" have been and are cheap and easy. Circuits that can discriminate between "nothing", "saturation", and "midway-between" get more and more difficult as "saturation" gets closer and closer to "nothing". From an electrical point of view, if you can build a device with half a volt of imprecision, and try for 0V and 5V levels, a device that runs at 0.5V and 4.5V is good enough to sell; and it and can be scaled down to perhaps 1.1V total range while still discriminating between 0 and 1. But if you need three values and your circuit is imprecise to half a volt, then you can't go lower than 2V at the absolute minimum.

      Over the years the precision of the devices has improved substantially. But rather than re-express everything in ternary logic, designers made the devices smaller/faster/more numerous.

      1. Arthur the cat
        Happy

        Re: ternary?

        From a purely theoretical point of view, the most information-dense number base would be "e" (2.78128etc.)

        Lot of people round here have read Knuth's TAoCP (not surprisingly).

      2. Torben Mogensen

        Re: ternary?

        If you store values at 0V, 1V, and 2V, you will also have to switch between 0V and 2V, which cost four times as much as switching between 0V and 1V in the same time frame. Changing one value to another costs 0 for the trits that stay the same (3 cases), 1 for the trits that move one step (0 to 1, 1 to 2, 2 to 1, or 1 to 0, 4 cases) and 4 for the two cases of 0→2 and 2→ 0. This gives an average of 12/9 = 4/3 per trit. For binary, the average is 1/2. Even if you need fewer trits (63%) than bits to represent the same number range, you get higher energy use: 0.63*4/3 = 0.84 versus the 0.5 for binary.

        So, unless you can find a technology where switching between any trit value to any other trit value is about the same as switching between bits, you lose on energy. Additionally, circuits for addition etc. are more complex and have higher logic depth, so they are likely to be slower. Just look at the logic table for one-trit addition with carry and compare that to the logic table for one-bit addition with carry.

        Ternary may make sense for long-term storage, though, assuming a trit takes no more than 50% more space than a bit. But if the computers use binary, you need to convert when storing and fetching data.

        1. the spectacularly refined chap Silver badge

          Re: ternary?

          This is the fallacy of assuming independent variables. If in binary one digit needs to be changed the probability that the "next" digit in the calculation increases from 50% to 67% due to carried digits.

          Model it fully and the amount of flipping stays essentially constant regardless of the base used.

      3. Doctor Syntax Silver badge

        Re: ternary?

        "Circuits that can discriminate between "nothing", "saturation", and "midway-between" get more and more difficult as "saturation" gets closer and closer to "nothing"

        Have you considered polarity? Full negative, nothing and full positive. That shouldn't be too difficult to implement.

        1. I could be a dog really Silver badge

          Re: ternary?

          It isn't, but it's still more complicated than simply detecting on or off, + or -, A>B or A<B, ...

    2. herman Silver badge

      Re: ternary?

      42 of course

    3. Simon Harris Silver badge

      Re: ternary?

      Many logic simulators use more than three states:

      Verilog based simulators have 4:

      Low

      High

      High impedance

      Not yet known (e.g. when propagation delays haven't yet filtered through that gate yet since the start of the simulation, or a device such as a flip-flop or latch could be in either state until it receives a set/reset input)

      Some have many more - VHDL based simulators for example, have 9 states. As well as the above, they also have conflict states (a signal is driven by two conflicting outputs) and the idea of forced and weak signals (forced being a typical logic output driven by complimentary transistors, weak being where a pull-up/down resistor is driving an input.

  15. Draco
    Windows

    "There's no inherent reason computers have to encode everything in binary."

    There is: simplicity of implementation.

    1. Tron Silver badge

      Re: "There's no inherent reason computers have to encode everything in binary."

      This is true to some extent. But binary computers sit well with Boolean logic, transistors and 2D circuit boards. And we all know courtesy of decades of suffering inflicted upon us by MS that the moment you make something more complicated it becomes less resilient. There will be more examples of that as ever more simple tasks get digitised and fall over.

      The two fields that could benefit from non-binary computing/analogue computing are real AI, not the guff currently being hyped, and random number generation, which could depend on the characteristics of charging, discharging and transitioning electronic components.

      You can have much more fun with FPGAs, allowing CPUs and software to optimise themselves in tandem.

      I'd much rather see a stable (no upgrades for 10 years and it still works), documented, WIMP OS, running on a stable chip that is in permanent production, on a stable mobo. Anything 64-bit would do. You could do everything most of us do on it (bar gaming), build in a raft of proper security from day 1 (without making it difficult to use), and ignore GAFA's endless scams (like AI) and proprietary junk. Tech has plateaued, we haven't had anything both new and useful since memory cards & BD/SSD drives. So-called development since then has been solely to maintain GAFA's income.

      1. Neil Barnes Silver badge

        Re: "There's no inherent reason computers have to encode everything in binary."

        Heinlein's sentient AIs used ternary logic, as I recall.

  16. Red Ted
    Go

    Menace

    I recall writing a Matchbox Educable Noughts and Crosses Engine (MENACE) implementation, and a significant part of the effort was converting the board, as 9 digit ternary number (each position can be blank, nought or cross) in to decimal and back again.

    I remember leaving it to play itself (yes, you entered 0 for the number of players, I had been watching "War Games") whilst I was at school, and then played it once I'd got home again. It's wasn't great, but better than random. I suspect I hadn't got the feedback quite right.

  17. Bebu sa Ware Silver badge
    Happy

    Apropos of …

    of pretty much bugger all, I vaguely recall reading that the most efficient base for encoding (presumably numbers) was e (=2.718…) So 3 being closer to e than 2 actual ternary system might store information more efficiently.

    Presumably a ternary ALU was implemented in the FPGA although rather spoilt for choice in the trit·wise operations on multi-trit words.

    Back when, I imagined tristate TTL buffers implemented a true/false/not·at·home (or out·to·lunch) ternary logic.

  18. captain veg Silver badge

    Python

    There are 10 kinds of people, those that understand ternary, those that don't, fear, surprise, ruthless efficiency, and an almost fanatical devotion to the Pope.

    Oh bugger.

    -A.

  19. Henry Wertz 1 Gold badge

    Interesting!

    Very interesting!

    Two points...

    A) I took some classes with Professor Jones, graduated in 2001. It's interesting to see he has a fairly complete treatise on trinary logic.

    B) In case anyone wondered what a balanced trinary computer is... it has the values represent -1, 0, and 1. It's entirely possible (and Douglas Jones' paper discusses this) having the 3 values be 0, 1, and 2 instead.

  20. Steve Aubrey
    Joke

    An answer to prayer

    There's a saying that God has three answers to prayer: Yes, No, and Not Yet. That ties in very nicely to the new computer.

    Although recent investigations have shown there is actually a fourth answer to prayer: God saying "You gotta be kidding Me!!". Unsure where this is stored.

  21. Blackjack Silver badge

    So how much would it cost to make a real bare metal trinary computer instead of basically emulating it?

  22. samuri

    Sounds simple enough

  23. PRR Silver badge
    Meh

    I first heard of tri-state (in this sense) from my father in (IIRC) the late 1960s. He said G.E. had built one in the early 1960s. And when it got all working, it wasn't enough simpler or faster than binary. He also hinted that it was rumored that the Russians were working on trinary; if the Russkies thought it worth study, then the US "had" to get into it. But by the late 1960s, IBM had sucked all the big profit out of computers, so interest waned.

  24. croc

    TI 94a.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon