Skip to main content

Encoder and octal-to-binary (8-to-3) encoder

Short answer

An encoder converts one active input into its binary code. The 8-to-3 encoder assumes exactly one input high; outputs are A2 = D4+D5+D6+D7, A1 = D2+D3+D6+D7, A0 = D1+D3+D5+D7. D0 is inferred when all outputs are 0; a valid bit resolves the ambiguity.

What is an encoder? Explain 8 to 3 line encoder with circuit diagram and truth table.

An encoder is a combinational circuit that converts an active signal on one of its 2n2^n (or fewer) input lines into an n-bit binary code. It does the reverse of a decoder.

8-to-3 line (octal-to-binary) encoder

It has 8 inputs D0D_0–D7D_7 (one per octal digit) and 3 outputs A2A1A0A_2A_1A_0. It is assumed that only one input is 1 at any time.

D0D_0D1D_1D2D_2D3D_3D4D_4D5D_5D6D_6D7D_7A2A_2A1A_1A0A_0
10000000000
01000000001
00100000010
00010000011
00001000100
00000100101
00000010110
00000001111

Output expressions

Each output is the OR of the inputs whose code has a 1 in that bit:

A2=D4+D5+D6+D7A1=D2+D3+D6+D7A0=D1+D3+D5+D7\begin{aligned} A_2 &= D_4 + D_5 + D_6 + D_7 \\ A_1 &= D_2 + D_3 + D_6 + D_7 \\ A_0 &= D_1 + D_3 + D_5 + D_7 \end{aligned}

Circuit diagram

 D0 D1 D2 D3 D4 D5 D6 D7
  │  │  │  │  │  │  │  │
  x  │  │  │  ├──┼──┼──┼──[OR]── A2  (D4,D5,D6,D7)
     │  ├──┼──┼──┼──┼──┼──[OR]── A1  (D2,D3,D6,D7)
     ├──┼──┼──┼──┼──┼──┼──[OR]── A0  (D1,D3,D5,D7)

Three 4-input OR gates are enough; D0D_0 is not connected (no output bit is 1 for it).

Limitations

  • If no input is active, the output is 000, the same as for D0D_0; a valid-output line is needed to tell them apart.
  • If two inputs are active together, the output is wrong (e.g. D3D_3 and D5D_5 give 011+101=111011 + 101 = 111, which reads as 7). A priority encoder solves this by encoding only the highest active input.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Digital Logic chapter 4 questions →