You are on page 1of 3

STATE MACHINE DESIGN A 3-BIT GRAY CODE COUNTER

FIGURE 2 Figure 1 is the general diagram of a State Machine. There are two basic components in a state machine, Memory which are usually JK Flip-Flops, and Combinational Logic. To design a state machine, the JK flipflops are usually a counter which is a device that is known. The following procedure will allow us to design the combinational logic necessary to allow the counter to sequence through the binary patterns that we desire. THE STATE DIAGRAM Figure 2 shows the State Diagram for the 3-Bit Gray Code Counter. It shows the progression of states and the input and outputs. The arrow in the center shows the direction of the counter. However, it is possible to progress through the state table in the reverse order. If we start at 000, the next state is 001. From 001 the next state is 011. We progress through all possible states until the sequence repeats. We use the State Diagram to create the Next State Table which is shown in Table 1. NEXT STATE TABLE PRESENT STATE QC 0 0 0 0 1 1 1 1 QB 0 0 1 1 1 1 0 0 QA 0 1 1 0 0 1 1 0 QC 0 0 0 1 1 1 1 0 NEXT STATE QB 0 1 1 1 1 0 0 0 QA 1 1 0 0 1 1 0 0

FIGURE 1

TABLE 1 Table 1 contains the Next State Table for a 3-bit Gray Code Generator, and is created from the State Diagram. It merely lists or specifies the output after the next clock pulse for a specific binary pattern

STATE MACHINE DESIGN A 3-BIT GRAY CODE COUNTER on the outputs from the previous state. QC is the Q output of the MSB while QA is the output of the LSB. Once we have the Next State Table, we will use this to create the State Transition Table. STATE TRANSITION TABLE STATE TRANSISTIONS QC 00 00 00 01 11 11 11 10 QB 00 01 11 11 11 10 00 00 QA 01 11 10 00 01 11 10 00 OUTPUT CONDITION QC R/H R/H R/H S/T S/H S/H S/H R/T QB R/H S/T S/H S/H S/H R/T R/H R/H TABLE 2 The Transition Table shows the flip-flop inputs required to make the counter go from the present state to the proper next state. Each transition can be accomplished by two of the four possible conditions: For S/T we see an entry of 0 1. This means we can have a 0 to 1 transition by Setting the flip-flop or by Toggling the flip-flop. For Set, J=1 and K = 0. For Toggle, J = 1 and K = 1. Therefore, J must be 1, but K can be 0 or 1. Since K can be either 0 or 1, the K input is X (Don't Care), we place 1 in the J column and X in the K column For S/H, the entry is 1 1. For Set, J = 1 and K = 0. For Hold, J = 0 and K = 0. Therefore, the flipflop inputs for J and K is X 0. For R/T, the entry is 1 0. For Set, J = 0 and K = 1. For Toggle, J = 1 and K = 1. Therefore, the flipflop inputs for J and K is X 1. For R/H, the entry is 0 0. For Set, J = 0 and K =1. For Hold, J = 0 and K = 0. Therefore, the flipflop inputs for J and K is 0 X. QA S/T S/H R/T R/H S/T S/H R/T R/H FLIP-FLOP INPUTS JC KC 0 X 0 X 0 X 1 X X 0 X 0 X 0 X 1 JB KB 0 X 1 X X 0 X 0 X 0 X 1 0 X 0 X JA KA 1 X X 0 X 1 0 X 1 X X 0 X 1 0 X

STATE MACHINE DESIGN A 3-BIT GRAY CODE COUNTER K-MAP The next step in a state machine design is to use the Transition Table to plot the KMAP for the counter. JC QC QB 0 0 1 1 0 1 1 0 QA 0 0 0 X X JC = QB QA 1 0 1 X X JB QC QB 0 0 1 1 0 1 1 0 QA 0 0 X 0 X JB = QC QA 1 1 X 0 X JA QC QB 0 0 1 1 0 1 1 0 QA 0 1 X X 1 JA = QA or JA = QB KC QC QB 0 0 1 1 0 1 1 0 QA 0 X X 0 0 KC = QB QA 1 X X 1 0 KB QC QB 0 0 1 1 0 1 1 0 QA 0 X 0 X 0 KB = QC QA or 1 X 0 X 1 KA QC QB 0 0 1 1 0 1 1 0 QA 0 X 1 1 X 1 0 X X 0 1 X 0 0 X

KA = QA or KB = QB QA KA = QB Note: In the above K-Map, the Boolean equation for KB, JA, and KA have two possible solution. You may use either, but not both. IMPLEMENTATION Now draw the logic diagram to implement the device.

You might also like