|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MOORE FINITE STATE MACHINE: CONTROL CIRCUIT FOR
|
State | Conditions | |||
---|---|---|---|---|
Neither | Front | Rear | Both | |
Closed | ||||
Open |
Figure 3: Empty State Transition Table
Next we fill the table by following the arrows in the state diagram. For instance, the arrow that goes from closed to open is labeled front; which means if the door is closed and the condition is front then the door will go open. So in Figure 4, we write open in the cell where closed and front intersect.
State | Conditions | |||
---|---|---|---|---|
Neither | Front | Rear | Both | |
Closed | Open | |||
Open |
Figure 4: State Transition Table with one cell
Figure 5 represents the completed state transition diagram. I add a few more labels to make the table easier to read. You should check Figure 5 against Figure 1 to make sure that the information match exactly.
Given state of door | Shopper location | |||
---|---|---|---|---|
Neither | Front | Rear | Both | |
What will happen to door (Next State) | ||||
Closed | Closed | Open | Closed | Closed |
Open | Closed | Open | Open | Open |
Figure 5: State Transition Table
Nearly all designers use this table. As a result, different people call the table by different names: state table, excitation table, flow table, state assigned table, etc. Whatever name you choose to call the table, make sure your audience knows what you are talking about.
Because the table represents the operation of a logic circuit, it makes sense to replace the states with 0s and 1s: Closed = 0; Open = 1. Hence, Figure 5 becomes Figure 6.
Given state of door | Shopper location | |||
---|---|---|---|---|
Neither | Front | Rear | Both | |
What will happen to door (Next State) | ||||
0 | 0 | 1 | 0 | 0 |
1 | 0 | 1 | 1 | 1 |
Figure 6: Excitation Table
Some designers go further. They call the front pad F, the rear pad R, the given state q, and the next state Q; hence, changing the labels of the table. And they change the pad signals to 0s and 1s so that Neither becomes RF = 00, Front becomes RF = 01; Rear becomes RF = 10; Both becomes RF = 11. Hence, Figure 6 becomes Figure 7.
Given state of door q | Shopper Location RF |
|||
---|---|---|---|---|
00 | 01 | 10 | 11 | |
What will happen to door (Next State Q) | ||||
0 | 0 | 1 | 0 | 0 |
1 | 0 | 1 | 1 | 1 |
Figure 7: State Assigned Table
I told you this table were famous!
Now for the cool trick: if we interchange column 10 with column 11, Figure 7 becomes a K-map! And from the K-map we can get the logic expression for Q, which we do next.
Given state of door q | Shopper Location RF |
|||
---|---|---|---|---|
00 | 01 | 11 | 10 | |
What will happen to door (Next State Q) | ||||
0 | 0 | 1 |
0 | 0 |
1 | 0 | 1 |
1 |
1 |
Figure 8: K-Map
Q = R' • F + q•R.
This is our Boolean function, and Q is the next state of the door.
Normally at this point we would say our work is done and implement the circuit directly from the Boolean expression. But if you try to build this circuit, you will find that q does not have a source. We know that signal F is coming from the front pad and that signal R is coming from the rear pad. But where is signal q coming from?
Intuitively, we know that q is whatever Q was previously. In other words, if we run the control circuit five times, then q(t1) = Q(t0), … q(t5) = Q(t4). This means the circuit must find a way to remember the value of Q, so it can use the value as q next time it has to run. To remember past information, digital systems use flipflops as storage units. Hence, we must input the value of Q into a flipflop. And when we need the value to use as q, simply get it from the output of the flipflop.
We create the circuit as below, linking Q to q using a D-flipflop.
In reality, which flipflop you use depends on which flipflop you have available. I choose a D-flipflop above because it was convenient. Recall how a D-flipflop works: after each clock cycle, the output becomes the input. Since that's exactly what our control circuit needs to do with Q and q, the D-flipflop was an easy choice.
But what if you only have a JK flipflop? Then you would apply the rules of a JK flipflop to the excitation table in Figure 7 in order to get the input equations for J and K. The rules for a JK flipflop are simple, see Figure 9 below:
- If the flipflop is to go from state 0 to state 0, then J=0 and K=d (d means don't care; you choose whatever you want for K, 0 or 1).
- If the flipflop is to go from state 0 to state 1, then J=1 and K=d.
- If the flipflop is to go from state 1 to state 1, then J=d and K=0.
- If the flipflop is to go from state 1 to state 0, then J=d and K=1.
q | Q | J | K | |
---|---|---|---|---|
0 | 0 | 0 | d | |
0 | 1 | 1 | d | |
1 | 0 | d | 1 | |
1 | 1 | d | 0 |
Figure 9: JK Flipflop Characteristic Table
Figure 10 is a typical way of changing an excitation table to accommodate the JK flipflop. We basically create an extra column for JK under each RF value and then evaluate JK using the characteristic table in Figure 9.
Present State |
Flipflop Inputs | |||||||
---|---|---|---|---|---|---|---|---|
RF = 00 | RF = 01 | RF = 11 | RF = 10 | |||||
q | Q | JK | Q | JK | Q | JK | Q | JK |
0 | 0 | 0d | 1 | 1d | 0 | 0d | 0 | 0d |
1 | 0 | d1 | 1 | d0 | 1 | d0 | 1 | d0 |
Figure 10: Excitation Table with JK Flipflops
To get the Boolean expression for J, we assemble all the J values in one table, as in Figure 11 below. And since the table is already in K-map form, we simply extract the expression: so that J = R' • F.
q | RF = 00 | RF = 01 | RF = 11 | RF = 10 |
---|---|---|---|---|
0 | 0 | 1 |
0 | 0 |
1 | d | d |
d | d |
Figure 11: Karnaugh map for J input of flip flop
Doing similarly for K in Figure 12, we get K = R' • F'.
q | RF = 00 | RF = 01 | RF = 11 | RF = 10 |
---|---|---|---|---|
0 | d |
d | d | d |
1 | 1 |
0 | 0 | 0 |
Figure 12: Karnaugh map for K input of flip flop
We show the JK version of the circuit below. Notice how using a JK flipflop obviates the need to get feedback data from the state variable q. That often happens; sometimes using the right flipflop can reduce the complexity of a circuit.
While it is always possible to build sequential systems that do not depend on the passage of time (i.e. asynchronous systems), it is often easier to build machines that do indeed depend on some representation of time. We live in a temporal universe. For us time is always continual. Hence, in both the D-flipflop and the JK flipflop versions of the control circuit, we use a time signal to regulate the circuit. In reality the source of the time (CLK) signal can be an actual clock or any persistent system. We do not account for the CLK signal in the Boolean expressions because the CLK signal comes standard with the flipflops.