Professional Documents
Culture Documents
Sub code & Sub Name : 18ECE206J & Advanced Digital System Design
REPORT VERIFICATION
Signature :
1
FINITE STATE MACHINE
OBJECTIVE:
Purpose of this project is to implement a finite state machine.
ABSTRACT:
FSM (Finite State Machines) is a simple state machine or a mathematical model of
computation. Each FSM has a finite number of states, inputs, outputs, and rules to change from one state to
the other state. FSM is defined by a finite number of states and switches from one state to the other when
specific input is given to the state machine. FSM’s are widely used in vending machines, traffic lights,
security locks, and software algorithms. In this article, you can learn about the basics of FSM and
implementing an FSM design in VHDL using ModelSim.
FSM DIAGRAM:
The green circles indicate the states of the FSM. So, the available states are A, B, C, D. The near the
state circle A indicates that ‘A’ is the initial state. The double circled state, D indicates that D is the last state of
the FSM. We can see that arrows are running between the available states with 1’s and 0’s. These are the inputs
and outputs that determine where the next state should shift to and the corresponding outputs.
2
Always remember that these arrows form the rule for transition. The notations above the arrows left side of the
slash represent input, right side to slash represent the output. For example, if it is “1/0” 1 represents input, and 0
represents output.
FSM’s have a state transition table from which we can calculate the next state. The Transition Table is given
below.
Let us examine the State Transition Table and the State Diagram for a better understanding. If the present state
is A and the input is “1”, look for the arrows pointing outwards of state A which has input “1”. If so, the next
state is B and the output is 0. Now, the present state gets updated as “B”. Now lookup for the present state “B”,
says input is 0 the next state is “D”. So on, the state keeps changing.
Moreover, FSM has a clock and reset signal too. If the reset =1 or reset is active, it will go back to the initial
state which is “A” (i.e. starting state)
3
Now, that we know the basics of FSM, let's implement the same design in VHDL using ModelSim.
Brace yourself let's learn how to implement the same design in VHDL using ModelSim .
SOFTWARE REQUIREMENTS:
VHDL CODE:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity fsm is
end fsm;
begin
process (clk,reset)
begin
end if;
end process;
4
process (present_state,input)
begin
case present_state is
next_state <= C;
else
next_state <= B;
end if;
next_state <= D;
else
next_state <= B;
end if;
next_state <= D;
else
next_state <= C;
end if;
5
output <= '1';
next_state <= A;
else
next_state <= D;
end if;
end case;
end process;
end Behavioral;
OUTPUT:
(output screen shot with name and reg.no )
CONCLUSION:
Finite State Machine was designed and simulated using VHDL code
REFERENCES:
https://circuitdigest.com/microcontroller-projects/implementing-finite-state-machine-design-in-
6
vhdl-using-modelsim