This project implements a simple vending machine controller as a finite state machine (FSM) in Verilog.
It accepts coins (5¢, 10¢, 25¢) and dispenses an item priced at 40¢, managing balance and returning change.
Designed for the Basys 3 FPGA board (Artix-7 xc7a35tcpg236-1).
- Accepts coins: 5, 10, and 25 cents.
- Tracks inserted balance.
- Dispenses product once 40¢ is reached or exceeded.
- Returns correct change for overpayment.
- Finite State Machine with four states:
- IDLE
- ACCUMULATE
- DISPENSE
- RETURN
clk
— system clockreset
— synchronous reset signalcoin_5
— input for 5¢ coin insertioncoin_10
— input for 10¢ coin insertioncoin_25
— input for 25¢ coin insertion
dispense
— signals when to dispense the productreturn_change
— 8-bit value indicating change to returnstate
— current FSM state (for debugging)balance
— current accumulated balance (for debugging)
Included tb_vending_controller.v
simulates various coin insertion scenarios, including exact payment and overpayment, verifying the controller behavior.

vending_controller.v
— main vending machine controller moduletb_vending_controller.v
— testbench for simulationREADME.md
— this documentation
Maxim Pintea