Domain: ๐ฅ๏ธ VLSI Design / ๐งฎ FPGA Development
Technology: ๐ Verilog
Compliance: ๐ APB Protocol
- ๐ Introduction
- โจ Key Features
- ๐ Visual Documentation
- ๐๏ธ System Architecture
- ๐ Interface Specifications
- โ๏ธ Configuration Protocol
- ๐ Results & Validation
- ๐ฎ Future Scope
This repository contains a production-grade ๐๏ธ Verilog implementation of a vending machine controller IP core with:
- โฑ๏ธ Multi-clock domain operation:
- ๐ฆ 1024-item inventory management
- ๐ฐ Six currency denomination support with smart change calculation
- ๐ Built-in error handling mechanisms
| Feature | Specification | Notes |
|---|---|---|
| ๐ถ Max Items | 1024 | Parameterized via MAX_ITEMS |
| ๐ต Max Currency | 100 units | Configurable with MAX_CURRENCY |
| โก Transaction Latency | <10 clock cycles | Worst-case scenario |
| ๐ข Supported Denominations | 5, 10, 15, 20, 50, 100 | Hard-coded in FSM |
- ๐ง Metastability-protected inputs (2-stage synchronizers)
- ๐ Automatic inventory reconciliation
- ๐จ Immediate refund for:
- Invalid currency (non-standard denominations)
- Out-of-stock items
- Configuration errors
| State Code | Mode | Description |
|---|---|---|
| 00 | RESET | Initialization state, all registers cleared |
| 01 | CONFIG | APB interface active for inventory setup |
| 10 | OPERATION | Normal vending machine operation |
| Signal | Type | Width | Description |
|---|---|---|---|
clk |
Input | 1b | 100MHz ยฑ50ppm |
rstn |
Input | 1b | Async active-low reset |
cfg_mode |
Input | 1b | Config/operation mode select |
| Signal | Direction | Timing | Description |
|---|---|---|---|
currency_valid |
Input | 10KHz-50MHz | Single-cycle pulse |
currency_value |
Input | 7b | Encoded denomination |
| Signal | Direction | Condition | Description |
|---|---|---|---|
item_select |
Input | Operation mode | 10-bit encoded product ID |
item_select_valid |
Input | Operation mode | Selection validation pulse |
| Signal | Width | Direction | Description |
|---|---|---|---|
paddr |
15b | Input | Register address |
pwdata |
32b | Input | Write data |
prdata |
32b | Output | Read data |
pready |
1b | Output | Transfer ready |
| Address Range | Register | Access | Description |
|---|---|---|---|
| 0x4000_0000 | CFG_CTRL | RW | Global control |
| 0x4000_0004 | ITEM_0 | RW | First item config |
| ... | ... | ... | ... |
| 0x4000_0FFC | ITEM_1023 | RW | Last item config |
| Bits | Field | Type | Description |
|---|---|---|---|
| 31-24 | DISPENSED | RO | Items sold count |
| 23-16 | AVAILABLE | RW | Current stock |
| 15-0 | PRICE | RW | Item value |
| Scenario | Input | Expected Output | Results |
|---|---|---|---|
| Exact Payment | Item5 (20) + 20 | Dispense5 + 0 | โ๏ธ |
| Overpayment | Item3 (15) + 20 | Dispense3 + 5 | โ๏ธ |
| Out-of-Stock | Item10 (0) + 50 | Empty(1023) + 50 | โ |
| Invalid Currency | Item2 + 13 | Empty(1023) + 13 | โ |
- ๐ง NFC/RFID interface
- ๐ฑ Remote inventory monitoring
- ๐น Dynamic pricing engine