## 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 DigitBinaryDecoding functionOutput
A0A10123
0001000
1010100
2100010
3110001

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 DigitBinaryDecoding functionOutput
A0A1A201234567
000010000000
100101000000
201000100000
301100010000
410000001000
510100000100
611000000010
711100000001

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 DigitBinaryDecoding functionOutput
A0A1A2A30123456789101112131415
000001000000000000000
100010100000000000000
200100010000000000000
300110001000000000000
401000000100000000000
501010000010000000000
601100000001000000000
701110000000100000000
810000000000010000000
910010000000001000000
1010100000000000100000
1110110000000000010000
1211000000000000001000
1311010000000000000100
1411100000000000000010
1511110000000000000001