Complete the code to declare the state type in a three-process FSM.
type state_type is (IDLE, PROCESS, DONE);
signal current_state : state_type := [1];The initial state is usually set to IDLE to start the FSM in a known state.
Complete the code to write the synchronous process for state transitions.
process(clk, reset) begin if reset = '1' then current_state <= IDLE; elsif rising_edge(clk) then current_state <= [1]; end if; end process;
The synchronous process updates current_state to the value of next_state on the clock edge.
Fix the error in the combinational process for next state logic.
process(current_state, start, done)
begin
case current_state is
when IDLE =>
if start = '1' then
next_state <= [1];
else
next_state <= IDLE;
end if;
when PROCESS =>
if done = '1' then
next_state <= DONE;
else
next_state <= PROCESS;
end if;
when DONE =>
next_state <= IDLE;
when others =>
next_state <= IDLE;
end case;
end process;When in IDLE and start = '1', the FSM should move to the PROCESS state.
Fill both blanks to complete the output logic process.
process(current_state)
begin
case current_state is
when IDLE => output_signal <= [1];
when PROCESS => output_signal <= [2];
when DONE => output_signal <= '1';
when others => output_signal <= '0';
end case;
end process;Output is '0' in IDLE and '1' in PROCESS state to indicate activity.
Fill all three blanks to complete the reset and clock sensitivity list in the synchronous process.
process([1], [2]) begin if [3] = '1' then current_state <= IDLE; elsif rising_edge(clk) then current_state <= next_state; end if; end process;
The process is sensitive to reset and clk. The reset signal is checked for '1' to initialize the FSM.
