Design and Implementation Of: Vending Machine Using Verilog HDL
The document describes the design and implementation of a vending machine using Verilog HDL. It discusses the objectives, methodology, advantages and disadvantages of the vending machine design. It also provides the Verilog code for the vending machine state machine.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
641 views2 pages
Design and Implementation Of: Vending Machine Using Verilog HDL
The document describes the design and implementation of a vending machine using Verilog HDL. It discusses the objectives, methodology, advantages and disadvantages of the vending machine design. It also provides the Verilog code for the vending machine state machine.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2
DESIGN AND IMPLEMENTATION OF
VENDING MACHINE USING VERILOG HDL
Prakhar Kumar-150907430 Electronic and Communication Department Manipal Institute Of Technology [email protected] AbstractA soft drink vending machine is a soft drink mathematical model of computation used to design both dispenser machine that dispenses a soft drink based on the computer programs and sequential logic circuits. It is amount deposited in the machine. It is an abstract model of conceived as an abstract machine that can be in one of a finite machine that Scan be in one of the finite number of states at a number of states. The machine is in only one state at a time; time. The state at any given time is called the current state. A the state it is in at any given time is called the current state. It particular FSM is given by a set of states and the triggering can change from one state to another when initiated by a condition for each transition[2].In these,the hardware gets triggering event or condition; this is called a transition. A reduced as the whole algorithm can be explained in one process. particular FSM is defined by a list of its states, and the There are mainly two types of machines-Mealy and Moore. We triggering condition for each transition. are using the mealy machine model in which the output depends on the present state as well as the input. The behavior of state machines can be observed in many devices in modern society which perform a predetermined INTRODUCTION sequence of actions depending on a sequence of events with which they are presented. Simple examples are vending A vending machine is a machine that provides items such as machines which dispense products when the proper four different products even diamonds and platinum jewellery combination of coins is deposited, elevators which drop riders to customers, after the vendee inserts currency or credit into off at upper floors before going down, traffic lights which the machine using extremely simple steps. These steps would change sequence when cars are waiting, and combination not be time consuming at all. The vendee would get all the locks which require the input of combination numbers in the details on the screen which he/she should follow. Previous proper order. Finite-state machines can model a large number microcontroller or microprocessor based vending machines of problems, among which are electronic design automation, were inefficient as compared to FPGA based vending communication protocol design, language parsing and other machine. So it is necessary to make it more reliable with engineering applications. In biology and artificial intelligence efficient algorithm that will be fully commanded by FPGA research, state machines or hierarchies of state machines have based solution. The main purpose of this project was to create been used to describe neurological systems and in a vending machine which could provide two different snacks linguisticsto describe the grammars of natural languages. products to the people using extremely simple steps. We have Considered as an abstract model of computation, the finite made an attempt to vend two products of different prices in the state machine is weak; it has less computational power than same machine. The machine will also provide the change to some other models of computation. A state machine may the vendee depending on the amount of money he/she has allow for a finite or an infinite set of possible states and inserted. It is also possible to withdraw the deposited money in furthermore, they may have nondeterministic or deterministic between, if consumer wishes by pressing a cancel button. behavior. A deterministic state machine is one whose outputs are the same for a given internal state and input values. A Design Objectives finite state machine (FSM) is one where all possible state To Design a powerful vending machine containing the values made a finite set. In a Finite State Machine the circuits following features: output is defined in a different set of states i.e. each output is a 1. Sell four different types of snacks and accept three types of state. A State Register to hold the state of the machine and a coins(Rs1, Rs2) next state logic to decode the next state. An output register 2. Give change after successful trade defines the output of the machine. In FSM based machines the 3. Return money when trade fails hardware gets reduced as in this the whole algorithm can be 4. If cancel button is enter, amount will return explained in one process. Two types of State machines are: MEALY Machine: In this machine model, the output depends on the present state as well as on the input. Design Methodology Of Vending Machine MOORE Machine: In Moore machine model the output FINITE STATE MACHINE METHOD only depends on the present state. A finite-state machine (FSM) or finite-state automaton Advantages (plural: automata), or simply a state machine, is a 1. Vending machines give the clients a free choice to purchase S3:NS=S0; products at any time of the day. One can shop for his or her S4:NS=S0; intended product on a 24 hour, throughout the year. S5:NS=S0; 2. Diversity in terms of the products that a vending machine S6:NS=S5; can handle is another advantage that this technology in S7:NS=S0; business has brought. A wide range of products can be sold endcase using the machine as fruits, beverages, drinks, and cigarettes assign among other products. This concept is also applied to some {p1,c}={(state[0]&state[1]&~state[2])|(~state[0]&~state[1] service provision industries like air drier, play stations and &state[2]),(state[2]&~state[1])|(state[2]&~state[0])}; other public utility practices. end 3. Reduction of overhead costs by not hiring of staff only increases the profit margin for the owner making it a success if(item2==1'b1) bound venture. begin 4. The machine can always be moved to other areas if need case(state) arises and it will continue delivering the services as usual. S0:NS=pu?S0:(i?(j?S2:S1):S0); Disadvantages S1:NS=pu?S5:(i?(j?S3:S2):S1); S2:NS=S0; 1. The main disadvantage of vending machine is that it can S3:NS=S0; cost you a lot of money. S4:NS=S0; 2. Fraud cases are also common in this kind of business by S5:NS=S0; customers who formulate means of hacking into the system of S6:NS=S0; the machine to dispense products. S7:NS=S0; endcase Verilog Code Of Vending Machine end assign SPECIFICATIONS: {p2,c}={state[1],(state[2]&state[1])|(state[2]&state[0])}; 1. Price of the product=Rs.2 -Tea and Rs3- Coffee. end 2. Possible money inputs=Rs.2 and Re.1. endmodule 3. Product to be delivered when Rs.2 or Rs.3 or Rs.4 is reached. Conclusion 4. A Push button is there (pu) which indicates the cancellation When we realized that we have at last made a code that could of transaction and the return of the amount deposited. actually work as a user friendly vending machine. This code can actually provide a variety of options to the user and also VERILOG CODE: return him/her the balance money. This verilog code has been `timescale 1ns / 1ps successfully verified using the Xilinx ISE tool and the desired module vend(pu,i,j,rst,clk,p1,p2,c,item1,item2); outputs have been achieved. Vending Systems enhances productivity, reduces system development cost, and input pu,i,j,rst,clk,item1,item2; accelerates time to market. Vending machine give fast output p1,p2,c; response and easy to use by an ordinary person. The designed reg [2:0] state,NS; machine can be used for many applications and we can easily reg p1,p2,c; enhance the number of selections. parameter S0=3'b000,S1=3'b001,S2=3'b010,S3=3'b011,S4=3'b100 ,S5=3'b101,S6=3'b110,S7=3'b111; initial begin p1=0; p2=0; c=0; end always@ (posedge clk or negedge rst) if (~rst) state=S0; else state=NS; always@(state or i or j or pu) begin if(item1==1'b1) begin case(state) S0:NS=pu?S0:(i?(j?S2:S1):S0); S1:NS=pu?S5:(i?(j?S3:S2):S1); S2:NS=pu?S6:(i?(j?S4:S3):S2);