-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdetect_edge_tb.sv
126 lines (97 loc) · 1.68 KB
/
detect_edge_tb.sv
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
`timescale 1ns/100ps
module detect_edge_tb;
reg rst;
reg clk;
reg clean_target_clock;
reg arm_1;
reg arm_3;
reg arm_n_1;
reg target;
wire trig_1;
wire trig_3;
wire trig_n_1;
initial begin
clk = 0;
#1;
forever clk = #1 ~clk;
end
initial begin
string filename;
// This is the +vcd=desynk_tb.vcd on the command line
if (!$value$plusargs("vcd=%s", filename))
filename = "default.vcd";
$dumpfile(filename);
$dumpvars(0, detect_edge_tb);
arm_1 <= 0;
arm_3 <= 0;
arm_n_1 <= 0;
target <= 1;
rst <= 1;
#4;
rst <= 0;
#2
arm_1 <= 1;
arm_3 <= 1;
#2
arm_1 <= 0;
arm_3 <= 0;
#4
target <= 0;
#2
target <= 1;
#2
arm_n_1 <= 1;
#2
arm_n_1 <= 0;
#4
target <= 0;
#2
target <= 1;
#4
arm_1 <= 1;
arm_3 <= 1;
arm_n_1 <= 1;
#2
arm_1 <= 0;
arm_3 <= 0;
arm_n_1 <= 0;
#4
target <= 0;
#2
target <= 1;
#2
target <= 0;
#12;
$finish;
end
detect_edge #(
.TRIG_CYCLES(1),
.RISING_EDGE(1)
) DUT_1 (
.rst(rst),
.clk(clk),
.target(target),
.arm(arm_1),
.trigger(trig_1)
);
detect_edge #(
.TRIG_CYCLES(3),
.RISING_EDGE(1)
) DUT_3 (
.rst(rst),
.clk(clk),
.target(target),
.arm(arm_3),
.trigger(trig_3)
);
detect_edge #(
.TRIG_CYCLES(1),
.RISING_EDGE(0)
) DUT_N_1 (
.rst(rst),
.clk(clk),
.target(target),
.arm(arm_n_1),
.trigger(trig_n_1)
);
endmodule