Professional Documents
Culture Documents
Question:
Implement an FSM with the following specification:
• The set of input symbols is Σ = {a, b}.
• The set of output symbols is Λ = {Y, N }.
The behaviour of the FSM is as follows:
• The FSM outputs a Y at time instant k only if the last 4 inputs were
either
abab
baba
(that is, either x(k) = a, x(k − 1) = b, x(k − 2) = a, x(k − 3) = b or x(k) = b, x(k − 1) = a, x(k − 2) = b,
x(k − 3) = a). Otherwise the FSM outputs N .
Solution:
1. The abstract Mealy Machine after minimization looks like following:
Reset
RST
b/N a/N
b/N a/N
Sb Sa
b/N a/N
a/N b/N
b/N a/N
Sba Sab
b/N a/N
a/Y
Sbab Saba
b/Y
Fig. 1: State Diagram for the Mealy Machine
x S2 S1 S0 y S2 S1 S0
0 0 0 0 0 0 0 1
0 0 0 1 0 0 0 1
0 0 1 0 0 1 0 0
0 0 1 1 0 1 0 1
0 1 0 0 0 0 0 1
0 1 0 1 0 0 0 1
0 1 1 0 1 1 0 1
0 1 1 1 d d d d
1 0 0 0 0 0 1 0
1 0 0 1 0 0 1 1
1 0 1 0 0 0 1 0
1 0 1 1 0 0 1 0
1 1 0 0 0 1 1 0
1 1 0 1 1 1 1 0
1 1 1 0 0 0 1 0
1 1 1 1 d d d d
Using K-map for minimization of Output logic in terms of input and present states.
S1S0
xS2
d 1
1 d
Output y= x S2 S 0 + x̄ S2 S 1
1 1
d 1
1 1 d
Therefore nS2 can be written as nS2 = reset
¯ ( x̄ S1 + x S2 S¯1)
Similarly,
S1S0
xS2
d
1 1 d 1
1 1 1 1
nS1= reset
¯ x
S1S0
xS2
1 1 1
1 1 d 1
D
1
nS0= reset
¯ ( S¯2 S̄1 S 0 + x̄ S2 + x̄ S̄ 1+ x̄ S 0 )
5.
Solution 2:
3. Here one-hot encoding is used for the states
• For input reset and x variables are used
variables
reset x
symbol
sreset 1 don’t care
a 0 0
b 0 1
• The output symbol is encoded in 2 bit
symbol variable(y)
Y 1
N 0
S 1= Reset
¯ (( S 0+ S 1+ S 4 + S5 ) x̄ )
S 2= Reset
¯ ( x (S 0 +S 2 +S 3 +S 6 ))
S 3= Reset
¯ (S1 x )
S 4 = Reset(S
¯ 2 x̄)
S 5= Reset
¯ ( x̄ (S 3 +S 6 ))
S 6= Reset
¯ (x (S4 + S 5))