A priority encoder is a digital circuit that encodes the position of the highest-order active input (the highest priority) into a binary code. It is used in applications where multiple inputs need to be prioritized, such as interrupt handling in microprocessors.
For a 4-to-2 priority encoder, the inputs are D3
, D2
, D1
, D0
, and the outputs are Y1
, Y0
, with V
(valid) indicating if any input is active.
Here Priority is in order D3 > D2 > D1 > D0
D3 | D2 | D1 | D0 | V | Y1 | Y0 |
---|---|---|---|---|---|---|
0 | 0 | 0 | 0 | 0 | - | - |
0 | 0 | 0 | 1 | 1 | 0 | 0 |
0 | 0 | 1 | 0 | 1 | 0 | 1 |
0 | 0 | 1 | 1 | 1 | 0 | 1 |
0 | 1 | 0 | 0 | 1 | 1 | 0 |
0 | 1 | 0 | 1 | 1 | 1 | 0 |
0 | 1 | 1 | 0 | 1 | 1 | 0 |
0 | 1 | 1 | 1 | 1 | 1 | 0 |
1 | 0 | 0 | 0 | 1 | 1 | 1 |
1 | 0 | 0 | 1 | 1 | 1 | 1 |
1 | 0 | 1 | 0 | 1 | 1 | 1 |
1 | 0 | 1 | 1 | 1 | 1 | 1 |
1 | 1 | 0 | 0 | 1 | 1 | 1 |
1 | 1 | 0 | 1 | 1 | 1 | 1 |
1 | 1 | 1 | 0 | 1 | 1 | 1 |
1 | 1 | 1 | 1 | 1 | 1 | 1 |
-
Here you can find the data flow modeling of a 4 to 2 encoder.
-
8 to 3 encoder and its testbench in structral modeling using a 4 to 2 encoder.
-
8 to 3 encoder and its testbench in Behavioural modeling.