This project implements a simple Finite State Machine (FSM)-based Vending Machine using Verilog HDL. It accepts ₹5 and ₹10 as input and dispenses a product when the total value reaches ₹10. It also returns change when applicable. The design is simulated and verified using Xilinx Vivado.
vending_machine_project/ ├── vending_machine.v # Main Verilog module (FSM logic) ├── vending_machine_tb.v # Testbench for simulating input sequences
- FSM with 3 states: ₹0, ₹5, ₹10
- Accepts ₹5 and ₹10 (as binary:
01
,10
) - Dispenses product when total reaches ₹10
- Returns ₹5 or ₹2 as change when needed
- Reset and clock-driven design
- Testbench simulates coin insertions
- Verified on Xilinx Vivado simulator
State | Total Amount | Input ₹ | Next State | Output | Change |
---|---|---|---|---|---|
S0 | ₹0 | ₹5 | S1 | No | ₹0 |
S1 | ₹5 | ₹5 | S2 | No | ₹0 |
S2 | ₹10 | ₹0 | S0 | No | ₹10 |
S1 | ₹5 | ₹10 | S0 | Yes | ₹0 |
S2 | ₹10 | ₹5 | S0 | Yes | ₹5 |
- Open Xilinx Vivado and create a new project.
- Add the following files:
vending_machine.v
vending_machine_tb.v
- Set
vending_machine_tb.v
as the top module for simulation. - Run behavioral simulation.
- Observe the waveform and output (
out
andchange
).