0% found this document useful (0 votes)
12 views4 pages

Cat 2 Solution

The document provides a detailed solution for a Moore Vending Machine system, including the generation of state tables, minimization of states, and the drawing of both minimized state diagrams and equivalent Mealy machines. It also outlines the implementation of the FSM using D flip-flops and includes the VHDL entity code for the system. The analysis of the system utilizes state transition tables and notes on equivalent states for simplification.

Uploaded by

Kevin Mutai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views4 pages

Cat 2 Solution

The document provides a detailed solution for a Moore Vending Machine system, including the generation of state tables, minimization of states, and the drawing of both minimized state diagrams and equivalent Mealy machines. It also outlines the implementation of the FSM using D flip-flops and includes the VHDL entity code for the system. The analysis of the system utilizes state transition tables and notes on equivalent states for simplification.

Uploaded by

Kevin Mutai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

DKUT, EEE DEPARTMENT,

EEE, TIE & B.ED(EET) YEAR III


EEE/ETI 3206 DIGITAL ELECTRONICS II CAT II SOLUTION
1). For the FSM in Figure 1 below representing a Moore Vending Machine system

D̄N̄
Reset

S1
D̄N̄ 0 D̄N̄ D̄N̄
D̄N̄
D N
S4 N S2 S3 D S7
1 0 0 1
D D̄N̄ N
D̄N̄

S5 S6 D̄N̄
1 0
N D
S8 S9
1 1

Figure 1: FSM of a Vending Machine system

Solution:

(i) Generate the state table of the system


From the state diagram, we can draw the following table

Table 1: State transition table

States Next state (DN) Output


00 01 10 F
S1 S1 S3 S2 0
S2 S2 S4 S5 0
S3 S3 S6 S7 0
S4 S1 − − 1
S5 S3 − − 1
S6 S6 S8 S9 0
S7 S1 − − 1
S8 S1 − − 1
S9 S3 − − 1

(ii) Using partition tables or otherwise, minimize the system states


Looking at states S4 , S7 and S8 , they go to state S1 for DN = 00 and remain as they don’t transition to any
other state for either DN = 01 or DN = 10. Further, they have the same outputs for DN = 00. Thus they are
equivalent i.e S7 = S8 = S4 . Looking at states S5 and S9 , both go to state S3 for DN = 00 and remain as they
don’t transition to any other state for either DN = 01 or DN = 10. Further, they have the same outputs for
both DN = 00. Thus they are equivalent i.e S5 = S9 .

Note:
Before we draw the final state table, look at states S2 and S6 , both of them transition back to themselves
for DN = 00, to S4 and S5 for DN = 01 and DN = 10 respectively, thus they are equivalent.

Removing the equivalent states results in Table 4 below


(iii) Draw the minimized state diagram
(iv) Draw the equivalent Mealy machine of the minimized system
To be able to draw the equivalent Mealy machine, it is important to note that for Mealy Machine, the output
is dependent on the present input and the next state. Knowing that, states S4 and S5 are not valid states since
they do not have next states for all possible inputs.
Figure 3 shows the equivalent Mealy machine.
Table 2: State transition table

States Next state (DN) Output


00 01 10 F
S1 S1 S3 S2 0
S2 S2 S4 S5 0
S3 S3 S6 S7 = S4 0
S4 S1 − − 1
S5 S3 − − 1
S6 S6 S8 = S4 S9 0
S7 = S4 S1 − − 1
S8 = S4 S1 − − 1
S9 S3 − − 1

Table 3: State transition table

States Next state (DN) Output


00 01 10 F
S1 S1 S3 S2 0
S2 S2 S4 S5 0
S3 S3 S6 S7 = S4 0
S4 S1 − − 1
S5 S3 − − 1
S6 S6 S8 = S4 S9 = S5 0
S7 = S4 S1 − − 1
S8 = S4 S1 − − 1
S9 = S5 S3 − − 1

Table 4: State transition table

States Next state (DN) Output


00 01 10 F
S1 S1 S3 S2 0
S2 S2 S4 S5 0
S3 S3 S2 S4 0
S4 S1 − − 1
S5 S3 − − 1

D̄N̄
Reset

S1
0
N

D S3
D̄N̄
0
D̄N̄ N D̄N̄

S2 D S5 D
D̄N̄
0 1
N

S4
1

Figure 2: Minimized FSM of a Vending Machine system

(v) Using D-FF, realize the system


To implement the FSM using D FF, note that the simplified FSM has 5 states and 2 inputs thus 3 JK FF will
be required. Let state S0 = 000, S1 = 001, S3 = 010 , S4 = 011 and S5 = 100.
D̄N̄ /0

S1

D/1 N/0

N/1 D̄N̄ /0 S3 D/0

D/1 N/0

S2

D̄N̄ /0

Figure 3: Equivalent Mealy machine of the Vending Machine system

Table 5: State transition table

Input Present state Next state F F2 F F1 F F0 Output


D N Q2n Q1n Q0n Q2n+1 Q1n+1 Q0n+1 D2 D1 D0 F
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 1 0 0 1 0 0 1 0
0 0 0 1 0 0 1 0 0 1 0 1
0 0 1 0 0 0 0 0 0 0 0 1
0 0 1 0 0 0 1 0 0 1 0 0
0 1 0 0 0 0 1 0 0 1 0 0
0 1 0 0 1 0 1 1 0 1 1 0
0 1 0 1 0 0 0 1 0 0 1 1
1 0 0 0 0 0 0 1 0 0 1 0
1 0 0 0 1 1 0 0 1 0 0 0
1 0 0 1 0 0 1 1 0 1 1 0

Note:
Analysis past this point requires application of 5 variables kanaugh map which is beyond the scope of
this course. Free marks will be given for this part of the question..

2). Draw the VHDL entity of the of the system and write entity section of the VHDL code for the system.
Solution:
Below is the block representing the entity

D F
N
rst
clk

Figure 4: VHDL entity of the vending machine

and the VHDL section

library IEEE ;
use IEEE . std_logic_1164 . all ;

entity vending_machine is
port (
D : in STD_LOGIC ;
N : in STD_LOGIC ;
rst : in STD_LOGIC ;
clk : in STD_LOGIC ;
F : out STD_LOGIC
);
end entity ; -- end vending_machine would also work

©Waweru Njeri(Ph.D), DKUT, 2025

You might also like