How adrofier/vending-machine-controller-using-verilog works
Project Type and Purpose
• This is a small Verilog HDL project implementing a finite-state-machine (FSM) “Vending Machine Controller” plus a basic Verilog testbench.
• Purpose: model coin handling, product selection, dispensing, and change logic in hardware, and verify its behavior via simulation.
Main Components
a. Vending Machine Controller Module (vending.v)
b. Testbench Module (vending_testbench.v)
c. Simulation Environment & Toolchain (Icarus Verilog & waveform viewer)
d. External Interfaces (coin inputs, select inputs, dispense outputs, change outputs, clock/reset)
Relationships and Data Flow
• The Testbench drives all inputs (coins, selections, clock, reset) into the Controller.
• The Controller FSM processes inputs, transitions between states, and produces outputs (dispense, change).
• Outputs loop back to the Testbench for verification and waveform capture.
• Icarus Verilog compiles both .v files and runs the simulation, generating waveforms/logs.
Architectural Patterns and Design Principles
• Finite State Machine (FSM) inside the Controller: clearly delineate states like IDLE, COLLECT, DISPENSE, RETURN_CHANGE.
• Separation of concerns:
– Controller = combinational + sequential logic for machine operation
– Testbench = stimulus generator and checker
• Simulation flow: source → compile → simulate → verify waveforms
Technologies and Tools
• Verilog HDL for both module and testbench
• Icarus Verilog 0.9.7 (compiler/simulator)
• Waveform viewer (e.g., GTKWave) for post-simulation analysis