Priority encoder
Encyclopedia
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 request
s 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 an irrelevant value - i.e. any input value there yields the same output since it is superseded by higher-priority input.
Priority encoders can be easily connected in arrays to make larger encoders, such as one 16-to-4 encoder made from six 4-to-2 priority encoders - four 4-to-2 encoders having the signal source connected to their inputs, and the two remaining encoders 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 configuration
s.
For example a single bit 4 to 2 encoder takes in 4 bits and outputs 2 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 bits) the outputs are treated as don't cares. It makes no sense to infer the priority encoder if input circuit guarantees one and only one bit high in the input or if it is understood that non-single-active-inputs will produce garbage encodings.
Electronic circuit
An electronic circuit is composed of individual electronic components, such as resistors, transistors, capacitors, inductors and diodes, connected by conductive wires or traces through which electric current can flow...
or algorithm
Algorithm
In mathematics and computer science, an algorithm is an effective method expressed as a finite list of well-defined instructions for calculating a function. Algorithms are used for calculation, data processing, and automated reasoning...
that compresses multiple binary
Binary
- Mathematics :* Binary numeral system, a representation for numbers using only two digits * Binary function, a function in mathematics that takes two arguments- Computing :* Binary file, composed of something other than human-readable text...
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 request
Interrupt request
The computing phrase "interrupt request" is used to refer to either the act of interrupting the bus lines used to signal an interrupt, or the interrupt input lines on a Programmable Interrupt Controller...
s 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
Precedence
Precedence may refer to:* Message precedence of military communications traffic* Order of precedence, the ceremonial hierarchy within a nation or state* Order of operations, in mathematics and computer programming...
. An example of a single bit 4 to 2 encoder
Encoder
An encoder is a device, circuit, transducer, software program, algorithm or person that converts information from one format or code to another, for the purposes of standardization, speed, secrecy, security, or saving space by shrinking size.-Media:...
is shown, where highest-priority inputs are to the left and "x" indicates an irrelevant value - i.e. any input value there yields the same output since it is superseded by higher-priority input.
I3 | I2 | I1 | I0 | O1 | O0 |
---|---|---|---|---|---|
0 | 0 | 0 | 1 | 0 | 0 |
0 | 0 | 1 | x | 0 | 1 |
0 | 1 | x | x | 1 | 0 |
1 | x | x | x | 1 | 1 |
Priority encoders can be easily connected in arrays to make larger encoders, such as one 16-to-4 encoder made from six 4-to-2 priority encoders - four 4-to-2 encoders having the signal source connected to their inputs, and the two remaining encoders 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 configuration
Configuration
The term configuration has several meanings.In computing it may refer to:* Computer configuration or system configuration* Configure is the output of Autotools and used to detect system configuration...
s.
Simple encoder
A simple encoder circuit is one-hot to binary converter. That is, if there are of 2n input lines at the input, whereas only one of them is in 1, binary code of this 'hot' line is produced a on the n-bit output.For example a single bit 4 to 2 encoder takes in 4 bits and outputs 2 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 bits) the outputs are treated as don't cares. It makes no sense to infer the priority encoder if input circuit guarantees one and only one bit high in the input or if it is understood that non-single-active-inputs will produce garbage encodings.
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 |