CS Atlas GATE 2027
Digital Logic course
0 / 57 complete

Digital Logic/Phase 5 · Combinational Circuits

Lesson 5.2.2 · Item 37 of 57

Decoders, encoders, priority encoders and demultiplexers

Read at your own pace. Try the questions before opening the answers.

On this page

0 · Recall Warm-up

Answer from memory first. Answers are in the Answer Vault at the bottom.

1 · The Hook

🎣

A lift panel has a button per floor; the controller must know which button was pressed (encoder). A memory chip receives an address and must switch on exactly one row of cells (decoder). These two circuits are everywhere, and a decoder plus an OR gate can build any function, a quick GATE question.

2 · Predict First

🤔

A circuit has 3 inputs and 8 outputs, and exactly one output is 1: the one numbered by the input code. Which output is 1 for input 101?

Make a guess in your head. The answer opens Section 3.

3 · Core Concept

💡

Predict First — the answer

Output 5. Each output is one minterm: Y₅ = AB'C.

🗣️

In plain words

A decoder turns an n-bit code into 2ⁿ separate lines, switching on exactly the line whose number is the code; each output is a minterm. An encoder does the reverse: given one active line, it outputs its number. A priority encoder copes with several active lines by reporting the highest one. A demultiplexer sends one data input to the output chosen by the select lines.

1. Decoders

  • n-to-2ⁿ decoder: output Yₖ = mₖ (the k-th minterm of the inputs). Often with an enable E: all outputs 0 when E = 0.
  • Any function = decoder + OR gate: OR together the outputs of its minterms. F(A, B, C) = Σm(1, 2, 6, 7) → a 3-to-8 decoder and a 4-input OR of Y₁, Y₂, Y₆, Y₇. (If F has more 1s than 0s, a NOR of the 0-outputs is smaller.)
  • Bigger from smaller: a 4-to-16 decoder = two 3-to-8 decoders with enables driven by A and A'. Or from 2-to-4 decoders in a tree: one for the top two bits enabling four for the bottom two → 5 decoders.

2. Encoders

  • 2ⁿ-to-n encoder: exactly one input is 1; the output is its number. For 4-to-2: Y₁ = D₂ + D₃, Y₀ = D₁ + D₃.
  • Problem: if two inputs are 1 at once, the output is wrong; if none is 1, it outputs 0 like D₀.

3. Priority encoder

The highest-numbered active input wins, and a valid output V says whether any input is 1. For 4 inputs D₃ … D₀:

  • Y₁ = D₃ + D₂
  • Y₀ = D₃ + D₂'D₁
  • V = D₃ + D₂ + D₁ + D₀
D₃ D₂ D₁ D₀Y₁ Y₀V
0 0 0 0x x0
0 0 0 10 01
0 0 1 x0 11
0 1 x x1 01
1 x x x1 11

4. Demultiplexer

1-to-2ⁿ: the data input D goes to output k chosen by the selects; the others are 0. It is the same circuit as a decoder whose enable is used as the data input.

4 · Visual

Diagram: 3-to-8 · decoder · A · B · C · Y0 · Y1 · Y2 · Y3 · Y4 · Y5 · Y6 · Y7 · A · B · C · F

F(A, B, C) = Σm(1, 2, 6, 7): a 3-to-8 decoder supplies the minterms, a 4-input OR collects the ones F needs.

5 · Worked Examples

Example 1 Easy

A 2-to-4 decoder has inputs A B = 10. Which output is 1?

Solution

Y₂.

Example 2 Medium

A 4-input priority encoder receives D₃ D₂ D₁ D₀ = 0110. What are Y₁ Y₀ and V?

Solution

Highest active input is D₂ → Y₁Y₀ = 10, V = 1.

Example 3 GATE

How many 2-to-4 decoders (with enable) are needed to build a 4-to-16 decoder?

Solution

1 for the top two bits + 4 for the bottom two = 5.

6 · GATE Traps

