Documentation for implementation receiver.edgedet.rtl
Verilog contents
1
2
3
4
5
6
7 module edgedet (clk, d, d_neg, d_pos, resetn) ;
8
9 input clk;
10 input d;
11 output d_neg;
12 reg d_neg;
13 output d_pos;
14 reg d_pos;
15 input resetn;
16
17
18 reg d_old;
19
20 always @(posedge clk or negedge resetn)
21 begin
22 if (~resetn)
23 begin
24 d_neg <= 1'b0;
25 d_pos <= 1'b0;
26 d_old <= 1'b0;
27 end
28 else
29 begin
30 if (d && !d_old)
31 d_pos <= 1'b1;
32 else
33 d_pos <= 1'b0;
34
35 if (!d && d_old)
36 d_neg <= 1'b1;
37 else
38 d_neg <= 1'b0;
39
40 d_old <= d;
41 end
42 end
43
44 endmodule
45
46