









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










Sequential circuits are also called finite state machines (FSM) , which is a more formal name that often found in technical literature. The name derives from the fact that the functional behavior of these circuits can be represented using a finite number of states. A sequential circuit or finite state machine (FSM) can be described or specified in three ways:
a. Algebraically using Boolean equations called Flip-flop input equations. b. State Table. c. State Diagram.
These three representations of a sequential circuit can be determined from the inputs, outputs, and present state of the circuit. As stated in chapter 1, there are two fundamental types of finite-state machines: Mealy and Moore. Sequential circuits, in which the outputs depend on the inputs as well as on the states, are referred to as Mealy model whereas if the outputs depend only on the states they are referred to Moore model. Analysis of a sequential circuit (Mealy or Moore) starts from a given sequential logic diagram or flip-flop input equations of a sequential circuit and asks to obtain the state table or the state diagram that specifies the behavior of the sequential circuit. In this section, first we introduce an algebraic representation for specifying the logic diagram of a sequential circuit. We then present a state table and state diagram that describe the behavior of the circuit. Specific examples will be used throughout the discussion to illustrate the various procedures.
The logic diagram of a sequential circuit consists of memory elements (flip-flops) and often a combinational circuit. The part of the combinational circuit that generates the signals for the inputs of the flip-flops can be described by a set of Boolean functions called flip-flop input equations. These equations fully specify and represent the logic diagram of a sequential circuit. An example of a sequential circuit (Meal circuit) is shown in Figure 2.1. The circuit consists of two RS-type flip-flops labeled A and B, one input variable X, and one output variable Y. it can be specified by the following Boolean equations:
As a second example consider the Mealy type sequential circuit shown in Figure 2.2. The circuit consists of two D-type flip-flops labeled A and B, one input variable X, and one output variable Y. It can be specified by the following Boolean equations:
The functional relationships between the inputs, outputs, and flip-flop states of a sequential circuit can be enumerated in state table as shown in Table 2.1 for the sequential circuit shown in Figure 2.2. The state table consists of four sections labeled present state, input, next state, and output. The present state reflects the states of the flip-flops before the occurrence of a clock pulse. The next state shows the states of the flip-flops after the application of a clock pulse and the input and the output sections list the values of the input and the output variables during the present state.
Table 2.1 State Table for of Figure 2.
Present state Input Next state output A B X A B Y 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 1 0 1 1 1 1 0 1 0 0 0 0 1 1 0 1 1 0 0 1 1 0 0 0 1 1 1 1 1 0 0
The state table shown above is one dimensional since the input is in a separate column. A two-dimensional state table having the present state tabulated in the left column and the inputs tabulated across the top row is also frequently used. Table 2. shows a two-dimensional state representation of Table 2.1.
Table 2.2 Two-dimensional State Table for the Circuit of Figure 2.
Present
state
Next state Output X = 0 X = 1 X = 0 X = 1 A B A B A B Y Y 0 0 0 0 0 1 0 0 0 1 0 0 1 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 0 1 0
As an example of a Moore model circuit, suppose we want to obtain the logic diagram and state table of a sequential that is specified by the flip-flop input equation:
separated by a slash. The input value during the present state precedes the slash, and the value following the slash gives the output value during the present state with the given input applied. For example, the directed line from the state 00 to state 01 is labeled 1/0, meaning that when the sequential circuit is in the present state 00 and the input is 1, the output is 0. After the next clock transition, the circuit goes to the next state, 01. If the input changes to 0, then the output becomes 1, but if the input remains at 1, the output stays at 0. This information is obtained from the state diagram along the two directed lines emanating from the circle with state 01. A directed line connecting a circle with itself indicates that no change of state occurs.
The state diagram of Figure 2.4(b) is for the Moore sequential circuit of Figure 2.3. The circuit has only one flip-flop with two states, two binary inputs, and one
output that depends only on the state of the flip-flop. For such a Moore model circuit, the slash on the directed lines is not included, since the outputs depend only on the state and not on the input values. Instead, the output is written inside a circle after a slash as (state/output). There are two input conditions for each state transition in the diagram, and they are separated by a comma. When there are two input variables, each state may have up to four directed lines coming out of the corresponding circle, depending upon the number of states and the next state for each binary combination of the input values.
There is no difference between a state table and a state diagram, except for their manner of representation. The state table is easier to derive from a given logic diagram or input equations. The state diagram follows directly from the state table.
Example 2.
A Moore sequential circuit with two JK flip-flops A and B and one input X is specified by the following flip-flop input equations
And output equation
a. Draw the logic diagram. b. Derive the state table. c. Obtain the state diagram.
Solution
Figure 2.5 shows the logic diagram, the state table, and state diagram of the sequential circuit.
The design of clocked sequential circuits starts from a set of specifications and culminates in a logic diagram or a list of Boolean functions from which the logic diagram can be obtained. In contrast to a combinational circuit, which is fully specified by a truth table, a sequential circuit requires a state table or state diagram for its specification. Thus, the first step in the design of a sequential circuit is to obtain a state diagram or an equivalent representation such as a state table from the problem statement.
A synchronous sequential circuit is made up of flip-flops and combinational gates. The design of the circuit consists of choosing the flip-flops and finding a combinational circuit structure which, together with the flip-flops, produces a circuit that fulfils the stated specifications. The number of flip-flops is determined from the number of states in the circuit; n flip-flops can represent up to 2 n^ binary states. The combinational circuit is derived from the state table by evaluating the flip-flop input equations and output equations. In fact, once the type and the number of flip-flops are determined, the design process involves a transformation from a sequential circuit problem into a combinational circuit problem. In this way, the techniques of combinational circuit design can be applied.
The following is a procedure for the design of sequential circuits:
Example 2. Design a sequential circuit for the state diagram shown in Figure 2.8(a) using D flip- flops. The sequential circuit has two flip-flops A and B, an input X, and an output Y. Solution: The state table of the circuit is listed in Figure 2.8(b) and it is derived directly from the state diagram. The flip-flop input equations are obtained from the next state values as listed in the table. Note that the values listed in the column labeled next state are
identical to the values listed in the column labeled flip-flop inputs. Thus, when designing with D flip-flops the column labeled flip-flop inputs can be eliminated. The complete design appears in Figure 2.8.
Example 2. Design a Moore sequential circuit with D flip-flops whose state diagram is shown in Figure 2.9(a). The circuit consists of two flip-flops, one input X , one output Y. Solution: The complete design is shown in Figure 2.9.
A circuit with n flip-flops would have maximum 2 n^ states. There are occasions when
a sequential circuit may use less than this maximum number of states. State that are not used in specifying the sequential circuit are not listed in the state table. When simplifying the flip-flop input equations and output equations, the unused states can be treated as don't-care conditions. This idea would be illustrated in the following example.
Example 2.
Design the sequential circuit whose state diagram is shown in Figure 2.10(a) using RS flip-flops. Solution: The state diagram shown in Figure 2.10(a) consists of five states and that means it would require three flip-flops to implement the sequential circuit. In the state table (Table 2.10(b), the three flip-flops are defined as A, B, and C whereas the input as X. With three flip-flops, it is possible to specify eight states, but in this example the state diagram and the state table list only five states. Thus, there are three unused states which are 101, 110, and 111 that are not included in the state table. When the input X, with value 0 or 1, is taken into account with the present state values, we obtain six unused states for the present state and input columns: 1010, 1011, 1100, 1101, 1110, and 1111. These six combinations (or minterms) are not listed in the state table and hence can be treated as don't-care minterms.
The flip-flop input equations and the output equation which form the combinational circuit part of the sequential circuit are simplified in the K-maps of Figure 2.10(c) and the logic diagram is shown in Figure 2.10(d). Note that the six don't-care minterms are used in all k-maps and are marked as X in their corresponding squares: 10, 11, 12, 13, 14, and 15.
One factor neglected up to this point in the design is the initial state of a sequential circuit. When power is first turned on in a digital system, one does not know in what state the flip-flops will settle. It is customary to provide s master-reset input whose purpose is to initialize the states of all flip-flops in the system. Typically, the master reset is a signal applied to all flip-flops asynchronously before the clocked operations start. In most cases flip-flops are cleared to 0 by the master-reset signal, but some may be set to 1.
It is possible that outside interference (noise) or malfunction will cause the circuit to enter one of the unused states. Thus, it is sometimes desirable to specify fully or at least partially the next state values or output values for the unused states. If the sequential circuit circulates among invalid states, there will be no way to bring it back to its intended sequence of state transitions. Although one can assume that this undesirable condition is not supposed to occur, a careful designer must ensure that this situation never occurs. Depending on the function and application of the circuit, a number of ideas may be applied. First, the outputs for the unused states may be
specified so that any actions that result from entry into and transitions between the unused states are not harmful. Second, an additional output may be provided or an unused output code employed which indicates that the circuit has entered an incorrect state. Third, to ensure that a return to normal operation is possible without resetting the entire system, the next state behavior for the unused states may be specified. Typically, next states are selected such that one of the normally occurring states is reached regardless of the input values within a few clock cycles. The decision as to which of the three options to apply, either individually or in combination, is based on the application of the circuit or the policies of a particular design group. Therefore, if a circuit contains unused states, the circuit must be investigated to determine the effect of these unused states. The next state from invalid states can be determined from the analysis of the circuit as will be illustrated in the following example.
Example 2. Analyze the sequential circuit obtained in example 2.6 and determine the effect of the unused states.
Solution: The map of Figure 2.10 can be used to find the next state from each of unused states. Take, for instance, the unused state 101. If the circuit, for some reason, happen to be in the present state 101, an input X = 0 will transfer it to another (or the same) next state. We first investigate minterm ABCX = 1010. From the maps, we see that this minterm is included in the functions for S (^) B , S (^) C and Y. Therefore, flip-flops B and C
and function Y will be set to 1 but flip-flop A will not change (remains at 1). Since the
Example 2. Design a sequential circuit with one input X and one output Y that recognizes (detects) the sequence 110 applied to its input X by asserting its output Y high whenever the sequence is detected. Design the circuit with Mealy and Moore models. A sample input/output trace for a Mealy circuit: X 1011000100011010110110111100001101110 Y 0000100000000100001001000010000010001 A sample input/output trace for a Moore circuit: X 10110001000110101101101111000011011100
Y 00000100000000100001001000010000010001
A key factor in the formulation of any state diagram is to recognize that states are used to "remember" something about the history of the input. For example, for the sequence 110, to be able to produce the output value 1 coincident with the final 0 in the sequence, the circuit must be in a state that "remembers" that the previous two inputs were 11. With this concept in mind, we begin the formulation of the state diagram by defining an arbitrary initial state A as the starting point for deriving the state diagram. If the input X is 1 while the circuit in state A, the output Y is 0 indicating that the sequence has not occurred. After a clock pulse a transition from state A to state B occurs to remember the occurrence of the first 1 in the sequence and the output Y remains at 0. On the other hand, if the input X is 0, while the circuit in state A, the output Y is 0 and when a clock pulse occurs the circuit remains in state A. While the circuit in state B, if the input X is 1, a transition to a third state C occurs after the second clock pulse to confirm that the first two 1's of the sequence have occurred. On other hand, a 0 on the input X, while the circuit in state B, returns the circuit to state A to indicate that the first 1 does not constitute the first bit in the sequence. While the circuit in state C, if the input X is 0, the output Y is asserted high to indicate that the complete sequence has occurred and when a clock pulse occurs, a transition from state C to state A would take place. On the other hand, if the input X is 1, while the circuit in state C, the output Y is 0 and when a clock pulse occurs the circuit remains in state C and it remains in that state as long as the input X is 1. While the circuit in state C it remembers the occurrence of the first two 1's in the sequence. The final Mealy state diagram is shown in Figure 2.13(a). Similarly, the Moore state diagram can be obtained as shown in Figure 2.13(b). The simplified flip- flop input equations and output equations for both Mealy and Moore models are given by the k-maps shown in Figure 2.13 from which the logic diagrams, not shown here, can be drawn.
In order to understand the difference between Mealy and Moore Model circuits, the timing diagrams for example 2.8 for both models, showing the input/ output waveforms, are shown in Figure 2.14. The differences can be summarized as follow:
Example 2. Design a sequential circuit with one input X and one output Y that recognizes (detects) the sequence 10010 applied to its input X. The circuit should be able to recognize the sequence anywhere in a long input sequence by asserting its output Y high whenever the sequence is detected. Derive only the state diagrams for Mealy and Moore models by considering the following two cases: a. Overlapping is allowed. b. (^) Overlapping is not allowed. Solution: a. Overlapped case The following is a sample input/output trace for overlapped case X 010100101011001001010100100 Y 000000010000000100100000010 Mealy output Y 000000001000000010010000001 Moore output Note that sequences leading to an output can overlap i.e., the final ---10 in the above sequence can form the beginning of a new sequence as indicated by double line in the input X. The overlapped state diagrams for Mealy and Moore can be derived as shown in Figure 2.15.
b. No overlapped case The following is a sample input/output trace for no overlapped case X 010100101011001001010100100 Y 000000010000000100000000010 Mealy output Y 000000001000000010000000001 Moore output
Mealy and Moore state diagrams for no overlapped case are shown in Figure 2.16.
.
Example 2.
through the state transitions from 00 to 11to 10 to 01, back to 00, and then repeats. Anytime the circuit goes through one complete transition it asserts its output Z high
The state diagram, the state table, and the logic diagram of the sequential circuit are shown in Figure 2.20.
Example 2.
When a certain serial binary communication channel is operating correctly, all blocks of 0's are of even length and all blocks of 1's are of odd length. Find the state diagram of a circuit that will produce an output Z = 1 whenever a discrepancy from the above pattern is detected.
Example: X: 00100011101100 Z: 00000010001010
Solution:
It is possible to convert any given flip-flop to other flip-flops using sequential technique presented in the previous sections. This will be illustrated by means of examples.
Example 2.
Convert a D flip-flop (FF) to a JK FF and a T FF.
Solution:
This example, in other words, ask us to design a JK FF and a T FF using D FF as a memory element where J, K, and T are external inputs to the combinational circuit that is part of the sequential circuit that implements these two FFs as shown in the block diagram of Figure 2.21. First, we construction state tables, one for JK FF and another for T FF to obtain the two combinational circuits indicted in Figure 2.21.
The state tables for JK FF and T FF can be obtained as shown in Figure 2.22(a) and (b), respectively. From the state tables the logic diagrams for JK FF and T FF are obtained as shown in Figure 2.22(c) and (d), respectively.
Example 2.
Convert a JK flip-flop (FF) to a D FF.
Solution:
In this example, we need to obtain a D flip-flop using JK flip-flop as a memory element. First, the state table is constructed considering D as an external input as shown in Figure 2.23 (a) from which the flip-flop input equations are obtained. Then logic diagram for the D flip-flop is drawn as shown in Figure 2.23 (b).
2.1 A sequential circuit with two D flip-flops A and B, two inputs X and Y, and one output Z is specified by the following input equations:
a. Draw the logic diagram of the circuit
b. Derive the state table
c. Derive the state diagram
2.2 A sequential circuit has three JK flip-flops A, B, and C , and input X. The circuit is specified by the following flip-flop input equations:
a. Draw the logic diagram of the sequential circuit specified by the above Boolean equations. b. Derive the state table.
2.9 Derive two state diagrams one for Mealy and another for Moore that has one input X and one output Z. The circuit should be capable of detecting the occurrence of either sequence 1001or 1101 anywhere in a long input sequence X and asserts its output Z high when one of the sequences occurs. Assume sequence overlap. The following is a sample input/output
X: 0101101001100110100011010 Z: 0000001001000100100000010
2.10 Derive two state diagrams one for Mealy and another for Moore that capable of recognizing the occurrence of either sequence 110 or 0110 anywhere in a long input sequence.
2.11 A sequential circuit has two inputs, X1 and X2, and one output Z. The circuit function is to compare the two input sequences occurring along its inputs X1 and X2. If X1 = X2 during any four consecutive clock cycles, the circuit asserts its output Z high to indicate that two identical sequences have occurred. Derive only the state diagram for the circuit. The following is a sample input/output: X1: 011011100011011101 X2: 111010100011101101 Z: 000010000111000001
2.12 Design a serial two’s complement circuit with one input X and one output Z_._ An arbitrary length binary number is entered one bit at a time through input X, starting with the least significant bit. The circuit yields the two's complement at output Z on the same cycle.
2.13 Design a sequential circuit which produces an output Z = 1 whenever any of the following input sequences occur: 1100, 1010, or 1001. The circuit resets to its initial state after a 1 output is generated. Find the state diagram.
2.14 When a certain serial binary communication channel is operating correctly, all blocks of 0's are of even length and all blocks of 1's are of odd length. Find the state diagram of a circuit that will produce an output Z = 1 whenever a discrepancy from the above pattern is detected.
Example: X: 00100011101100 Z: 00000010001010
2.15 Design a Mealy and a Moore circuits whose output is 1 iff (if and only if) the input has been 1 for at least three consecutive clock cycles. The following is a sample input/output for both models:
Input X: 01111111011011101 Output Z: 000011111000000100 Moore output Z: 00011111000000100 Mealy output