Professional Documents
Culture Documents
07 FSM - VHDL
07 FSM - VHDL
07 FSM - VHDL
2
Finite State Machines (FSMs)
• Defining states
• Optimization / minimization
3
Moore FSM
• Output Is a Function of Present State Only
Inputs
Next State
function
Next State
Present State
Transition condition 1
clock
Present State
reset Register state 1 /output 1 state 2 /output 2
Transition condition 2
Outputs
Output
function
4
Mealy FSM
• Output Is a Function of a Present State and Inputs
Output Outputs
function
5
Moore FSM with asynchronous reset
comb_logic: process(current_state, a)
begin
a=0
a=0 a=0
a=0 case current_state is
a=1 a=1 a=1
S0 /x= 0 S1 / x=0 S2 /x= 0 S3 /x= 1 when S0 => x <= '0';
if a='0' then
a=1 next_state <= S0;
reset elsif a ='1' then
next_state <= S1;
end if;
S0 S1
reset 0/1
7
Mealy FSM in VHDL
TYPE state IS (S0, S1);
SIGNAL Mealy_state: state;
WHEN S1 =>
IF input = ‘0’ THEN
Mealy_state <= S0;
ELSE
Mealy_state <= S1;
END IF;
END CASE;
END IF;
END PROCESS;
Output <= ‘1’ WHEN (Mealy_state = S1 AND input = ‘0’) ELSE ‘0’;
8