Complete the code to declare the state type for the vending machine FSM.
type state_type is ([1]);The state_type should be declared as an enumeration listing all states. Here, multiple states are declared to represent the vending machine states.
Complete the code to define the signal for the current state.
signal current_state : [1] := IDLE;The current_state signal must be of the state_type declared for the FSM states.
Fix the error in the process sensitivity list to include the clock and reset signals.
process([1]) begin if reset = '1' then current_state <= IDLE; elsif rising_edge(clock) then -- state transitions end if; end process;
The sensitivity list must include both clock and reset signals separated by a comma (,). This makes the process sensitive to changes in either signal.
Fill both blanks to complete the state transition for coin insertion and dispensing.
case current_state is
when IDLE =>
if coin = '1' then
current_state <= [1];
else
current_state <= IDLE;
end if;
when [2] =>
current_state <= IDLE;
when others =>
current_state <= IDLE;
end case;When a coin is inserted, the state moves to COIN_INSERTED. After dispensing, the state returns to IDLE.
Fill all three blanks to complete the output logic for dispensing and coin return.
with current_state select dispense <= [1] when DISPENSE, [2] when COIN_INSERTED, [3] when others;
Dispense signal is '1' only in DISPENSE state; otherwise, it is '0'.
