In my 8-bit computer build, I only used decoders. However, I will still cover encoders in this post for the sake of completeness. You can see the decoders being used in the RAM, multiplexers, and the control unit of the computer.
Decoders decode the binary value on the input to an individual selection on the output. The encoder will of course do the exact opposite.
In this post, we’ll take a look at encoders/decoders with 4 inputs/outputs because it’s easier to understand how they work. The logic is the same for more inputs/outputs, the logic circuit just gets scaled up.
In this example, we have a 2 to 4 decoder(described as n to 2n ). The n stands for the number of input lines. This decoder will take 2 input lines in and decode(select an output by setting it high) them to 2n or in this case 4 output lines.
The encoder will do the opposite of the decoder. In this example, we have a 4 to 2 encoder(described as 2n to n ). The n stands for the number of output lines. This encoder will take 4 or 2n input lines in and encode them to n or in this case 2 output lines(select an output by setting it high).