A Turing-Complete CPU From RAM

Building a general-purpose computer means that you’ll have to take a lot of use cases into consideration, and while the end product might be useful for a lot of situations, it will inherently contain a lot of inefficiencies. On the other hand, if you want your computer to do one thing and do it very well, you can optimize to extremes and still get results. This computer, built from RAM, is just such an example.

The single task in this case was to build a computer that can compute the Fibonacci sequence.  Since it only does one thing, another part of the computer that can be simplified (besides the parts list) is the instruction set. In this case, the computer uses a single instruction: byte-byte-jump. Essentially all this computer does is copy one byte to another, and then perform an unconditional jump. Doing this single task properly is enough to build every other operation from, so this was chosen for simplicity even though the science behind why this works is a little less intuitive.

Of course, a single instruction set requires a lot of clock cycles to work (around 200 for a single operation). The hardware used in this build is also interesting and although it uses a Raspberry Pi to handle some of the minutiae, it’s still mostly done entirely in RAM chips, only cost around $15, and is a fascinating illustration of some of the more interesting fundamentals of computer science. If you’re interested, you can build similar computers out of 74-series chips as well.

16 thoughts on “A Turing-Complete CPU From RAM

  1. “””
    I left out a tremendous amount of detail about how the CPU works, because it’s extremely dry. Still, if anyone wants to know the dirty details, shoot me an email.
    “””
    It was interesting until reaching that. Now I regret every second wasted on it.

    Retract this article until schematics and other essential details are available.

    1. Or you know, shoot him an email and publish it yourself if you feel it’s so important. It’s his article, he can do whatever he wants in it, like you can write whatever you want in your comment, and I can reply to you than I think you’re being a little prick, free speech is indeed wonderful :)

    2. It is good he doesn’t interleave the article with arbitrary details. It keeps the story flowing. He tells more than enough that anybody who has seen a CPU before can build something very similar. And he offers to fill in the gaps to those who need it. Such a toxic comment is absolutely unnecessary.

  2. There’s plenty of space to store lots of useful look-up tables if they’re for 4-bit operations.

    the only instruction is “copy source byte to destination byte then unconditionally jump”, and that’s pretty cool that is all that is needed. I’ve toyed with some more luxurious one-instruction architectures like “subtract and branch if negative” or “reverse subtract and skip if borrow”

  3. There was an article in Byte about a Turing machine, no later than 1985, and likely closer to 1980. It certainky explained them, but I think there was examples.

    Not so useful without a date, but maybe someone remembers. It would be great to have master indexes of the old magazines now online. That americanradiohistory site has a search engine, but every time I try to use it, I get way too many results, so I’ve given up.

    1. What difference would it have made if he toggled the program into SRAM and not using some other machine as a glorified RAM he can easily manipulate with modern tools?
      The feat of building such a CPU still stands.

Leave a Reply

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