Complete the code to declare the clock input in the entity.
entity MealyMachine is
Port (
clk : [1];
reset : in std_logic;
input_signal : in std_logic;
output_signal : out std_logic
);
end MealyMachine;The clock signal must be an input of type std_logic.
Complete the code to define the state type with two states S0 and S1.
type state_type is ([1]);The Mealy machine uses states named S0 and S1.
Fix the error in the process sensitivity list to include the clock signal.
process([1]) begin if rising_edge(clk) then -- state transitions end if; end process;
The process must be sensitive to the clock signal clk to detect edges.
Fill both blanks to assign the next state and output based on input_signal.
if input_signal = '1' then next_state <= [1]; output_signal <= [2]; else next_state <= S0; output_signal <= '0'; end if;
When input is '1', the machine moves to state S1 and output is '1'.
Fill all three blanks to complete the Mealy machine state transition and output logic.
case current_state is
when S0 =>
if input_signal = '1' then
next_state <= [1];
output_signal <= [2];
else
next_state <= [3];
output_signal <= '0';
end if;
when others =>
next_state <= S0;
output_signal <= '0';
end case;From state S0, if input is '1', go to S1 and output '1'. Otherwise, stay in S0 and output '0'.
