# eckucukoglu/basic-vending-machine architecture

> Architecture diagram of the GitHub repository eckucukoglu/basic-vending-machine, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/eckucukoglu/basic-vending-machine
- Repository: https://github.com/eckucukoglu/basic-vending-machine

## Overview

##### Project type and purpose
- This is a hardware-design project written in Verilog, implementing a basic vending machine.
- The top-level “Board232.v” likely instantiates the core module “lab3_2.v,” which contains the vending-machine FSM and I/O logic. A separate testbench (“lab3_testbench.v”) drives inputs and checks outputs.

##### File structure
- src/Board232.v       → top-level wrapper/module for FPGA or simulation harness
- src/lab3_2.v         → core vending-machine logic (FSM, coin counter, product dispenser, change calculator)
- src/lab3_testbench.v → testbench that applies stimulus (coins, selections) and observes outputs (dispensed items, change)
- doc/problem.pdf      → problem statement & requirements

##### README for additional insights
- The machine accepts money, allows multiple item selections, and returns remainder in coins.

##### Detail but avoid over-engineering
- Every distinct functional block (counter, decoder, dispenser, change logic).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Simulation"
        TB[Testbench]:::testbench
    end

    subgraph "Hardware Design"
        B232["Board232"]:::module
        lab["lab3_2"]:::module

        subgraph "lab3_2 Internals"
            CC["Coin Acceptor & Counter"]:::sub
            SL["Selection Logic (decoder)"]:::sub
            PD["Product Dispenser Control"]:::sub
            CH["Change Calculator & Dispenser"]:::sub
        end
    end

    Problem["Problem Statement & Requirements"]:::doc

    TB -->|"clk, reset, coin_in, item_select"| B232
    B232 -->|"clk, reset, coin_in, item_select, product_out, change_out"| lab

    lab -->|"coin_in"| CC
    CC -->|"state update"| SL
    SL -->|"selection"| PD
    SL -->|"selection"| CH
    PD -->|"product_out"| OutputProd[(product_out)]
    CH -->|"change_out"| OutputChange[(change_out)]

    Problem -.-> TB

    subgraph "Legend"
        L1["Simulation Testbench"]:::testbench
        L2["Verilog Modules"]:::module
        L3["Internal Sub-blocks"]:::sub
        L4["Documentation"]:::doc
    end

    click TB "https://github.com/eckucukoglu/basic-vending-machine/blob/master/src/lab3_testbench.v"
    click B232 "https://github.com/eckucukoglu/basic-vending-machine/blob/master/src/Board232.v"
    click lab "https://github.com/eckucukoglu/basic-vending-machine/blob/master/src/lab3_2.v"
    click Problem "https://github.com/eckucukoglu/basic-vending-machine/blob/master/doc/problem.pdf"

    classDef testbench fill:#eeeeee,stroke:#888,stroke-dasharray:5 5;
    classDef module fill:#add8e6,stroke:#000,stroke-width:1px;
    classDef sub fill:#90ee90,stroke:#000,stroke-width:1px;
    classDef doc fill:#f9f,stroke:#333,stroke-width:1px;
```
