🧠 Logic Gates - Study Plan & Notes
✅ Study Plan
Day 1: Basics of Logic Gates
Day 2: Advanced Gates
Day 3: Logic Applications + Simplification
Day 4: Creative Thinking + Homework
📘 Logic Gates Overview
Definition
Logic gates are devices that use Boolean logic to produce output based on binary input (0 or 1).
🔌 Types of Gates
1. AND Gate ( && )
- Output is
1 only if both inputs are 1
- Boolean:
A ⋅ B
- Example Use: Keycard AND PIN for access
| A |
B |
A AND B |
| 0 |
0 |
0 |
| 0 |
1 |
0 |
| 1 |
0 |
0 |
| 1 |
1 |
1 |
2. OR Gate ( || )
- Output is
1 if at least one input is 1
- Boolean:
A + B
- Example Use: Motion sensor OR button to open door
| A |
B |
A OR B |
| 0 |
0 |
0 |
| 0 |
1 |
1 |
| 1 |
0 |
1 |
| 1 |
1 |
1 |
3. NOT Gate ( !A )
- Inverts the input
- Boolean:
Ā
- Example Use: Thermostat off when temp exceeds limit
4. NAND & NOR
- NAND: ¬(A ⋅ B), Universal Gate
- NOR: ¬(A + B), Universal Gate
| A |
B |
NAND |
NOR |
| 0 |
0 |
1 |
1 |
| 0 |
1 |
1 |
0 |
| 1 |
0 |
1 |
0 |
| 1 |
1 |
0 |
0 |
Use: Found in self-driving car decision logic
5. XOR Gate ( ⊕ )
- Outputs
1 if inputs are different
- Boolean:
A ⊕ B
- Example Use: Data comparison in memory
| A |
B |
A XOR B |
| 0 |
0 |
0 |
| 0 |
1 |
1 |
| 1 |
0 |
1 |
| 1 |
1 |
0 |
6. XNOR Gate ( ⊙ )
- Outputs
1 if inputs are the same
- Boolean:
A ⊙ B = ĀB + A B̄ = ¬(A ⊕ B)
- Example Use: Pattern recognition
| A |
B |
A XNOR B |
| 0 |
0 |
1 |
| 0 |
1 |
0 |
| 1 |
0 |
0 |
| 1 |
1 |
1 |
🧮 Boolean Algebra & De Morgan’s Laws
¬(A ⋅ B) = ¬A + ¬B
¬(A + B) = ¬A ⋅ ¬B
Used to simplify logic circuits and reduce cost/complexity.
🛠 Popcorn Hacks
Hack #1: Secure Entry System (AND Gate)
```python
def secure_entry_system(keycard, pin):
return keycard & pin