Professional Documents
Culture Documents
Data in
Data out
Data in
Data out
Rotate right
Data out
FF0
D
CLK
FF1
Q0
D
CLK
FF2
Q1
D
CLK
FF3
Q2
Q3
Serial
data
CLK
CLK
2
Suppose we want to store the 4 bit data 1010 into the register,
beginning with the right-most bit. Assume the register is initially
clear (Q0 = Q1 = Q2 = Q3 = 0).
The 0 is put onto the data input line, making D = 0 for FF0. When
the first clock pulse is applied, FF0 is reset, thus storing the 0. The
second bit, which is a 1, is applied next to the data input. When the
second clock pulse occurs, the 1 on the data input is shifted into
FF0, causing FF0 to set, and the 0 that was in FF0 is now shifted
into FF1.
The third bit, a 0, is now put onto the data-input line, and the clock
pulse is applied. The 0 is entered into FF0, the 1 stored in FF0 is
shifted into FF1, and the 0 stored in FF1 is shifted into FF2. Do
you see why it is called a shift register now?
The last bit, a 1, is now applied to the data input, and a clock pulse
is applied. This time the 1 is entered into FF0, the 0 stored in FF0
is shifted to FF1, the 1 stored in FF1 is shifted into FF2, and the 0
stored in FF2 is shifted into FF3. This completes the serial entry of
the 4 bits into the shift register, where they can be stored as long as
the flip-flops have dc power.
Note that data is stored in the register on each CLK edge (rising in
this case). In summary, the storage and shifting process can be
summarized as:
input at D0 output at Q0 output at Q1 output at Q2 output at Q3
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
1
0
0
1
1
0
1
0
To get the data out of the register, the bits must be shifted out
serially and taken off the Q3 output. If we apply a CLK pulse, the
right-most bit, 0, appears on the Q3 output. In the second CLK
pulse, the second bit appears at Q3 output. The third CLK pulse
shifts the third bit to the output, and the fourth CLK pulse shifts the
fourth bit to the output.
output at Q0 output at Q1 output at Q2 output at Q3
1
0
1
0
0
1
0
1
0
0
1
0
0
0
0
1
0
0
0
0
Output
0
1
0
1
The logic block diagram of a 4-bit serial in / serial out shift register
is shown below.
Data in
SRG 4
Q3
CLK
Q3
Q0
Data
input
D
CLK
D
CLK
Q2
D
CLK
Q3
D
CLK
CLK
The operation of the serial in / parallel out shift register is the same
as that of the serial in / serial out register except that the data out is
Q0, Q1, Q2, Q3. Whereas the data out for the serial in / serial out
register is Q3 only.
The logic block diagram of a 4-bit serial in / parallel out shift
register is shown below.
Data in
SRG 4
CLK
Q1 Q2 Q3 Q4
7.1.2 Data Transfers between Register
It is common to transfer data from one register to another in a
digital system. The data is usually sent through common data lines
called the data bus. A bus is a group of wires that perform a
common function.
To prevent damage to outputs of inactive registers, the outputs of
the registers are connected to tri-state buffers. The diagram below
shows a 4-bit parallel in / parallel out register with tri-state outputs:
The slash with a number beside it indicates the number of bits that
the wire carries. Several registers can be connected to a data bus as
shown:
Data bus has
inputs / outputs
In the diagram above, T0 is the LSB and T3 is the MSB. When the
input Initialize is set to 1, the first flip-flop is preset (T0 = 1) and
the rest of the flip-flops are cleared (T1 = T2 = T3 = 0) on the first
CLK pulse. Because T3 is fed back to the input of the first flip-flop,
on the second CLK pulse, T0 = 0 because T3 = 0. And T1 = 1, T2 =
0. On the third CLK pulse, T2 = 1 (T0 = T1 = T3 = 0). On the fourth
CLK pulse, T3 = 1 (T0 = T1 = T2 = 0). After that, the process
repeats.
T3 T2 T1 T0
4-bit ring counter sequence
0
0
0
1
0
0
1
0
0
1
0
0
1
0
0
0
0
0
0
1 and repeats.
8
B
0
0
1
1
1
1
0
0
C
0
0
0
1
1
1
1
0
E
0
0
0
0
1
1
1
1
and repeats
Q0
Q1
1
Q
Q
CLR
CLR
J
CLR
CLK
CLR
Q1
Q2 (MSB)
7
10
11
on rising CLK
J2 = K2 = Q0Q1 Q2 toggles if Q0Q1 = 1
and on rising CLK
Q1 pulse lasts
for 2 CLK
pulses
Q2 pulse
lasts for 4
CLK pulses
0
12
Counters that can count from state 0 through state (N - 1) and then
cycle back to state 0 are called modulo-N counters. However, for
binary counters with n flip-flops, there can be a maximum number
of 2n states. Hence, if we want an N that is less than 2n, we need to
reset the counter once the Nth state is reached.
For example, if N = 10, we have a decade (modulo-10) counter. To
build this counter, we need four flip-flops since 24 = 16 (three flipflops are not enough since it counts only to 23 = 8 states). Hence, a
decade counter is a counter whereby it will be reset to state 0 (0000)
after state 9 (1001) is reached.
13
14
Flip-flop
inputs
Next state
where the inputs for T flip-flop are given by the truth table below:
Q
0
0
1
1
Q+
0
1
0
1
T
0
1
1
0
16
We can also start with the state table. Since Q+ = D (output follows
input), we have
17
where the inputs for D flip-flop are given by the truth table below:
Q
0
0
1
1
Q+
0
1
0
1
D
0
1
0
1
DC
= CBA+CB+CA
= CBA+C(BA)
= C BA
DB
DB
= BA+BA
=BA
Example 7.1
Design a counter using T flip-flops that counts in the following
way:
18
In the truth table above, there are no T flip-flop inputs. So, how
do we construct the K-maps for the T flip-flops? For details,
refer to Roth p338. Here, I will give you an outline. First, we
construct the truth table for C+, B+ and A+ using A, B, C as
inputs. Then, we can convert these truth tables into TC, TB and
TA truth tables as follows:
For the C+ Karnaugh map, a 1 is placed on the cell where there
is a toggle, i.e., if C = 0 and C+ = 1 or if C = 1 and C+ = 0. If
C = C+, there is no toggle and the cell has a value of 0.
Similarly, for the B+ Karnaugh map, look for a toggle in the B
variable and for A+ Karnaugh map, toggle in A. For example,
the K-map of C+ is
C
BA
00
01
11
10
X
C+
19
+ +
20
21
The counter may never enter the designed sequence at all or the
sequence transition eventually leads into the main counting
sequence. This will depends on how dont cares have been mapped
into 0s and 1s by the implementation procedure.
A self-starting counters is one where every possible state including
those not in the desired count sequence, has a sequence of
transitions that eventually leads to a valid counter state. So, no
22
matter how the counter starts up, it will eventually enter the desired
counter sequence.
To check whether a counter is self-starting:
Replace the dont cares in the K-maps with the actually assigned
1s and 0s. Remap the K-maps to obtain the effects on each flipflops state.
TC
C0
BA
00 1
01 1
11 0
10 0
Present State
TB
C0
BA
00 0
1
1
01 1
TA
C0
BA
00 0
01 0
11 1
11 1
10 0
10 1
1
0
C + B+
A+
0
0
0
0
1
1
1
1
1
1
0
0
1
1
0
0
0
1
1
0
1
0
1
0
0
1
0
1
0
1
0
1
Next State
C B A
0
0
1
1
0
0
1
1
1
1
0
1
1
0
1
1
1
1
110
001
101
23