Welcome to the World of Universal Gates!
In our previous lessons, we looked at the basic logic gates like AND, OR, and NOT. They each have a specific "job" to do. But what if I told you there are two "Superstar" gates that can do everyone else's job?
In this chapter, we are going to explore Universal Gates. By the end of this page, you’ll understand why these gates are the favorite tools of electronic engineers and how they can be used to build any circuit imaginable!
What is a Universal Gate?
A Universal Gate is a logic gate that can be used to create any other logic gate (like NOT, AND, and OR).
There are only two universal gates you need to know:
1. The NAND gate
2. The NOR gate
Analogy: Think of a universal gate like a LEGO brick. Even if you only have one type of brick, if you have enough of them and connect them in different ways, you can build a house, a car, or a plane. In electronics, if you have enough NAND gates, you can build any computer chip!
Did you know? Using only one type of gate (like NAND) makes it much cheaper and easier for factories to mass-produce electronic chips (ICs). This is why your smartphone and computer are mostly made of millions of tiny NAND gates!
1. The NAND Gate as a Universal Gate
The NAND gate is the "NOT-AND" gate. Let’s see how we can use it to pretend to be other gates.
A. Making a NOT Gate from a NAND Gate
A NOT gate has only one input, but a NAND gate has two. To make it work like a NOT gate, we simply join the two inputs together.
The Step-by-Step:
1. Take a NAND gate.
2. Connect input A and input B together so they become a single input.
3. Now, if you put in a '0', both inputs see '0', and the NAND output is '1'. If you put in a '1', both inputs see '1', and the NAND output is '0'.
4. Result: It works exactly like a NOT gate!
Boolean Expression: \( \text{Output} = \overline{A \cdot A} = \bar{A} \)
B. Making an AND Gate from NAND Gates
Since a NAND gate is just an AND gate followed by a NOT gate, we can "cancel out" the NOT part by adding another NOT gate at the end.
The Step-by-Step:
1. Feed your inputs into the first NAND gate.
2. Take the output of that gate and feed it into a second NAND gate (which is set up as a NOT gate, as we learned above).
3. The second gate flips the signal back.
4. Result: You now have an AND gate!
Boolean Expression: \( \text{Output} = \overline{\overline{A \cdot B}} = A \cdot B \)
C. Making an OR Gate from NAND Gates
This one is a little trickier, but don't worry! It requires three NAND gates.
The Step-by-Step:
1. Use two NAND gates as NOT gates to invert Input A and Input B separately.
2. Feed these two inverted signals into a third NAND gate.
3. Result: The final output will follow the OR gate logic.
Key Takeaway: With enough NAND gates, you don't need any other type of gate in your toolkit!
2. The NOR Gate as a Universal Gate
The NOR gate is the "NOT-OR" gate. Just like the NAND gate, it can be used to build everything else.
A. Making a NOT Gate from a NOR Gate
Just like the NAND gate, we connect both inputs together.
The Step-by-Step:
1. Join input A and B of the NOR gate.
2. When the input is '0', the output is '1'. When the input is '1', the output is '0'.
3. Result: It is now a NOT gate!
Boolean Expression: \( \text{Output} = \overline{A + A} = \bar{A} \)
B. Making an OR Gate from NOR Gates
To get an OR gate, we just need to remove the "NOT" part of the NOR gate.
The Step-by-Step:
1. Feed inputs into a NOR gate.
2. Take that output and feed it into a second NOR gate (configured as a NOT gate).
3. Result: The double inversion gives you an OR gate!
Boolean Expression: \( \text{Output} = \overline{\overline{A + B}} = A + B \)
C. Making an AND Gate from NOR Gates
This is the reverse of the NAND-to-OR process.
The Step-by-Step:
1. Use two NOR gates as NOT gates to invert Input A and Input B.
2. Feed those inverted signals into a third NOR gate.
3. Result: The output behaves exactly like an AND gate!
Key Takeaway: The NOR gate is just as powerful as the NAND gate; it can recreate NOT, OR, and AND functions easily.
Summary Tables for Quick Review
If you are feeling a bit confused, use this simple "cheat sheet" to remember how many gates you need to build the basics:
To build a gate using ONLY NAND:
NOT: Use 1 NAND gate (inputs joined).
AND: Use 2 NAND gates.
OR: Use 3 NAND gates.
To build a gate using ONLY NOR:
NOT: Use 1 NOR gate (inputs joined).
OR: Use 2 NOR gates.
AND: Use 3 NOR gates.
Memory Trick: Notice the pattern? To make the "partner" gate (NAND to AND, or NOR to OR), you always need 2 gates. To make the "opposite" gate (NAND to OR, or NOR to AND), you always need 3 gates!
Common Mistakes to Avoid
1. Forgetting to join inputs: When making a NOT gate, you must connect the inputs of the NAND/NOR gate together. If you leave one input floating (disconnected), the gate won't work correctly!
2. Mixing them up: Remember that NAND and NOR are the only universal gates. You cannot build every other gate using just AND gates or just OR gates.
Quick Check: Why is it useful to use only NAND gates in a factory?
Answer: It is cheaper and simpler to manufacture many of the same component rather than different types.
Don't worry if this seems tricky at first! Drawing these out on paper is the best way to learn. Try drawing three NAND gates connected to make an OR gate and trace the '0's and '1's through the circuit. You'll see the magic happen!