Goseeko blog

# What are Encoders and Decoders?

• Encoders convert 2N lines of input into a code of N bits and Decoders decode those N bits into 2N lines.
• Binary code of N digits is used to store 2N distinct elements of coded information.
• This is the reason encoders and decoders are used.

## Encoders –

• It is a combinational circuit which converts binary information in the form of a 2N input lines into N output lines, which represent N bit code for the input.
• For simple encoders, only one input line is active at a time.
• For example: Octal to Binary encoder takes 8 input lines and generates 3 output lines.

Truth Table –

The truth table shows that the output is 000 when D0 is active; 001 when D1 is active; 010 when D2 is active and so on.

Implementation of Encoders –

• From the above truth table, the output Z is active when the input octal digit is 1, 3, 5 or 7.
• Y will be active when we have the input octal digit is 2, 3, 6 or 7 and X is active when input octal digits 4, 5, 6 or 7.
• Hence, the Boolean functions would be:

X = D4 + D5 + D6 + D7

Y = D2 +D3 + D6 + D7

Z = D1 + D3 + D5 + D7

Hence, the encoder is realized using OR gates is shown below

• In encoders only one input is active at one particular time.
• If more than one input is active, then the output of the encoder is undefined.
• For example, if D6 and D3 are both active, then, our output would be 111 which is the output for D7.
• Problem arises when all inputs are 0.
• Then the encoder gives output 000 which actually is the output for D0. To avoid this, we add an extra bit to the output which is the valid bit. This valid bit has value 0 when all inputs are 0 or 1.

## Decoders –

• It works as an inverse of an encoder.
• It is a combinational circuit which converts n input lines into 2n output lines.
• Take an example of a 3-to-8 line decoder.

Truth Table –

Implementation of Decoders

D0 is high when X = 0, Y = 0 and Z = 0. Hence,

D0 = X’ Y’ Z’

Similarly,

D1 = X’ Y’ Z

D2 = X’ Y Z’

D3 = X’ Y Z

D4 = X Y’ Z’

D5 = X Y’ Z

D6 = X Y Z’

D7 = X Y Z

Hence,

Interested in learning about similar topics? Here are a few hand-picked blogs for you!