Logic gates, adders, encoders, decoders, multiplexers & universal gates — complete ISC theory for 100/100.
A logic gate is a basic electronic circuit that implements a Boolean function. It takes one or more binary inputs (0 or 1) and produces a single binary output.
| A | B | NOT A | A AND B | A OR B | A NAND B | A NOR B | A XOR B | A XNOR B |
|---|---|---|---|---|---|---|---|---|
| 0 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 1 |
| 0 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 0 |
| 1 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 1 |
AND: All must be 1 → output is 1
OR: Any one is 1 → output is 1
NAND: Opposite of AND (bubble on output)
NOR: Opposite of OR (bubble on output)
XOR: "eXclusive OR" — different inputs → 1
XNOR: Same inputs → 1 (equality checker)
Output is 1 when an odd number of inputs are 1. Used in arithmetic (half adder sum), parity generation and checking.
Output is 1 when an even number of inputs are 1 (including zero). Used as an equality comparator.
A half adder adds two single-bit binary numbers A and B, producing a Sum (S) and Carry (C). It cannot accommodate a carry from a previous addition (no carry-in).
| A | B | Sum (S) | Carry (C) |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
1 XOR gate (for Sum) + 1 AND gate (for Carry) = 2 gates total
A full adder adds three bits: A, B, and Carry-in (Cᵢₙ), producing a Sum (S) and Carry-out (Cₒᵤₜ). It can be cascaded to add multi-bit binary numbers (ripple carry adder).
| A | B | Cᵢₙ | Sum (S) | Carry-out (Cₒᵤₜ) | Minterms |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | m₀ |
| 0 | 0 | 1 | 1 | 0 | m₁ →S |
| 0 | 1 | 0 | 1 | 0 | m₂ →S |
| 0 | 1 | 1 | 0 | 1 | m₃ →Cout |
| 1 | 0 | 0 | 1 | 0 | m₄ →S |
| 1 | 0 | 1 | 0 | 1 | m₅ →Cout |
| 1 | 1 | 0 | 0 | 1 | m₆ →Cout |
| 1 | 1 | 1 | 1 | 1 | m₇ →S,Cout |
An encoder is a combinational circuit that converts one of 2ⁿ input lines into an n-bit binary output code. At any given time, exactly ONE input line is active (HIGH). It is the reverse of a decoder.
Only ONE input is 1 at a time (mutually exclusive). If multiple inputs are 1 simultaneously, a priority encoder is needed (not in ISC syllabus).
| I₃ | I₂ | I₁ | I₀ | Y₁ | Y₀ |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 1 | 0 | 0 |
| 0 | 0 | 1 | 0 | 0 | 1 |
| 0 | 1 | 0 | 0 | 1 | 0 |
| 1 | 0 | 0 | 0 | 1 | 1 |
Each output bit is simply the OR of the input lines where that output bit is 1 in the truth table.
Only 2 OR gates needed (one per output bit).
| I₇ | I₆ | I₅ | I₄ | I₃ | I₂ | I₁ | I₀ | Y₂ | Y₁ | Y₀ |
|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
| 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 |
| 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 |
| 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 |
| 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
| 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 |
| 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 |
A decoder is a combinational circuit that converts an n-bit binary input into one of 2ⁿ output lines. Exactly ONE output is active (HIGH) for each unique binary input combination. It is the reverse of an encoder.
| A | B | D₀ | D₁ | D₂ | D₃ |
|---|---|---|---|---|---|
| 0 | 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 0 | 0 |
| 1 | 0 | 0 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 | 0 | 1 |
Each output is a minterm of the inputs. D₀ = m₀, D₁ = m₁, D₂ = m₂, D₃ = m₃.
2 NOT gates + 4 AND gates. Each AND gate generates one minterm.
A decoder generates ALL minterms of n variables. It can therefore implement ANY Boolean function by connecting relevant outputs to an OR gate.
Any n-variable Boolean function in SOP form can be realized using an n-to-2ⁿ decoder and an external OR gate. The decoder generates all minterms; the OR gate selects the required ones.
Example: f(A,B,C) = ∑m(1,3,5,7) — connect D₁, D₃, D₅, D₇ to an OR gate.
A multiplexer (MUX) is a combinational circuit that selects ONE of several input data lines and routes it to a single output, based on a set of selection (control) lines. It acts as a data selector.
Data input lines
Control/select lines
Single output line
| S (Select) | Output Y |
|---|---|
| 0 | I₀ (selects input I₀) |
| 1 | I₁ (selects input I₁) |
When S=0: Y = I₀. When S=1: Y = I₁. Needs 1 NOT, 2 AND, 1 OR gate.
| S₁ | S₀ | Output Y |
|---|---|---|
| 0 | 0 | I₀ |
| 0 | 1 | I₁ |
| 1 | 0 | I₂ |
| 1 | 1 | I₃ |
Each term enables exactly one input based on the select line combination.
A 2ⁿ:1 MUX can implement any n-variable Boolean function by connecting the data inputs (I₀ to I₂ⁿ⁻¹) to 0 or 1 based on the function's truth table, and using the n variables as select lines.
Example: To implement f(A,B) = A XOR B using a 4:1 MUX with A,B as select lines:
S₁S₀=00 (A=0,B=0): f=0 → I₀=0 S₁S₀=01 (A=0,B=1): f=1 → I₁=1
S₁S₀=10 (A=1,B=0): f=1 → I₂=1 S₁S₀=11 (A=1,B=1): f=0 → I₃=0
A gate is called a universal gate if it can be used to implement any Boolean function — i.e., any combination of NOT, AND, and OR gates can be replaced by using only that gate. NAND and NOR are the two universal gates.
Proof: NAND(A,A) = ̄(A·A) = ̄(A) = Ā ✓ (idempotent law A·A=A)
Proof: NAND gives ̄(A·B). Apply NOT (which is NAND with itself): ̄[̄(A·B)] = A·B ✓
NOT: 1 NAND gate | AND: 2 NAND gates | OR: 3 NAND gates
A two-level AND-OR circuit implementing SOP form can be directly converted to a two-level NAND-NAND circuit. Replace each AND gate and the final OR gate with NAND gates. This works because: ̄(Ā·B̄·...) = A+B+... by De Morgan's, and ̄[̄(AB)+̄(CD)+...] = AB+CD+... ✓
Proof: NOR(A,A) = ̄(A+A) = ̄(A) = Ā ✓ (idempotent law A+A=A)
NOT: 1 NOR gate | OR: 2 NOR gates | AND: 3 NOR gates
Just as SOP maps to NAND-NAND, POS (Product of Sums) maps to NOR-NOR:
A two-level OR-AND circuit implementing POS form can be converted to a two-level NOR-NOR circuit. Replace each OR gate and the final AND gate with NOR gates.
| Function | Using NAND only | Using NOR only |
|---|---|---|
| NOT A | NAND(A,A) | NOR(A,A) |
| A AND B | NAND(NAND(A,B), NAND(A,B)) | NOR(NOR(A,A), NOR(B,B)) |
| A OR B | NAND(NAND(A,A), NAND(B,B)) | NOR(NOR(A,B), NOR(A,B)) |
| Best for | SOP (Sum of Products) | POS (Product of Sums) |
| 2-level form | NAND-NAND (≡ AND-OR) | NOR-NOR (≡ OR-AND) |
Half Adder: S = A⊕B = Ā·B + A·B̄ C = A·B
Carry using NAND:
C = A·B = NAND(NAND(A,B), NAND(A,B))
Sum using NAND (5 gates):
Let P = NAND(A,B) = ̄(A·B)
Let Q = NAND(A,P) = ̄(A·̄(AB)) = Ā + AB = A+̄AB... (simplifies to A⊕B via NAND construction)
Full NAND implementation: S = NAND(NAND(A, NAND(A,B)), NAND(B, NAND(A,B)))
Verification: NAND(A,B)=P; NAND(A,P)=̄(A·̄(AB)); NAND(B,P)=̄(B·̄(AB)); S=NAND(these two)=A⊕B ✓
1. Draw and explain the logic circuit and truth table of a Half Adder / Full Adder
2. Show how NAND gate is a universal gate by implementing NOT, AND, OR
3. Show how NOR gate is a universal gate by implementing NOT, OR, AND
4. Write Boolean expressions for a 2-to-4 decoder
5. Convert an AND-OR circuit to NAND-NAND equivalent
6. Write the Boolean expression for a 4:1 MUX
7. Find the output of a given logic circuit for specific inputs
8. Draw the logic diagram for the SOP expression of a given truth table