Code in Verilog help inputs btn0coin addersw1basic washsw2no
Code in Verilog: help
inputs: btn0(coin adder),sw1(basic wash),sw2(normal wash),sw3(Large wash),sw5(start switch)
outputs: on 7 segment display it must show coins being entered(starts at 00,then 25,50,75,10 and back to 00) Cents to dollar b0=25 n0=50 L0=10
then cycles will need to be showed once switch is on (b0,n0,L0)
LED3(wash) LED2(rinse) LED3 (spin) *each cycles goes through all three LED\'s once
*FSM *clk (synchronize)
help please**
Solution
Verilog Code :
module COIN8(CUR_CNT,QUARTER,CENTS,DOLLAR,NEW_CNT);
//Count quarters ,CENTS and DOLLAR
input [7:0] CUR_CNT;
input QUARTER, CENTS,DOLLAR;
output [7:0] NEW_CNT;
reg [7:0] NEW_CNT;
// Block adds 25,50,75 and 10
always @ (CUR_CNT or QUARTER or CENTS or DOLLAR);
elseif(CENTS)NEW_CNT=CUR_CNT + 8\'d75;
else if (CENTS)NEW_CNT=CUR_CNT + 8\'d50;
elseif(QUARTER)NEW_CNT=CUR_CNT + 8\'d25;
elseif(CENTS)NEW_CNT=CUR_CNT + 8\'d10;
else NEW_CNT=CUR_CNT;
endmodule

