Building an OR Gate from NAND

A NAND gate can act as an inverter with its inputs tied together. Applying that operation to both inputs lets another NAND produce OR.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Derive the relation
  2. Check a mixed input
  3. Calculate the inverted inputs before combining them
  4. Separate logical equivalence from timing

Derive the relation

An inverter made from NAND computes \(\neg(A\land A)=\neg A\). NAND on the two inverted inputs therefore yields \(\neg(\neg A\land\neg B)=A\lor B\) by De Morgan's law.

Check a mixed input

With A one and B zero, the inverted inputs are zero and one. Their NAND is one. With both originally zero, both inverted inputs are one and NAND is zero. Verify the other rows with a gate truth table.[1]

Calculate the inverted inputs before combining them

Feeding A to both inputs of NAND produces the inversion of A. Repeat with B. NAND of those two inverted values evaluates \(\neg(\neg A\land\neg B)=A\lor B\). This construction applies De Morgan's law using a single gate type. See De Morgan's laws in code.

A B    NAND(A,A)  NAND(B,B)   Final NAND
0 0        1          1           0
0 1        1          0           1
1 0        0          1           1
1 1        0          0           1

Separate logical equivalence from timing

Adding intermediate gates adds propagation delay. The truth table describes the stable output after signals settle. A short intermediate glitch during changing inputs needs a timing analysis beyond the table.

References

  1. Noam Nisan and Shimon Schocken, From Nand to Tetris: Course Projects ↩