Encoder (digital)
Digital electronic circuit

An encoder (or "simple 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.
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.
01Types of encoder
2n-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" (logic state "1") at a time.
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 (i.e., inputs containing 0, 2, 3, or 4 high bits) the outputs are treated as don't cares.
4-to-2 encoder
| Input | Output | |||||
| I3 | I2 | I1 | I0 | O1 | O0 | |
| 0 | 0 | 0 | 0 | x | ||
| 0 | 0 | 0 | 1 | 0 | 0 | |
| 0 | 0 | 1 | 0 | 0 | 1 | |
| 0 | 1 | 0 | 0 | 1 | 0 | |
| 1 | 0 | 0 | 0 | 1 | 1 | |
https://en.m.wikipedia.org/wiki/Encoder_(digital)#/editor/4 https://en.m.wikipedia.org/wiki/Encoder_(digital)#/editor/4

Sources and credits
This article is adapted from the Wikipedia article “Encoder (digital)”, written by its contributors and licensed under CC BY-SA 4.0. Fathomly has changed the layout, removed citation markers, navigation and maintenance notices, and adjusted punctuation. This adapted version is shared under the same license. For references, see the original article.
Images, from Wikimedia Commons:
- Encoder block diagram.jpg by Nitianabhigyan, CC BY-SA 4.0
- 4to2 Simple Encoder.png by YogeshwarB, CC BY-SA 4.0
Fathomly is not affiliated with or endorsed by the Wikimedia Foundation. Spotted a problem? Tell us.