3.3.7 · D3Combinational Circuits

Worked examples — Encoders and priority encoders

2,308 words10 min readBack to topic

This page is the exhaustive drill room for Encoders and priority encoders. The parent note gave you the equations. Here we hunt down every kind of input pattern those equations can ever see, and we work each one to death — so that on an exam or a real chip, no case surprises you.

Before we start, let me re-anchor every symbol so this page stands alone.


The scenario matrix

Here is every class of situation a 4-input priority encoder can be handed. If we work one example from each row, we have literally covered all input patterns' worth of behaviour, because every pattern falls into exactly one of these classes.

# Case class What makes it special Covered by
A Single input, low index () the "index 0" trap — needs to be meaningful Example 1
B Single input, high index () the winner is also the highest — no suppression Example 2
C Two inputs, no conflict on bits multiple on, but the higher one's code is clean Example 3
D Two inputs, suppression fires ( & ) the term must kill Example 4
E All four inputs HIGH maximum contention — top dog must win alone Example 5
F Zero / degenerate — nothing on ambiguity with ; saves us Example 6
G Real-world word problem interrupt lines firing together Example 7
H Exam-style twist — plain vs priority same input, two devices, different answers Example 8

Figure 1 shows the whole priority-encoder as a little "tournament bracket" so you can see what "highest index wins" means.

Figure — Encoders and priority encoders

Look at the bracket: each input enters at the bottom, and whenever a higher-numbered input is on, it eats the lower ones on its way up. Only the survivor's index reaches the output.


Fully worked examples

Example 1 — Case A: the lonely low input


Example 2 — Case B: the lonely high input


Example 3 — Case C: two on, no bit conflict


Example 4 — Case D: suppression must fire

Figure — Encoders and priority encoders

In Figure 2, the red arrow is vetoing 's attempt to set . That crossed-out path is exactly .


Example 5 — Case E: everybody on at once


Example 6 — Case F: the empty row (degenerate)


Example 7 — Case G: real-world interrupt lines


Example 8 — Case H: exam twist, plain vs priority on the SAME input

Figure — Encoders and priority encoders

Figure 3: the yellow bar (plain) jumps to for the two-input case, while the green bar (priority) correctly caps at . The gap between them is the suppression term.


Coverage check — did we hit every cell?

Recall Did every matrix row get an example?

A → Ex 1 · B → Ex 2 · C → Ex 3 · D → Ex 4 · E → Ex 5 · F → Ex 6 · G → Ex 7 · H → Ex 8. Every class covered. ::: Yes — all 8 rows, spanning single/multiple/all/none inputs plus a word problem and an exam contrast.

Quick self-test:

Two inputs into the priority encoder — output?
(Case C logic: outranks ).
All zeros — what tells you the is meaningless?
The valid bit (Case F).
Which single example proves the term is necessary?
Example 4 ( and both on) — without it would wrongly be .

Connections

  • Parent topic — the equations drilled here.
  • Interrupt controllers — Example 7 is a live use of the priority rule.
  • Karnaugh maps — the tool that derives the suppression term from the don't-care truth table.
  • Boolean algebra simplification — justifies as the minimal .
  • Decoders · Multiplexers · Combinational circuits — surrounding topics.