hello guys....
i am providing u a verilog code for washing machine with testbench....
i am providing u a verilog code for washing machine with testbench....
WASHING MACHINE
module wm(clk,rst,coin, lid_r, d_wash, T, soak,rinse, spin, wash,pause,break); input clk,rst,coin,lid_r,d_wash,T; output reg soak,rinse,spin,wash,pause,break; reg[2:0] cst, nst; // state assignment parameter IDLE = 3'b000, SOAK = 3'b001, WASH=3'b010, RINSE=3'b011, WASH2=3'b100, RINSE2=3'b101, SPIN=3'b110, PAUSH=3'b111; always @(cst or coin or d_wash or lid_r or T) begin case (cst) IDLE: if(coin==1) begin nst=SOAK; soak=1; rinse=0; spin=0; wash=0; pause=0; break=0; end else begin nst=cst; soak=0; rinse=0; spin=0; wash=0; pause=0; break=0; end SOAK: if(T==1) begin nst=WASH; soak=0; rinse=0; spin=0; wash=1; pause=0; break=0; end else begin nst=cst; soak=1; rinse=0; spin=0; wash=0; pause=0; break=0; end WASH: if(T==1) begin nst=RINSE; soak=0; rinse=1; spin=0; wash=0; pause=0; break=0; end else begin nst=cst; soak=0; rinse=0; spin=0; wash=1; pause=0; break=0; end RINSE: if(T==1 && d_wash==1) begin nst=WASH2; soak=0; rinse=0; spin=0; wash=1; pause=0; break=0; end else if(T==1 && d_wash==0) begin nst=SPIN; soak=0; rinse=0; spin=1; wash=0; pause=0; break=0; end else begin nst=cst; soak=0; rinse=1; spin=0; wash=0; pause=0; break=0; end WASH2: if(T==1) begin nst=RINSE2; soak=0; rinse=1; spin=0; wash=0; pause=0; break=0; end else begin nst=cst; soak=0; rinse=0; spin=0; wash=1; pause=0; break=0; end RINSE2: if(T==1) begin nst=SPIN; soak=0; rinse=0; spin=1; wash=0; pause=0; break=0; end else begin nst=cst; soak=0; rinse=1; spin=0; wash=0; pause=0; break=0; end SPIN: if(T==0 && lid_r==1) begin nst=PAUSH; soak=0; rinse=0; spin=0; wash=0; pause=1; break=0; end else if(T==1) begin nst=IDLE; soak=0; rinse=0; spin=0; wash=0; pause=0; break=0; end else begin nst=cst; soak=0; rinse=0; spin=1; wash=0; pause=0; break=0; end PAUSH: if(lid_r==0) begin nst=SPIN; soak=0; rinse=0; spin=1; wash=0; pause=0; break=0; end else begin nst=cst; soak=0; rinse=0; spin=0; wash=0; pause=1; break=0; end default: nst=IDLE; endcase end always @(posedge clk or negedge rst) begin if (rst) cst <= IDLE; else cst <= nst; end /* assign soak = (cst == SOAK); assign rinse = (cst == RINSE) | (cst == RINSE2); assign brake = (cst == PAUSE); assign spin = (cst == SPIN); assign wash = (cst == WASH) | (cst == WASH2); */ endmodule TEST BENCH module wm_tb; reg clk,reset,coin,lid_r,d_wash,T; wire soak,rinse,spin,wash,pause,break; wm m1(clk,reset,coin,lid_r,d_wash,T,soak,rinse,spin,wash,pause,break); initial begin $monitor($time, ,,"c=%b",clk,,"t=%b",coin,,"l=%b",lid_r,,"d=%b",d_wash,,"T=%b",T,,"s=%b",soak,,"r=%b",rinse,,"S=%b",spin,,"w=%b",wash,,"p=%b",pause,,"b=%b",break); reset=0 ;clk=0;coin=0;lid_r=0;d_wash=0;T=0; #10 coin=1; #10 T=1;coin=0; #20 d_wash=1; #30 lid_r=1;d_wash=0;T=0; #10 lid_r=0;T=0; #10 T=1;lid_r=0; #10 T=1; #10 coin=1;T=0; //#10 T=1; //#10 T=1; //#5 reset=1; //#5 reset=0; end always #5 clk=~clk; initial #100 $finish ; endmodule
nice work dhaval
ReplyDeleteGud one...modify your code for standard design :
ReplyDeleteIf you use logic high for reset then use posedge reset statement in always block...!!!
define task in test-bench for repetitive control signal.
always disable all control signal in start of always block in FSM design.
ya...i tried during practice...........but during upload i changed it....so sorry for that....i put reset on neg edge during practice.....
Deletei put here only for reference purpose....u can modify accordingly.......
Deletedear dhaval,
Deletei have an urgent requirement ,if u dont mind plz send to my mail id (yedunath.k@gmail.com) following details as per above verilog
1-state diagram
2-transition table
3-excitation table
4-kmap
5-circuit
can we imlement this in bassy3 board
Deletehow can i implement it in FPGA development board
ReplyDeleteI had implement it on Xilinx FPGA board. In your case you need to configure toggle button for input and for output u can watch out led pin number from your respective FPGA board and then dump code through any JTAG connector.
Deletewhat does nst stand for?
ReplyDeleteNst - next state
DeleteCst - current state
Nst - next state
DeleteCst - current state
What does the T stand for?
ReplyDeleteT stand for Timer...
DeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
DeleteCan you pls provide me vhdl code for washing machine controller for my project on my email id ramayadav1970@gmail.com its urgent.
ReplyDeletenice work dhaval keep doing bro
ReplyDeletehey I am trying to implement md5 in my code please help me getting some wrong hash value for more please contact me on akshayamj4@gmail.com
ReplyDeletewhat is lid_r?
ReplyDeleteWhat lid_r stand for?
ReplyDeletehey ...can u plz me state machine explaintation please
ReplyDeletehamza.687@gmail.com can you please send me whole code on my email. Th one you use for yourself in final stage. I need your help to for teaching me few things related to that i will pay you for teaching me
ReplyDeletehi. i run your code, but then there an error at this phase: line if (nst)
ReplyDeletealways @(posedge clk or negedge rst)
begin
if (nst)
cst <= IDLE;
else
cst <= nst;
end
Can you explain why?
remove the negedge rst and it should be fine
DeleteThis comment has been removed by the author.
ReplyDeletecan you also share how does the waveform look like for this verilog coding. my email is afrafathimah001101@gmail.com
ReplyDeletecan you also share how does the waveform look like for this verilog coding. my email is lanjiocb8@gmail.com
ReplyDeletecan i know what is lid r stand for
ReplyDeletecan i know what is lid r and coin stand for
ReplyDeleteWashing machine service in dubai
ReplyDeletehttps://www.hometech.ae/service/washing-machine-service/
UAEs Authorized Major brand Washing Machine Service in Dubai, On-Demand experienced professionals for washing machine service in Dubai.
1632380306853-9
Sir, can you please tell what is lid_r stands for?and can you please provide it's output also..
ReplyDeletedear dhaval,
ReplyDeletei have an urgent requirement ,if u dont mind plz send to my mail id (syiqin.ciken97@gmail.com) following details as per above verilog
1-state diagram
2-transition table
3-excitation table
4-kmap
5-circuit
6-procedure to implement to fpga board
7- full report for this project
dear dhaval,
ReplyDeletei have an urgent requirement ,if u dont mind plz send to my mail id (azfarhaniff1@gmail.com) following details as per above verilog
1-state diagram
2-transition table
3-excitation table
4-kmap
5-circuit
6-procedure to implement to fpga board
7- full report for this project