Priority encoder

This is an old revision of this page, as edited by Rich Farmbrough (talk | contribs) at 08:42, 29 April 2010 (Simple encoder). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

A priority encoder is a circuit or algorithm that compresses multiple binary inputs into a smaller number of outputs. The output of a priority encoder is the binary representation of the ordinal number starting from zero of the most significant input bit. They are often used to control interrupt requests by acting on the highest priority request.

If two or more inputs are given at the same time, the input having the highest priority will take precedence. An example of a single bit 4 to 2 encoder is shown, where highest-priority inputs are to the left and "x" indicates either a 1 or a 0 (i.e., either input value yields the same output when superseded by a higher-priority input).

I3 I2 I1 I0 O1 O0
0 0 0 x 0 0
0 0 1 x 0 1
0 1 x x 1 0
1 x x x 1 1

Template:Caption

Priority encoders can be easily connected in arrays to make larger encoders, such as a 16 to 4 encoder made from six 4 to 2 priority encoders (four encoders having the signal source connected to their inputs, and two encoders that take the output of the first four as input).

The priority encoder is an improvement on a simple encoder circuit, in terms of handling all possible input configurations.

Simple encoder

A simple encoder circuit can receive a single active input out of 2n input lines generate a binary code on n parallel output lines.

For example a single bit 4 to 2 encoder takes in 4 bits and outputs 2 bits. The illustrated example will sometimes fail as a priority encoder if more than one input line is active at a time.

 
Gate level circuit diagram of a single bit 4-to-2 line encoder
I3 I2 I1 I0 O1 O0
0 0 0 1 0 0
0 0 1 0 0 1
0 1 0 0 1 0
1 0 0 0 1 1

Template:Caption

References