## Decoder:

A Decoder is a combinational logic circuit that can have at most 2^{n} output lines for n number of input lines. Note that a decoder with n number of inputs can have maximum output lines of m. A decoder with n number of inputs and m number of outputs is called an **nxm** line decoder.

## 2×4 Decoder:

From the definition of decoder we already know that decoder can have 2ⁿ number of output lines for n number of input lines. If the number of input bits of a decoder is 2, the number of output lines will be 2^{n} = 4, this is a 2×4 decoder. Block diagram of 2×4 decoder is given next.

In the truth table of the decoder we see that an output line being active means a 1 on that line. For any input combination of decoder X and Y, only one output line will be 1 and all remaining lines will be 0. The output line with a 1 is the Decoded Output of the input code.

Explanation:

If O_{0} = 1 then x=0 and y=0 i.e. O_{0}=x.y [Here when x and y are 0, bar ( ‾‾ ) sits on the head.]

If O_{1} = 1 then x=0 and y=1 i.e. O_{1}=x.y

If O_{2} = 1 then x=1 and y=0 i.e. O_{2}=x.y

If O_{3} = 1 then x=1 and y=1 i.e. O_{3}=x.y

## 3×8 Decoder:

If the number of input bits of a decoder is 3 then the number of output lines will be 2^{3} = 8 according to the definition of the decoder. This is a 3×8 decoder. Next is the block diagram of 3×8 decoder.

In the truth table of the decoder we see that an output line being active means a 1 on that line.

For any input combination of x, y and z to the decoder, only one output line will be 1 and all remaining lines will be 0. The 1 on the output line is the **Decoded Output** of the input code. The output obtained from the adjacent truth table is-

D_{0} = x y z
D_{1} = x y z
D_{2} = x y z
D_{3} = x y z
D_{4} = x y z
D_{5} = x y z
D_{6} = x y z
D_{7} = x y z

## Encoder:

The process by which computer input data is converted into equivalent binary signals (0, 1) is called Encoding. The combinational logic circuit that helps this encoding is called encoder. The encoder has n number of output lines for a maximum of 2^{n} number of input lines. Encoders are of two types (A)Decimal to Binary, (B)Octal to Binary.

## Decimal to Binary:

Decimal to Binary encoder consists of 10 input signals from 0 to 9, 4 output lines and OR gates. Below is the truth table of decimal to binary encoder:

Explanation: The above truth table outputs O_{0}=1 where the inputs are 1.

Get them- O_{0} = D_{1} + D_{3} + D_{5} + D_{7} + D_{9}

Similarly for O_{1}, O_{1} = D_{2} + D_{3} + D_{6} + D_{7}

Similarly for O_{2}, O_{2} = D_{4} + D_{5} + D_{6} + D_{7}

Similarly for O_{3}, O_{3} = D_{8} + D_{9}

## Octal to Binary:

In this case Octal to Binary Encoder consists of 8 input signals (from 0 to 7), three output lines and OR gate. Below is the truth table of octal to binary encoder:

Explanation: The above truth table outputs x=1 where the inputs are 1.

Get them-

x = D_{4} + D_{5} + D_{6} + D_{7}

Similarly for y, y = D_{2} + D_{3} + D_{6} + D_{7}

Similarly for z, z = D_{1} + D_{3} + D_{5} + D_{7}

## Frequently Asked Question (FAQs):

- What is Decoder?
- What is 2×4 Decoder?
- What is 3×8 Decoder?
- What is Encoder?
- Decimal to Binary.
- Octal to Binary