This page is the "case gym" for the parent decoder note . We take every kind of question a decoder can throw at you and grind through one worked example per case — from the simplest "which line lights up" to active-low chips, demux routing, and full chip-expansion. Read the scenario matrix first, then work each example before peeking at the steps.
Everything here is built on one fact you already met: a decoder turns a binary address (a number written in 0s and 1s) into a one-hot output — exactly one wire goes "hot" (active), the one whose number equals the address. If any word here is unfamiliar, that's fine — each example rebuilds it from zero.
Every decoder problem is one of these case classes . The examples below each carry a tag like (Cell A) so you can see the whole grid is covered.
Cell
Case class
What makes it tricky
Covered by
A
Plain 2:4 evaluate
mapping binary → decimal index
Ex 1
B
Plain 3:8 evaluate
3 bits, bigger index arithmetic
Ex 2
C
MSB/LSB swap trap
reading bits in the wrong order
Ex 3
D
Disabled chip (Enable = 0)
the degenerate all-zero output
Ex 4
E
Active-low outputs
"selected" means 0, not 1
Ex 5
F
Implement an SOP function
OR the right minterm outputs
Ex 6
G
Decoder as demultiplexer
data on Enable, routing
Ex 7
H
Limiting / boundary cases
address 0, address 2 n − 1
Ex 8
I
Real-world word problem
memory row/chip select
Ex 9
J
Exam twist (build 4:16)
hierarchical expansion
Ex 10
Intuition The one skill under all of these
Every cell reduces to the same move: turn the address into a decimal number, and that number is the hot line . Enable, active-low, and expansion are just wrappers around this core move. Keep that anchor in mind and no case can surprise you.
Before any symbol appears in an example, here is the full vocabulary, once. Nothing below this box uses a symbol not defined here.
Definition Input and output labels
A i — an input bit (a single 0 or 1). A 0 is the LSB (Least Significant Bit, weight 2 0 = 1 ). The highest index is the MSB (Most Significant Bit, weight 2 n − 1 ).
Decimal value of the address = ∑ i A i 2 i — you multiply each bit by its weight and add.
D k — output line number k . "Hot" / "active" means it carries the asserted logic level (1 for active-high, 0 for active-low — see below).
Definition Minterm — what each output actually
is
A minterm of some input variables is a single AND term that is 1 for exactly one input combination. You build the minterm for combination k by ANDing every input, writing it plain (A i ) where that bit is 1 and complemented (A i , read "NOT A i ", which is 1 when A i = 0 ) where that bit is 0.
Example: combination A 2 A 1 A 0 = 011 (decimal 3) gives the minterm A 2 A 1 A 0 — complement the 0-bit A 2 , keep the 1-bits.
We write the minterm for index k as m k . Key fact: decoder output D k is the minterm m k , so D k = 1 for exactly the one address k .
∑ m ( … ) ("sum of minterms") means: OR together the listed minterms — used in Ex 6.
E — one master switch on every output
Real decoders add one extra input, the Enable pin , written E . It is a master on/off switch that is wired into every output through an AND gate, so each output becomes
D k = E ⋅ m k .
Read E ⋅ m k as "E AND m k ": the output is 1 only when both E = 1 and the minterm m k = 1 .
Active-high enable: E = 1 → chip works normally; E = 0 → all outputs off (the degenerate state), because 0 ⋅ ( anything ) = 0 .
Active-low enable: written E ; the chip is on when E = 0 and off when E = 1 . Do not assume "enable" always means active-high — always check the chip's bubbles.
The tiny truth table below shows the wrapper behaviour on one representative output D 2 of a 2:4 decoder (so m 2 = A 1 A 0 ). Notice the whole "m 2 " column is ignored whenever E = 0 :
E
A 1
A 0
m 2 = A 1 A 0
D 2 = E ⋅ m 2
0
1
0
1
0 (chip asleep)
0
0
1
0
0
1
1
0
1
1 (selected)
1
0
1
0
0
Every other output (D 0 , D 1 , D 3 ) has the identical wrapper — only its minterm differs.
Definition Chips with several enable pins (e.g. the 74138)
Some real decoders have more than one enable pin, wired so the chip is on only when they all agree. We name them E 1 , E 2 , E 3 , … and put a bar on the active-low ones. The 74138 has three: two active-low (E 1 , E 2 ) and one active-high (E 3 ). Its single effective enable is their AND:
E eff = E 1 = 0 AND E 2 = 0 AND E 3 = 1.
In words: both active-low pins must be pulled to 0 and the active-high pin pulled to 1; if any one disagrees, E eff = 0 and the whole chip sleeps. Everything then behaves exactly like the single-E rule with E = E eff . (Multiple enables exist precisely to make chip-expansion easy — see Ex 10.)
Definition Active-low outputs and the bar notation
Some chips assert the selected line as a logic 0 and hold all others at 1 — the opposite of what you'd first guess. This is called active-low output . We flag such a pin by drawing a bar over its name: D k means "output k , active-low", and "D k = 0 " reads as "line k is the selected one". A bar always means "active / asserted when this signal is 0".
"Weigh, add, that's the line." Weigh each bit by its power of two, add them, and the sum is the single hot output — then apply the enable and polarity wrappers.
A 2:4 decoder has inputs A 1 (MSB) and A 0 (LSB). Given A 1 A 0 = 01 , which output is hot?
Forecast: Guess the output index before reading on. (It is not line 1 just because the bits "look like 1"? Actually — check it.)
Weigh each bit. A 1 = 0 has weight 2 1 = 2 ; A 0 = 1 has weight 2 0 = 1 .
Why this step? The output index is the decimal value of the address, so we must convert.
Add. Value = 0 ⋅ 2 + 1 ⋅ 1 = 1 .
Why this step? This sum is the line that goes hot.
State the result. D 1 = 1 ; D 0 = D 2 = D 3 = 0 .
Why this step? One-hot means every other output is off.
Verify: Plug into the minterm formula D 1 = m 1 = A 1 A 0 = 0 ⋅ 1 = 1 ⋅ 1 = 1 . ✓ And D 3 = m 3 = A 1 A 0 = 0 ⋅ 1 = 0 . ✓ Exactly one line is 1.
Reading the figure. The box is the decoder; the two arrows on the left are the input bits A 1 = 0 , A 0 = 1 ; the four arrows on the right are D 0 … D 3 . Three are grey (logic 0) and one is red — that red wire is D 1 . It maps directly to step 3: the algebra said "D 1 = m 1 = A 1 A 0 = 1 ", and the picture shows exactly that one wire carrying current while its three siblings stay dark.
A 3:8 decoder has inputs A 2 A 1 A 0 . Given A 2 A 1 A 0 = 011 , which output fires?
Forecast: More bits, bigger number. Guess the index.
Weigh. A 2 = 0 (weight 4), A 1 = 1 (weight 2), A 0 = 1 (weight 1).
Why this step? Three bits means weights 4 , 2 , 1 — always powers of two.
Add. 0 ⋅ 4 + 1 ⋅ 2 + 1 ⋅ 1 = 3 .
Why this step? Sum = the hot line index.
Result. D 3 = 1 , all seven others 0.
Verify: Minterm form D 3 = m 3 = A 2 A 1 A 0 = 0 ⋅ 1 ⋅ 1 = 1 . ✓ Since 3 = 01 1 2 , the pattern (complement the 0-bit A 2 , keep the 1-bits) matches. ✓
Same 3:8 decoder. A student reads the input "left to right" as A 0 A 1 A 2 = 011 but the physical wiring is A 2 A 1 A 0 . The actual electrical inputs are A 2 = 1 , A 1 = 1 , A 0 = 0 . What output truly fires, and what wrong answer does the student get?
Forecast: Two different answers — predict both.
Student's (wrong) reading. They treat the string as value 01 1 2 = 3 , so they claim D 3 .
Why this step? This is the classic error: reading bits without matching them to weights.
Correct reading by weight. Actual bits A 2 A 1 A 0 = 110 . Value = 1 ⋅ 4 + 1 ⋅ 2 + 0 ⋅ 1 = 6 .
Why this step? Only the MSB-anchored weighting gives the real hardware answer.
Result. The true hot line is D 6 , not D 3 .
Verify: D 6 = m 6 = A 2 A 1 A 0 = 1 ⋅ 1 ⋅ 0 = 1 . ✓ The wrong D 3 = m 3 = A 2 A 1 A 0 = 1 ⋅ 1 ⋅ 0 = 0 — off, confirming the student would light the wrong lamp. ✓
Reading the figure. The single bit-string "0 1 1" sits at the top. Two arrows fan out: the grey left branch is the wrong reading (bits taken as A 0 A 1 A 2 , giving value 3 → grey D 3 lamp), and the red right branch is the correct MSB-anchored reading (bits as A 2 A 1 A 0 = 110 , giving value 6 → red D 6 lamp). The picture shows the two branches landing on different lamps — a direct visual of step 3's "D 6 , not D 3 ".
Common mistake Reading bits without weights
Why it feels right: we read numbers left-to-right in daily life. Fix: always tag the MSB and compute ∑ A i 2 i deliberately. A 3-bit swap can send you to line 6 instead of line 3.
A 2:4 decoder with active-high enable E is fed A 1 A 0 = 10 but E = 0 . Which output is hot?
Forecast: The address wants D 2 . Does it get it?
Recall enabled output form. With enable, D k = E ⋅ m k (from the Enable definition above), i.e. "E AND the minterm".
Why this step? Enable gates every output through an AND, so E = 0 zeroes them all — exactly the top rows of that definition's truth table.
Evaluate the wanted line. D 2 = E ⋅ m 2 = E ⋅ A 1 A 0 = 0 ⋅ 1 ⋅ 1 = 0 .
Why this step? Anything ANDed with 0 is 0 — the address is irrelevant.
Result. No output is hot. D 0 = D 1 = D 2 = D 3 = 0 . This is the degenerate / all-off state .
Verify: Try any other line, say D 0 = E ⋅ m 0 = E ⋅ A 1 A 0 = 0 ⋅ 0 ⋅ 0 = 0 . ✓ Every output is 0 regardless of the address bits. ✓
Intuition Why "all zero" is a legal, important state
A one-hot decoder normally has exactly one 1. But "disabled" is the only case where zero lines are hot — it is the master-off state. Chip-expansion (Ex 10) depends on this: most sub-decoders sit in this all-off state at any moment.
A 74138-style 3:8 decoder has active-low outputs and three enable pins E 1 , E 2 , E 3 (defined in the "several enable pins" box above). Its pins are set to E 1 = 0 , E 2 = 0 , E 3 = 1 . Given address A 2 A 1 A 0 = 101 , what value appears on each output line?
Forecast: In active-low logic, "selected" is the odd one out. Predict which line differs from the rest.
Combine the enable pins. E eff = E 1 = 0 AND E 2 = 0 AND E 3 = 1 = 1 → the chip is on .
Why this step? With several enables the chip works only when all agree; if any one disagreed, E eff = 0 and every output would sit inactive (all 1s here). Never assume enable is active-high.
Find the selected index. 10 1 2 = 1 ⋅ 4 + 0 ⋅ 2 + 1 ⋅ 1 = 5 . So line 5 is selected.
Why this step? Selection arithmetic is identical to active-high — only the output level changes.
Assign active-low levels. The selected line goes to 0 ; all others sit at 1 (recall the bar notation: D k = 0 means "line k selected").
Why this step? "Active-low output" means the asserted (chosen) state is a logic 0.
Result. D 5 = 0 ; D 0 = D 1 = D 2 = D 3 = D 4 = D 6 = D 7 = 1 .
Verify: Number of lines at 0 must be exactly one → count = 1. ✓ The index of that 0 equals the decimal address 5 . ✓ (If you ever see all lines at 1, the chip is disabled — the active-low all-off state.)
Reading the figure. Eight output arrows leave the box. Seven are grey and labelled "1" (their inactive level), and the single red arrow is labelled "0" — that lonely 0 is the selected line D 5 . This is the visual of step 3: active-low flips the meaning, so the winner is the one wire at 0 while all its siblings rest at 1.
Using a 3:8 decoder (active-high) plus one OR gate, implement
F ( A , B , C ) = ∑ m ( 2 , 3 , 5 ) .
Which decoder outputs do you OR, and what is F when A B C = 010 ?
Forecast: How many wires enter the OR gate?
Map variables to inputs. Let A = A 2 , B = A 1 , C = A 0 .
Why this step? The decoder produces every minterm m 0 … m 7 on its output lines (D k = m k ); we just pick the ones we want. Ordering the variables fixes which output is which minterm.
Pick the outputs. ∑ m ( 2 , 3 , 5 ) (the OR of minterms 2, 3, 5) means OR together D 2 , D 3 , D 5 :
F = D 2 + D 3 + D 5 .
Why this step? A sum-of-minterms is 1 exactly when the input matches one of those minterms — and each D k is already that minterm.
Evaluate at A B C = 010 . Value = 0 ⋅ 4 + 1 ⋅ 2 + 0 ⋅ 1 = 2 , so D 2 = 1 , hence F = 1 .
Why this step? Input 2 is in the set { 2 , 3 , 5 } , so F must be 1.
Verify: Truth-check the full set. F = 1 for inputs { 2 , 3 , 5 } and 0 otherwise. At input 4 : D 2 = D 3 = D 5 = 0 ⇒ F = 0 . ✓ At input 3 : D 3 = 1 ⇒ F = 1 . ✓ Exactly three inputs give F = 1 . ✓
Intuition Why decoders make SOP trivial
A Sum of Products (SOP) is a big OR of minterms. Since the decoder hands you all minterms on separate wires , implementing any function is just wiring the needed wires into one OR gate — no algebra, no K-map simplification. That is the decoder's superpower for logic design.
Take a 2:4 decoder and feed a data bit x into the Enable pin E instead of a constant. Address is A 1 A 0 = 11 . A stream sends x = 1 , 0 , 1 over three clock ticks. What appears on the outputs each tick?
Forecast: Which single output "carries" the data, and what do the rest do?
Recall the enabled form. D k = E ⋅ m k ; now E = x is the data, not a fixed enable.
Why this step? This turns the decoder into a demultiplexer : one input routed to one of 2 n outputs.
Find the routed line. 1 1 2 = 3 , so only m 3 is 1; every other minterm is 0.
Why this step? The address selects which output copies x .
Compute per tick. D 3 = x ⋅ m 3 = x ⋅ 1 = x , so D 3 follows the stream 1 , 0 , 1 . All others = x ⋅ 0 = 0 always.
Why this step? The unselected outputs are gated by a 0 minterm, so they stay 0 no matter what x does.
Verify: Tick 1: x = 1 ⇒ D 3 = 1 , others 0. ✓ Tick 2: x = 0 ⇒ D 3 = 0 , others 0. ✓ Tick 3: x = 1 ⇒ D 3 = 1 . ✓ The data appeared only on D 3 — routing achieved.
For a 3:8 decoder, work the two extreme addresses: the smallest (A 2 A 1 A 0 = 000 ) and the largest (A 2 A 1 A 0 = 111 ). Which lines fire?
Forecast: Guess both endpoints.
Smallest address. 00 0 2 = 0 , so D 0 fires.
Why this step? Zero is a valid address — it maps to line 0, the "all-complemented" minterm.
Its minterm. D 0 = m 0 = A 2 A 1 A 0 = 0 ⋅ 0 ⋅ 0 = 1 ⋅ 1 ⋅ 1 = 1 .
Why this step? All-zero input still selects exactly one line — never "no line" (unless disabled).
Largest address. 11 1 2 = 4 + 2 + 1 = 7 , so D 7 fires.
Why this step? The top address maps to the last line, the "all-true" minterm.
Its minterm. D 7 = m 7 = A 2 A 1 A 0 = 1 ⋅ 1 ⋅ 1 = 1 .
Verify: For an n -input decoder the valid indices run 0 to 2 n − 1 . Here n = 3 ⇒ 0 … 7 , and our endpoints are exactly 0 and 7 . ✓ Both minterms evaluate to 1. ✓ There is no address that selects "no line" — only the disable pin can do that (Ex 4).
A computer has 4 memory chips , each holding one block of addresses. Each chip has a Chip-Select (CS) pin — a control input that "wakes up" that chip so it can drive the data bus; while C S is inactive the chip is silent. The CPU's two high address bits A 15 A 14 pick which chip. Treat C S as active-high here (C S = 1 means selected). If A 15 A 14 = 10 , which chip's C S should be asserted?
Forecast: Which of chips 0–3 wakes up?
Recognise the decoder. Two select bits → a 2:4 decoder whose four outputs are the four C S lines C S 0 … C S 3 .
Why this step? Memory Address Decoding is literally "address bits in, one-hot chip-enable out."
Convert the select bits. 1 0 2 = 1 ⋅ 2 + 0 ⋅ 1 = 2 .
Why this step? The decimal value is the chip index to enable.
Assert that CS. C S 2 is asserted (=1); C S 0 , C S 1 , C S 3 stay inactive (=0).
Why this step? One-hot guarantees only one chip drives the data bus — no bus conflict. (On real RAM the C S is often active-low, C S ; then "selected" would be 0 — same idea, flipped polarity.)
Verify: C S 2 = m 2 = A 15 A 14 = 1 ⋅ 0 = 1 (active); C S 0 = m 0 = A 15 A 14 = 0 . ✓ Exactly one chip enabled — this is why decoders prevent two chips fighting over the same wires. ✓
Build a 4:16 decoder from two 3:8 decoders (each with an active-high enable E ). Inputs A 3 A 2 A 1 A 0 . For input A 3 A 2 A 1 A 0 = 1011 , which of the 16 outputs fires, and which sub-decoder is enabled?
Forecast: Which decoder wakes, and which line?
Split the bits. MSB A 3 chooses the decoder; the lower three bits A 2 A 1 A 0 address inside it.
Why this step? Same hierarchical trick as building 3:8 from two 2:4 — the top bit selects a "bank."
Wire the enables. Top 3:8 (outputs D 0 … D 7 ) enabled by E = A 3 ; bottom 3:8 (outputs D 8 … D 15 ) enabled by E = A 3 .
Why this step? A 3 and A 3 are opposites, so exactly one bank is ever enabled (the other sits in Ex 4's all-off state).
Evaluate the enables for this input. A 3 = 1 → bottom enable E = A 3 = 1 (on ), top enable E = A 3 = 0 (off ).
Why this step? Only the on-bank can produce a hot line; the off-bank contributes all zeros.
Address inside the on-bank. Lower bits A 2 A 1 A 0 = 011 = 3 → the bottom decoder fires its line 3.
Why this step? Inside the enabled bank, ordinary 3:8 selection (weigh-and-add) applies.
Convert to a global index. The bottom bank's outputs are numbered D 8 … D 15 , so its internal line 3 is global D 8 + 3 = D 11 .
Why this step? We must translate the sub-decoder's local index into the 4:16's global numbering.
Result. The single hot output is D 11 ; all other 15 outputs are 0.
Verify: Compute the full-address decimal directly: 101 1 2 = 1 ⋅ 8 + 0 ⋅ 4 + 1 ⋅ 2 + 1 ⋅ 1 = 11 , which matches D 11 . ✓ Top decoder disabled (A 3 = 0 ) so D 0 … D 7 are all 0. ✓ Exactly one of 16 lines hot — a valid one-hot output. ✓
Reading the figure. Two stacked boxes are the two 3:8 banks. The red wire from A 3 is the steering signal: it feeds A 3 = 0 to the top box (drawn grey = the off / all-zero bank of step 3) and A 3 = 1 to the bottom box (drawn black = on). Inside the live bottom bank the lower bits pick internal line 3, which the numbering maps to the red output D 11 on the right — mirroring steps 3→5 exactly.
Recall Which cell is which?
Cell D (disabled) is the only case with ::: zero hot lines — every other case has exactly one.
Recall Active-low selected line
On an active-low chip the selected output is ::: 0, and all the others are 1.
Recall Decoder-as-demux
To make a decoder route a data bit, put the data on the ::: Enable pin; the address selects which output copies it.
Recall 4:16 from two 3:8
The extra top bit (A 3 ) is used to ::: enable one 3:8 bank via A 3 / A 3 while the lower three bits address inside it.
Recall What is a minterm
m k ?
An AND of all inputs, complemented where the bit of k is 0, that is 1 for ::: exactly one input combination — namely k ; and D k = m k .
Recall Multi-enable chip (74138)
A chip with pins E 1 , E 2 , E 3 is enabled only when ::: all agree: E 1 = 0 AND E 2 = 0 AND E 3 = 1 .
Decoders (2 - 4, 3 - 8) — parent note; this page drills its every case.
Minterms and Maxterms — each output is a minterm (Ex 6).
Sum of Products (SOP) — decoder + OR realizes any SOP (Ex 6).
Demultiplexers — decoder + data-on-enable (Ex 7).
Multiplexers — complementary block.
Encoders — the inverse (one-hot in, binary out).
Memory Address Decoding — chip-select example (Ex 9).
7-Segment Display Driver — another decode-to-many use.