Académique Documents
Professionnel Documents
Culture Documents
N. B. Dodge 9/15
N. B. Dodge 9/15
Input Data
Bus (8 Lines)
CLK
D7 Q7
D6 Q6
D5 Q5
D4 Q4
D3 Q3
D2 Q2
D1 Q1
D0 Q0
8-bit Storage
Register
D7
Q7
D6
Q6
Etc.
Etc.
CLK
Output Data
Bus (8 Lines)
N. B. Dodge 9/15
N. B. Dodge 9/15
CLK
D7 Q7
D6 Q6
D5 Q5
D4 Q4
D3 Q3
D2 Q2
D1 Q1
D0 Q0
N. B. Dodge 9/15
5/32 Decoder
5-Bit
Address Bus
0
1
2
.
.
.
.
.
30
31
32-Bit
* Note: the register inputs are the data (32 bits ) Data Bus
and the clock (C) line. This clock input is called,
variously, clock, enable, or strobe. It
corresponds to the clock input on a D FF.
6
C Reg. 0
D
C
D Reg. 1
C Reg. 2
D
C
D
C
D
C
D
C
D
R. 30
R. 31
CPU Register
Block
N. B. Dodge 9/15
busses.
D
C
In the MIPS computer that we
D R. 30
will study, there are two ALU
C R. 31
input buses, since the ALU often
D
uses two operands.
CPU Register Block
Lecture #8: Registers, Counters, and Other Latch-Based Circuits
32-Bit
Data Bus
32:1 MUX
32-Bit
Data Bus
32:1 MUX
N. B. Dodge 9/15
Exercise 1
Data In
a
b
c
d
Reset
Address
w (MSB)
x
D Q
Data a
C R
D Q
Data b
C R
D Q
Data c
C R
D Q
Data d
C R
y
z
Clock
N. B. Dodge 9/15
Shift Registers
Shift registers are particularly important in modern computers
and computing systems.
Not only do they perform the shifting or rearrangement of
numbers in some cases (although modern computers usually
employ shifters much faster than the old-fashioned shift register),
but they are also very valuable in communication systems.
They can be employed to convert serial data streams to parallel
and vice-versa (as in internet communications).
Although technically there are a number of variations of shift
registers (see Tokheim, page 260), we are really only concerned
with two practical registers: the serial-to-parallel shift register,
and the parallel-to-serial shift register.
10
N. B. Dodge 9/15
MSB
Parallel
Data
Out
Clock
LSB
In the shift register shown, data is shifted into the first masterslave D FF on the left when the clock goes high.
After the first clock pulse goes low, the output of the first ff is
available as an input to the second.
On the second clock pulse, MSB is shifted into the second ff, and a
new bit goes into the left ff.
On the third clock pulse, the bits shift again, and are now available
at the parallel output.
11
N. B. Dodge 9/15
MSB
Parallel
Data
Out
Clock
LSB
FF #3
MSB
FF #2
FF #1
LSB
Serial Data
1
Clock
12
0
N. B. Dodge 9/15
13
N. B. Dodge 9/15
DL
DS Q
Ld
C
R
DL
DS Q
Ld
C
R
Serial
Data Out
Reset
Load Parallel Data
Serial Data Clock
N. B. Dodge 9/15
1
0
1
DL
Load+
D
DL
DS Q
Ld
1
C
R
DL
DS Q
Ld
0
C
R
DL
DS Q
Serial
Ld
1 Data Out
C
R
Reset
Load Parallel Data
Serial Data Clock
Serial
Data Out
Serial Data Clock
CR Q
Reset-
Serial
Clock Out
Load Parallel
Data
Clear
15
N. B. Dodge 9/15
Exercise 2
CR Q
CR Q
Out
CR Q
CR Q
CR Q
Clock
Set/Reset
Out
1
Clock
16
7
N. B. Dodge 9/15
N. B. Dodge 9/15
T FF Frequency Divider
1
Clock
f/4
Pulse Out
Reset
Clock frequency = f
T FF #3
T FF #2
T FF #1
1
Clock
18
0
Lecture #8: Registers, Counters, and Other Latch-Based Circuits
N. B. Dodge 9/15
f/2
f/4
Clock (at
frequency f)
Reset
19
f/8
Count
MSB
LSB
N. B. Dodge 9/15
T FF Counter
1
f/4
f/2
Count
MSB
f/8
Clock (at
frequency f)
LSB
Reset
T FF #3
000
001
010
011
100
101
110
111
MSB
T FF #2
LSB
T FF #1
Clock
20
1
0
N. B. Dodge 9/15
N. B. Dodge 9/15
000
001
010
011
100
101
110 111
MSB
T FF #2
LSB
T FF #1
1
Clock
N. B. Dodge 9/15
Counter Circuits
The ripple counter has problems, as we have
seen.
The parallel or synchronous binary counter
synchronizes all stages (flip-flops) so that they
change, or toggle, in parallel.
The parallel counter assures that the counter
output will always be correct, and that the wrong
count will not be accidentally decoded or
recognized.
23
N. B. Dodge 9/15
Counter stage 1
T
Counter stage 2
CR
CR
Clock
N. B. Dodge 9/15
Counter stage 1
T
Counter stage 2
CR
CR
Clock
Consider stage 0. This stage counts 1s (or it performs counts for the
20 column in this three-bit number being counted, hence the name
stage 0).
This stage toggles every time the clock ticks. Its input should always
be a 1, since the ff only toggles on a 1 input to T, and we want it to
always toggle on a clock pulse (similar to the exercise in Lecture 7).
Then tie T0 (i.e., stage 0 T-input) to 1 (as before, we recognize that
1 would be a plus voltage such as +5 V. in a real digital circuit).
25
N. B. Dodge 9/15
N. B. Dodge 9/15
27
Q1NEXT
0
1
1
0
0
1
1
0
N. B. Dodge 9/15
Q2
28
T1 = Q0
Count
T1
000
001
010
011
100
101
110
111
000
0
N. B. Dodge 9/15
N. B. Dodge 9/15
=
T2 Q2Q1Q0 + Q2Q1Q0
The expression is plotted on
the K-map below the truth
table.
From the K-map, we can
simplify the stage 2 T input
to:
T2 = Q1Q0
30
Count
210
T2
Q2
Q2NEXT
stage
000
001
010
011
100
101
110
111
0
0
0
1
0
0
0
1
0
0
0
0
1
1
1
1
000
0
0
0
1
1
1
1
0
Q1Q0
00
01
Q2 0
11 10
1
1
N. B. Dodge 9/15
N. B. Dodge 9/15
Exercise 3
Bit y
Less
Significant
Digit
Bit x
Clock
More
Significant
Digit
Reset
N. B. Dodge 9/15
34
N. B. Dodge 9/15
Exercise 4
Wire the 5 T FFs below according to the general rules given to
build a 5-bit, modulo-32 counter. Assume that the clock is slow
enough that a few gate delays are trivial.
35
N. B. Dodge 9/15
N. B. Dodge 9/15
A Modulo-6 Counter
Counter stage 0
"1"
T
CR
Counter stage 1
T
CR
Counter stage 2
T
MSB
CR
Clock
LSB
N. B. Dodge 9/15
T
CR
Counter stage 1
T
CR
Counter stage 2
T
MSB
CR
Clock
LSB
Since the stage 0 bit always toggles, after count 5 (101) it will go to
zero (the next count would be 110, for which that bit goes to 0).
Stage 0 behaves correctly; we do not have to modify this stage.
The middle bit will toggle to 1 if we do not stop it because Q0 is 1.
We have to negate this input -- but only for the 5 condition.
The MSB does not toggle either the T2 input is Q0Q1 (= 0, since
Q1= 0), so the T2 input is 0. Thus we must force stage 2 to 0.
How do we fix these last two conditions?
40
N. B. Dodge 9/15
Consider the truth table for the Q output of the middle counter bit (Q1):
Each clock tick, Q1 will change if T1 =1; Q1 will remain the same if T1 =0.
What we require is that when T1 (Q0)=1, Q1 will change states, except when
T1 =1, and count = 5 (binary 101).
If T1 (=Q0) = 1, and the counter output is exactly 5, we want the output of
the middle counter bit to stay 0.
Count
T1
Q1
Q1NEXT
000
0
0
0
001
1
0
1
010
0
1
1
011
1
1
0
100
0
0
0
101
0
0
0
110 & 111 Dont cares. Will never happen!
41
N. B. Dodge 9/15
00
Q2 0
42
01
1
11 10
1
Count
000
001
010
011
100
1 0 1 Etc.
T1
Q1
0
1
0
1
0
0
0
0
1
1
0
0
Q1 NEXT
0
1
1
0
0
0
N. B. Dodge 9/15
43
N. B. Dodge 9/15
T
CR
Counter stage 1
T
CR
Counter stage 2
T
LSB
T1 = Q2Q0
44
MSB
CR
Clock
=
T2 Q1Q0 + Q2Q0
N. B. Dodge 9/15
Counter stage 1
CR
Counter stage 2
CR
MSB
CR
Clock
LSB
Q2
Q1
Q0
Clock
45
000
001
010
011
100
101
000
001 MSB
LSB
1
N. B. Dodge 9/15
1
0
N. B. Dodge 9/15
Counter stage 1
CR
Counter stage 2
CR
MSB
CR
Clock
LSB
Inverted (m-1)
Decoded "5" (m-1)
Note that this version of the circuit uses slightly more logic, but
that the counter is equally valid. Also, it is conceptually easier
(and yes, it would be an acceptable answer on a test)!
47
N. B. Dodge 9/15
Summary
Like their simple combinational-logic relatives, the D,
J-K, and T flip-flops find many uses in modern
computing.
These include storage registers, counters, and shift
registers.
In our next lecture, we will design additional sequential
circuits.
In future lectures on computer architecture and design,
we will see just how sequential logic is employed in a
modern computer CPU.
48
N. B. Dodge 9/15
Take-Home Exercise
49
N. B. Dodge 9/15