LogicBlocks Experiment Guide

Pages
Contributors: jimblom
Favorited Favorite 2

3. NANDs, NORs, and DeMorgan's Laws

NAND -- in other words NOT AND or negated AND -- is what you get when you place an inverter at the output of an AND gate. NAND gates are very popular in the world of digital logic. They’ve even got their very own circuit symbol, an AND gate with a “bubble” at the output:

NAND gate

Let's make one with LogicBlocks!

What You'll Need

  • 1x AND Block
  • 1x NOT Block
  • 2x Input Blocks
  • 1x Power Block

LogicBlocks Layout

This layout is similar to the setup from experiment 1, with the addition of a NOT gate between the AND Block output and the Power Block.

NAND LogicBlocks

The output of this circuit is represented by the red LED on the NOT gate.

The Experiment

Two inputs means four possible input combinations. Try them all and fill out the 2-input NAND gate's truth table:

Input AInput BOutput
000
010
100
111


  • How does that compare to the truth table of the AND gate?

Sub-Experiments

You can also negate an OR gate to create a NOR:

NOR LogicBlock

Which also has its own "bubbled" circuit symbol:

NOR gate

  • What does the 2-input NOR gate's truth table look like?

DeMorgan's Law

All of this NAND and NOR discussion has me itching to discuss De Morgan's Law! De Morgan's Law allows us to convert NANDs to OR, and NORs to ANDs. There are two parts to De Morgan's Law:

  1. A 2-input NAND is equivalent to OR-ing two inverted inputs. In boolean equation terms:

  2. A 2-input NOR is equal to AND-ing two inverted inputs. Or, in boolean terms:

Prove it yourself! Build the circuit below with your LogicBlocks, and compare the truth table you filled out for the NAND gate with the truth table for this circuit -- two inverted inputs running into an OR gate.

Two inverters running into an OR

Are the truth tables the same? You've just verified the first part of DeMorgan's law!

Now, you might be asking: "what's the point?" Well, a big part of digital logic is simplifying the circuit, and using a few gates as possible. Thanks to De Morgan's Law, we can use a NAND gate to stand in for all of the other gates.

For example, a NOT can be made out of a NAND by simply tying one the inputs permanently high:

Making a not out of NAND

Or use three NAND gates to make an OR:

Making an OR out of NANDs

Or use two NANDs to make an AND:

Making an AND out of NANDs

The versatility of NAND gates makes them truly magical!