Exp 12
Exp 12
Silchar
Department of
Electronics and Instrumentation Engineering
Experiment No. – 12
Digital Electronics Lab (EI-216)
1
SHIFT REGISTER
Aim of the Experiment – To implement all four 3-bit shift
registers mentioned below using J-K flip-flop
(1) SISO (2) SIPO (3) PISO (4) PIPO
2
Basic Concept of D flip flop –
Symbol
Truth Table
Clock D Q
1 0 0
1 1 1
Hence, D flip-flop stores one bit of data and can be called as a single-
bit register.
3
Types of shift registers – Shift registers can be classified on
the basis in which data is entered into the register for storage and the
way in which data is outputted from the register.
Circuit Diagram
4
Working Suppose the register is initially clear (means Q3 = Q2 =
Q1 = Q0 = 0), then the steps to store the four bits (1010) are
Let us place bit by bit from left to right starting with left most bit.
So first of all, 1 is placed on the data input line making D0 = 1 for
FF0. The first positive edge of the clock sets first flip-flop (means
FF0 stores the data input, Q0 = 1).
Next, the second bit which is a 0 is placed on the data input line
making D0 = 0 for FF0 and D1 = 1 for FF1 as D1 input of FF1 is
connected to Q0 output. The second positive edge of the clock sets
second flip-flop (means FF1 stores the output of FF0, Q1 = 1) and
resets first flip-flop (means FF0 stores the data input, Q0 = 0). So
the data stored in FF0 is shifted to FF1 and FF0 stores the input
data.
Again, the third bit which is a 1 is placed on the data input line
making D0 = 1 for FF0, D1 = 0 for FF1 as D1 input of FF1 is
connected to Q0 output and D2 = 1 for FF2 as D2 input of FF2 is
connected to Q1 output. The third positive edge of the clock sets
third flip-flop (means FF2 stores the output of FF1, Q2 = 1), resets
second flip-flop (means FF1 stores the output of FF0, Q1 = 0) and
sets first flip-flop (means FF0 stores the data input, Q0 = 1). So the
data stored in FF1 is shifted to FF2, data stored in FF0 is shifted to
FF1 and FF0 stores the input data.
The last bit which is a 0, is placed on the data input line making D0
= 0 for FF0, D1 = 1 for FF1 as D1 input of FF1 is connected to Q0
output, D2 = 0 for FF2 as D2 input of FF2 is connected to Q1 output
and D3 = 1 for FF3 as D3 input of FF3 is connected to Q2 output.
The fourth positive edge of the clock sets fourth flip-flop (means
FF3 stores the output of FF2, Q3 = 1), resets third flip-flop (means
FF2 stores the output of FF1, Q2 = 0), sets second flip-flop (means
FF1 stores the output of FF0, Q1 = 1) and resets first flip-flop
(means FF0 stores the data input, Q0 = 0). So the data stored in FF2
is shifted to FF3, data stored in FF1 is shifted to FF2, data stored in
5
FF0 is shifted to FF1 and FF0 stores the input data. That is how,
four bits are serially entered into the shift register and stored.
To get remaining data output, bits are further shifted serially out and
become available at Q3. After fourth positive edge of the clock, we
have left most bit at Q3 (means Q3 = 1). Similarly after fifth, sixth and
seventh positive edge of the clock, we have Q3 = 0, Q3 = 1 and Q3 = 0
respectively. After eighth positive edge of the clock, the register is
clear again.
Timing Diagram
6
Construction Let us consider a 4-bit SIPO shift register designed
using four positive edge triggered D flip-flops
Serial data input is placed on D0 input of 1st flip-flop (FF0),
Q0 output of 1st flip-flop goes into D1 input of 2nd flip-flop (FF1),
Q1 output of 2nd flip-flop goes into D2 input of 3rd flip-flop (FF2),
Q2 output of 3rd flip-flop goes into D3 input of 4th flip-flop (FF3),
And finally, output of each flip-flop is taken out. A 4-bit SIPO shift
register has one serial input line (D0) and four parallel output lines
(Q3, Q2, Q1 and Q0).
Circuit Diagram
Let us place bitwise starting with left most bit. So first of all, 1 is
placed on the data input line making D0 = 1 for FF0. The first
positive edge of the clock sets first flip-flop (means FF0 stores the
data input i.e., Q0 = 1).
Next, the second bit which is a 1 is placed on the data input line
making D0 = 1 for FF0 and D1 = 1 for FF1 as D1 input of FF1 is
connected to Q0 output. The second positive edge of the clock sets
second flip-flop (means FF1 stores the output of FF0, Q1 = 1) and
leaves first flip-flop unchanged (means FF0 stores the data input,
7
Q0 = 1). So, the data stored in FF0 is shifted to FF1 and FF0 stores
the input data.
Again, the third bit which is a 1 is placed on the data input line
making D0 = 1 for FF0, D1 = 1 for FF1 as D1 input of FF1 is
connected to Q0 output and D2 = 1 for FF2 as D2 input of FF2 is
connected to Q1 output. The third positive edge of the clock sets
third flip-flop (means FF2 stores the output of FF1, Q2 = 1) and
leaves first as well as second flip-flop unchanged (means FF1
stores the output of FF0 and FF0 stores the data input, Q0 = Q1 = 1).
So, the data stored in FF1 is shifted to FF2, data stored in FF0 is
shifted to FF1 and FF0 stores the input data.
The last bit which is a 0 is placed on the data input line making D0
= 0 for FF0, D1 = 1 for FF1 as D1 input of FF1 is connected to Q0
output, D2 = 1 for FF2 as D2 input of FF2 is connected to Q1 output
and D3 = 1 for FF3 as D3 input of FF3 is connected to Q2 output.
The fourth positive edge of the clock sets fourth flip-flop (means
FF3 stores the output of FF2, Q3 = 1), leaves second as well as third
flip-flop unchanged (means FF2 stores the output of FF1 and FF1
stores the output of FF0, Q1 = Q2 = 1) and resets first flip-flop
(means FF0 stores the data input, Q0 = 0). So the data stored in FF2
is shifted to FF3, data stored in FF1 is shifted to FF2, data stored in
FF0 is shifted to FF1 and FF0 stores the input data. That is how
four bits are serially entered into the shift register and stored. So
after fourth positive edge of the clock, data output is available at
Q3, Q2, Q1 and Q0.
8
Timing Diagram
9
When Shift/Load = 1, shifting operation takes place and the Q0
output of first flip-flop goes to D1 input of second flip-flop (FF1),
Q1 output of second flip-flop goes to D2 input of third flip-flop
(FF2) and Q2 output of third flip-flop goes to D3 input of fourth
flip-flop (FF3).
Circuit Diagram
Let us place each bit in parallel into the register. The left most bit
which is a 0 is placed on Data3 input line. The second bit which is
a 1 is placed on Data2 input line. The third bit which is a 0 is
placed on Data1 input line and the right most bit which is a 1 is
placed on Data0 input line.
As Shift/Load signal goes low, bits placed on Data3, Data2, Data1
and Data0 input line can reach D3, D2, D1 and D0 input of the
corresponding flip-flop making D3 = 0, D2 = 1, D1 = 0 and D0 = 1.
That is how, the four bits are entered in parallel into the register.
The first positive edge of the clock resets fourth flip-flop (means
FF3 stores D3 input, Q3 = 0), sets third flip-flop (means FF2 stores
D2 input, Q2 = 1), resets the second flip-flop (means FF1 stores D1
input, Q1 = 0) and sets first flip-flop (means FF0 stores D0 input,
Q0 = 1). That is how, four bits of data are stored in the register and
10
left most bit is available at Q3. To get remaining data output, bits
are further shifted serially out and become available at Q3.
The moment Shift/Load signal goes high, data outputs Q0, Q1, Q2
and Q3 remain same and data inputs D0, D1, D2 and D3 changes
according to the previous stage output as Q0 output of first flip-flop
can reach D1 input of second flip-flop (means D1 = Q0), Q1 output
of second flip-flop can reach D2 input of third flip-flop (means D2
= Q1) and Q2 output of third flip-flop can reach D3 input of fourth
flip-flop (means D3 = Q2).
The second positive edge of the clock sets fourth flip-flop (means
FF3 stores the output of FF2, Q3 = 1), resets third flip-flop (means
FF2 stores the output of FF1, Q2 = 0), sets second flip-flop (means
FF1 stores the output of FF0, Q1 = 1) and resets first flip-flop (as
no data input, so Q0 = 0). So, the data stored in FF2 is shifted to
FF3, data stored in FF1 is shifted to FF2 and data stored in FF0 is
shifted to FF1. That is how, second bit is available at Q3.
The third positive edge of the clock resets fourth flip-flop (means
FF3 stores the output of FF2, Q3 = 0), sets third flip-flop (means
FF2 stores the output of FF1, Q2 = 1), resets second flip-flop (as no
data input, so Q1 = 0) and leaves the first flip-flop unchanged (as
no data input, so Q0 = 0). So, the data stored in FF2 is shifted to
FF3 and data stored in FF1 is shifted to FF2. That is how, third bit
is available at Q3.
The fourth positive edge of the clock sets fourth flip-flop (means
FF3 stores the output of FF2, Q3 = 1), resets third flip-flop (as no
data input, so Q2 = 0) and leaves first as well as second flip-flop
unchanged (as no data input, so Q0 = Q1 = 0). So, the data stored in
FF2 is shifted to FF3 and the right most bit is available at Q3.
The fifth positive edge of the clock resets fourth flip-flop (as no
data input, so Q3 = 0) and leaves first, second as well as third flip-
flop unchanged (as no data input, so Q0 = Q1 = Q2 = 0). Thus, the
register is clear again.
11
Timing Diagram
12
When Shift/Load = 1, shifting operation takes place and Q0 output
of first flip-flop goes to D1 input of second flip-flop (FF1), Q1
output of second flip-flop goes to D2 input of third flip-flop (FF2)
and Q2 output of third flip-flop goes to D3 input of fourth flip-flop
(FF3).
Circuit Diagram
Let us place each bit in parallel into the register. The left most bit
which is a 1 is placed on Data3 input line. The second bit which is
a 1 is placed on the Data2 input line. The third bit which is a 0 is
placed on the Data1 input line and the right most bit which is a 1 is
placed on Data0 input line.
As Shift/Load signal goes low, bits placed on Data3, Data2, Data1
and Data0 input lines can reach D3, D2, D1 and D0 input lines of
corresponding flip-flop making D3 = 1, D2 = 1, D1 = 0 and D0 = 1.
That is how, four bits are entered in parallel into the register.
The first positive edge of the clock sets fourth flip-flop (means FF3
stores D3 input, Q3 = 1), sets third flip-flop (means FF2 stores D2
input, Q2 = 1), resets second flip-flop (means FF1 stores D1 input,
13
Q1 = 0) and sets first flip-flop (means FF0 stores D0 input, Q0 = 1).
That is how, the four bits of data are stored in the register and are
available at Q3, Q2, Q1 and Q0.
The moment Shift/Load signal goes high, data output Q0, Q1, Q2
and Q3 remain same and data input lines D0, D1, D2 and D3 change
according to the previous stage output as Q0 output of first flip-flop
can reach D1 input of second flip-flop (means D1 = Q0), Q1 output
of second flip-flop can reach D2 input of third flip-flop (means D2
= Q1) and Q2 output of third flip-flop can reach D3 input of fourth
flip-flop (means D3 = Q2).
The second positive edge of the clock leaves the fourth flip-flop
unchanged (means FF3 stores the output of FF2, Q3 = 1), resets
third flip-flop (means FF2 stores the output of FF1, Q2 = 0), sets
second flip-flop (means FF1 stores the output of FF0, Q1 = 1) and
resets first flip-flop (as no data input, so Q0 = 0). So the data stored
in FF2 is shifted to FF3, data stored in FF1 is shifted to FF2 and
data stored in FF0 is shifted to FF1.
The third positive edge of the clock resets fourth flip-flop (means
FF3 stores the output of FF2, Q3 = 0), sets third flip-flop (means
FF2 stores the output of FF1, Q2 = 1), resets second flip-flop (as no
data input, so Q1 = 0) and leaves the first flip-flop unchanged (as no
data input, so Q0 = 0). So, the data stored in FF2 is shifted to FF3
and data stored in FF1 is shifted to FF2.
The fourth positive edge of the clock sets fourth flip-flop (means
FF3 stores the output of FF2, Q3 = 1), resets third flip-flop (as no
data input, so Q2 = 0) and leaves first as well as second flip-flop
unchanged (as no data input, so Q0 = Q1 = 0). So, the data stored in
FF2 is shifted to FF3.
The fifth positive edge of the clock resets fourth flip-flop (as no
data input, so Q3 = 0) and leaves first, second as well as third flip-
flop unchanged (as no data input, so Q0 = Q1 = Q2 = 0). Thus, the
register is clear again.
14
Timing Diagram
15
Conversion of J-K flip-flop into D flip flop –
16
𝐉=𝐃
𝐊=𝐃
Experimental Setup –
SISO shift register
17
SIPO shift register
18
PIPO shift register
Signature
19