general sequential systems
DESCRIPTION
COUNTERS Counters with I nputs Kinds of Counters Asynchronous vs. Synchronous Counters Cascaded Counters. D Q. D Q. Current State. State Memory. Next State. Input Forming Logic. General Sequential Systems. Counters. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/1.jpg)
COUNTERSCounters WİTH INPUTS
Kinds of CountersAsynchronous vs. Synchronous
CountersCascaded Counters
![Page 2: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/2.jpg)
General Sequential Systems
D QD Q
CurrentStateState
MemoryInputForming
Logic
NextState
![Page 3: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/3.jpg)
April 22, 2023 Lecture Notes - SE 141: Digital Circuits and Systems 3
Counters• Counters are registers that go through a predefined
sequence of states when inputs are applied• Many counters follow the binary number sequence
– For example, a 3-bit binary ripple counter goes through the following state transitions when the clock is asserted:000 → 001 → 010 → 011 → 100 → 101 → 110 → 111 → 000 …
• Counters are said to overflow when their sequence is complete
• Overflow causes counters to repeat a sequence of values over time
![Page 4: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/4.jpg)
April 22, 2023 Lecture Notes - SE 141: Digital Circuits and Systems 4
Types of Counters• Two types of counters exist:
1. Synchronous Counters2. Ripple Counters
Synchronous counters are triggered by a common clock Ripple counters use flip-flop output transitions to serve as the trigger source for other flip-flops
– For example, a 1 to 0 transition on flip-flopi triggers a toggling transition on flip-flopi + 1
Ripple counters are not triggered by a common clock
![Page 5: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/5.jpg)
Synchronous Counters
• In a synchronous counter, all flip flops are clocked by the same clock signal– They all change at the same time
• Synchronous counters can be cascaded to create larger counters that are also globally synchronous
![Page 6: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/6.jpg)
Transition Table for 2-Bit Counter
CurrentState
NextState
00 0101 1010 1111 00
It is the truth table for the input forming logic…
It describes what the next state values are as a function of the current state
(clock is assumed)
Q1 Q0 N1 N00 0 0 10 1 1 01 0 1 11 1 0 0
CurrentState
NextState
![Page 7: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/7.jpg)
Q1
Q0 0 1
0 1 1
1 0 0
Implementation of 2-Bit Counter
Q0
Q1D Q
D Q
CLK
CLK
N1
N0
N0 = Q0’
Q1
Q0 0 1
0 0 1
1 1 0
N1 =Q1 Q0
Q1 Q0 N1 N00 0 0 10 1 1 01 0 1 11 1 0 0
CurrentState
NextState
![Page 8: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/8.jpg)
Example 2 – A Gray Code CounterQ1 Q0 N1 N0
0 0 0 10 1 1 11 0 0 01 1 1 0
N1= Q0
N0 = Q1’
Q1D Q
D Q Q0
CLK
CLK
N1
N0
Q1
Q0 0 1
0 0 0
1 1 1
Q1
Q0 0 1
0 1 0
1 1 0
![Page 9: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/9.jpg)
Example 3 – Not All Count Values Used
Desired count sequence = 00 – 01 – 11 - 00 …
Q1 Q0 N1 N0
0 0 0 10 1 1 11 0 ? ?1 1 0 0
What should next state for 10 be?
![Page 10: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/10.jpg)
Example 3 – Not All Count Values Used
Q1 Q0 N1 N0
0 0 0 10 1 1 01 0 X X1 1 0 0
Do the normal K-map minimization with don’t cares
Q1
Q0 0 1
0 0 X
1 1 0
N1 = Q0•Q1’
Q1
Q0 0 1
0 1 X
1 0 0
N0 = Q0’
![Page 11: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/11.jpg)
Counters With Alternative FF’s
CurrentState
InputForming
Logic
T Inputs
StateMemory
T QT QT Q
![Page 12: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/12.jpg)
55:032 - Introduction to Digital Design Page 12
Counter Design ProcedureIntroduction
The process is a special case of the general sequential circuit design procedure.
no decisions on state assignment or transitions current state is the output
Example: 3-bit Binary Upcounter Decide to implement withToggle Flipflops
What inputs must bepresented to the T FFsto get them to change
to the desired state bit?
We need to use the T FF excitation table to translate the present/next state values to FF
inputs
00001111
00110011
01010101
00011110
01100110
10101010
Presentstate
Nextstate
![Page 13: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/13.jpg)
TFF Counter Design Using Augmented Transition Table
Q2 Q1 Q0 N2 N1 N0 T2 T1 T0
0 0 0 0 0 10 0 1 0 1 00 1 0 0 1 10 1 1 1 0 01 0 0 1 0 11 0 1 1 1 01 1 0 1 1 11 1 1 0 0 0
TFFInputs
CurrentState State
Next
Next state values Inputs to apply to achieve desired next state
![Page 14: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/14.jpg)
TFF Counter Design Using Augmented Transition Table
Q2 Q1 Q0 N2 N1 N0 T2 T1 T0
0 0 0 0 0 1 0 0 10 0 1 0 1 0 0 1 10 1 0 0 1 1 0 0 10 1 1 1 0 0 1 1 11 0 0 1 0 1 0 0 11 0 1 1 1 0 0 1 11 1 0 1 1 1 0 0 11 1 1 0 0 0 1 1 1
TFFInputs
CurrentState State
Next
Next state values Inputs to apply to achieve desired next state
T2 = Q1•Q0T1 = Q0T0 = ‘1’
Q2
Q1Q0 0 1
00
01
11 1 1
10
T2
![Page 15: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/15.jpg)
TFF Counter Design
‘1’
CLK
Q1
CLK
T Q
T Q
T Q
CLK
Q2
Q0
![Page 16: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/16.jpg)
April 22, 2023 Lecture Notes - SE 141: Digital Circuits and Systems 16
4-Bit Synchronous Binary Counter
NOTE:
This is a well-designed circuit. It can operate at high clock frequencies. The maximum clock frequency can be easily calculated. For high-speed digital design, synchronous binary counters are preferred.
![Page 17: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/17.jpg)
JKFF Gray Code Counter Design
Next state values Inputs to apply to achieve desired next state
Q2 Q1 Q0 N2 N1 N0 J2 K2 J1 K1 J0 K0
0 0 0 0 0 10 0 1 0 1 10 1 0 1 1 00 1 1 0 1 01 0 0 0 0 01 0 1 1 0 01 1 0 1 1 11 1 1 1 0 1
![Page 18: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/18.jpg)
JKFF Gray Code Counter Design
Next state values Inputs to apply to achieve desired next state
J2 = Q1•Q0’K2 = Q1’•Q0’
J1 = Q2’•Q0K1 = Q2•Q0
J0 = Q2•Q1 + Q2’•Q1’ = K0’K0 = Q2’•Q1 + Q2•Q1’ = Q2 Q1
Q2 Q1 Q0 N2 N1 N0 J2 K2 J1 K1 J0 K0
0 0 0 0 0 1 0 X 0 X 1 X0 0 1 0 1 1 0 X 1 X X 00 1 0 1 1 0 1 X X 0 0 X0 1 1 0 1 0 0 X X 0 X 11 0 0 0 0 0 X 1 0 X 0 X1 0 1 1 0 0 X 0 0 X X 11 1 0 1 1 1 X 0 X 0 1 X1 1 1 1 0 1 X 0 X 1 X 0
![Page 19: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/19.jpg)
Counters With Outputs
Outputs
D QD Q
CurrentState
InputForming
Logic
NextState
StateMemory
OutputForming
Logic
Outputs = f (CurrentState)
![Page 20: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/20.jpg)
Counters With Outputs
Q2 Q1 Q0 Z
0 0 0 10 0 1 00 1 0 00 1 1 11 0 0 01 0 1 01 1 0 11 1 1 0
Z=1 when count={0,3,6}
Z is called a Moore or static output. It is a function only of the current state.
![Page 21: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/21.jpg)
Combined Transition TableQ2 Q1 Q0 N2 N1 N0 Z
0 0 0 0 0 1 10 0 1 0 1 0 00 1 0 0 1 1 00 1 1 1 0 0 11 0 0 1 0 1 01 0 1 1 1 0 01 1 0 1 1 1 11 1 1 0 0 0 0
Current state Next state Output
Z = Q2’•Q1’•Q0’ + Q2’•Q1•Q0 + Q2•Q1•Q0’
(implement OFL with gates)
![Page 22: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/22.jpg)
D Q
D Q
D Q
Q2
Q1
Q0
N2
N1
N0
Z
Counter With A Moore Output
IFL OFL
CLK
CLK
CLK
![Page 23: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/23.jpg)
Note that the next state is afunction of the input ‘INC’ aswell as the current state.
INC Q1 Q0 N1 N0
0 0 0 0 00 0 1 0 10 1 0 1 00 1 1 1 11 0 0 0 11 0 1 1 01 1 0 1 11 1 1 0 0
D QD Q
CurrentState
StateMemory
InputForming
Logic
NextStateInputs
An Incrementable Counter
![Page 24: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/24.jpg)
N1 N0
N1 = INC•Q1’•Q0 + INC’•Q1 + Q1•Q0’N0 = INC’•Q0 + INC•Q0’ = INC Q0
INC Q1 Q0 N1 N0
0 0 0 0 00 0 1 0 10 1 0 1 00 1 1 1 11 0 0 0 11 0 1 1 01 1 0 1 11 1 1 0 0
Doing the KMaps for this results in:
Incrementable Counter Derivation
INC
Q1Q0 0 1
00
01 1
11 1
10 1 1
INC
Q1Q0 0 1
00 1
01 1
11 1
10 1
![Page 25: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/25.jpg)
The counter increments on the clock edge only when INC is asserted
Incrementable Counter Behavior
CLK
CurrentState 00 01
INC
10
![Page 26: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/26.jpg)
Counters With More InputsCLR INC Q1 Q0 N1 N0
0 0 0 00 0 0 10 0 1 00 0 1 10 1 0 00 1 0 10 1 1 00 1 1 11 0 0 01 0 0 11 0 1 01 0 1 11 1 0 01 1 0 11 1 1 01 1 1 1
CLR = INC = 0No state transition
CLR = 0 INC = 1Counter Increments
CLR = 1 INC = 0Counter resets to ‘00’
CLR = 1 INC = 1What should it do?
![Page 27: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/27.jpg)
Counters With More InputsCLR INC Q1 Q0 N1 N0
0 0 0 0 0 00 0 0 1 0 10 0 1 0 1 00 0 1 1 1 10 1 0 0 0 10 1 0 1 1 00 1 1 0 1 10 1 1 1 0 01 0 0 0 0 01 0 0 1 0 01 0 1 0 0 01 0 1 1 0 01 1 0 0 ? ?1 1 0 1 ? ?1 1 1 0 ? ?1 1 1 1 ? ?
CLR = INC = 0No state transition
CLR = 0 INC = 1Counter Increments
CLR = 1 INC = 0Counter resets to ‘00’
CLR = 1 INC = 1What should it do?
![Page 28: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/28.jpg)
Precedence of INC vs. CLR?
1. Could do nothing2. Could give INC precedence3. Could give CLR precedence4. Assume INC=CLR=1 will never occur
You decide when you draw the transition table!
![Page 29: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/29.jpg)
Case 1 – Do NothingClr Inc
Q1Q0 00 01 11 10
00
01 1
11 1 1
10 1 1 1
CLR INC Q1 Q0 N1 N0
0 0 0 0 0 00 0 0 1 0 10 0 1 0 1 00 0 1 1 1 10 1 0 0 0 10 1 0 1 1 00 1 1 0 1 10 1 1 1 0 01 0 0 0 0 01 0 0 1 0 01 0 1 0 0 01 0 1 1 0 01 1 0 0 0 01 1 0 1 0 11 1 1 0 1 01 1 1 1 1 1
N1 = CLR’•INC•Q1’•Q0 +CLR’•INC’•Q1 +CLR•INC•Q1 +INC•Q1•Q0’
N0 = CLR’•INC’•Q0 +CLR•INC•Q0 +CLR’•INC•Q0’
Clr Inc
Q1Q0 00 01 11 10
00 1
01 1 1
11 1 1
10 1
N1 N0
![Page 30: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/30.jpg)
Case 2 – Give INC PrecedenceClr Inc
Q1Q0 00 01 11 10
00
01 1 1
11 1
10 1 1 1
CLR INC Q1 Q0 N1 N0
0 0 0 0 0 00 0 0 1 0 10 0 1 0 1 00 0 1 1 1 10 1 0 0 0 10 1 0 1 1 00 1 1 0 1 10 1 1 1 0 01 0 0 0 0 01 0 0 1 0 01 0 1 0 0 01 0 1 1 0 01 1 0 0 0 11 1 0 1 1 01 1 1 0 1 11 1 1 1 0 0
Clr Inc
Q1Q0 00 01 11 10
00 1 1
01 1
11 1
10 1 1
N1 N0
N1 = INC•Q1’•Q0 +CLR’•INC’•Q1 +INC•Q1•Q0’
N0 = CLR’•INC’•Q0 +INC•Q0’
![Page 31: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/31.jpg)
Case 3 – Give CLR PrecedenceClr Inc
Q1Q0 00 01 11 10
00
01 1
11 1
10 1 1
CLR INC Q1 Q0 N1 N0
0 0 0 0 0 00 0 0 1 0 10 0 1 0 1 00 0 1 1 1 10 1 0 0 0 10 1 0 1 1 00 1 1 0 1 10 1 1 1 0 01 0 0 0 0 01 0 0 1 0 01 0 1 0 0 01 0 1 1 0 01 1 0 0 0 01 1 0 1 0 01 1 1 0 0 01 1 1 1 0 0
Clr Inc
Q1Q0 00 01 11 10
00 1
01 1
11 1
10 1
N1 N0
N1 = CLR’•INC•Q1’•Q0 +CLR’•INC’•Q1 +CLR’•Q1•Q0’
N0 = CLR’•INC’•Q0 +CLR’•INC•Q0’
![Page 32: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/32.jpg)
Case 4 – Assume INC=CLR=1 Will Never Occur
Clr Inc
Q1Q0 00 01 11 10
00 X
01 1 X
11 1 X
10 1 1 X
CLR INC Q1 Q0 N1 N0
0 0 0 0 0 00 0 0 1 0 10 0 1 0 1 00 0 1 1 1 10 1 0 0 0 10 1 0 1 1 00 1 1 0 1 10 1 1 1 0 01 0 0 0 0 01 0 0 1 0 01 0 1 0 0 01 0 1 1 0 01 1 0 0 X X1 1 0 1 X X1 1 1 0 X X1 1 1 1 X X
Clr Inc
Q1Q0 00 01 11 10
00 1 X
01 1 X
11 1 X
10 1 X
N1 N0
What happens in the real circuit when INC=CLR=1?
It depends on the final equations…
N1 = CLR’•INC’•Q1 + INC•Q1’•Q0 +CLR’•Q1•Q0’
N0 = CLR’•INC’•Q0 + INC•Q0’
![Page 33: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/33.jpg)
April 22, 2023 Lecture Notes - SE 141: Digital Circuits and Systems 33
4-Bit Up-Down Binary Counter
NOTE:
The Up control signal has priority. If Up is asserted, the Down signal will not pass through the AND gate.
![Page 34: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/34.jpg)
April 22, 2023 Lecture Notes - SE 141: Digital Circuits and Systems 34
4-Bit Binary Counter with Parallel Load
![Page 35: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/35.jpg)
![Page 36: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/36.jpg)
55:032 - Introduction to Digital Design Page 36
A common 4-bit counter
74163 Synchronous4-Bit Upcounter
Synchronous Load and Clear Inputs
Positive Edge Triggered FFs
Parallel Load Data from D, C, B, A
P, T Enable Inputs: both must be asserted to enable counting
RCO: asserted when counter enters its highest state 1111, used for cascading counters "Ripple Carry Output"
74161: similar in function, asynchronous load and reset
QAQBQCQD
163RCO
PT
ABCD
LOAD
CLR
CLK2
710
15
9
1
3456
14
1211
13
![Page 37: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/37.jpg)
55:032 - Introduction to Digital Design Page 37
74163 Detailed Timing Diagram
CLK
A
B
C
D
LOAD
CLR
P
T
Q A
Q B
Q C
Q D
RCO 12 13 14 15 0 1 2
Clear Load Count Inhibit
![Page 38: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/38.jpg)
55:032 - Introduction to Digital Design Page 38
Self-Starting CountersStart-Up States
At power-up, counter may be in any possible stateDesigner must guarantee that it (eventually) enters a valid stateEspecially a problem for counters that validly use a subset of states
Self-Starting Solution:Design counter so that even the invalid states eventually transition to valid state
Two Self-Starting State Transition Diagrams
S0 S4
S3S1
S2
S6
S5 S7
S0 S4
S3S1
S2
S5
S6 S7
![Page 39: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/39.jpg)
![Page 40: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/40.jpg)
![Page 41: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/41.jpg)
![Page 42: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/42.jpg)
55:032 - Introduction to Digital Design Page 42
Twisted Ring (Johnson, Mobius) CounterInvertedEnd-Around
8 possible states, single bit change per state, useful for avoiding glitches
+V
J CLK K
S
R
Q
Q
+V +V +V
0 1
Shift
Q 1 Q 2 Q 3 Q 4
\Reset
J
K
S
R
Q
Q
J
K
S
R
Q
Q
J
K
S
R
Q
Q CLK CLK CLK
1
0
0
0
1
1
0
0
1
1
1
0
1
1
1
1
0
1
1
1
0
0
1
1
0
0
0
1
0
0
0
0
Shift
Q 1
Q 2
Q 3
Q 4
100
![Page 43: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/43.jpg)
55:032 - Introduction to Digital Design Page 43
Ring Counter
V+
J CLK K
S
R
Q
Q
+V +V +V
0 1
Shift
Q 1 Q 2 Q 3 Q 4
\Reset
J
K
S
R
Q
Q
J
K
S
R
Q
Q
J
K
S
R
Q
Q CLK CLK CLK
1
0
0
0
Shift
Q1
Q2
Q3
Q4
100
0
1
0
0
0
0
1
0
0
0
0
1
1
0
0
0
0
1
0
0
0
0
1
0
0
0
0
1
1
0
0
0
End-Around
4 possible states, single bit change per state, useful for avoiding glitches
Must be initialized
![Page 44: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/44.jpg)
April 22, 2023 Lecture Notes - SE 141: Digital Circuits and Systems 44
Binary Ripple Counter• Consider the following binary sequence:
000001010011100101110111000
Indicates a toggling of the 2nd least significant bit
Indicates a toggling of the most significant bit
![Page 45: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/45.jpg)
April 22, 2023 Lecture Notes - SE 141: Digital Circuits and Systems 45
4-Bit Binary Ripple Counter
![Page 46: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/46.jpg)
April 22, 2023 Lecture Notes - SE 141: Digital Circuits and Systems 46
BCD Ripple Counter• It is possible to build counters that go through any
fixed sequence of binary numbers• For example, a BCD ripple counter can be specified
by the following state diagram:
![Page 47: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/47.jpg)
April 22, 2023 Lecture Notes - SE 141: Digital Circuits and Systems 47
4-Bit BCD Ripple Counter
![Page 48: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/48.jpg)
April 22, 2023 Lecture Notes - SE 141: Digital Circuits and Systems 48
12-Bit BCD Counter
![Page 49: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/49.jpg)
Mod-N Counters
• Generally we are interested in counters that count up to specific count values– Not just powers of 2
• A mod-N counter has N states– Counts from 0 to N-1 then rolls over– Requires flip flops
• For example…– A 4-bit binary counter is a mod-16 counter– A counter that counts from 0-9 is a mod-10
counter
N2log
![Page 50: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/50.jpg)
A Mod-4 CounterA.K.A. 2-bit counter
CLR INC Q1 Q0 N1 N0
0 0 0 0 0 00 0 0 1 0 10 0 1 0 1 00 0 1 1 1 10 1 0 0 0 10 1 0 1 1 00 1 1 0 1 10 1 1 1 0 01 - - - 0 0
00
10
0111
CLR’•INC
CLR’•INC’
CLR
CLR’•INCCLR’•INC
CLR’•INC
CLR’•INC’
CLR’•INC’
CLR’•INC’
![Page 51: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/51.jpg)
A Mod-4 Counter With Rollover Signal
CLR INC Q1 Q0 N1 N0 RO
0 0 0 0 0 0 00 0 0 1 0 1 00 0 1 0 1 0 00 0 1 1 1 1 00 1 0 0 0 1 00 1 0 1 1 0 00 1 1 0 1 1 00 1 1 1 0 0 11 - - - 0 0 0
00
10
0111
CLR’•INC
CLR’•INC’
CLR’•INCCLR’•INC
CLR’•INC / RO
CLR’•INC’
CLR’•INC’
The ROLL signal is used to tell other circuitry that the
counter is rolling over to all 0’s.
Mealy output CLR’•INC’CLR
![Page 52: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/52.jpg)
D Q
D Q
IFL
TerminalCount
RollOver
A Mod-4 Counter
CountValue
We could make a mod-4 counter from the block shown
in red.
CLR INCQ1 Q0 N1 N0 RO
0 0 0 0 0 0 00 0 0 1 0 1 00 0 1 0 1 0 00 0 1 1 1 1 00 1 0 0 0 1 00 1 0 1 1 0 00 1 1 0 1 1 00 1 1 1 0 0 11 - - - 0 0 0
inc
clr
clk
clk
![Page 53: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/53.jpg)
Cascaded Counters
MOD4
inc
TC MOD4
inc
TC MOD4
inc
TC
CV CV CV
inc
clk
clr clr clr
clr
digit0[1:0] digit1[1:0] digit2[1:0]
![Page 54: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/54.jpg)
Cascaded Counters
MOD4
inc
TC MOD4
inc
TC MOD4
inc
TC
CV CV CV
inc
clk
clr clr clr
clr
TerminalCount
Rollover
CountValue
digit0[1:0] digit1[1:0] digit2[1:0]
![Page 55: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/55.jpg)
Cascaded Counters
MOD4
inc
TC MOD4
inc
TC MOD4
inc
TC
CV CV CV
inc
clk
clr clr clr
clr
Assume that the second timer is already at the terminal count.
digit0[1:0] digit1[1:0] digit2[1:0]
![Page 56: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/56.jpg)
Cascaded Counters
MOD4
inc
TC MOD4
inc
TC MOD4
inc
TC
CV CV CV
inc
clk
clr clr clr
clr
digit0[1:0] digit1[1:0] digit2[1:0]
![Page 57: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/57.jpg)
Cascaded Counters
MOD4
inc
TC MOD4
inc
TC MOD4
inc
TC
CV CV CV
inc
clk
clr clr clr
clr
digit0[1:0] digit1[1:0] digit2[1:0]
![Page 58: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/58.jpg)
Cascaded Counters
MOD4
inc
TC MOD4
inc
TC MOD4
inc
TC
CV CV CV
inc
clk
clr clr clr
clr
digit0[1:0] digit1[1:0] digit2[1:0]
![Page 59: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/59.jpg)
Cascaded Counters
MOD4
inc
TC MOD4
inc
TC MOD4
inc
TC
CV CV CV
inc
clk
clr clr clr
clr
digit0[1:0] digit1[1:0] digit2[1:0]
![Page 60: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/60.jpg)
Cascaded Counters
MOD4
inc
TC MOD4
inc
TC MOD4
inc
TC
CV CV CV
inc
clk
clr clr clr
clr
digit0[1:0] digit1[1:0] digit2[1:0]
![Page 61: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/61.jpg)
Cascaded Counters
MOD4
inc
TC MOD4
inc
TC MOD4
inc
TC
CV CV CV
inc
clk
clr clr clr
clr
It looks like the inc signal ripples from counter to counter.How is this different from the ripple counter examples?
digit0[1:0] digit1[1:0] digit2[1:0]
![Page 62: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/62.jpg)
D Q
D Q
IFL
inc
TerminalCount
RollOver
A Mod-4 CounterWith consolidated rollover logic
CountValue
clr
clk
clk
A good mod-4 counter includes the logic within the red block.
![Page 63: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/63.jpg)
A Mod-4 Counter
MOD4
dout
rollclk
clr
inc
![Page 64: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/64.jpg)
Cascading two Mod-4 Counters
0001020310111213202122233031323300…
Count Sequence:
MOD4
2
incroll0
digit0
Increment higher digit’s counter when lower
digit’s counter is rolling over
digit1 digit0
clrMOD4
2
roll1
digit1
clr
clk clk
incincroll roll
dout doutclrclr
![Page 65: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/65.jpg)
Three-digit Mod-4 Counter
• Can combine any counters that have a rollover signal to make larger counters– Combine two 16-bit counters to make a 32-bit counter – Combine three mod-4 counters to make a three-digit mod-4
counter
MOD4
2
incroll0
digit0
clrMOD4
2
roll1
digit1
clr
clk clk
incincroll roll
dout doutclrclr
MOD4
2
roll1
digit2
clr
clk
incroll
doutclr
![Page 66: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/66.jpg)
BCD Counter
• Combine to create non-binary counters– BCD counter
MOD10
4
incroll0
digit0
clrMOD10
4
roll1
digit1
clr
clk clk
incincroll roll
dout doutclrclr
MOD10
4
roll1
digit2
clr
clk
incroll
doutclr
![Page 67: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/67.jpg)
D Flip Flop with Asynchronous Clearand Clock Enable
Clock Enable(a.k.a. Load)
Clear(a.k.a. Reset)
![Page 68: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/68.jpg)
Mod-4 Counter
D0
D1
CEO
CLK
CECE
![Page 69: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/69.jpg)
Reset
CLK
Digit0
CEO
Cascaded Synchronous Counter
Digit1
Digit0
CEO
Digit1
![Page 70: General Sequential Systems](https://reader031.vdocuments.us/reader031/viewer/2022013004/568158be550346895dc6080d/html5/thumbnails/70.jpg)
Hybrid Counters
• Can combine different kinds of mod counters– Combine an 8-bit counter with a 16-bit counter to
create a 24-bit counter– Combine mod-24 and mod-60 counters to create
a digital H:M:S clock
MOD60
6
secmin
Seconds
clrMOD60
6
hour
Minutes
clr
clk clk
incincroll roll
dout doutclrclr
MOD24
5
day
Hours
clr
clk
incroll
doutclr