forked from ashishrana160796/verilog-starter-tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDFlipFlop.v
More file actions
51 lines (44 loc) · 810 Bytes
/
DFlipFlop.v
File metadata and controls
51 lines (44 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
module dff(d,clk,q,qbar);
input d;
input clk;
output q,qbar;
reg q,qbar;
always@(posedge clk)
begin
case(d)
1'b0:
q = 0;
1'b1:
q=1;
endcase
qbar = ~q;
end
endmodule
module test;
reg d;
reg clk;
integer i;
wire q,qbar;
dff s(d,clk,q,qbar);
initial
begin
$display("sr flip flop");
$monitor("%b %b \t %b %b",d,clk, q,qbar);
$dumpfile("vcd/DFlipFlop.vcd");
$dumpvars(1,test);
d = 0;
#10
d = 1;
#10
d = 0;
#10
d = 1;
#10
$finish;
end
initial begin
clk = 0;
for(i=0;i<20;i=i+1)
#1 clk = ~clk;
end
endmodule