LogicBlocks Experiment Guide
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:
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.
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 A | Input B | Output |
---|---|---|
0 | 0 | 0 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
- 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:
Which also has its own "bubbled" circuit symbol:
- 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:
- A 2-input NAND is equivalent to OR-ing two inverted inputs. In boolean equation terms:
- 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.
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:
Or use three NAND gates to make an OR:
Or use two NANDs to make an AND:
The versatility of NAND gates makes them truly magical!