CARVIEW |
Select Language
HTTP/2 200
date: Sat, 11 Oct 2025 15:29:41 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=5cdb2179893601fee3c76843f05854c5d1a2a2b5f1055d86249f905e94d1065ba%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22mkjDVbFi98eQDWr8I6GCHWoSmjSawW5i%22%3B%7D; HttpOnly; Path=/
cf-ray: 98cf64f91c1b1ec2-BLR
question_11 - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Code your design here
- //Interface
- interface ifc(input clk);
- logic rst;
- logic coin;
- logic dwash;
- logic lid;
- logic soak;
- logic wash;
- logic rinse;
- logic spin;
- logic done;
- modport DESIGN(
- input clk, rst, coin, dwash, lid,
- output soak, wash, rinse, spin, done
- );
- modport TEST(
- output rst, coin, dwash, lid,
- input soak, wash, rinse, spin, done, clk
- );
- endinterface
- // Controller
- module wmc(
- ifc.DESIGN inf,
- input T,
- output pause
- );
- reg [2:0] nst, cst;
- localparam [2:0]
- IDLE = 0,
- SOAK = 1,
- WASH = 2,
- RINSE = 3,
- SPIN = 4,
- DWASH = 5,
- DRINSE = 6,
- PAUSE = 7;
- always@(posedge inf.clk or negedge inf.rst) begin
- if(!inf.rst) cst <= IDLE;
- else cst <= nst;
- end
- always_comb begin
- nst <= cst;
- case(cst)
- IDLE: if(inf.coin) nst <= SOAK;
- SOAK: if(T) nst <= WASH;
- WASH: if(T) nst <= RINSE;
- RINSE: begin
- if(inf.dwash & T) nst <= DWASH;
- else if(!inf.dwash & T) nst <= SPIN;
- end
- SPIN: begin
- if(inf.lid & !T) nst <= PAUSE;
- else if(T) nst <= IDLE;
- end
- DWASH: if(T) nst <= DRINSE;
- DRINSE: if(T) nst <= SPIN;
- PAUSE: if(!inf.lid) nst <= SPIN;
- endcase
- end
- assign inf.soak = (cst == SOAK);
- assign inf.wash = (cst == WASH) | (cst == DWASH);
- assign inf.rinse = (cst == RINSE) | (cst == DRINSE);
- assign inf.spin = (cst == SPIN);
- assign pause = (cst == PAUSE);
- assign inf.done = (cst == IDLE);
- endmodule
- // Timer
- module timer(
- input clk, rst, pause,
- output T
- );
- reg [9:0] count;
- always@(posedge clk or negedge rst) begin
- if(!rst) count <= 10'd0;
- else if(pause) count<= count;
- else count <= count + 1'b1;
- end
- assign T = (&count);
- endmodule
- // Top Level Controller
- module washing_machine(
- ifc.DESIGN inf
- );
- wire pause, T;
- wmc W1(.inf(inf), .T(T), .pause(pause));
- timer T1(.clk(inf.clk), .rst(inf.rst), .pause(pause), .T(T));
- endmodule
- ///////////////////////program block
- // Code your testbench here
- // or browse Examples
- program tb_washing_machine(
- ifc.TEST inf
- );
- virtual ifc.TEST inf_h = inf;
- initial begin
- inf_h.rst = 0;
- #12 inf_h.rst = 1;
- end
- initial begin
- wait(inf_h.rst);
- inf_h.coin = 1'b1;
- inf_h.dwash = 1'b1;
- #10 inf_h.coin = 1'b0;
- wait(inf_h.spin);
- inf_h.lid = 1'b1;
- #24 inf_h.lid = 1'b0;
- wait(inf_h.done);
- $finish;
- end
- initial begin
- $dumpfile("dump.vcd");
- $dumpvars;
- end
- endprogram
- module top_washing_machine;
- reg clk;
- ifc inf(clk);
- washing_machine DUT(.inf(inf.DESIGN));
- tb_washing_machine TEST(.inf(inf.TEST));
- initial begin
- wait(inf.rst);
- clk = 0;
- forever #5 clk = ~clk;
- end
- endmodule
Advertisement
Add Comment
Please, Sign In to add comment
-
⭐✅ Swapzone Glitch ✅ Working⭐⭐⭐ I
JavaScript | 4 sec ago | 0.24 KB
-
⭐ Free Crypto Method ✅ NEVER SEEN BEFORE ⭐⭐⭐
JavaScript | 4 sec ago | 0.24 KB
-
⭐⭐⭐Exploit 500$ in 15 Minutes⭐⭐
Java | 8 sec ago | 0.10 KB
-
✅⭐ Make huge profits on trading ✅ NEVER SEEN...
JavaScript | 14 sec ago | 0.24 KB
-
✅ Make $2500 in 20 minutes⭐⭐⭐ A
JavaScript | 15 sec ago | 0.24 KB
-
⭐⭐⭐MAKE $9OO INSTANTLY D M⭐⭐
Java | 21 sec ago | 0.10 KB
-
⭐✅ Marketplace Glitch ✅ Working ✅ NEVER SEEN...
JavaScript | 23 sec ago | 0.24 KB
-
⭐⭐Exchange Exploit⭐⭐ 5
JavaScript | 26 sec ago | 0.24 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand