Sequence Recognizer
Sequence Recognizer
Objectives
1. Design of synchronous sequential circuits with an example. 2. Construction of state diagrams and state tables/ 3. Translation of State transition table into excitation table. 4. Logic diagram construction of a synchronous sequential circuit
The next step is to derive the state table of the sequential circuit. A state table represents the verbal specifications in a tabular form. In certain cases state table can be derived directly from verbal description of the problem. In other cases, it is easier to first obtain a state diagram from the verbal description and then obtain the state table from the state diagram. A state diagram is a graphical representation of the sequential circuit. In the next step, we proceed by simplifying the state table by minimizing the number of states and obtain a reduced state table.
The states in the reduced state table are then assigned binary-codes. The resulting table is called output and state transition table. From the state transition table and using flip-flops excitation tables, flip-flops input equations are derived. Furthermore, the output equations can readily be derived as well. Finally, the logic diagram of the sequential circuit is constructed. An example will be used to illustrate all these concepts.
Sequence Recognizer
A sequence recognizer is to be designed to detect an input sequence of 1011. The sequence recognizer outputs a 1 on the detection of this input sequence. The sequential circuit is to be designed using JK and D type flip-flops. A sample input/output trace for the sequence detector is shown in Table 1.
Table 1: Sample Input/Output Trace Input Output 0 0 1 0 1 0 0 0 1 0 0 0 1 0 1 1 0 0 1 0 1 1 1 0 0 0 1 0 0 0 1 0 1 1 1 0 0 0 0 0
We will begin solving the problem by first forming a state diagram from the verbal description. A state diagram consists of circles (which represent the states) and directed arcs that connect the circles and represent the transitions between states. In a state diagram: 1. The number of circles is equal to the number of states. Every state is given a label (or a binary encoding) written inside the corresponding circle. 2. The number of arcs leaving any circle is 2n, where n is the number of inputs of the sequential circuit. 3. The label of each arc has the notation x/y, where x is the input vector that causes the state transition, and y is the value of the output during that present state. 4. An arc may leave a state and end up in the same or any other state.
Before we begin our design, the following should be noted. 1. We do not have an idea about how many states the machine will have. 2. The states are used to remember something about the history of past inputs. For the sequence 1011, in order to be able to produce the output value 1 when the final 1 in the sequence is received, the circuit must be in a state that remembers that the previous three inputs were 101. 3. There can be more than one possible state machine with the same behavior.
Thus, the state machine given in the figure will require two flip-flops log2(4)=2. We assign letters A and B to them.
Table 2: State Table of the Sequence Recognizer Present State S0 S1 S2 S3 Next State X=0 X=1 S0 S1 S2 S1 S0 S3 S2 S1 Output X=0 X=1 0 0 0 0 0 0 0 1
Table 3: Alternative Format of Table 2 Inputs of Combinational Circuit Present State Input S0 0 S0 1 S1 0 S1 1 S2 0 S2 1 S3 0 S3 1 Next State S0 S1 S2 S1 S0 S3 S2 S1 Output 0 0 0 0 0 0 0 1
State Assignment
The states in the constructed state diagram have been assigned symbolic names rather than binary codes. It is necessary to replace these symbolic names with binary codes in order to proceed with the design. In general, if there are m states, then the codes must contain n bits, where 2n m, and each state must be assigned a unique code. There can be many possible assignments for our state machine. One possible assignment is show in Table 4.
Table 4: State Assignment State S0 S1 S2 S3 Assignment 00 01 10 11
The assignment of state codes to states results in state transition table as shown.
It is important to mention here that the binary code of the present state at a given time t represents the values stored in the flip-flops; and the next-state represents the values of the flip-flops one clock period later, at time t+1.
Table 5: State Transition Table Inputs of Combinational Circuit Present State Input A B X 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 Next State A 0 0 1 0 0 1 1 0 B 0 1 0 1 0 1 0 1 Output Y 0 0 0 0 0 0 0 1
What remains to be determined is the combinational circuit which specifies the external outputs and the flip-flop inputs. The state transition table as shown can now be expanded to construct the excitation table for the circuit.
Since we are designing the sequential circuit using JK and D type flip-flops, we need to correlate the required transitions in state transition table with the excitation tables of JK and D type-flip-flops. The functionality of the required combinational logic is encapsulated in the excitation table. Thus, the excitation table is next simplified using map or other simplification methods to yield Boolean expressions for inputs of the used flip-flops as well as the circuit outputs.
For deriving the actual circuitry for the combinational circuit, we need to simplify the excitation table in a similar way we used to simplify truth tables for purely combinational circuits. Whereas in combinational circuits, our concern were only circuit outputs; in sequential circuits, the combinational circuitry is also feeding the flip-flops inputs. Thus, we need to simplify the excitation table for both outputs as well as flip-flops inputs. We can simplify flip-flop inputs and output using K-maps as shown in Figure 4. Finally the logic diagram of the sequential circuit can be made as shown in Figure 5.