Week 9 Sequential Circuits Counters
Week 9 Sequential Circuits Counters
• We’ll look at different kinds of counters and discuss how to build them
• These are not only examples of sequential analysis and design, but also real
devices used in larger circuits
1
Introducing counters
– Synchronous Counters
– Ripple Counters
• Synchronous Counters:
2
Synchronous Binary Up Counter
1
Present State Next State 00 01
A B A B
0 0 0 1 1 1
0 1 1 0
1 0 1 1 1
1 1 0 0 11 10
3
What good are counters?
• You may need to record how many times something has happened
4
Synch Binary Up/Down Counter
• We’ll need two flip-flops again. Here are the four possible states:
00 01
11 10
5
The complete state diagram and table
• Here’s the complete state diagram and state table for this circuit
6
D flip-flop inputs
• If we use D flip-flops, then the D inputs will just be the same as the
desired next states
7
JK flip-flop inputs
8
JK flip-flop input equations
• We can then find equations for all four flip-flop inputs, in terms of the
present state and inputs. Here, it turns out J1 = K1 and J0 = K0
J1 = K1 = Q0’ X + Q0 X’
J0 = K0 = 1
9
Unused states
• The examples shown so far have all had 2n states, and used n flip-flops.
But sometimes you may have unused, leftover states
• For example, here is a state table and diagram for a counter that
repeatedly counts from 0 (000) to 5 (101)
• What should we put in the table for the two unused states?
• If the circuit somehow ends up in one of the unused states (110 or 111),
its behavior will depend on exactly what the don’t cares were filled in with
11
…or maybe you do care
• To get the safest possible circuit, you can explicitly fill in next states
for the unused states 110 and 111
• This guarantees that even if the circuit somehow enters an unused state,
it will eventually end up in a valid state
0 0 0 0
0 0 0 1
0 0 1 0
0 0 1 1
0 1 0 0
0 1 0 1
0 1 1 0
0 1 1 1
1 0 0 0
1 0 0 1
1 0 1 0
1 0 1 1
1 1 0 0
1 1 0 1
1 1 1 0
CO= 1 when 1111 1 1 1 1
> 4 gate delays 13
4-bit Counter with Parallel Gating
14
4-bit Binary Counter with Parallel Load
Load Count
Parallel
1 x
Load
No
0 0
Change
0 1 Count
15
More complex counters
16
An 8-bit counter
• We can also make a counter that “starts” at some value besides 0000
• In the diagram below, when CO=0 the LD signal forces the next state
to be loaded from D3-D0
• The result is this counter wraps from 1111 to 0110 (instead of 0000)
18
Another restricted counter
• We can also make a circuit that counts up to only 1100, instead of 1111
• Here, when the counter value reaches 1100, the NAND gate forces
the counter to load, so the next state becomes 0000
19
Ripple Counter
21