Question: # Verilog Vending Machine State Detailed Specification ## Timing Requirements 1 . All state transitions must occur on posedge clock 2 . Coin processing must

# Verilog Vending Machine State Detailed Specification
## Timing Requirements
1. All state transitions must occur on posedge clock
2. Coin processing must occur on negedge clock and trigger only once
3. Reset functionality is asynchronous and must be processed immediately
4. Statements must be implemented using Case statements
5. vending_machine inputs include clk,3bits drinkchoose, 6bits money, cancel; output has 6bits change
6. Implement the vending machine simulation using the finite state machine method shown in the diagram
## S0: Initial State (Coin Input State)
-**Functional Requirements:**
1. Display current total amount inserted
2. Accept coins (1,5,10,50 NTD)
3. Only one coin can be inserted at a time
4. Must update and display total amount in real-time
5. Transition to S1 state when input amount reaches minimum beverage price (10 NTD)
6. Return all inserted money when cancel button (reset) is pressed
7. Process coin insertion on negedge clock
## S1: Selection State (Available Beverage Display State)
-**Functional Requirements:**
1. Display available beverages based on inserted amount:
-10 NTD: Display Tea
-15 NTD: Display Tea, Coke
-20 NTD: Display Tea, Coke, Coffee
-25 NTD: Display Tea, Coke, Coffee, Milk
2. Allow continued coin insertion to increase amount
3. Wait for customer beverage selection (drink_choose input)
4. Upon beverage selection, check if amount is sufficient:
- Sufficient: Transition to S2 state
- Insufficient: Remain in current state
5. If cancel button is pressed, transition to S0 state and return all money
## S2: Dispensing State (Output State)
-**Functional Requirements:**
1. Output selected beverage name
2. Calculate change amount
3. Automatically transition to S3 state upon completion
4. Do not accept new coins or selections in this state
5. If cancel button is pressed, transition to S0 state and return all money
## S3: Checkout State (Change Return State)
-**Functional Requirements:**
1. Calculate and display change amount (inserted amount - beverage price)
2. Output change amount (6-bit change output)
3. Automatically transition back to S0 state upon completion
4. Do not accept new coins or selections in this state
5. If cancel button is pressed, transition to S0 state and return all money
## Reset Functionality (Applicable to All States)
-**Functional Requirements:**
1. When reset (cancel button) is pressed in any state:
- Immediately stop current operation
- Return all inserted money
- Clear all state records
- Return to S0 initial state
2. Ensure all counters and registers are cleared during reset
3. Display returned amount
## Deliverable
One main.v file
# Verilog Vending Machine State Detailed

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!