Файл: Digital design with CPLD applications and VHDL (R. Dueck, 2000).pdf

ВУЗ: Не указан

Категория: Не указан

Дисциплина: Не указана

Добавлен: 13.06.2025

Просмотров: 8103

Скачиваний: 6

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

370 C H A P T E R 9 • Counters and Shift Registers

Control section The combinational logic portion of a synchronous circuit that determines the next state of the circuit.

Status lines Signals that communicate the present state of a synchronous circuit

from its memory section to its control section.

Command lines Signals that connect the control section of a synchronous circuit to its memory section and direct the circuit from its present to its next state.

In Chapter 7, we briefly examined the circuits of a 3-bit and a 4-bit synchronous counter (Figures 7.53 and 7.87, respectively). A synchronous counter is a circuit consisting of flipflops and control logic, whose outputs progress through a regular predictable sequence, driven by a clock signal. The counter is synchronous because all flip-flops are clocked at the same time.

Figure 9.8 shows the block diagram of a synchronous counter, which consists of a memory section to keep track of the present state of the counter and a control section to direct the counter to its next state. The memory section is a sequential circuit (flip-flops) and the control section is combinational (gates). They communicate through a set of status lines that go from the Q outputs of the flip-flops to the control gate inputs and command lines that connect the control gate outputs to the synchronous inputs (J, K, D, or T) of the flip-flops. Outputs can be tied directly to the status lines or can be decoded to give a sequence other than that of the flip-flop output states. The circuit might have inputs to implement one or more control functions, such as changing the count direction, clearing the counter, or presetting the counter to a specific value.

Input

Control section

lines

(gates)

Output

decoder

Command

Status

(optional)

Output

lines

lines

lines

Memory section (flip-flops)

CLK

FIGURE 9.8

Synchronous Counter Block Diagram

Analysis of Synchronous Counters

A 3-bit synchronous binary counter based on JK flip-flops is shown in Figure 9.9. Let us analyze its count sequence in detail so that we can see how the J and K inputs are affected by the Q outputs and how transitions between states are made. Later we will look at the function of truncated sequence counter circuits and counters that are made from flip-flops other than JK.

The synchronous input equations are given by:

J2 K2 Q1 Q0

J1 K1 Q0

J0 K0 1


9.2 • Synchronous Counters

371

VCC

JKFF

JKFF

AND2

JKFF

J

PRN

J

PRN

J

PRN

Q

Q

Q

K

K

K

CLRN

CLRN

CLRN

INPUT

CLK

OUTPUT

Q2

OUTPUT

Q1

OUTPUT

Q0

FIGURE 9.9

3-bit Synchronous Binary Counter

For reference, the JK flip-flop function table is shown in Table 9.4:

Table 9.4 Function Table of a JK Flip-Flop

J

K

Qt 1

Function

0

0

Qt

No change

0

1

0

Reset

1

0

1

Set

1

1

Qt

Toggle

Qt indicates the state of Q before a clock pulse is applied. Qt 1 indicates the state of Q after the clock pulse.

Assume the counter output is initially Q2Q1Q1 000. Before any clock pulses are applied, the J and K inputs are at the following states:

J2

K2

Q1 Q0 0 0 0

(No change)

J1

K1

Q0 0

(No change)

J0

K0

1 (Constant)

(Toggle)

The transitions of the outputs after the clock pulse are:

Q2: 0 → 0

(No change)

Q1: 0 → 0

(No change)

Q0: 0 → 1

(Toggle)

The output goes from Q2Q1Q1 000 to Q2Q1Q1 001 (see Figure 9.10). The transition is defined by the values of J and K before the clock pulse, since the propagation delays of the flip-flops prevent the new output conditions from changing the J and K values until after the transition.

The new conditions of the J and K inputs are:

J2

K2

Q1 Q0 0 1 0

(No change)

J1

K1

Q0 1

(Toggle)

J0

K0

1 (Constant)

(Toggle)


372 C H A P T E R 9 • Counters and Shift Registers

The transitions of the outputs generated by the second clock pulse are:

Q2: 0 → 0

(No change)

Q1: 0 → 1

(Toggle)

Q0: 1 → 0

(Toggle)

The new output is Q2Q1Q0 010, since both Q0 and Q1 change and Q2 stays the

