1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left,...

48
1 Shift Registers

Transcript of 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left,...

Page 1: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

1

Shift Registers

Page 2: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

• Shift Registers– Definitions– I/O Types: serial, parallel, combinations– Direction: left, right, bidirectional – Applications– VHDL implementations

• MSI Shift Registers• Serial Communications

2

D QInput

Clock

D Q D Q D Q

Q3 Q2 Q1 Q0

Enable

Output

Page 3: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

Shift Registers

Using registers to store, manipulate and transfer data

3

Page 4: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

Definition• Register: Group of FFs. Each is capable of

storing 1-bit of information.• A register is a digital circuit with two basic

functions: Data Storage and Data Movement– A shift register provides the data movement

function– A shift register “shifts” its output once every clock

cycle

• A shift register is a group of flip-flops set up in a linear fashion with their inputs and outputs connected together in such a way that the data is shifted from one device to another when the circuit is active

4

Page 5: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

Shift Register Applications• communications

– UART

• converting between serial data and parallel data

• temporary storage in a processor– scratch-pad memories

• some arithmetic operations– multiply, divide

• some counter applications– Johnson counter– ring counter

• time delay devices• more …

5

Page 6: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

Shift Register Characteristics

6

• Types– Serial-in, Serial-out– Serial-in, Parallel-out– Parallel-in, Serial-out– Parallel-in, Parallel-out– Universal

• Direction– Left shift– Right shift– Rotate (right or left)– Bidirectional

n-bit shift register

Page 7: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

Data Movement• The bits in a shift register can move in any of the

following manners

7

Page 8: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

n-bit shift register

n-bit shift register

Data Movement• Block diagrams for shift registers with various

input/output options:

8

n-bit shift register

n-bit shift register

Page 9: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

n-bit shift register

Serial-In Serial-Out• Data bits come in one at a

time and leave one at a time• One Flip-Flop for each bit to

be handled• Movement can be left or

right, but is usually only a single direction in a given register

• Asynchronous preset and clear inputs are used to set initial values

9

Page 10: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

Serial-In Serial-Out• The logic circuit diagram below shows a

generalized serial-in serial-out shift register– SR Flip-Flops are shown– Connected to behave as D Flip-Flops– Input values moved to outputs of each Flip-Flop

with the clock (shift) pulse

10

N-Bit Shift Register

0N 1

Page 11: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

Shift Registers• The simplest shift register is one that uses only Flip-Flops• The output of a given Flip-Flop is connected to the D input of the

Flip-Flop at its right. • Each clock pulse shifts the contents of the register one bit

position to the right. • The Serial input (SI) determines what goes into the leftmost Flip-

Flop during the shift. The Serial output (SO) is taken from the output of the rightmost Flip-Flop.

11

Q Q QQ

Page 12: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

Serial-In Serial-Out• A simple way of looking

at the serial shifting operation, with a focus on the data bits, is illustrated at right

• The 4-bit data word “1011” is to be shifted into a 4-bit shift register

• One shift per clock pulse• Data is shown entering at

left and shifting right

12

1

2

3

4

5

Page 13: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

Serial-In Serial-Out• Serial -in• The diagram shows the 4-bit sequence

“1010” being loaded into the 4-bit serial-in serial-out shift register

• Each bit moves one position to the right each time the clock’s leading edge occurs

• Four clock pulses loads the register

13

Page 14: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

14

Page 15: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

Serial-In Serial-Out• Serial -out• This diagram shows the 4-bit sequence “1010”

as it is unloaded from the 4-bit serial-in serial-out shift register

• Each bit moves one position to the right each time the clock’s leading edge occurs

• Four clock pulses unloads the register

15

Page 16: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

16

Page 17: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

17

Serial-In Serial-Out• Serial-in, serial-out

shift registers are often used for data communications– such as RS-232– modem transmission

and reception– Ethernet links– SONET– etc.

Page 18: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

Serial-to-Parallel Conversion• We often need to convert

from serial to parallel– e.g., after receiving a series

transmission

• It consists of serial i/p and outputs are taken from all the FF’s parallel

