NAND-NAND logic is a way to build any sum of products expression using only NAND gates, in two levels.
The recipe:
- Draw the AND-OR circuit: one AND per product term, all feeding one OR.
- Replace every gate, AND and OR alike, with a NAND. Keep the wiring.
Why it works, by bubble pushing: put a pair of bubbles on each wire between the ANDs and the OR. The pair cancels, so nothing changes. Now each AND has an output bubble, making it a NAND. The OR has bubbled inputs, and an OR with bubbled inputs is a NAND too.
In algebra, for , drawn above:
= by De Morgan's law.
Why designers like it: NAND is a universal gate and the cheapest gate in CMOS, so a whole design can use one cell type. The circuit has the same two-level speed as AND-OR.
One detail to watch: a product term that is a single literal has no AND gate. It goes straight into the output NAND, so it must enter inverted. For , the output NAND's inputs are and C.