Logic Gates: Basic, Universal, and Special Gates
For inputs 1 and 1, OR gives 1 and XOR gives 0. OR asks whether at least one input is high. XOR with two inputs asks whether the inputs differ, which makes it useful for the sum bit in a half adder.
What is a Logic Gate? (In Simple Words)
Inside your laptop or smartphone, billions of tiny switches work together to make decisions. These basic electronic decision-makers are called Logic Gates.
- A Logic Gate is an electronic circuit with one or more inputs (
0or1) and produces exactly one output. - An input
0means Low Voltage (0V), and1means High Voltage (+5V).
An everyday example
Think of college exam eligibility:
“You need 75% attendance AND you must clear internal exams.”
Only when both conditions are true, you get the admit card. That is an AND gate!
1. The Three Basic Logic Gates
AND requires both inputs high and OR requires at least one high. NOT reverses the value of its single input.
- AND Gate (•) — Output is 1 ONLY when ALL inputs are 1. Like two switches connected in SERIES.
- OR Gate (+) — Output is 1 if AT LEAST ONE input is 1. Like two switches connected in PARALLEL.
- NOT Gate (Inverter) — Output is the OPPOSITE of the input. 0 turns into 1, and 1 turns into 0.
A. The AND Gate
- Formula:
Y = A • B(or simplyAB) - Simple Rule: Output is
1only when both inputs A and B are1. - Truth Table:
| Input A | Input B | Output Y = A • B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
View diagram · The Three Fundamental Logic Operations
B. The OR Gate
- Formula:
Y = A + B - Simple Rule: Output is
1if any input (A or B or both) is1. - Truth Table:
| Input A | Input B | Output Y = A + B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
C. The NOT Gate (Inverter)
- Formula:
Y = A'(orĀ) - Simple Rule: Has only 1 input. It flips the bit upside-down.
- Truth Table:
| Input A | Output Y = A’ |
|---|---|
| 0 | 1 |
| 1 | 0 |
2. Universal Logic Gates: NAND and NOR
Why Are They Called “Universal Gates”?
A gate is called Universal because you can build any other gate (AND, OR, NOT, XOR) using only NAND gates or only NOR gates!
- Chip factories love this because making just one type of gate in bulk saves huge manufacturing costs.
A. The NAND Gate (NOT + AND)
- Formula:
Y = (A • B)' - It is an AND gate with a NOT bubble at its output.
- Simple Rule: Output is
0only when all inputs are1. Otherwise, it gives1. - Truth Table:
| Input A | Input B | Output Y = (A • B)’ |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Making Basic Gates Using Only NAND:
- NOT Gate: Join both inputs together:
Y = (A • A)' = A'. - AND Gate: Pass inputs through a NAND gate, then invert the result:
Y = ((AB)')' = AB. - OR Gate: Invert inputs A and B first using NAND inverters, then pass into a NAND gate:
Y = (A' • B')' = A + B(by De Morgan’s Law).
B. The NOR Gate (NOT + OR)
- Formula:
Y = (A + B)' - It is an OR gate followed by an inversion bubble.
- Simple Rule: Output is
1only when both inputs are0. - Truth Table:
| Input A | Input B | Output Y = (A + B)’ |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
3. Special Purpose Gates: XOR and XNOR
XOR gives one when two input bits differ. XNOR gives one when the two bits match.
- XOR (Exclusive-OR) — Output = 1 when inputs are DIFFERENT (Odd 1s detector)
- XNOR (Exclusive-NOR) — Output = 1 when inputs are THE SAME (Equivalence detector)
A. The XOR Gate (Exclusive-OR)
- Symbol: ⊕
- Formula:
Y = A ⊕ B = A'B + AB' - Simple Rule: Output is
1when inputs are different from each other. - Truth Table:
| Input A | Input B | Output Y = A ⊕ B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
View diagram · XOR and XNOR Comparison
B. The XNOR Gate (Equivalence Gate)
- Symbol: ⊙
- Formula:
Y = (A ⊕ B)' = AB + A'B' - Simple Rule: Output is
1when both inputs are the exact same (00or11). - Truth Table:
| Input A | Input B | Output Y = (A ⊕ B)’ |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
💡 DAVV Exam Preparation Tips
5-Mark Question: “Why are NAND and NOR gates called Universal Gates? Show how to create an OR gate using only NAND gates.”
- Define Universal Gate: Any Boolean logic circuit can be designed using only that single gate.
- Draw the diagram: 2 NAND gates invert A and B to give A’ and B’. These feed into a 3rd NAND gate.
- Write the proof:
Y = (A' • B')' = A'' + B'' = A + B.10-Mark Question: “Explain all primary, universal, and special logic gates with their graphical symbols, Boolean expressions, and complete truth tables.”
- Systematically cover all 7 gates: AND, OR, NOT, NAND, NOR, XOR, and XNOR.
- For each gate, draw its neat logic symbol, write the Boolean equation, and draw its truth table.
- Mention where XOR is used: Binary Adders and parity generation circuits.