• Once the data is stored each bit appears on its respective output line.(rather than bit-by-bit as in SISO.

• Note that we could also use the Q of the right-most Flip-Flop as a serial-out output

18

n-bit shift register

Page 19: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

SIPO

19

Page 20: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

Clock pulse Input QA QB QC QD

X XXX

First pulseSecond pulseThird pulseFourth pulse

1

11 1 X X0

1 1 X01 11 0

0 1 X X X

The Serial information (information coming in bit by bit) is now available on the Q outputs in parallel.

Page 21: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

21

Serial-to-Parallel Conversion• We would use a

serial-in parallel-out shift register of arbitrary length N to convert an N-bit word from serial to parallel

• It would require N clock pulse to LOAD and one clock pulse to UNLOAD

Page 22: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

Serial-to-Parallel Conversion• These two shift

registers are used to convert serial data to parallel data

• The upper shift register would “grab” the data once it was shifted into the lower register

22

Page 23: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

MSI Shift Registers• 74LS164 8-Bit Serial-In Parallel-Out Shift

Register

23

Page 24: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

IC 74164- 8 bit SIPO

24

Page 25: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

Parallel-to-Serial Conversion• We use a Parallel-in Serial-out

Shift Register • The DATA is applied in parallel

form to the parallel input pins PA to PD of the register

• It is then read out sequentially from the register one bit at a time from PA to PD on each clock cycle in a serial format

• One clock pulse to load• Four pulses to unload

25

n-bit shift register

Page 26: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

26

Parallel-to-Serial Conversion

• Logic circuit for a parallel-in, serial-out shift register• PISO• Shift/load –control line• When Shift/load-LOW - AND (0) gates are enabled,

allows parallel inputs.• When Shift/load-HIGH -AND (0) gates are disabled,

AND(1) gates are enabled, allows serial inputs.

• OR gates allow either normal shifting operation or parallel data-entry operation.

Page 27: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

27Mux-like

0

0

0

0

1

1

1

1

Page 28: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

28

8-bit serial/parallel-in-serial-outIC 74165

Page 29: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

8-bit serial/parallel-in-serial-outIC 74165

29

Page 30: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

Parallel-In Parallel-Out• Parallel-in Parallel-out Shift

Registers can serve as a temporary storage device or as a time delay device

• The DATA is presented in a parallel format to the parallel input pins PA to PD and then shifted to the corresponding output pins QA to QD when the registers are clocked

• One clock pulse to load• One pulse to unload

30

Page 31: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

PIPO

31

Page 32: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

PIPO• 4-bit parallel shift register-IC74195

32

Page 33: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

n-bit shift register

Universal Shift Register• Universal shift register• Can do any combination of

parallel and serial input/output operations

• Requires additional inputs to specify desired function

• Uses a Mux-like input gating

33

L/SL/S

A

B

A

BF

1

01

0

Page 34: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

34

Universal Shift Register• Parallel-in, parallel-out shift register

Mux-like

0

0

1

0

1

1

Page 35: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

Universal Shift Register • Parallel shift register (can serve as

converting parallel-in to serial-out shifter):

35

Page 36: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

4-Bit Universal Shift register

36

Page 37: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

MSI Shift Registers• 74LS194 4-Bit

Bidirectional Universal Shift Register

• may be used in – serial-serial, – shift left, – shift right, – serial-parallel, – parallel-serial, – and parallel-parallel

• data register transfers

37

Page 38: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

MSI Shift Registers• 74LS194 4-Bit Bidirectional Universal Shift

Register

38

Page 39: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

MSI Shift Registers• 74LS194 control inputs S1 and S0

39

Page 40: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

MSI Shift Registers• 74LS299 universal shift/storage register

40

Page 41: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

MSI Shift Registers• 74LS299 universal shift/storage register

41

S0S1

D Q

CPCD

Page 42: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

APPLICATION

42

Page 43: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

Serial Data Transmission• Parallel-to-serial conversion for serial

transmission

43

serial transmission media

in: parallel data

out: parallel data

Destination moduleSource module

Page 44: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

Shift-Register Counters-RING COUNTER

• If the output of a shift register is fed back to the input, a ring counter results.

• The data pattern contained within the shift register will recirculate as long as clock pulses are applied.

Page 45: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

Shift-Register CountersRING COUNTER

45

Page 46: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

Johnson Counter• The switch-tail ring counter, also know as the Johnson

counter• overcomes some of the limitations of the ring counter.

Like a ring counter a Johnson counter is a shift register fed back on its' self.

• It requires half the stages of a comparable ring counter for a given division ratio. If the complement output of a ring counter is fed back to the input instead of the true output, a Johnson counter results.

• The difference between a ring counter and a Johnson counter is which output of the last stage is fed back (Q or Q').

• Ring counter- Q is fedback, whereas Johnson counter Q’ is fedback

46

Page 47: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

SHIFT COUNTERJohnson Counter

Page 48: 1 Shift Registers. –Definitions –I/O Types: serial, parallel, combinations –Direction: left, right, bidirectional –Applications –VHDL implementations.

Johnson Counter

48