Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/justin-marian/fsm-vending-machine
FSM vending machine, it dispenses products based on user input and provides change based on the money introduced.
https://github.com/justin-marian/fsm-vending-machine
fsm vending-machine-proplem verilog
Last synced: 14 days ago
JSON representation
FSM vending machine, it dispenses products based on user input and provides change based on the money introduced.
- Host: GitHub
- URL: https://github.com/justin-marian/fsm-vending-machine
- Owner: justin-marian
- License: bsl-1.0
- Created: 2024-03-13T06:04:43.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-03-20T23:22:12.000Z (10 months ago)
- Last Synced: 2024-11-07T05:41:38.889Z (2 months ago)
- Topics: fsm, vending-machine-proplem, verilog
- Language: C
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Vending Machine
Simple `finite state vending machine` designed to dispense products based on user input and provide change when necessary. The vending machine operates in three main states: `Idle`, `Money`, and `Product & Change`.
## States
### Idle
- In this state, the vending machine **awaits user input**.
- **Receives money / request for a product**, it transitions to the `Money` state.
- **Receives request for change**, it goest to the `Product & Change` state.### Money
- In this state, the vending machine processes the user's **money input**.
- If the user requests a product (`product_x` or `product_y`), it checks if there's enough money to **dispense the selected product**.
- For **insufficient funds**, it returns to the `Idle` state.
- For **enough money**, gives the product and goes back to the `Idle` state.### Product & Change
- Calculates the **remaining change** to be returned to the user.
- It calculates the change in terms of `1 Lei` and `50 Bani`.
- After calculating the change, it transitions back to the `Idle` state.## Inputs and Outputs
***Inputs:***
- `input_50bani`: Indicates insertion of a `50 Bani`.
- `input_1lei`: Indicates insertion of a `1 Lei`.
- `input_5lei`: Indicates insertion of a `5 Lei`.
- `reset`: Resets the vending machine.
- `clk`: Clock input.
- `get_product_x`: Request for product `X`.
- `get_product_y`: Request for product `Y`.
- `change`: Request for change.***Outputs:***
- `give_product_x`: Signal to dispense product `X`.
- `give_product_y`: Signal to dispense product `Y`.
- `give_remaining_50bani`: Signal to dispense rest `50 Bani` as change.
- `give_remaining_1lei`: Signal to dispense rest `1 Lei` as change.## Usage
Instantiate the vending machine module in your Verilog design and connect the inputs and outputs as described above. Simulate or synthesize the design to observe the behavior of the vending machine.