Skip to main content

Priority encoder and octal priority encoder

Short answer

A priority encoder outputs the code of the highest active input and a valid bit V. For an octal encoder with D7 highest, A2 = D4+D5+D6+D7, A1 = D6+D7 + D3·D4'·D5' + D2·D4'·D5', A0 = D7 + D5·D6' + D3·D4'·D6' + D1·D2'·D4'·D6', V = OR of all inputs.

What is a priority encoder? Design an octal priority encoder.

A priority encoder is an encoder that, when more than one input is active at the same time, outputs the code of the input with the highest priority and ignores the others. It also has a valid output V that is 1 when at least one input is active, to separate "input D0D_0 active" from "no input active" (both give code 000).

Octal (8-to-3) priority encoder

Inputs D0D_0–D7D_7 (active high), D7D_7 has the highest priority. Outputs A2A1A0A_2A_1A_0 (binary code) and V. X = don't care.

D7D_7D6D_6D5D_5D4D_4D3D_3D2D_2D1D_1D0D_0A2A_2A1A_1A0A_0V
00000000XXX0
000000010001
0000001X0011
000001XX0101
00001XXX0111
0001XXXX1001
001XXXXX1011
01XXXXXX1101
1XXXXXXX1111

Output equations

Each output is 1 for the rows where the highest active input has that bit set. For example, A0=1A_0 = 1 for highest input 7, 5, 3 or 1. Input 5 counts only if 6 and 7 are 0, and so on. After simplification (a term like D7‾D6\overline{D_7}D_6 reduces to D6D_6 because D7+D7‾D6=D7+D6D_7 + \overline{D_7}D_6 = D_7 + D_6):

A2=D4+D5+D6+D7A1=D7+D6+D3D4‾ D5‾+D2D4‾ D5‾A0=D7+D5D6‾+D3D4‾ D6‾+D1D2‾ D4‾ D6‾V=D0+D1+D2+D3+D4+D5+D6+D7\begin{aligned} A_2 &= D_4 + D_5 + D_6 + D_7 \\ A_1 &= D_7 + D_6 + D_3\overline{D_4}\,\overline{D_5} + D_2\overline{D_4}\,\overline{D_5} \\ A_0 &= D_7 + D_5\overline{D_6} + D_3\overline{D_4}\,\overline{D_6} + D_1\overline{D_2}\,\overline{D_4}\,\overline{D_6} \\ V &= D_0 + D_1 + D_2 + D_3 + D_4 + D_5 + D_6 + D_7 \end{aligned}

Logic diagram

D4,D5,D6,D7 ─────────────────[OR]── A2

D7 ─────────────────────────┐
D6 ─────────────────────────┤
D3,D4',D5' ──[AND]──────────┼[OR]── A1
D2,D4',D5' ──[AND]──────────┘

D7 ─────────────────────────┐
D5,D6' ──────[AND]──────────┤
D3,D4',D6' ──[AND]──────────┼[OR]── A0
D1,D2',D4',D6' ─[AND]───────┘

D0 ... D7 ───────────────────[OR]── V

Complements D2‾,D4‾,D5‾,D6‾\overline{D_2}, \overline{D_4}, \overline{D_5}, \overline{D_6} come from NOT gates.

Example: D6=D3=D1=1D_6 = D_3 = D_1 = 1, others 0. Then A2=1A_2 = 1, A1=D6=1A_1 = D_6 = 1, A0=0A_0 = 0 (since D6‾=0\overline{D_6} = 0 blocks every term except D7D_7). Output = 110 = 6, the highest-priority active input, and V = 1. The IC 74148 is a standard 8-to-3 priority encoder (with active-low inputs and outputs).

✓ Answer checked by Claude Opus 5.5 (high effort)

All Digital Logic chapter 4 questions →