Priority Encoder

Basic Combinational Circuit Blocks

9965

Priority Encoder

An encoder essentially performs the reverse of a decoder function in a combinational logic circuit. The process of converting from symbols or numbers to coded format is called encoding. A priority encoder has a priority function which allows it to produce an output corresponding to the highest-order input.

A priority encoder is, in a sense, the dual (or opposite) of the decoder circuit‚ it receives N inputs (where N is typically 4, 8 or 16), and asserts an output binary code of M=log2N bits (so the M-bit binary code is typically 2, 3, or 4 bits). The M-bit binary code indicates which input was asserted (i.e., in a 4:2 binary encoder, binary code 00 would be output if the 0th input line was asserted, binary code 01 would be output of the 1st input line was asserted, etc.). Since more than one input line to the encoder might be asserted at any given time, the priority encoder asserts an output code corresponding to the highest numbered input that is asserted (i.e., if both input line 0 and input line 2 were asserted in a 4:2 encoder, then binary code 10 would be output indicating that input line 2 is the highest line number‚ or highest priority input‚ currently asserted). Figure 1 below shows a priority encoder block.

At first thought, a four-input encoder circuit should require just two outputs. In such a circuit, asserting the 3rd input signal would cause an “11” output, asserting the 2nd input signal would output a “10”, asserting the 1st input signal would output a “01”, and asserting the 0th input would output “00”. But what if no inputs are asserted? Again, a “00” would be appropriate. To avoid creating an ambiguous “00” output, encoders typically use an “Enable In” (EIN) signal and an “Enable Output” (EOUT) signal.

Figure 1. Priority Encoder Block
Figure 1. Priority Encoder Block

EIN functions like other enable signals, when it is de-asserted, all outputs are driven to logic ‘0’, and when it is asserted, the encoder outputs can be driven by the inputs. EOUT is asserted only when EIN is asserted and no input signals are asserted. Thus, EOUT can be used to distinguish between no inputs asserted and the 0th input asserted.

Larger encoders can be built from smaller encoder modules in much the same way that larger decoders can be built from smaller decoder modules. An encoder module that can be used as a building block for larger encoders must have one additional output called Group Signal (GS). GS is asserted whenever EIN is asserted along with any other input signal, and it is used to form the most significant bit of the encoded output data element.

Encoder circuits are typically used in digital systems when a binary number that corresponds to a given input must be generated. For example, individual call attendant signals arising from passengers seated on an airplane could be encoded into a seat number. Priority encoders are also used when certain input signals must be dealt with in a special manner. For example, if inputs from several sources can all arrive simultaneously, a priority encoder can indicate which signal should be dealt with first.

Important Ideas

  • Since more than one input line to the encoder might be asserted at any given time, the priority encoder asserts an output code corresponding to the highest numbered input that is asserted.
  • To avoid creating an ambiguous “00” output, encoders typically use an “Enable In” (EIN) signal and an “Enable Output” (EOUT) signal.
  • Larger encoders can be built from smaller encoder modules in much the same way that larger decoders can be built from smaller decoder modules. An encoder module that can be used as a building block for larger encoders must have one additional output called group-signal (GS).
  • Encoder circuits are typically used in digital systems when a binary number that corresponds to a given input must be generated.