# Decoders

Decoders are the combinational circuits that detect the presence of some code on its input and indicate the presence of that code by a specified output. Generally, a decoder has n input lines and 2n output lines.

Basic binary decoder

Suppose we need to detect the occurrence of binary number 1100 on the input of the circuit. AND can be used as a decoding element because of AND gate produces HIGH output only when all of its inputs are HIGH. Now we have to make sure that all inputs to the AND gate are HIGH when the number 1100 occurs. This can be achieved by inverting last 2 bits. The corresponding circuit design and logic equations are shown in the figure.

2 bit decoder

A 2-bit decoder (2 to 4-bit decoder) has 2 input lines and 4 output lines. That is, 4 decoding gates are required to decode all possible combinations of two bits. For any given code on its input, one of the four output becomes HIGH.

Binary codes corresponding outputs and decoding functions are described in the table.

Decimal Digit Binary Decoding function Output
A0 A1 1 0 2 3
0 0 0 $${ \overline{A_0} \overline{A_1}}$$ 1 0 0 0
1 0 1 $${\overline{A_0} A_1}$$ 0 1 0 0
2 1 0 $${A_0 \overline{ A_1}}$$ 0 0 1 0
3 1 1 $${A_0 A_1}$$ 0 0 0 1

logical diagram of 2 to 4 bit decoder is shown in the figure.

3 bit decoder

A 3-bit decoder has 3 input lines and 8 output lines. That is, 8 decoding gates are required to decode all possible combinations of three bits. For any given code on its input, one of the eight output becomes HIGH.

Binary codes corresponding outputs and decoding functions are described in the table.

Decimal Digit Binary Decoding function Output
A2 A1 A0 0 1 2 3 4 5 6 7
0 0 0 0 $${\overline{A_2} \overline{A_1} \overline{A_0}}$$ 1 0 0 0 0 0 0 0
1 0 0 1 $${ \overline{A_2} \overline{A_1} A_0}$$ 0 1 0 0 0 0 0 0
2 0 1 0 $${ \overline{A_2} A_1 \overline{ A_0}}$$ 0 0 1 0 0 0 0 0
3 0 1 1 $${ \overline{A_2} A_1 A_0}$$ 0 0 0 1 0 0 0 0
4 1 0 0 $${ A_2 \overline{A_1} \overline{ A_0}}$$ 0 0 0 0 1 0 0 0
5 1 0 1 $${ A_2 \overline{A_1} A_0}$$ 0 0 0 0 0 1 0 0
6 1 1 0 $${ A_2 A_1 \overline{A_0}}$$ 0 0 0 0 0 0 1 0
7 1 1 1 $${ A_2 A_1 A_0}$$ 0 0 0 0 0 0 0 1

Circuit of a 3 bit decoder is given below,

4 bit decoder

A 4-bit decoder has 4 input lines and 16 output lines. That is 16 decoding gates are required to decode all possible combinations of four bits. For any given code on its input, one of the sixteen output becomes HIGH.

Binary codes corresponding outputs and decoding functions are described in the table.

Decimal Digit Binary Decoding function Output
A3 A2 A1 A0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 0 0 0 0 $${\overline{A_3} \overline{A_2} \overline{A_1} \overline{A_0}}$$ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 0 0 1 $${\overline{A_3} \overline{A_2} \overline{A_1} A_0}$$ 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2 0 0 1 0 $${\overline{A_3} \overline{A_2} A_1 \overline{ A_0}}$$ 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
3 0 0 1 1 $${\overline{A_3} \overline{A_2} A_1 A_0}$$ 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
4 0 1 0 0 $${\overline{A_3} A_2 \overline{A_1} \overline{ A_0}}$$ 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
5 0 1 0 1 $${\overline{A_3} A_2 \overline{A_1} A_0}$$ 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
6 0 1 1 0 $${\overline{A_3} A_2 A_1 \overline{A_0}}$$ 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
7 0 1 1 1 $${\overline{A_3} A_2 A_1 A_0}$$ 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
8 1 0 0 0 $${A_3 \overline{A_2} \overline{A_1} \overline{A_0}}$$ 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
9 1 0 0 1 $${A_3 \overline{A_2} \overline{A_1} A_0}$$ 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
10 1 0 1 0 $${A_3 \overline{A_2} A_1 \overline{A_0}}$$ 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0
11 1 0 1 1 $${A_3 \overline{ A_2} A_1 A_0}$$ 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
12 1 1 0 0 $${A_3 A_2 \overline{A_1} \overline{A_0}}$$ 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
13 1 1 0 1 $${A_3 A_2 \overline{A_1} A_0}$$ 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
14 1 1 1 0 $${A_3 A_2 A_1 \overline{A_0}}$$ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
15 1 1 1 1 $${A_3 A_2 A_1 A_0}$$ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1