|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Priority Encoder |
|
|
|
|
|
|
|
We can't always assume
that only one input will be 1. |
|
|
Priority encoder: assumes that at least one input will be 1. |
|
|
Which input to
encode? Use priority scheme |
|
|
|
Larger subscripts could
have higher priority |
|
|
|
|
Smaller subscripts could
have higher priority |
|
|
|
|
Assume larger subscripts
have priority |
|
|
|
|
Boolean expressions no
longer necessarily valid |
|
|
|
|
|
Suppose x4 and x3
are both equal to 1 |
|
|
|
|
Then z2z1z0 =
111, but the result should be 100, since 4 has higher priority |
|
|
What does it mean that 4
has the highest priority? |
|
|
|
|
All of the higher inputs
must be 0, and the lower inputs don't matter: |
|
|
|
\x7\x6\x5x4 |
|
|
|
|
|
|
Negate all literals with
higher priority, and leave out lower ones |
|
|
Replace each term in
original expressions |
|
|
|
z2 = x7 + \x7x6 +
\x7\x6x5 + \x7\x6\x5x4 |
|
|
|
|
z1 = x7 + \x7x6 +
\x7\x6\x5\x4x3 + \x7\x6\x5\x4\x3x2 |
|
|
|
|
z0 = x7 + \x7\x6x5
+ \x7\x6\x5\x4x3
+ \x7\x6\x5\x4\x3\x2x1 |
|
|
|
This can be further simplified. |
|
|
|
|
If x7 is the highest priority 1,
then it doesn't matter if the other terms are 0 or not. |
|
|
|
|
z2 = x7 + x6 + \x6x5 +
\x6\x5x4 |
|
|
|
|
|
Similarly, if x6 is the
highest priority 1, then \x6 is not necessary in the other 2 terms. |
|
|
z2 = x7 + x6 + x5 + \x5x4 |
|
|
|
|
We can also eliminate \x5
in the last term. |
|
|
|
|
z2 = x7 + x6 + x5 + x4 |
|
|
|
|
(Notice that this
expression gives back the original form.) |
|
|
|
|
In the expression for z1,
however, we need to keep \x5 and \x4: |
|
|
|
|
z1 = x7 + x6 + \x5\x4x3 + \x5\x4x2 |
|
|
|
|
Likewise, for z0,
we need to keep \x6, \x4, and \x2: |
|
|
|
|
z0 = x7 + \x6x5
+ \x6\x4x3 + \x6\x4\x2x1 |
|
|
|
|
In general, we need to
keep the negation of any literal which doesn't appear |
|
|
|
as a higher-priority
value. |
|
|
|
|
|
|
|
|
|
What if all inputs are 0? |
|
|
|
|
|
We can encode the output
as 000, and x0 will have the highest priority by default. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|