In: Computer Science
Design a 8-to-3 binary encoder, with priority in binary sequence (i.e. input line 0 has higher priority than input line 1 etc). There should also be an "active" output which is 1 when any input line is active, and "0" when all input lines are 0. If all input lines are 0, the output lines other than the "active" output are "don't care".
The truth table for the 8-to-3 priority encoder will be
D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 | Q2 | Q1 | Q0 | O |
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | x | x | x | 0 |
x | x | x | x | x | x | x | 1 | 0 | 0 | 0 | 1 |
x | x | x | x | x | x | 1 | 0 | 0 | 0 | 1 | 1 |
x | x | x | x | x | 1 | 0 | 0 | 0 | 1 | 0 | 1 |
x | x | x | x | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 1 |
x | x | x | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 |
x | x | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 |
x | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 |
1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 |
In the above truth table, D0 to D7 are 8 input lines; Q0 to Q2 are 3 output lines and O is active output.
----------------------------------------
Steps to write the equations:
-----------------------------------------
Using the above truth table, we will derive the expression for Q0 to Q2 and O.
We are using the property to reduce the expressions below:
Verification:
provide input to lines 2 and 3.
Q0 = 0
Q1 = 1
Q2 = 0
We got the answer 010 which is 2.
----------------------------------------------
For the bonus part, the truth table will be
The priority order is 3, 4, 0, 2, 1, 5, 7, 6.
D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 | Q2 | Q1 | Q0 | O |
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | x | x | x | 0 |
x | x | x | 0 | 0 | x | x | 1 | 0 | 0 | 0 | 1 |
x | x | x | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 |
x | x | x | 0 | 0 | 1 | x | 0 | 0 | 1 | 0 | 1 |
x | x | x | x | 1 | x | x | x | 0 | 1 | 1 | 1 |
x | x | x | 1 | 0 | x | x | x | 1 | 0 | 0 | 1 |
x | x | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 |
0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 |
1 | x | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 |
Now use this above truth table to find the equation for Q0 to Q2 and simplify them using boolean algebra properties.