This program is in verilog and need help to get it working correctly. This is the code i have so far. Please help. Simple testbench would be great. Thanks\ 'define vend_a_drink {D,dispense,collect} = {IDLE,2'b11}; module drink_machine(nickel_in, dime_in, quarter_in, collect, nickel_out, dime_out, dispense, reset, clk) ; parameter IDLE=0,FIVE=1,TEN=2,TWENTY_FIVE=3, FIFTEEN=4,THIRTY=5,TWENTY=6,OWE_DIME=7; input nickel_in, dime_in, quarter_in, reset, clk; output collect, nickel_out, dime_out, dispense; reg collect, nickel_out, dime_out, dispense; reg [2:0] D, Q; /* state */ // synopsys state_vector Q always @ ( nickel_in or dime_in or quarter_in or reset ) begin nickel_out = 0; dime_out = 0; dispense = 0; collect = 0; if ( reset ) D = IDLE; else begin D = Q; case ( Q ) IDLE: if (nickel_in) D = FIVE; else if (dime_in) D = TEN; else if (quarter_in) D = TWENTY_FIVE; FIVE: if(nickel_in) D = TEN; else if (dime_in) D = FIFTEEN; else if (quarter_in) D = THIRTY; TEN: if (nickel_in) D = FIFTEEN; else if (dime_in) D = TWENTY; else if (quarter_in) 'vend_a_drink; TWENTY_FIVE: if( nickel_in) D = THIRTY; else if (dime_in) 'vend_a_drink; else if (quarter_in) begin 'vend_a_drink; nickel_out = 1; dime_out = 1; end FIFTEEN: if (nickel_in) D = TWENTY; else if (dime_in) D = TWENTY_FIVE; else if (quarter_in) begin 'vend_a_drink; nickel_out = 1; end THIRTY: if (nickel_in) 'vend_a_drink; else if (dime_in) begin 'vend_a_drink; nickel_out = 1; end else if (quarter_in) begin 'vend_a_drink; dime_out = 1; D = OWE_DIME; end TWENTY: if (nickel_in) D = TWENTY_FIVE; else if (dime_in) D = THIRTY; else if (quarter_in) begin 'vend_a_drink; dime_out = 1; end OWE_DIME: begin dime_out = 1; D = IDLE; end endcase end end always @ (posedge clk ) begin Q = D; end endmodule
3378Post New Intel Embedded Systems AllOther Interview Questions
what is collation? : Sql dba
What bit version ambary needs and list out the operating system that are compatible?
Pl's confirm me this entry how to pass in Tally 9.0 & Tally ERP.9 that if I purchase 20 mobile,30 phone,20 LCD,15 laptop from mangesh @ Rs.7000,Rs.200,Rs.17000 and Rs.14000 respectively on each. But I purchase by cash and 15 days later I sold half of the thing to priya margin of Rs.100 on each by cheque and rest i sold to minal on cash margin of Rs.200 on each. But I received cash 1 month later. so calculate how much profit I got by selling the products.
How customizable is the user-to-user access?
Explain what is with () and by () function in r is used for?
If I want to build a shared assembly, does that require the overhead of signing and managing key pairs?
Please write some additional where clauses in laravel?
Name the two types of shared variable available in Apache Spark?
How do I add one column in postgresql?
List the benefits of traffic manager?
What is a managed bean?
Will upgrading from windows 7 to windows 10 delete everything?
Why is mongodb used?
What is the char data type?
What is known as 'demand management'?