Файл: Digital design with CPLD applications and VHDL (R. Dueck, 2000).pdf
ВУЗ: Не указан
Категория: Не указан
Дисциплина: Не указана
Добавлен: 13.06.2025
Просмотров: 8127
Скачиваний: 6
180 C H A P T E R 5 • Combinational Logic Functions
FIGURE 5.29
3-bit Encoder (No Input Priority)
Table 5.4 Partial Truth Table for a 3-bit Encoder |
|||||||||
D7 |
D6 |
D5 |
D4 |
D3 |
D2 |
D1 |
Q2 |
Q1 |
Q0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
1 |
0 |
0 |
1 |
0 |
0 |
0 |
0 |
0 |
1 |
0 |
0 |
1 |
0 |
0 |
0 |
0 |
0 |
1 |
0 |
0 |
0 |
1 |
1 |
0 |
0 |
0 |
1 |
0 |
0 |
0 |
1 |
0 |
0 |
0 |
0 |
1 |
0 |
0 |
0 |
0 |
1 |
0 |
1 |
0 |
1 |
0 |
0 |
0 |
0 |
0 |
1 |
1 |
0 |
1 |
0 |
0 |
0 |
0 |
0 |
0 |
1 |
1 |
1 |
Priority Encoder |
|
The shortcoming of the encoder circuit shown in Figure 5.29 is that it can generate wrong |
|
codes if more than one input is active at the same time. For example, if we make D3 and D5 |
|
HIGH at the same time, the output is neither 011 or 101, but 111; the output code does not |
|
correspond to either active input. |
|
One solution to this problem is to assign a priority level to each input and, if two or |
|
more are active, make the output code correspond to the highest-priority input. This is |
|
called a priority encoder. Highest priority is assigned to the input whose subscript has the |
|
largest numerical value. |
|
EXAMPLE 5.5 |
Figures 5.30a through c show a priority encoder with three different combinations of in- |
puts. Determine the resultant output code for each figure. Inputs and outputs are active |
|
HIGH. |
FIGURE 5.30
Example 5.5
Priority Encoder Inputs
5.2 • Encoders |
181 |
Solution
Figure 5.30a: The highest-priority active input is D5. D4 and D1 are ignored. Q2Q1Q0101.
Figure 5.30b: The highest-priority active input is D4. D1 is ignored. Q2Q1Q0 100.
Figure 5.30c: The highest-priority active input is D7. All other inputs are ignored.
Q2Q1Q0 111.
N O T E
The encoding principle of a priority encoder is that a low-priority input must not change the code resulting from a higher-priority input.
For example, if inputs D3 and D5 are both active, the correct output code is Q2Q1Q0 101. The code for D3 would be Q2Q1Q0 011. Thus, D3 must not make Q1 1. The Boolean expressions for Q2, Q1, and Q0 covering only these two codes are:
Q2 |
D5 |
(HIGH if D5 |
is active.) |
|
Q1 |
D3D5 |
(HIGH if D3 |
is active AND D5 is NOT active.) |
|
Q0 |
D3 |
D5 |
(HIGH if D3 |
OR D5 is active.) |
The truth table of an 3-bit priority encoder is shown in Table 5.5.
Table 5.5 Truth Table for an 3-bit Priority Encoder
D7 |
D6 |
D5 |
D4 |
D3 |
D2 |
D1 |
Q2 |
Q1 |
Q0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
1 |
0 |
0 |
1 |
0 |
0 |
0 |
0 |
0 |
1 |
X |
0 |
1 |
0 |
0 |
0 |
0 |
0 |
1 |
X |
X |
0 |
1 |
1 |
0 |
0 |
0 |
1 |
X |
X |
X |
1 |
0 |
0 |
0 |
0 |
1 |
X |
X |
X |
X |
1 |
0 |
1 |
0 |
1 |
X |
X |
X |
X |
X |
1 |
1 |
0 |
1 |
X |
X |
X |
X |
X |
X |
1 |
1 |
1 |
Restating the encoding principle, a bit goes HIGH if it is part of the code for an active input AND it is NOT kept LOW by an input with a higher priority. We can use this principle to develop a mechanical method for generating the Boolean equations of the outputs.
1. Write the codes in order from highest to lowest priority, as in Table 5.6.
Table 5.6 Binary Outputs and
Corresponding Decimal Values
Q2 |
Q1 |
Q0 |
Code Value |
1 |
1 |
1 |
7 |
1 |
1 |
0 |
6 |
1 |
0 |
1 |
5 |
1 |
0 |
0 |
4 |
0 |
1 |
1 |
3 |
0 |
1 |
0 |
2 |
0 |
0 |
1 |
1 |
0 |
0 |
0 |
0 |