Shift Register Functions and Examples
Shift Register Functions and Examples
1
FACULTY OF COMPUTER SCIENCE & INFORMATION SYSTEM
2
Module:
• SR is a register in which binary data can Page 33
• Each FF can
store 1 bit data.
a ) The flip-flop as a storage element • More bits require b ) Basic Data Transfer/Movements in SR.
(Four bits are used for illustration. The bits move in the direction of the arrows.)
more FF.
When a 1 is on D, Q becomes a 1
at the triggering edge of CLK or
remains a 1 if already. SISO SISO PISO
When a 0 is on D, Q becomes a 0
at the triggering edge of CLK or
remains a 0 if already.
SIPO PIPO continue...
5 6
2012/2013-ii @m 1
11/29/12
SISO
Example 1:
Example 2: SISO
4 Q3
Example 3:
Q3
Bit MSB will insert first. Bit MSB will go out first MSB
The last FF will hold MSB
continue...
11 12
2012/2013-ii @m 2
11/29/12
Self-Test:
Generate a table
for the data
shifting out.
(MSB shifted out
first)
13 14
Ex
tr
a
Example 4: Show the states of 4-bit SIPO shift register (SRG 4) for the
data input 0110 and clock waveforms. The register initially all
is 1s. Exercise 9.1: Show the states of 6-bit SIPO shift register (SRG 6) for the
data input 011001 and clock waveforms.
The register initially all is 0s and MSB will enter first.
15 16
15
Exercise 9.1: Show the states of 6-bit SIPO shift register (SRG 6) for the
data input 011001 and clock waveforms.
The register initially all is 0s and MSB will enter first.
Solution :
MSB
1
MSB
Self-Test: 0
MSB
0
Generate a table MSB 1
for the data
shifting out.
MSB 1
0 MSB
17 18
2012/2013-ii @m 3
11/29/12
Exercise 9.2: a) Determine how many bit entered to the SISO (Right SR)
register?
b) Circle on the timing diagram the valid output.
c) Determine the data entered. (Assume MSB shifted in first)
• Input can be A or B
• CLR’ is active LOW; clear all output
to 00000000
• Data entered at A or B will appear
at Q0 after the first clock pulse.
• The data will appear at Q7 after the
8-th clock pulse.
• A valid parallel data only appear at
all output after 8 clock cycles.
19 20
Ex
tr
a
Exercise 9.3: a) Determine how many bit entered to the SIPO
Exercise 9.2b: Based on the data entered in exercise 9.2, register?
a) Redraw the timing diagram with LSB shifted in first. b) Circle on the timing diagram the valid output.
b) Circle on the timing diagram the valid output. c) Determine the data entered. (Assume LSB
c) Determine which output Q or flip flop hold the LSB bit at shifted in first)
CLK5.
Data = 11010
21 22
PISO
• Inputs entered
simultaneously into
respective stages on
parallel lines
• Outputs are one bit at
a time
23 24
2012/2013-ii @m 4
11/29/12
(Q5)
25 26
RESET
SET
§ Can perform PIPO, PISO, SIPO and RESET
SISO
§ SH / LD 0 1
§ SHIFT / LOAD input 0 0
§ When LOW, data from inputs are 0 1
loaded 0 0
§ When HIGH, data will be shifted
to outputs (Q0 - Q3)
§ J and K are serial data inputs
§ First stage serial input into Q0
§ Serial output will be at Q3
continue...
27 28
• In normal counter, to
• 2 most common types:
provide individual digit
outputs instead of a binary
Shift Register Counters or BCD output.
à adding a decoder.
SR Counter
2012/2013-ii @m 5
11/29/12
31 32
Solution: D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
MSB LSB
0 0 0 0 0 0 0 1 0 1
D0 D1 D2 D8 D9
1 0 1 . . . . . . . . 0 0
33 34
Clock Pulse Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q9
Shift Register Counter:
Johnson Counter
0 0 0 0 0 0 0 0 1 0 1
• In the Johnson counter the last complemented output is
1 1 0 0 0 0 0 0 0 1 0
fed back in as an input to the first FF
2 0 1 0 0 0 0 0 0 0 1 • Examples shown with D FF, but can be implemented
3 1 0 1 0 0 0 0 0 0 0 with other types of FF as well.
4 0 1 0 1 0 0 0 0 0 0 • Number of unique states are 2 times the number of bits
(FF)
5 0 0 1 0 1 0 0 0 0 0
– 4 bits è 4*2 = 8 states n-bit = MOD 2n
6 0 0 0 1 0 1 0 0 0 0 (state number)
– 5 bits è 5*2 = 10 states
7 0 0 0 0 1 0 1 0 0 0 • Johnson counter will produce a modulus of 2n;
8 0 0 0 0 0 1 0 1 0 0 (n = number of stages)
9 0 0 0 0 0 0 1 0 1 0 • **modulus 10 a.k.a. mod 10
35
35 36
2012/2013-ii @m 6
11/29/12
Example:
Q3
Clock Pulse Q0 Q1 Q2 Q3
n-bit = MOD 2n 0 0 0 0 0
(state number)
1 1 0 0 0
Example: 2 1 1 0 0
• For a 4-bit ring
counter, there 3 1 1 1 0
are 4 FFs which
make a MOD 8 4 1 1 1 1
counter.
• It will recycle
5 0 1 1 1
after 8 clock
6 0 0 1 1
cycles. Complete
7 0 0 0 1 one cycle
Repete
8 0 0 0 0 cycle
9 . . . .
continue... 38
37 38
Ex
tr
a
Summary:
Ring Counter FF3 FF2 FF1 FF0
D3 D2 D1 D0
Q0
n-bit = MOD n
(state number)
D3 D2 D1 D0 1000
Clock FF3 FF2 FF1 FF0
MSB LSB
1 0 0 0 1 1 0 0 0
2 0 1 0 0 0001 0100
3 0 0 1 0
4 0 0 0 1 0010
39 40
D3
Other characteristic of
D2 D1 D0
Johnson counter:
2012/2013-ii @m 7
11/29/12
Ex
tr
a
Self-Test:
43 44
4. The group of 8 bits 1011 0110 is serially shifted (right most bit first) 6. To parallel load a byte of data into a shift register with a
into an 8-bit parallel output shift register with an initial state of 1110 synchronous load, there must be
0100. After 2 clock pulses, the register contains A) 1 clock pulse
A) 1011 1001 C) 0111 1001 B) 8 clock pulse
B) 1001 0010 D) 0010 1101 C) one load pulse
D) one clock pulse for each 0 in the data
5. To serially shift a byte of data into a shift register, there must be
A) 1 clock pulse
B) 8 clock pulse
C) one load pulse
D) one clock pulse for each 1 in the data
45 46
2012/2013-ii @m 8