One-Hot FSM Vending Machine
Design a one-hot encoded vending machine controller that accepts 5 and 10 cent coins, dispenses at 20 cents and returns change when overpaid.
Constraints
- One-hot state encoding for states 0, 5, 10, 15 cents.
- Inputs coin5 and coin10, never both in the same cycle.
- Outputs dispense and return5.
- Both outputs are single-cycle pulses.
- Return to the 0-cent state after dispensing.
- Synchronous reset returns to the 0-cent state.
1module vending (2 input wire clk,3 input wire rst,4 input wire coin5,5 input wire coin10,6 output reg dispense,7 output reg return58);9// TODO10endmodule