Use the following logic gate symbols: NOT, AND, OR, NAND, NOR, XOR
3.2 Logic Gates and Logic Circuits
What is a Logic Gate?
A logic gate is a tiny electronic switch that takes one or more binary inputs (0 or 1) and produces a single binary output. Think of it as a tiny decision‑maker that follows a simple rule. 🚦
The Six Basic Gates
- NOT (¬) – Inverts the input: 0 becomes 1, 1 becomes 0. It’s like a mirror that flips the truth.
- AND (∧) – Output is 1 only if both inputs are 1. Imagine two friends needing to agree before a plan goes ahead. 🤝
- OR (∨) – Output is 1 if at least one input is 1. Like a club where any member can open the door. 🏢
- NAND (↑) – The opposite of AND: output is 0 only if both inputs are 1. Think of a safety lock that triggers when both conditions are met.
- NOR (↓) – The opposite of OR: output is 1 only when both inputs are 0. It’s a “no‑one‑is‑on” alarm.
- XOR (⊕) – Output is 1 when the inputs differ. It’s like a “one‑of‑two” rule: only one friend can win the game. 🎲
Truth Tables
| A | B | ¬A | A ∧ B | A ∨ B | A ↑ B | A ↓ B | A ⊕ B |
|---|---|---|---|---|---|---|---|
| 0 | 0 | 1 | 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 1 | 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 0 | 1 | 1 | 0 | 1 |
| 1 | 1 | 0 | 1 | 1 | 0 | 0 | 0 |
De Morgan’s Laws (A Quick Cheat‑Sheet)
Law 1: $ eg(A \land B) = eg A \lor eg B $ Law 2: $ eg(A \lor B) = eg A \land eg B $ These laws let you flip AND to OR and vice versa by adding a NOT gate. Think of it as swapping the roles of “yes” and “no” while keeping the logic intact. 🔄
Building a Simple Circuit: The “Door Lock” Example
- Define the problem: The door opens (output 1) only when both the key (input A) and the code (input B) are correct.
- Choose the gate: AND gate (∧) is perfect because we need both conditions satisfied.
- Draw the circuit: Connect A and B to the two inputs of an AND gate. The output of the AND gate goes to the lock mechanism.
- Test the truth table: Verify that only the (1,1) row gives 1. 🚪
- Optional: Add a NOT gate to create a “panic button” that opens the door regardless of key/code (output 1 when panic button is pressed).
Practical Tips for Designing Circuits
- Start with a truth table – it shows every possible input combination and the desired output.
- Use De Morgan’s laws to simplify circuits that use many NOT gates.
- Remember that AND and NAND are functionally complete: any logic function can be built using just these two.
- When in doubt, draw a block diagram with boxes for each gate and arrows for signals.
Quick Quiz (Try it yourself!)
1. What is the output of a NOR gate when both inputs are 0?
2. Write the Boolean expression for a circuit that outputs 1 when exactly one input is 1 (XOR).
3. Using only NAND gates, how would you construct a NOT gate?
Answers: 1) 1, 2) $A \oplus B$, 3) $A \uparrow A$ (a NAND gate with both inputs tied together). 🎓
Revision
Log in to practice.