Encoders are digital circuits used when we need to represent data/information in a different format, like a long sequence of bits with fewer bits.

We still need to be able to recover/decode that information, i.e., the encoder should ideally be injective. An easy example of an encoder is a circuit that transforms a one-hot encoding into a compact binary number.1 There are two problems with this initial approach — what if more than one input is high, or no inputs are high? We haven’t specified a proper output yet.

A priority encoder encodes inputs according to an associated priority. The bit (for valid) will indicate if an input is actually properly read.

Footnotes

  1. From Prof Korst’s lecture notes.