same. The J and K conditions are now:

J2

K2

Q1 Q0 1 0 0

(No change)

J1

K1

Q0 0

(No change)

J0

K0

1 (Constant)

(Toggle)

The output transitions are:

Q2: 0 → 0

(No change)

Q1: 1 → 1

(No change)

Q0: 0 → 1

(Toggle)

The output is now Q2Q1Q0 011, which results in the JK conditions:

J2

K2

Q1 Q0 1 1 1

(Toggle)

J1

K1

Q0 1

(Toggle)

J0

K0

1 (Constant)

(Toggle)

The above conditions result in output transitions:

Q2: 0 → 1

(Toggle)

Q1: 1 → 0

(Toggle)

Q0: 1 → 0

(Toggle)

All the outputs toggle and the new output state is Q2Q1Q0 100. The J and K values repeat the above pattern in the second half of the counter cycle (states 100 to 111). Go through the exercise of calculating the J, K, and Q values for the rest of the cycle. Compare the result with the timing diagram in Figure 9.10.

Recycle

point

CLK

Q0

0

1

0

Q1

0

1

0

Q2

0

1

0

FIGURE 9.10

Timing Diagram for a Synchronous 3-bit Binary Counter

In the counter we have just analyzed, the combinational circuit generates either a toggle (JK 11) or a no change (JK 00) state at each point through the count sequence. We could use any combination of JK modes (no change, reset, set, or toggle) to make the transitions from one state to the next. For instance, instead of using only the no change and toggle modes, the 000 → 001 transition could also be done by making Q0 set (J0 1,


9.2 • Synchronous Counters

373

K0 0) and Q1 and Q2 reset (J1 0, K1 1 and J2 0, K2 1). To do so we would need a different set of combinational logic in the circuit.

The simplest synchronous counter design uses only the no change (JK 00) or toggle (JK 11) modes, since the J and K inputs of each flip-flop can be connected together. The no change and toggle modes allow us to make any transition (i.e., not just in a linear sequence), even though for truncated sequence and nonbinary counters this is not usually the most efficient design.

There is a simple progression of algebraic expressions for the J and K inputs of a synchronous binary (full sequence) counter, which uses only the no change and toggle states:

J0 K0 1

J1 K1 Q0

J2 K2 Q1 Q0

J3 K3 Q2 Q1 Q0

J4 K4 Q3 Q2 Q1 Q0 etc.

The J and K inputs of each stage are the ANDed outputs of all previous stages. This implies that a flip-flop toggles only when the outputs of all previous stages are HIGH. For example, Q2 doesn’t change unless both Q1 AND Q0 are HIGH (and therefore J2 K2 1) before the clock pulse. In a 3-bit counter, this occurs only at states 011 and 111, after which Q2 will toggle, along with Q1 and Q0, giving transitions to states 100 and 000 respectively. Look at the timing diagram of Figure 9.10 to confirm this.

Determining the Modulus of a Synchronous Counter

We can use a more formal technique to analyze any synchronous counter, as follows.

1.Determine the equations for the synchronous inputs (JK, D, or T) in terms of the Q outputs for all flip-flops. (For counters other than straight binary full sequence types, the equations will not be the same as the algebraic progressions previously listed.)

2.Lay out a table with headings for the Present State of the counter (Q outputs before CLK pulse), each Synchronous Input before CLK pulse, and Next State of the counter (Q outputs after the clock pulse).

3.Choose a starting point for the count sequence, usually 0, and enter the starting point in the Present State column.

4.Substitute the Q values of the initial present state into the synchronous input equations and enter the results under the appropriate columns.

5.Determine the action of each flip-flop on the next CLK pulse (e.g., for a JK flip-flop, the output either will not change (JK 00), or will reset (JK 01), set (JK 10), or toggle (JK 11) ).

6.Look at the Q values for every flip-flop. Change them according to the function determined in Step 5 and enter them in the column for the counter’s next state.

7.Enter the result from Step 6 on the next line of the column for the counter’s present state (i.e., this line’s next state is the next line’s present state).

8.Repeat the above process until the result in the next state column is the same as the initial state.

EXAMPLE 9.3

Find the count sequence of the synchronous counter shown in Figure 9.11 and, from the

count sequence table, draw the timing diagram and state diagram. What is the modulus of

the counter?