CH 4 Lecture 3f
CH 4 Lecture 3f
CH 4 Lecture 3f
Sequential Circuit
02
Design Multivibrators
View slide
Register and Counters Counters
2
▪ Moreover, flip-flops can be linked to one another to carry out counting tasks.
• The number of flip-flops used and The way in flip-flops connected
✓ determine the number of states (called the modulus) and also
✓ the specific sequence of states that the counter goes through during each complete cycle.
▪ A counter is an example of a state machine;
• Where a state machine is a sequential circuit with a finite number of states that happen in a
predetermined order. Two basic types of state machines are the
1. Moore (is one where the outputs depend only on the internal present state. )
2. Mealy (is one where the outputs depend on both the internal present state and on the inputs.)
Counters are classified into two broad categories according to the way they are clocked:
▪ Each flip-flop is triggered by the output of the previous flip- ▪ All flip-flops are triggered by the same clock signal,
flop, allowing for sequential operation without the need for ensuring that the outputs change simultaneously.
a common clock signal. ▪ Typically require more complex circuitry due to the
▪ Asynchronous counters are simpler in design as they rely need for a synchronized clock signal and additional
on the propagation of signals through individual flip-flops control logic to coordinate the flip-flop outputs.
without the need for synchronization, resulting in
potentially lower complexity and faster propagation times.
▪ The term asynchronous refers to events that do not have a fixed time relationship with
each other and, generally, do not occur at the same time.
▪ An asynchronous counter is one in which the flip-flops (FF) within the counter do not change states at
exactly the same time because they do not have a common clock pulse.
▪ For illustration we will examine
Figure 4.3.3Timing diagram for the counter of Figure 3.3.2. the leading edge of CLK1, Q0 = 1 and Q1 = 0.
• For simplicity, the transitions of Q0 , Q1 , and the clock pulses are shown as simultaneous even though this is an asynchronous counter. There is, of
course, some small delay between the CLK and the Q0 transition and between the Q0 transition and the Q1 transition.
By Abdulaziz J. Sequential Circuit Design 6/1/2024
Register and Counters Counters
8
Figure 4.3.5 shows a 3-bit counter timing diagram for one cycle.
▪ The effect of the input clock pulse is first “felt” by FF0. This effect cannot get to FF1 immediately because of the propagation
delay through FF0. Then there is the propagation delay through FF1 before FF2 can be triggered. Thus, the effect of an input
clock pulse “ripples” through the counter, taking some time, due to propagation delays, to reach the last flip-flop.
▪ To illustrate, notice that all three flip-flops in the
counter of Figure 4.3.4 change state on the leading
edge of CLK4. This ripple clocking effect is shown in
Figure 4.3.6 for the first four clock pulses, with the
propagation delays indicated. Figure 4.3.6Propagation delays in a 3-bit asynchronous (ripple-clocked) binary counter.
By Abdulaziz J. Sequential Circuit Design 6/1/2024
Register and Counters Counters
12
Thus, it takes three propagation delay times for the effect of the clock pulse, CLK4,
Propagation Delay
to ripple through the counter and change Q2 from LOW to HIGH.
The maximum cumulative delay in a counter must be less than the period of the clock waveform.
EXAMPLE 1 A 4-bit asynchronous binary counter is shown in Figure 4.3.7(a). Each D flip-flop is negative edge-triggered
and has a propagation delay for 10 nanoseconds (ns). Develop a timing diagram showing the Q output of each flip-flop, and
determine the total propagation delay time from the triggering edge of a clock pulse until a corresponding change can occur in
the state of Q3 . Also determine the maximum clock frequency at which the counter can be operated.
Figure 4.3.7(a). Four-bit asynchronous binary counter and its timing diagram.
▪ The timing diagram with delays omitted is as shown in Figure 4.3.7(b). For the total delay time, the
effect of CLK8 or CLK16 must propagate through four flip-flops before Q3 changes, so
𝒕𝒑(𝒕𝒐𝒕) =
𝟒 ∗ 𝟏𝟎 𝒏𝒔 = 𝟒𝟎 𝒏𝒔
By Abdulaziz J. Sequential Circuit Design 6/1/2024
Register and Counters Counters
14
1 1
▪ The maximum clock frequency is 𝑓𝑚𝑎𝑥 = = 𝑛𝑠 = 25 𝑀𝐻𝑧
𝑡𝑝 40
𝑡𝑜𝑡
▪ The counter should be operated below this frequency to avoid problems due to the propagation delay.
Related Problem Show the timing diagram if all of the flip-flops in Figure 4.3.7(a) are positive edg
etriggered.
▪ Notice in Figure 4.3.8(a) that only Q1 and Q3 are connected to the NAND gate inputs. This
arrangement is an example of partial decoding, in which the two unique states (Q1 = 1 and Q3 = 1)
are sufficient to decode the count of ten because none of the other states (zero through nine) have
both Q1 and Q3 HIGH at the same time.
▪ When the counter goes into count ten (1010), the decoding gate output goes LOW and
asynchronously resets all the flip-flops. The resulting timing diagram is shown in Figure 4.3.8(b).
▪ Notice that there is a glitch on the Q1 waveform. The reason for this glitch is that Q1 must first go
HIGH before the count of ten can be decoded. Not until several nanoseconds after the counter goes to
the count of ten does the output of the decoding gate go LOW (both inputs are HIGH).
▪ Thus, the counter is in the 1010 state for a short time before it is reset to 0000, thus producing the glitch
on Q1 and the resulting glitch on the CLR line that resets the counter. We will see about glitch in
chapter five
▪ Other truncated sequences can be implemented in a similar way, as Example 2 shows.
▪ Observe that Q0 and Q1 both go to 0 anyway, but Q2 and Q3 must be forced to 0 on the twelfth clock
pulse. Figure 4.3.9(a) shows the modulus-12 counter.
▪ The NAND gate partially decodes count twelve (1100) and resets flip-flop 2 and flip-flop 3.
Related Problem
1. How can the counter in Figure 4.3.9(a) be modified to make it a modulus-13 counter?
2. What does the term asynchronous mean in relation to counters?
3. How many states does a modulus-14 counter have? What is the minimum number of flip-flops
required
▪ It is an example of a specific integrated circuit asynchronous counter. This device actually consists of a
single flip-flop (CLK A) and a 3-bit asynchronous counter (CLK B). This arrangement is for flexibility.
▪ It can be used as a divide-by-2 device if only the single flip-flop is used, or it can be used as a modulus-
8 counter if only the 3-bit counter portion is used.
▪ This device also provides gated reset inputs, RO(1) and RO(2). When both of these inputs are HIGH, the
counter is reset to the 0000 state CLR.
▪ Additionally, the 74HC93 can be used as a 4-bit modulus-16 counter (counts 0 through 15) by
connecting the Q0 output to the CLK B input as shown by the logic symbol in Figure 4.3.10(a).
FIGURE 4.3.10 Two configurations of the 74HC93 asynchronous counter. (The qualifying label, CTR DIV n,
indicates a counter with n states.)
By Abdulaziz J. Sequential Circuit Design 6/1/2024
Register and Counters Counters
25
▪ The term synchronous refers to events that have a fixed time relationship with
each other. A synchronous counter is one in which all the flip-flops in the counter
are clocked at the same time by a common clock pulse.
▪ J-K flip-flops are used to illustrate most synchronous counters.
▪ D flip-flops can also be used but generally require more logic because of having no direct toggle or no-
change states. For illustration we will examine
1. 2-bit synchronous binary counter
2. 3-bit synchronous binary counter
3. 4-bit synchronous binary counter
4. Synchronous decade counter
By Abdulaziz J. Sequential Circuit Design 6/1/2024
Register and Counters Counters
26
FIGURE 4.3.12Timing details for the 2-bit synchronous counter operation (the propagation delays of both flip-flops are assumed to be equal).
By Abdulaziz J. Sequential Circuit Design 6/1/2024
Register and Counters Counters
29
✓ Although the delays are an important factor in the synchronous counter operation, in an overall timing diagram they are
normally omitted for simplicity. Major waveform relationships resulting from the normal operation of a circuit can be conveyed
completely without showing small delay and timing differences. However, in high-speed digital circuits, these small delays are
an important consideration in design and troubleshooting.
By Abdulaziz J. Sequential Circuit Design 6/1/2024
Register and Counters Counters
30
b) Timing diagram
a) A 3-bit synchronous binary counter.
FIGURE 4.3.14
✓ You can understand this counter operation by examining its sequence of states as shown in Table 4.3.2.
✓ First, let’s look at Q0 . Notice that Q0 changes on each clock pulse as the counter
progresses from its original state to its final state and then back to its original state.
✓ To produce this operation, FF0 must be held in the toggle mode by constant HIGHs
on its J0 and K0 inputs. Notice that Q1 goes to the opposite state following each time
Q0 is a 1. This change occurs at CLK2, CLK4, CLK6, and CLK8. The CLK8 pulse
✓ causes the counter to recycle. To produce this operation, Q0 is connected to the J1 and K1 inputs of FF1. When Q0 is a 1 and a
clock pulse occurs, FF1 is in the toggle mode and therefore changes state.
✓ The other times, when Q0 is a 0, FF1 is in the no-change mode and remains in its present state.
By Abdulaziz J. Sequential Circuit Design 6/1/2024
Register and Counters Counters
32
✓ Next, let’s see how FF2 is made to change at the proper times according to the binary sequence.
• Notice that both times Q2 changes state, it is preceded by the unique condition in which both Q0 and Q1 are HIGH.
• This condition is detected by the AND gate and applied to the J2 and K2 inputs of FF2.
• Whenever both Q0 and Q1 are HIGH, the output of the AND gate makes the J2 and K2 inputs of FF2 HIGH, and FF2
toggles on the following clock pulse.
• At all other times, the J2 and K2 inputs of FF2 are held LOW by the AND gate output, and FF2 does not change state.
• The analysis of the counter in Figure 4.3.14 is summarized in Table 4.3.3
FIGURE 4.3.15 A 4-bit synchronous binary counter and timing diagram. Times
where the AND gate outputs are HIGH are indicated by the shaded areas.
By Abdulaziz J. Sequential Circuit Design 6/1/2024
Register and Counters Counters
35
a) b)
Figure 4.3.16 A synchronous BCD decade counter. Timing diagram for the BCD decade counter (Q0 is the LSB).
▪ Flip-flop 2 (Q2 ) changes on the next clock pulse each time both Q0 = 1 and Q1 = 1.
▪ This requires an input logic equation as follows: J2 = K2 = Q0Q1
• This equation is implemented by ANDing Q0 and Q1 and connecting the gate output to the
J2 and K2 inputs of FF2.
▪ Finally, FF3 (Q3 ) changes to the opposite state on the next clock pulse each time Q0 = 1, Q1 = 1, and
Q2 = 1 (state 7), or when Q0 = 1 and Q3 = 1 (state 9).
▪ The equation for this is as follows: J3 = K3 = Q0Q1Q2 + Q0Q3
▪ This function is implemented with the AND/OR logic connected to the J3 and K3 inputs of FF3 as
shown in the logic diagram in Figure 4.3.16.
By Abdulaziz J. Sequential Circuit Design 6/1/2024
Register and Counters Counters
39
▪ When a LOW is applied to the LOAD’ input, the counter will assume the state of the data inputs on
the next clock pulse. Thus, the counter sequence can be started with any 4-bit binary number.
▪ Also, there is an active-LOW clear input (CLR)’, which synchronously resets all four flip-flops in the
counter. There are two enable inputs, ENP and ENT. These inputs must both be HIGH for the counter to
sequence through its binary states. When at least one input is LOW, the counter is disabled.
▪ The ripple clock output (RCO) goes HIGH when the counter reaches the last state in its sequence of
fifteen, called the terminal count (TC = 15).
▪ This output, in conjunction with the enable inputs, allows these counters to be cascaded for higher
count sequences.
By Abdulaziz J. Sequential Circuit Design 6/1/2024
Register and Counters Counters
41
1. To begin, the LOW level pulse on the CLR’ input causes all the outputs (Q0 , Q1 , Q2 , and Q3 ) to go LOW.
2. Next, the LOW level pulse on the LOAD’ input synchronously enters the data on the data inputs (D0 , D1 , D2 , and D3 ) into
the counter. These data appear on the Q outputs at the time of the first positive-going clock edge after LOAD’ goes LOW.
• This is the preset operation. In this particular example, Q0 is LOW, Q1 is LOW, Q2 is HIGH, and Q3 is HIGH.
• This, of course, is a binary 12 (Q0 is the LSB). The counter now advances through states 13, 14, and 15 on the next three
positive going clock edges. It then recycles to 0, 1, 2 on the following clock pulses.
• Notice that both ENP and ENT inputs are HIGH during the state sequence. When ENP goes LOW, the counter is
inhibited and remains in the binary 2 state.
Problems
▪ For the up sequence, Q1 changes state on the next clock pulse when Q0 = 1. For the down sequence, Q1
changes on the next clock pulse when Q0 = 0. Thus, the J1 and K1 inputs of FF1 must equal 1 under the
conditions expressed by the following equation: J1 = K1 = (Q0 UP) + (Q0 DOWN’)
By Abdulaziz J. Sequential Circuit Design 6/1/2024
Register and Counters Counters
46
▪ Figure4.3.20 shows a logic diagram for the 74HC190, an example of an integrated circuit up/down
synchronous decade counter. ▪ The direction of the count is determined by the level of the
up/down input (D/U’).
• When this input is HIGH, the counter counts down; when it is
LOW, the counter counts up.
▪ Also, this device can be preset to any desired BCD digit as
determined by the states of the data inputs when the LOAD’
FIGURE 4.3.20 The 74HC190 up/down
input is LOW.
synchronous decade counter.
By Abdulaziz J. Sequential Circuit Design 6/1/2024
Register and Counters Counters
50
▪ The MAX/MIN output produces a HIGH pulse when the terminal count nine (1001) is reached in the
UP mode or when the terminal count zero (0000) is reached in the DOWN mode.
▪ The MAX/MIN output, the ripple clock output (RCO)’, and the count enable input (CTEN)’ are used
when cascading counters.
▪ Figure 4.3.21 is a timing diagram that shows the 74HC190 counter preset to seven (0111) and then
going through a count-up sequence followed by a count-down sequence.
▪ The MAX/MIN output is HIGH when the counter is in either the all-0s state (MIN) or the 1001 state
(MAX).
1. A 4-bit up/down binary counter is in the DOWN mode and in the 1010 state. On the next clock
pulse, to what state does the counter go?
2. What is the terminal count of a 4-bit binary counter in the UP mode? In the DOWN mode? What is
the next state after the terminal count in the DOWN mode?
✓ The first step in the design of a state machine (counter) is to create a state diagram.
✓ A state diagram shows the progression of states through which the counter advances when it is clocked.
✓ Figure 4.3.22 is a state diagram for a basic 3-bit Gray code counter.
✓ This particular circuit has no inputs other than the clock and no outputs other
than the outputs taken off each flip-flop in the counter.
✓ You may wish to review the coverage of the Gray code in Chapter 1 at this
time.
FIGURE 4.3.22 State diagram
for a 3-bit Gray code counter.
2. Derive a next-state table from the state diagram.
✓ Once the sequential circuit is defined by a state diagram, the second step is to derive a next-state
table, which lists each state of the counter (present state) along with the corresponding next state.
By Abdulaziz J. Sequential Circuit Design 6/1/2024
Register and Counters Counters
55
To illustrate this procedure, two sample entries are shown for the J0 and the K0 inputs to the least significant flip-flop (Q0 ) in Figure 4.3.23.
By Abdulaziz J. Sequential Circuit Design 6/1/2024
Register and Counters Counters
59
FIGURE 4.3.25 Three-bit Gray code counter. Open file F09-29 to verify operation.
By Abdulaziz J. Sequential Circuit Design 6/1/2024
Register and Counters Counters
63
Step 1: The state diagram is as shown. Although there are only four states, a 3-
bit counter is required to implement this sequence because the maximum
binary count is seven. Since the required sequence does not include all the
possible binary states, the invalid states (0, 3, 4, and 6) can be treated as “don’t
FIGURE 4.3.26 cares” in the design. However, if the counter should erroneously get into an
invalid state, you must make sure that it goes back to a valid state.
Step 2: The next-state table is developed from the state diagram and is given in Table 4.3.8.
Table 4.3.8.
Step 3: The transition table for the D flip-flop is
shown in Table 4.3.9.
Table 4.3.9.
Step 4: The D inputs are plotted on the present-state Karnaugh maps in Figure 4.3.27. Also “don’t cares”
can be placed in the cells corresponding to the invalid states of 000, 011, 100, and 110, as indicated by the
red Xs.
Figure 4.3.27
Figure 4.3.27
By Abdulaziz J. Sequential Circuit Design 6/1/2024
Register and Counters Counters
67
Table 4.3.11.
FIGURE 4.3.30
By Abdulaziz J. Sequential Circuit Design 6/1/2024
Register and Counters Counters
70
Step 4: The UP/DOWN’ control input, Y, is considered one of the state variables along with Q0 , Q1 , and
Q2 . Using the next-state table, the information in the “Flip-Flop Inputs” column of Table 4.3.11 is
transferred onto the maps as indicated for each present state of the counter.
Step 5: The 1s are combined in the largest possible groupings, with “don’t cares” (Xs) used where possible.
The groups are factored, and the expressions for the J and K inputs are as follows:
Step 6: The J and K equations are implemented with combinational logic. Specify the number of flip-
flops, gates, and inverters that are required to implement the logic described in Step 5.
Asynchronous Cascading
▪ Notice that the final output of the modulus-8 counter, Q4 , occurs once for every 32 input clock
pulses. The overall modulus of the two cascaded counters is 4 * 8 = 32; that is, they act as a divide-
by-32 counter.
Synchronous Cascading
▪ When operating synchronous counters in a cascaded configuration, it is necessary to use the count
enable and the terminal count functions to achieve higher-modulus operation.
▪ On some devices the count enable is labeled simply CTEN (or some other designation such as G),
and terminal count (TC) is analogous to ripple clock output (RCO) on some IC counters.
▪ Figure 4.3.33 shows two decade counters connected in cascade.
Synchronous Cascading
▪ The terminal count (TC) output of counter 1 is connected to the count enable (CTEN) input of counter 2.
▪ Counter 2 is inhibited by the LOW on its CTEN input until counter 1 reaches its last, or terminal, state
and its terminal count output goes HIGH.
▪ This HIGH now enables counter 2, so that when the first clock pulse after counter 1 reaches its terminal
count (CLK10), counter 2 goes from its initial state to its second state.
▪ Upon completion of the entire second cycle of counter 1 (when counter 1 reaches terminal count the
second time), counter 2 is again enabled and advances to its next state. This sequence continues.
▪ Since these are decade counters, counter 1 must go through ten complete cycles before counter 2
completes its first cycle.
By Abdulaziz J. Sequential Circuit Design 6/1/2024
Register and Counters Counters
76
Synchronous Cascading
▪ In other words, for every ten cycles of counter 1, counter 2 goes through one cycle. Thus, counter 2 wil
complete one cycle after one hundred clock pulses. The overall modulus of these two cascaded counter
is 10 * 10 = 100. When viewed as a frequency divider, the circuit of Figure 4.3.33 divides the input clock
frequency by 100.
▪ Cascaded counters are often used to divide a high-frequency clock signal to obtain highly accurate
pulse frequencies. Cascaded counter configurations used for such purposes are sometimes called
countdown chains.
Synchronous Cascading
▪ For example, suppose that you have a basic clock frequency of 1 MHz and you wish to obtain 100 kHz,
10 kHz, and 1 kHz; a series of cascaded decade counters can be used.
▪ If the 1 MHz signal is divided by 10, the output is 100 kHz. Then if the 100 kHz signal is divided by 10, the
output is 10 kHz. Another division by 10 produces the 1 kHz frequency. The general implementation of
this countdown chain is shown in Figure 4.3.34.
EXAMPLE Determine the overall modulus of the two cascaded counter configurations in Figure below.
Solution
a) The overall modulus for the 3-counter configuration is 8 * 12 * 16 = 1536
b) The overall modulus for the 4-counter configuration is 10 * 4 * 7 * 5 = 1400
Related Problem How many cascaded decade counters are required to divide a clock frequency by
100,000?
By Abdulaziz J. Sequential Circuit Design 6/1/2024
Register and Counters Counters
79
EXAMPLE 1 Use 74HC190 up/down decade counters connected in the UP mode to obtain a 10 kHz
waveform from a 1 MHz clock. Show the logic diagram.
Solution
▪ To obtain 10 kHz from a 1 MHz clock requires a division factor of 100. Two 74HC190 counters must be
cascaded as shown in Figure 4.3.46. The left counter produces a terminal count (MAX/MIN) pulse for
every 10 clock pulses.
▪ The right counter produces a terminal count (MAX/MIN) pulse for every 100 clock pulses.
Solution
Related Problem Determine the frequency of the waveform at the Q0 output of the second counter (the
one on the right) in Figure above.
▪ Notice in Figure 4.3.47 that the RCO output of the right-most counter is inverted and applied to the
LOAD input of each 4-bit counter. Each time the count reaches its terminal value of 65,535, which is
(1111111111111111)2 , RCO goes HIGH and causes the number on the parallel data inputs (63C016) to be
synchronously loaded into the counter with the clock pulse.
▪ Thus, there is one RCO pulse from the right-most 4-bit counter for every 40,000 clock pulses.
▪ With this technique any modulus can be achieved by synchronous loading of the counter to the
appropriate initial state on each cycle.
1. How many decade counters are necessary to implement a divide-by-1000 (modulus1000) counter?
A divide-by-10,000?
2. Show with general block diagrams how to achieve each of the following, using a flipflop, a decade
counter, and a 4-bit binary counter, or any combination of these:
(a) Divide-by-20 counter
(b) Divide-by-32 counter
(c) Divide-by-160 counter
(d) Divide-by-320 counter
▪ In many applications, it is necessary that some or all of the counter states be decoded.
▪ The decoding of a counter involves using decoders or logic gates to determine when the counter is in
a certain binary state in its sequence. For instance, the terminal count function previously discussed is
a single decoded state (the last state) in the counter sequence.
▪ Suppose that you wish to decode binary state 6 (110) of a 3-bit binary counter. When Q2 = 1, Q1 = 1,
and Q0 = 0, a HIGH appears on the output of the decoding gate, indicating that the counter is at
state 6. This can be done as shown in Figure 4.3.38.
▪ This is called active-HIGH decoding. Replacing the AND gate with a NAND gate provides active-
LOW decoding
Decoding Glitches
By Abdulaziz J. Sequential Circuit Design 6/1/2024
Register and Counters Counters
87
1. A Digital Clock
Abdulaziz J.
Email:-
[email protected]