This is also referred to as 4- bit priority, which consists of 4 inputs and 2 output lines. Since an encoder contains 2^n input lines and n output lines. The third output is ‘V’, which is considered as a valid but indicator and it is set to 1 when more than one input line is high or active (1).
If the valid bit is equal to ‘0’, then all the inputs are ‘0’. In this case, the other 2 output lines are considered as don’t care conditions denoted by ‘X
The truth table of a 4 to 2 priority encoder is shown below.
D3 | D2 | D1 | D0 | A | B | V |
0 | 0 | 0 | 0 | X | X | 0 |
1 | 0 | 0 | 0 | 0 | 0 | 1 |
X | 1 | 0 | 0 | 0 | 1 | 1 |
X | X | 1 | 0 | 1 | 0 | 1 |
X | X | X | 1 | 1 | 1 | 1 |
From the above truth table, we can observe that D3, D2, D1, D0 are the inputs; A and B are the outputs and V is the valid bit indicator. Here D3 input is the highest priority input and D0 is the lowest priority input.
When the input D3 is active high (1), which has the highest priority irrespective of all other input lines, then the output of the 4-bit priority encoder is 11.
When the D3 input is active low and the D2 is active high that has the next highest priority irrespective of all other input lines, then the output is BA=10.
When D3, D2 inputs are active low, and the D1 is active high and has the next highest priority regardless of the remaining input line, then the output will be BA = 01