Академический Документы
Профессиональный Документы
Культура Документы
Introduction: Counters
Introduction: Counters
Counters are circuits that cycle through a specified
number of states.
Introduction: Counters
J
C
K
CLK
FF0
CLK
Q0
Q1
J
C
K
FF1
Q0
Timing diagram
Q0 0
Q1 0
00 01 10 11 00 ...
J
CLK
C
K
C
K
Q0
FF0
CLK
Q1
C
K
Q1
FF2
FF1
Q2
Q0
Q1
Q2
0
Recycles back to 0
Q0
Q1
Q2
tPLH
(CLK to Q0)
10
J
CLK
Q1
C
K
C
K
FF0
Q2
C
K
FF1
FF2
Q3
C
K
FF3
CLK
1
10 11 12 13 14 15 16
Q0
Q1
Q2
Q3
Asynchronous (Ripple) Counters
11
All J, K
inputs
are 1
(HIGH).
CLK
K
Q
CLR
CLK
K
Q
CLR
CLK
K
Q
CLR
B
C
Asynchronous Counters with
MOD number < 2^n
12
Example (contd):
C
All J, K
inputs
are 1
(HIGH).
Clock
CLK
K
Q
CLR
CLK
K
Q
CLR
CLK
K
Q
CLR
B
C
1
10 11 12
A
B
C
NAND 1
Output 0
Asynchronous Counters with
MOD number < 2^n
MOD-6 counter
produced by
clearing (a MOD-8
binary counter)
when count of six
(110) occurs.
13
Temporary
state
Clock
A 0
0 1
0 1
B 0
1 1
0 0
C 0
NAND 1
Output 0
0 0
0 0
111
10 11 12
000
001
110
010
101
Counter is a MOD-6
counter.
011
100
Asynchronous Counters with
MOD number < 2^n
14
K
CLR
K
CLR
C
D
E
F
K
CLR
K
CLR
K
CLR
K
CLR
All J = K = 1.
15
K
CLR
K
CLR
K
CLR
K
CLR
16
C
K
C
K
CLR
Clock
C
K
CLR
(A.C)'
C
K
CLR
CLR
10
D 0
C 0
B 0
A 0
11
NAND
output
Asynchronous Counters with
MOD number < 2^n
17
Q0
Q1
C
K Q'
C
Q'
K
Q2
C
K Q'
3-bit binary
up counter
1
J
CLK
C
Q'
K
Q0
C
K Q'
Q1
Q2
C
K Q'
3-bit binary
down counter
18
111
001
Q0
Q1
C
K Q'
C
Q'
K
Q2
010
C
K Q'
110
011
101
100
CLK
Q0
Q1
Q2
19
C
Q'
K
Q1
J
Q2
J
C
K Q'
C
Q'
K
Modulus-4 counter
Q3
Q
C
K Q'
Q4
J
C
K Q'
Modulus-8 counter
Cascading Asynchronous
Counters
20
Count
pulse
A1
A2
A3
3-bit
binary counter
A4
A5
3-bit
binary counter
A5
A4
A3
A2
A1
A0
0
0
0
0
0
0
:
0
0
0
0
0
0
:
0
0
0
0
1
1
:
0
0
:
1
0
0
:
0
0
:
1
0
0
:
0
1
:
1
0
1
:
Cascading Asynchronous
Counters
21
CTEN Decade
counter TC
C
Q3 Q2 Q1 Q0
CLK
freq/10
CTEN Decade
freq/100
counter TC
C
Q3 Q2 Q1 Q0
freq
Cascading Asynchronous
Counters
22
01
11
10
Present
state
Next
state
Flip-flop
inputs
A1 A0
0 0
0 1
1 0
1 1
A1+ A0+
0
1
1
0
1
1
0
0
TA1 TA0
0
1
1
1
0
1
1
1
23
Next
state
Flip-flop
inputs
A1 A0
0 0
0 1
1 0
1 1
A1+ A0+
0
1
1
0
1
1
0
0
TA1 TA0
0
1
1
1
0
1
1
1
TA1 = A0
TA0 = 1
1
J
C
Q'
K
A0
A1
C
K Q'
CLK
24
A2+
0
0
0
1
1
1
1
0
Next
state
A1+ A0+
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
0
A2
A0
TA2 = A1.A0
A2
Flip-flop
inputs
TA2 TA1 TA0
0
0
1
0
1
1
0
0
1
1
1
1
0
0
1
0
1
1
0
0
1
1
1
1
A1
1
A2
A1
1
A0
A0
TA1 = A0
TA0 = 1
25
TA1 = A0
TA0 = 1
A2
A1
A0
CP
1
26
11111 00000
27
1
J
C
Q'
K
A0
C
K Q'
A1
A2.A1.A0
Q
A2
C
K Q'
A3
C
K Q'
CLK
28
Q3
Q2
Q1
Q0
Initially
1
2
3
4
5
6
7
8
9
10 (recycle)
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
1
1
1
1
0
0
0
0
0
1
1
0
0
1
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
01 11
X X
10
Q1Q0
00
0 X
01 11
1
10
X
1 X
JQ1 = Q2'.Q0
KQ1 = Q2.Q0
Q0
Q1
K Q'
Q1
K Q' '
C
K Q'
Q2
Q2
'
Q0
'
CLK
36
Decoding A Counter
Decoding a counter involves determining which state
in the sequence the counter is in.
Decoding A Counter
37
Decoding A Counter
Example: MOD-8 ripple counter (active-HIGH
decoding).
Clock
10
A'
B'
C'
HIGH only on
count of ABC = 000
A'
B'
C
HIGH only on
count of ABC = 001
A'
B
C'
HIGH only on
count of ABC = 010
.
.
.
HIGH only on
count of ABC = 111
A
B
C
Decoding A Counter
38
Decoding A Counter
Example: To detect that a MOD-8 counter is in state
0 (000) or state 1 (001).
A'
B'
C'
A'
B'
C
Clock
10
HIGH only on
count of ABC = 000
or ABC = 001
A'
B'
10
Decoding A Counter
39
functionality.
40
Load
I4 I3 I2 I1
A4 A3 A2 A1
Count = 1
Clear = 1
CP
Inputs = 0
Count = 1
Load = 0
CP
Clear
I4 I3 I2 I1
Inputs have no effect
A4 A3 A2 A1
A4 A3 A2 A1
Carry-out
Load
I4 I3 I2 I1
Count = 1
Clear = 1
CP
Load
I4 I3 I2 I1
1 0 1 0
Count = 1
Clear = 1
CP
0 0 1 1
41
1
0
1
Next state
42
Introduction: Registers
An n-bit register has a group of n flip-flops and some
logic gates and is capable of storing n bits of
information.
Introduction: Registers
43
Simple Registers
No external gates.
Example: A 4-bit register. A new 4-bit data is loaded
every clock cycle.
A3
A2
A1
A0
I3
I2
I1
I0
CP
Simple Registers
44
45
A1
D Q
A2
D Q
A3
6
7
I3
D Q
4
5
I2
A0
2
3
I1
D Q
CLK
CLEAR
Registers With Parallel Load
46
Shift Registers
Another function of a register, besides storage, is to
provide for data movements.
Shift Registers
50
Shift Registers
Basic data movement in shift registers (four bits are
used for illustration).
Data in
Data out
Data out
Data in
Data out
Data in
Data out
(e) Parallel in /
parallel out
(f) Rotate right
51
Serial data
input
D Q
C
Q0
D Q
C
Q1
D Q
Q2
D Q
Q3
Serial data
output
CLK
52
D Q
D Q
D Q
D Q
CLK
Q0
Data input
CLK
Q1
Q2
Q3
SRG 4
Logic symbol
C
Q0 Q1 Q2 Q3
55
D1
D2
D3
SHIFT/LOAD
D Q
C
Q0
D Q
Q1
D Q
C
Q2
Serial
data
D Q
Q3 out
C
CLK
SHIFT.Q0 + SHIFT'.D1
Parallel In/Serial Out Shift
Registers
56
SHIFT/LOAD
CLK
SRG 4
C
Logic symbol
57
D1
D2
D3
D Q
D Q
D Q
D Q
CLK
Q0
Q1
Q2
Q3
58
RIGHT.Q0 +
RIGHT'.Q2
D Q
D Q
Q1
D Q
C
Q2
D Q
Q3
Q0
CLK
Bidirectional Shift Registers
59
Clear
A4
A3
A2
A1
CLK
s1
s0
Serial
input for
shift-right
4x1
MUX
3 2 1 0
I4
4x1
MUX
3 2 1 0
I3
4x1
MUX
3 2 1 0
I2
Parallel inputs
Bidirectional Shift Registers
4x1
MUX
3 2 1 0
I1
Serial
input for
shift-left
60
0
1
0
1
Register Operation
No change
Shift right
Shift left
Parallel load
61
64
Ring Counters
One flip-flop (stage) for each state in the sequence.
The output of the last stage is connected to the D
input of the first stage.
Ring Counters
65
Ring Counters
Example: A 6-bit (MOD-6) ring counter.
PRE
D Q
Q0
D Q
Q1
D Q
Q2
D Q
Q3
D Q
Q4
D Q
Q5
CLR
CLK
Clock
0
1
2
3
4
5
Q0
1
0
0
0
0
0
Q1
0
1
0
0
0
0
Q2
0
0
1
0
0
0
Q3
0
0
0
1
0
0
Q4
0
0
0
0
1
0
Q5
0
0
0
0
0
1
Ring Counters
100000
000001
010000
000010
001000
000100
66
Johnson Counters
The complement of the output of the last stage is
connected back to the D input of the first stage.
Johnson Counters
67
Johnson Counters
Example: A 4-bit (MOD-8) Johnson counter.
D Q
Q0
D Q
Q1
D Q
Q2
D Q
Q'
Q3'
CLR
CLK
Clock
0
1
2
3
4
5
6
7
Q0
0
1
1
1
1
0
0
0
Q1
0
0
1
1
1
1
0
0
Q2
0
0
0
1
1
1
1
0
Q3
0
0
0
0
1
1
1
1
0000
0001
1000
0011
Johnson Counters
1100
0111
1110
1111
68