„I Know What You Did Last Cycle“
The most important term for the upcoming topics is the word state. But what is a state?
It is a unique situation, where the possible next steps (= possible next states), the inner behavior, or the outputs are distinguishable from other situations.
Here are some practical examples:
Sequential logic is used to describe logic circuits that show internal states („stateful logic“), and therefore have at least one memory element (= flip-flop).
The following terminology is used in the upcoming explanations:
The Abbildung 12 shows the different terms in an abstract diagram. The „current“ output values are here the values, which are shown after the delay time of the gates (about some nanoseconds).
The principle interior of the black box in Abbildung 12 was already shown in one practical application in the previous chapter: We saw, that we need the combination of combinatorial logic and some storage components. Additionally, both have to be connected by feeding back some of the outputs back to the combinatorial logic. The output bits $\vec{Y}$ can result either from the combinatorial logic or the flip-flops. This is shown in Abbildung 13.
Abbildung 1 depicts a state machine.
One simple example of sequential logic is shown in Abbildung 4. There, the combinatorial logic is explicitly shown. Depending on the input $X$ the output $\vec{Y}$ shows an up-counting 2-bit value counting $0 \rightarrow 1 \rightarrow 2 \rightarrow 3 \rightarrow 0 \rightarrow ...$. This is a simple state machine that will be used in the net chapters
The up-counter in the previous sub-chapter was able to count from $0$ to $3$. But what can we do to count differently, like $ 7, 6, 1, 5$? To understand this, a simpler situation will be investigated. So, let's look at how one can create an up-counter counting $1, 2, 3, 4$.
The first idea might be to use what we already have: an up-counter, which facilitates 2 flip-flops to result in 2-bit output. The wanted new state machine needs 3 bits for the output, since the binary representation of our outputs is $001_2$,$010_2$,$011_2$,$100_2$.
A simple idea is to take the 2-bit up-counter and add a combinatorial logic in behind it. This logic shall convert the 2-bit up-counter output $00_2$ into $001_2$, the $01_2$ into $010_2$, $10_2$ into $011_2$ and $11_2$ into $101_2$. This can be logic can be created by:
When this is done, the result looks like Abbildung 5
This resembles a so-called Moore Machine.
A state machine is a Moore Machine when the output values $\vec{Y}$ depend only on the state values $\vec{Z}$. For this the Moore machine uses two combinatorial circuits:
The properties of a Moore machine are:
When looking at Abbildung 5 a bit more in detail, one can see, that the outputs $Y_0$ and $Y_1$ just equals the output of the first combinatorial logic circuit. This is not surprising: the input logic circuit shows the $\vec{Z}(n+1)$ and this is for the counter always the stored value plus one, except when the maximum is reached.
With this information, the state machine in Abbildung 5 can be simplified by using the outputs of the input circuit for $Y_0$ and $Y_1$. This is shown in Abbildung 6.
A state machine is a Mealy Machine when the output values $\vec{Y}$ depend not only on the state values $\vec{Z}$. For this, the mealy machine uses two combinatorial circuits:
The properties of a mealy machine are:
The mealy machine in Abbildung 6 can show invalid outputs. Try to find these by the correct timing of the input $X=1$ or $X=0$.
A state machine is a Medvedev Machine when the output values $\vec{Y}$ are directly given by the state values $\vec{Z}$. For this, the Medvedev machine uses only one combinatorial circuit. This circuit process the input values $\vec{X}(n+1)$ and the state values $\vec{Z}(n)$ (of the previous step) in such a way that the new states $\vec{Z}(n+1)$ and the output values $\vec{Y}(n+1)= \vec{Z}(n+1)$ are generated.
The properties of a Medvedev machine are:
The Abbildung 8 shows the principle differences in the architecture of the state machines.
This chapter is only focussing on Moore machines.
The diagrams of different states are well known from physics for example the state diagram (or better: phase diagram) of water, where its three states are: solid ice, liquid water, and gaseous steam. The possible state transitions are due to temperature increase or decrease.
In Abbildung 9 image (1) the states of water are shown on the temperature axis. When only the state transitions are relevant, the states are simplified to a circle, showing the state name and behavior. The transitions are depicted as arrows, where the needed condition is written onto (See Abbildung 9 image (2) ). This diagram is called state transition diagram.
For matter not only the dimension „temperature“ is important, but also the „pressure“. The full phase diagram is shown in Abbildung 10 image (1). By this, another variable is available and more transitions. These can be drawn into the state transition diagram (Abbildung 10 image (2)).
In Germany, often one has to pay for entering the toilet. An example of such an entrance control system is shown in Abbildung 11. In this (artificial) example, one can pay either 50ct or 1€.
Once paid, the turnstile will release and one can enter. Once the turnstile was pushed the entrance is closed again.
The Abbildung 12 the state transition diagram is drawn.
Important here are some additional considerations:
Out of this state transition diagram, one can create a table-like representation, see Abbildung 13.
the inputs, outputs, and states have to be encoded into binary, to investigate this table a bit more. How the binary value is connected to the outputs does not matter. We will choose the following coding:
This table is shown in Abbildung 14 and is called state transition table.
Interestingly, the logic circuit for this state transition table was already part of the course: it is the RS flip-flop! When looking deeper into the table in Abbildung 14 one can substitute $Xc$ with $S$ (as in Set) and $Xp$ with $R$ (as in Reset) to directly get the truth table of the RS flip flop.
In the previous sub-chapter (6.2) we had a look at different implementations of an up counter and in this chapter the way to represent a state machine via a state transition diagram. So one question is: what do these up-counters look like in the state transition diagram?
The answer is quite simple: there are 4 states, so 4 „circles“ are needed. These states need to have circular connections to get the wanted increase from $00_2=0_{10}$, to $01_2=1_{10}$, to $10_2=2_{10}$, to $11_2=3_{10}$ and then back to $00_2=0_{10}$. The first state shall be $00_2=0_{10}$, so after the reset, the state machine will get entered there. Finally, the output vector is similar to the state vector. With a deeper look at it: This is therefore in particular a Medvedev machine!
In Abbildung 15 both types of state machines are shown.
The shown state transition diagram can easily be created in the tool Digital:
Analysis
» Finite State Machine
Create
» Create Counter
» 4 States
Tasks:
Create
» State Transition Table
in order to see the state transition tableCreate
» Circuit
The next step is to transform this into an up counter from $1...4$. For this simply the output has to be changed. This means the numbers in the „lower half of the circles“ have to be adapted (see in <imfref pic16>).
This exercise is directly attached to exercise 6.3.3.2
The counter shall now be changed in such a way, that it counts $1 - 2 - 3 - 4$. For this: right-click on each present state beginning with state 0 and add for Outputs
$Y=001$ and up-counting (see image).
Tasks:
Looking at what we got, there is one part missing: the state machine does not have any input… So the input vectors have to be added to the transition (arrows). For an activatable counter, there only has to be one input $X$, which acts as an enable input.
This exercise is directly attached to exercise 6.3.3.2
The last step is to add the transitions: right-click on all transitions and add $X=1$ as a Condition
.
Tasks:
This exercise is directly attached to exercise 6.3.3.3
With the state machine in 6.3.3.3, it is also possible to create a state machine that can resemble a traffic light state machine. This shall transit from red to red-yellow, to green, to yellow, and then back to red.
Use the following addition to the resulting circuit to get the light running:
Tasks:
The following state transition diagram shall be given:
Out of this orientation, the next columns can be derived:
Design a state machine, which results in an output of the following (decimal) numbers: $4 - 5 - 2 - 1 - 6 - 7 - 0 - 3 - 4 - ...$
Design a state transition diagram for an automatic milling machine as a Moore machine, under the following conditions:
Explicitly draw all possible transitions.
Develop a sequential circuit, which creates the following output
Develop a sequential circuit, which allows driving the following LED sequence
Develop a sequential circuit, which generates a clock-driven up-counter from $1..6$. The not required states shall lead after one clock cycle to the state of number $1$.