⚠️

  • Decoder outputs are minterms; to build F, OR the minterms of F (not the maxterms).
  • A plain encoder assumes exactly one active input; use a priority encoder otherwise.
  • Priority encoders need the valid bit V to tell "D₀ active" from "nothing active".
  • Demultiplexer = decoder with the enable used as data.

7 · Memory Hook

🧠

"Decoder: code in, one line out (minterms). Encoder: one line in, code out. Priority: highest wins, V says someone pressed."

8 · Connect the Dots

Decoders + OR gates and multiplexers can build any function, but large designs need something more compact and reprogrammable. The last lesson of the phase covers ROMs and PLAs: arrays that store functions.

9 · Self-Test

GATE format. Try every question before opening the vault.

Q1NAT1 markDecoder

How many outputs does a 5-to-32 decoder have that are 1 for any single input code?

Numerical answer: ________

Q2NAT2 marksFunction with decoder

F(A, B, C) = Σm(0, 3, 5) is built from a 3-to-8 decoder and one OR gate. How many inputs does the OR gate need?

Numerical answer: ________

Q3MCQ1 markPriority encoder

A 4-input priority encoder (D₃ highest) receives D₃D₂D₁D₀ = 0011. The output Y₁Y₀ is:

  • (A) 01
  • (B) 11
  • (C) 00
  • (D) 10

Q4MCQ1 markPriority equations

For a 4-input priority encoder, Y₀ equals:

  • (A) D₃ + D₂
  • (B) D₃ + D₂'D₁
  • (C) D₀ + D₂
  • (D) D₁ + D₃

Q5NAT2 marksDecoder tree

How many 3-to-8 decoders with enable are needed to build a 6-to-64 decoder as a tree (one first-level decoder enabling the others)?

Numerical answer: ________

10 · Rule Card

  • n-to-2ⁿ decoder: Yₖ = mₖ (with enable). Function = decoder + OR of its minterm outputs.
  • Decoder trees: 4-to-16 from five 2-to-4 decoders, or from two 3-to-8 with enables.
  • Encoder 2ⁿ-to-n assumes one active input. Priority encoder (4-input): Y₁ = D₃ + D₂, Y₀ = D₃ + D₂'D₁, V = OR of all.
  • Demultiplexer = decoder with the enable as data.

11 · Concept Ledger

Unlocked in this lesson. From here on, these terms may be used.

decoderenable inputdecoder outputs as mintermsimplementing functions with a decoder and OR gatedecoder treesencoderpriority encodervalid bitdemultiplexer

12 · Answer Vault

Answer Vault

Try the questions first. Open when you are ready to check.

Recall Warm-up

  • S₁'S₀'I₀ + S₁'S₀I₁ + S₁S₀'I₂ + S₁S₀I₃.
  • 2ⁿ − 1.
  • AB'C.

Self-Test

Q1 Answer: 11 mark

Exactly one minterm is true.

Re-read: Lesson 5.2.2 — Decoders, encoders, priority encoders and demultiplexers

Q2 Answer: 32 marks

One per minterm.

Re-read: Lesson 5.2.2 — Decoders, encoders, priority encoders and demultiplexers

Q3 Answer: (A)1 mark

D₁ is the highest active input.

  • (B) is wrong: That is D₃.
  • (C) is wrong: That is D₀.
  • (D) is wrong: That is D₂.

Re-read: Lesson 5.2.2 — Decoders, encoders, priority encoders and demultiplexers

Q4 Answer: (B)1 mark

Y₀ = 1 for D₃, or for D₁ when D₂ is off.

  • (A) is wrong: That is Y₁.
  • (C) is wrong: No.
  • (D) is wrong: The plain-encoder equation; fails for 0110.

Re-read: Lesson 5.2.2 — Decoders, encoders, priority encoders and demultiplexers

Q5 Answer: 92 marks

1 + 8.

Re-read: Lesson 5.2.2 — Decoders, encoders, priority encoders and demultiplexers

Ready for the next idea?

Mark this item complete when you’ve finished reading and working through it.