A NAND Gate Computer
Sunday, 24 March 2013

You know it is possible, but to see it is another thing. The NAND gate is universal and it is all you need to build a computer, but how many NAND gates would it take?

It is one of the great ideas of computing. You only need one type of logic gate to build everything you need for a computer. For example the NAND i.e. Not And gate is universal. By tying its inputs together you get a NOT gate. By applying De Morgan's law you can get an OR gate. That is:

A OR B =NOT(NOT(A) AND NOT(B))

= NOT(A) NAND NOT(B)

as NOT AND is NAND and hence it takes three NAND gates to implement an OR gate, one for each NOT and a NAND.

From here you can build any logic you need. If you cross connect two NAND gates you can construct a flip-flop and hence any registers you need. You can also use the flip-flop as a memory element or an oscillator for timing.

So why not build a complete computer just using NAND gates?

This is what NANDputer is all about. It is adopts a bit serial design simply to save gates - and when you see the circuit boards you will realize that reducing the number of gates is an important consideration. So for example the arithmetic logic unit operates one bit at a time and latches any carry to be used with the next bit. Even with this simpler design it takes two logic boards packed with chips to implement the program counter register:

Notice that the construction is all hand soldered jumper wires - no PCB layout shortcuts here!

The complete machine looks like an impressive computer - something that might turn up on a sci-fi movie:

Currently the beast is being run at 11Mhz but it could go faster.

If you are interested the statistics on gate usage are:

```gate:    00  10  20  30 133 03  total ----------------------------------- display  10  1   10  3  0   8   32 timing   21  16  9   0  0   0   46 PCL      39  18  0   0  2   0   59 PCH      39  16  4   0  0   0   59 ROM      22  5   7   5  1   0   40 indexer  43  4   10  3  0   0   60 RAM      42  7   2   4  0   56 ------------------------------------------- total   216 67  42  15  4   8   352```

If anything this is a smaller number than you might expect!

Many years ago I designed a VDU using nothing but 74 series chips, simply because someone dropped a box full, that were no longer needed on another project, on my desk. In this case the while thing managed to fit on a single, but large PCB, and the biggest problem was finding enough power to switch it on. At the time production VDUs were a few LSI chips - today the equivalent would be on the corner of a modest chip that mostly does something else.

You can also see the NANDputer in action in the following video:

http://blog.kevtris.org/

Related Articles

Introduction to Boolean Logic

Getting Started With Digital Logic - Logic Gates

Learn By Building Your Own Computer

Fast Conway's Life on an FPG