Файл: Digital design with CPLD applications and VHDL (R. Dueck, 2000).pdf
ВУЗ: Не указан
Категория: Не указан
Дисциплина: Не указана
Добавлен: 13.06.2025
Просмотров: 8141
Скачиваний: 6
9.2 |
• Synchronous Counters |
375 |
||||||||||
The analysis in Example 9.3 did not account for the fact that the counter uses only 5 of |
||||||||||||
a possible 8 output states. In any truncated sequence counter, it is good practice to deter- |
||||||||||||
mine the next state for each unused state to ensure that if the counter powers up in one of |
||||||||||||
these unused states, it will eventually enter the main sequence. |
||||||||||||
EXAMPLE 9.4 |
Extend the analysis of the counter in Example 9.3 to include its unused states. Redraw the |
|||||||||||
counter’s state diagram to show how these unused states enter the main sequence (if they do). |
||||||||||||
Solution The synchronous input equations are: |
||||||||||||
J2 Q1 Q0 |
J1 Q0 |
J0 Q2 |
||||||||||
K2 1 |
K1 Q0 |
K0 1 |
||||||||||
The unused states are Q2Q1Q0 101, 110, and 111. Table 9.6 shows the transitions |
||||||||||||
made by the unused states. Figure 9.13 shows the completed state diagram. |
||||||||||||
Table 9.6 State Table for Mod-5 Counter Including Unused States |
||||||||||||
Present State |
Synchronous Inputs |
Next State |
||||||||||
Q2Q1Q0 |
J2K2 |
J1K1 |
J0K0 |
Q2Q1Q0 |
||||||||
000 |
01 |
(R) |
00 |
(NC) |
11 |
(T) |
001 |
|||||
001 |
01 |
(R) |
11 |
(T) |
11 |
(T) |
010 |
|||||
010 |
01 |
(R) |
00 |
(NC) |
11 |
(T) |
011 |
|||||
011 |
11 |
(T) |
11 |
(T) |
11 |
(T) |
100 |
|||||
100 |
01 |
(R) |
00 |
(NC) |
01 |
(R) |
000 |
|||||
101 |
01 |
(R) |
11 |
(T) |
01 |
(R) |
010 |
|||||
110 |
01 |
(R) |
00 |
(NC) |
01 |
(R) |
010 |
|||||
111 |
11 |
(T) |
11 |
(T) |
01 |
(R) |
000 |
|||||
FIGURE 9.13
Example 9.4
Complete State Diagram
SECTION 9.2 REVIEW PROBLEM
9.2A 4-bit synchronous counter based on JK flip-flops is described by the following set of equations:
J3 Q2Q1Q0 |
J2 Q1Q0 |
J1 Q3Q0 |
J0 1 |
K3 Q0 |
K2 Q1Q0 |
K1 Q0 |
K0 1 |
376 C H A P T E R 9 • Counters and Shift Registers
Assume the counter output is at 1000 in the count sequence. What will the output be after one clock pulse? After two clock pulses?
9.3 Design of Synchronous Counters
K E Y T E R M S
Excitation table A table showing the required input conditions for every possible transition of a flip-flop output.
State machine A synchronous sequential circuit.
A synchronous counter can be designed using established techniques that involve the derivation of Boolean equations for the counter’s next state logic. Alternatively, several VHDL structures can be used to define counters; we can use a behavioral description of the counter, or we can use a state machine definition in VHDL that specifies each present and next state explicitly.
In addition to the classical counter design techniques, we will examine the design of a counter through a behavioral description in VHDL. We will leave the state machine design for the following chapter.
Classical Design Technique
There are several steps involved in the classical design of a synchronous counter.
1.Define the problem. Before you can begin design of a circuit, you have to know what its purpose is and what it should do under all possible conditions.
2.Draw a state diagram showing the progression of states under various input conditions and what outputs the circuit should produce, if any.
3.Make a state table which lists all possible Present States and the Next State for each one. List the present states in binary order.
4.Use flip-flop excitation tables to determine at what states the flip-flop synchronous inputs must be to make the circuit go from each Present State to its Next State.
5.The logic levels of the synchronous inputs are Boolean functions of the flip-flop outputs and the control inputs. Simplify the expression for each input and write the simplified Boolean expression.
6.Use the Boolean expressions found in step 5 to draw the required logic circuit.
Flip-flop Excitation Tables
In the synchronous counter circuits we examined earlier in this chapter, we used JK flipflops that were configured to operate only in toggle or no change mode. We can use any type of flip-flop for a synchronous sequential circuit. If we choose to use JK flip-flops, we can use any of the modes (no change, reset, set, or toggle) to make transitions from one state to another.
A flip-flop excitation table shows all possible transitions of a flip-flop output and the synchronous input levels needed to effect these transitions. Table 9.7 is the excitation table of a JK flip-flop.
If we want a flip-flop to make a transition from 0 to 1, we can use either the toggle function (JK 11) or the set function (JK 10). It doesn’t matter what K is, as long as J 1. This is reflected by the variable pair (JK 1X) beside the 0→ 1 entry in Table 9.7. The X is a don’t care state, a 0 or 1 depending on which is more convenient for the simplification of the Boolean function of the J or K input affected.
Table 9.8 shows a condensed version of the JK flip-flop excitation table.
378 C H A P T E R 9 • Counters and Shift Registers
Table 9.9 State Table for a Mod-12 Counter
Present State |
Next State |
Synchronous Inputs |
||||
Q3Q2Q1Q0 |
Q3Q2Q1Q0 |
J3K3 |
J2K2 |
J1K1 |
J0K0 |
|
0000 |
0 0 0 1 |
0 X |
0 X |
0X |
1 X |
|
0001 |
0 0 1 0 |
0 X |
0 X |
1X |
X 1 |
|
0010 |
0 0 1 1 |
0 X |
0 X |
X0 |
1 X |
|
0011 |
0 1 0 0 |
0 X |
1 X |
X1 |
X 1 |
|
0100 |
0 1 0 1 |
0 X |
X 0 |
0X |
1 X |
|
0101 |
0 1 1 0 |
0 X |
X 0 |
1X |
X 1 |
|
0110 |
0 1 1 1 |
0 X |
X 0 |
X0 |
1 X |
|
0111 |
1 0 0 0 |
1 X |
X 1 |
X1 |
X 1 |
|
1000 |
1 0 0 1 |
X 0 |
0 X |
0X |
1 X |
|
1001 |
1 0 1 0 |
X 0 |
0 X |
1X |
X 1 |
|
1010 |
1 0 1 1 |
X 0 |
0 X |
X0 |
1 X |
|
1011 |
0 0 0 0 |
X 1 |
0 X |
X1 |
X 1 |
|
1100 |
XXXX |
XX |
XX |
XX |
XX |
|
1101 |
XXXX |
XX |
XX |
XX |
XX |
|
1110 |
XXXX |
XX |
XX |
XX |
XX |
|
1111 |
XXXX |
XX |
XX |
XX |
XX |
|
Let us examine one transition to show how the table is completed. The transition from Q3Q2Q1Q0 0101 to Q3Q2Q1Q0 0110 consists of the following individual flipflop transitions.
Q3: 0 → 0 |
(No change or reset; |
J3K3 0X) |
Q2: 1 → 1 |
(No change or set; |
J2K2 X0) |
Q1: 0 → 1 |
(Toggle or set; |
J1K1 1X) |
Q0: 1 → 0 |
(Toggle or reset; |
J0K0 X1) |
The other lines of the table are similarly completed.
5.Simplify the Boolean expression for each input. Table 9.9 can be treated as eight truth tables, one for each J or K input. We can simplify each function by Boolean algebra or by using a Karnaugh map.
Figure 9.15 shows K-map simplification for all 8 synchronous inputs. These maps yield the following simplified Boolean expressions.
J0 1
K0 1
J1 Q0
K1 Q0
J2 Q3Q1Q0
K2 Q1Q0
J3 Q2Q1Q0
K3 Q1Q0
6.Draw the required logic circuit. Figure 9.16 shows the circuit corresponding to the above Boolean expressions.
We have assumed that states 1100 to 1111 will never occur in the operation of the mod-12 counter. This is normally the case, but when the circuit is powered up, there is no guarantee that the flip-flops will be in any particular state.
If a counter powers up in an unused state, the circuit should enter the main sequence after one or more clock pulses. To test whether or not this happens, let us make a state