**7.7 ENCODERS**

A decoder's output code normally has more bits than its input code. If the device's output code has fewer bits than the input code, the device is usually called an *encoder*. So an encoder performs the function opposite to that of a decoder. It encodes the given information into a more compact form. The most commonly used encoders are binary encoders and priority encoders.

**7.7.1 Binary Encoder**

A *binary encoder* encodes information from 2^{N} inputs into an *N*-bit code. Exactly one of the input signals should have a value of 1, and the outputs present the binary number that identifies which input is equal to 1. A binary encoder converts only one input at a time into a binary code. The general structure of a binary encoder circuit is shown in Figure 7.20. A 4: 2 binary encoder, which has four inputs and two outputs, is illustrated in Figure 7.21. The modified truth table is shown in Figure 7.21. Notice that only one input isset at any time. All other states with multiple inputs, which are set, are considered don't-care states and are not shown in the truth table. Consequently, the logic circuit implementation of the 4 : 2 binary encoder has only two OR gates. Notice also that *x*_{1} does not have any effect on either output *y*_{1} or *y*_{2}.

### 7.7.2 **Priority Encoder**

A *priority encoder* is an encoder where more than one input can be activated ...

Get *Introduction to Digital Systems: Modeling, Synthesis, and Simulation Using VHDL* now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.