Encoder (digital)


An encoder in digital electronics is a one-hot to binary converter. That is, if there are 2n input lines, and at most only one of them will ever be high, the binary code of this 'hot' line is produced on the n-bit output lines. A binary encoder is the dual of a binary decoder.
For example, a 4-to-2 simple encoder takes 4 input bits and produces 2 output bits. The illustrated gate level example implements the simple encoder defined by the truth table, but it must be understood that for all the non-explicitly defined input combinations the outputs are treated as don't cares.
I3I2I1I0O1O0ع
0000xx0
0001001
0010011
0100101
1000111

If the input circuit can guarantee at most a single-active input, a simple encoder is a better choice than a priority encoder, since it requires less logic to implement. However, a simple encoder can generate an incorrect output when more than a single input is active, so a priority encoder is required in such cases.

Types of encoder

2^n-to-n encoders

A -to-n encoder has n number of outputs in correspondence to the number of inputs. It thus reduces the number of transmission lines and can be compared to a multiplexer. Only one of the inputs become "high" at a time.
Some typical examples would be 4:2 encoder, 8:3 encoder, 16:4 encoders etc.

4-to-2 encoder

8-to-3 encoder