How an n-to-2^n decoder generates every minterm, how enables and active-low outputs work, how to implement functions and build larger decoders, plus encoders, priority encoders and memory address decoding as GATE asks them.
An n-to- decoder has inputs and outputs. For each input code exactly one output is active: output is active when the input equals . So each output is one minterm of the inputs:
where is the enable. When the decoder is disabled, all outputs are inactive.
A 2-to-4 decoder needs four 2-input AND gates (three-input if the enable is included) and two inverters; a 3-to-8 decoder needs eight 3-input AND gates.
Active-low outputs. Many decoder ICs (for example a 3-to-8 decoder like the 74138) have active-low outputs: the selected output goes to 0 and all others stay at 1, so . Enables may also be active low; such a chip works only when every enable is at its active level.
Decoder vs demultiplexer. A 2-to-4 decoder with enable is a 1-to-4 demultiplexer: feed the data to and use as the select lines. The data appears on the selected output.
Always note which input is the MSB: with inputs and as MSB, the code activates , not .
A 2-to-4 decoder with enable: each output is one minterm of A1 A0 (A1 is the MSB), and all outputs are 0 when E = 0.
2. Implementing Boolean functions with a decoder
Since a decoder produces all minterms, any function of variables is a decoder plus one gate. Several functions of the same inputs can share one decoder, each with its own gate.
Decoder outputs
is
Gate on outputs in
Active high
OR of ,
OR
Active low
NAND of ,
NAND
Using the complement set (the minterms not in ) is cheaper when has many minterms:
Decoder outputs
Gate on outputs not in
Gives
Active high
NOR
Active low
AND
Why active low with AND works: the AND of over is .
Analysis questions run the other way: given which outputs go into which gate, write the minterms that the gate collects, then decide whether the gate gives the sum or its complement. For active-low outputs into an AND gate, is the complement of the sum of the minterms connected.
Example: a full adder from a 3-to-8 active-high decoder needs two OR gates: and .
3. Building larger decoders
Enables let small decoders combine into large ones.
3-to-8 from two 2-to-4 decoders (figure): go to both chips. The MSB enables the upper chip directly and the lower chip through an inverter. So selects – and selects –. Without enable inputs this needs extra AND gates.
Decoder trees. To build an -to- decoder from -to- decoders (with enable), the last level has decoders driven by the low bits. Their enables come from a smaller decoder tree driven by the high bits. Count level by level:
Build
From
Count
4-to-16
2-to-4
6-to-64
2-to-4
6-to-64
3-to-8
4-to-16
3-to-8
(plus an inverter on )
When the top level needs only two enables, an inverter does the job (as in the 3-to-8 and 4-to-16-from-3-to-8 cases); a chip with two enables of opposite polarity, one active high and one active low, avoids even the inverter.
Memory address decoding uses the same idea. With -word chips in a larger address space, the low address bits go to every chip, and a decoder on the next higher bits drives the chip selects. Chip on output covers addresses to , offset by any fixed higher bits.
A 3-to-8 decoder from two 2-to-4 decoders: A2 enables one chip directly and the other through an inverter.
4. Encoders and priority encoders
An encoder does the reverse of a decoder: inputs, outputs giving the index of the active input. An 8-to-3 encoder has , , , assuming exactly one input is active.
This simple encoder fails in two cases: when two inputs are active (the outputs OR together into a wrong code), and when no input is active (output 000 looks the same as active).
A priority encoder fixes both. It outputs the index of the highest-priority active input and adds a valid output that is 1 when at least one input is active. For a 4-to-2 priority encoder with highest:
0
0
0
0
x
x
0
0
0
0
1
0
0
1
0
0
1
x
0
1
1
0
1
x
x
1
0
1
1
x
x
x
1
1
1
So , , .
A BCD-to-7-segment decoder is a code converter, not an n-to- decoder: each segment output is a separate function of the 4 BCD bits, usually with the codes 1010–1111 as don't-cares.
Formulas to remember
Decoder output
Function from active-high outputs
Function from active-low outputsNAND of the outputs in , or AND of the outputs not in
Decoder tree count-to- decoders with enable, a multiple of
Chip address rangeChip on decoder output , words per chip
Common mistakes
With active-low outputs, using an OR gate on the minterm outputs; the correct gate is NAND (or AND on the complement set).
Forgetting that an AND of active-low outputs gives the complement of the sum of the connected minterms.
Swapping the MSB and LSB inputs, which moves the active output from D1 to D2 and changes every function.
Counting only the last level of a decoder tree and missing the decoders that drive the enables.
Treating an all-zero output of a plain encoder as input I0 active; without a valid bit it may mean no input is active.
In address decoding, ignoring the fixed high-order bits that gate the decoder's enable, which shifts the whole address range.
Worked examples
Try each step yourself, then reveal the working.
Example 1: Full adder with a 3-to-8 decoder
numerical
Implement a full adder (inputs , , , with as MSB) using a 3-to-8 decoder with active-high outputs and OR gates.
Step 1: Write the sum as minterms.
Try it on paper first.
Example 2: Reading an active-low decoder circuit
numerical
A 3-to-8 decoder with active-low outputs has inputs (MSB), , . Outputs , and go to a 3-input AND gate. Find .
Step 1: Write each connected output as a complemented minterm.
Try it on paper first.
Example 3: Counting decoders in a tree
numerical
How many 2-to-4 decoders (with enable) are needed for a 6-to-64 decoder, and how many 3-to-8 decoders?
Step 1: Count 2-to-4 decoders level by level.
Try it on paper first.
Example 4: Address range of a memory chip
conceptual
A system with a 16-bit address bus has eight 1 KB memory chips. Address lines – go to every chip; a 3-to-8 decoder on (with as MSB) drives the chip selects, and is enabled only when . Which addresses does the chip on output respond to?
Step 1: Fix the bits that select the chip.
Try it on paper first.
Previous year questions
1 official GATE EC question on this topic, newest first.
9 questions: up to 1 official PYQs and original practice questions, with GATE marking (MCQ wrong answers lose marks). Score 60% or more to pass. A new set is drawn each time.
Mark as mastered
Loading your progress…
My revision notes
Notes written by the GATEiit team against the official GATE EC syllabus; being checked by a reviewer. Updated 2026-11-28. Spotted a mistake? Use Report an issue on any question, or contact us.