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

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

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

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

Добавлен: 13.06.2025

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

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

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

9.7 •

Shift Registers

415

0

0

0

0

0

Q3

Q2

Q1

Q0

Data in

D

Q

D

Q

D

Q

D

Q

Data out

Q

Q

Q

Q

Clock

1

0

0

0

Data in

D

Q

Q3

D

Q

Q2

D

Q

Q1

D

Q

Q0

Data out

Q

Q

Q

Q

Clock

0

1

0

0

Data in

D

Q

Q3

D

Q

Q2

D

Q

Q1

D

Q

Q0

Data out

Q

Q

Q

Q

Clock

0

0

1

0

Data in

D

Q

Q3

D

Q

Q2

D

Q

Q1

D

Q

Q0

Data out

Q

Q

Q

Q

Clock

0

0

0

1

Data in

D

Q

Q3

D

Q

Q2

D

Q

Q1

D

Q

Q0

Data out

Q

Q

Q

Q

Clock

Case 2: Figure 9.60 shows a shift register, initially cleared, being filled with 1s.

As before, the initial 1 is clocked into the shift register and reaches the Data Out line on the fourth clock pulse. This time, the register fills up with 1s, not 0s, because the Data input remains HIGH.

Figure 9.61 shows a MAX PLUS II simulation of the 4-bit serial shift register in Figure 9.58 through 9.60. The first half of the simulation shows the circuit operation for Case


416

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

FIGURE 9.60

0

0

0

0

Filling a Shift Register with

0

Q3

Q2

Q1

Q0

“1”s (Shift Right)

D

Q

D

Q

D

Q

D

Q

Data in

Data out

Q

Q

Q

Q

Clock

1

0

0

0

1

D

Q

Q3

D

Q

Q2

D

Q

Q1

D

Q

Q0

Data in

Data out

Q

Q

Q

Q

Clock

1

1

0

0

1

D

Q

Q3

D

Q

Q2

D

Q

Q1

D

Q

Q0

Data in

Data out

Q

Q

Q

Q

Clock

1

1

1

0

1

D

Q

Q3

D

Q

Q2

D

Q

Q1

D

Q

Q0

Data in

Data out

Q

Q

Q

Q

Clock

1

1

1

1

1

D

Q

Q3

D

Q

Q2

D

Q

Q1

D

Q

Q0

Data in

Data out

Q

Q

Q

Q

Clock

FIGURE 9.61

Simulation of a 4-bit Shift

Register (Shift Right)


9.7 • Shift Registers

417

1, above. The 1 enters the register at Q3 on the first clock pulse after serial_in (Data In) goes HIGH. The 1 moves one position for each clock pulse, which is seen in the simulation as a pulse moving through the Q outputs.

Case 2 is shown in the second half of the simulation. Again, a 1 enters the register at Q3. The 1 continues to be applied to serial_in, so all Q outputs stay HIGH after receiving the 1 from the previous flip-flop.

N O T E

Conventions differ about whether the rightmost or leftmost bit in a shift register should be considered the most significant bit. The Altera Library of Parameterized Modules uses the convention of the leftmost bit being the MSB, so this is the convention we will follow. The convention has no physical meaning; the concept of right or left shift only makes sense on a logic diagram. The actual flip-flops may be laid out in any configuration at all in the physical circuit and still implement the right or left shift functions as defined on the logic diagram. (That is to say, wires, circuit board traces, and internal programmable logic connections can run wherever you want; left and right are defined on the logic diagram.)

EXAMPLE 9.11

srg4_sl.gdf srg4_sl.scf

Use the MAX PLUS II Graphic Editor to create the logic diagram of a 4-bit serial shift register that shifts left, rather than right.

flops are laid out the of each flip-flop is connected to the Q output of the flip-flop to its right, resulting in a looped-back connection.

A bit at D0 is clocked into the rightmost flip-flop. Data in the other flip-flops are moved one place to the left. The bit in Q2 overwrites Q3. The previous value of Q3 is lost.

INPUT

DFF

DFF

DFF

DFF

D3

PRN

Q3

D2

PRN

Q2

D1

PRN

Q1

D0

PRN

Q0

D

Q

D

Q

D

Q

D

Q

CLRN

CLRN

CLRN

CLRN

INPUT

OUTPUT

Q0

OUTPUT

Q1

OUTPUT

Q2

OUTPUT

Q3

9.62

Shift Register Configured to Shift Left

9.12Draw a diagram showing the movement of a single 1 through the register in Figure 9.62. Also draw a diagram showing how the register can be filled up with 1s.

Solution Figures 9.63 and 9.64 show the required data movements.


Data in

0

0

0

0

0

Q3

Q2

Q1

Q0

Data in

0

D

Q

D

D

D

Q

Q

Q

Q

Q

Q

Q

0

1

0

0

Clock

D

Q

Q3

Q2

D

Q1

D

Q0

D

Q

Q

Q

Data out

Q

Q

Q

Q

Data in

1

Clock

0

0

0

1

Data out

0

Q3

Q2

Q1

Q0

Data in

D

Q

D

D

D

Q

Q

Q

Q

Q

Q

Q

1

0

0

0

Clock

D

Q

Q3

Q2

D

Q1

D

Q0

D

Q

Q

Q

Data out

Q

Q

Q

Q

Data in

0

Clock

0

0

1

0

Data out

0

Q3

Q2

Q1

Q0

Data in

D

Q

D

D

D

Q

Q

Q

Q

Q

Q

Q

0

0

0

0

Clock

D

Q

Q3

Q2

D

Q1

D

Q0

D

Q

Q

Q

Data out

Q

Q

Q

Q

Clock

Data out

FIGURE 9.63

Shifting a “1” Through a Shift Register (Shift Left)

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


Data in

0

0

0

0

0

Q3

Q2

Q1

Q0

Data in

1

D

D

D

D

Q

Q

Q

Q

Q

Q

Q

Q

0

1

1

1

Clock

D

Q3

D

Q2

D

Q1

D

Q0

Q

Q

Q

Q

Data out

1

Q

Q

Q

Q

Data in

Clock

0

0

0

1

Data out

1

Q3

Q2

Q1

Q0

Data in

D

D

D

D

Q

Q

Q

Q

Q

Q

Q

Q

1

1

1

1

Clock

D

Q3

D

Q2

D

Q1

D

Q0

Q

Q

Q

Q

Data out

1

Q

Q

Q

Q

Data in

Clock

0

0

1

1

Data out

D

Q3

D

Q2

D

Q1

D

Q0

Q

Q

Q

Q

Q

Q

Q

Q

Clock

Data out

FIGURE 9.64

Filling a Shift Register with “1”s (Shift Left)

419 Registers Shift • 7.9