An 8-Bit ALU, Entirely From NAND Gates

One of the things that every student of digital electronics learns, is that every single logic function can be made from a combination of NAND gates. But nobody is foolhardy enough to give it a try, after all that would require a truly huge number of gates!

Someone evidently forgot to tell [Notbookies], for he has made a complete 8-bit ALU using only 4011B quad NAND gates on a set of breadboards, and in doing so has created a minor masterpiece with his wiring. It’s inspired by a series of videos from [Ben Eater] describing the construction of a computer with the so-called SAP (Simple As Possible) architecture. The 48 4011B DIP packages sit upon 8 standard breadboards, with an extra one for a set of DIP switches and LEDs, and a set of power busbar breadboards up their sides. He leaves us with the advice borne of bitter experience: “Unless your goal is building a NAND-only computer, pick the best IC for the job“.

We have covered countless processors and processor components manufactured from discrete logic chips over the years, though this makes them no less impressive a feat. The NedoNAND has been a recent example, a modular PCB-based design. TTL and CMOS logic chips made their debut over 50 years ago so you might expect there to be nothing new from that direction, however we expect this to be  well of projects that will keep flowing for may years more.

Via /r/electronics/.

18 thoughts on “An 8-Bit ALU, Entirely From NAND Gates

  1. An ALU is an interesting piece of circuitry. But I am though curious to what bit wise functions this one is implementing.

    Since there is no formal definition in the industry of what is required for a circuit to be an ALU, it could be an adder and a selectable AND gate and it would likely count as an ALU as far as I know.

    But I guess most people would also like to see OR, Not, and maybe an XOR function as well. And likely some bit shifting too.

    1. My guess is just selectable add and subtract with configurations or ways of interpreting the outputs for signed and unsigned. I’m mostly going off the minimum of parts I’ve seen use the ALU schematic symbol.

      1. Which appears to be about right. There is the following line in the article: “My ALU is about as simple as one can be as it can only add and subtract 8 bit numbers, but as we’ll see even this is pretty complicated when you are doing it with quad-NAND gates.”

  2. This certainly isn’t an ALU – it’s an adder/subtractor, which is somewhat simpler than an ALU. To be an ALU it would, in my opinion, need to do at least AND and OR as well.

    While all projects of this king are interesting building computers from a single type of logic element isn’t new. The best know computer using a single logic element was the Apollo Guidance Computer which was made from 3-input NOR gates.

  3. An ALU needs to contain (at a minimum) Add, Nand.

    With Nand we can invert an input, since
    ~(a&1) = ~a.

    Thus, subtraction: a-b = a+~(b&1)+1 is then possible.
    And = ~( ~(a&b) &1).
    Or = ~( ~(a&1) & ~(b&1)).
    XOR = (a+b)-2(a&b) = (a+b)+2*~(a&b)+1.

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.