-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtrigger_delay_tb.sv
99 lines (74 loc) · 1.45 KB
/
trigger_delay_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
`timescale 1ns/100ps
module trigger_delay_tb;
reg rst;
reg clk;
reg clean_target_clock;
reg trig;
reg [31:0] delay;
reg set_delay_1;
reg set_delay_3;
wire trig_1;
wire trig_3;
initial begin
clk = 0;
#1;
forever clk = #1 ~clk;
end
initial begin
clean_target_clock = 0;
#4;
forever clean_target_clock = #4 ~clean_target_clock;
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, trigger_delay_tb);
delay <= 6;
set_delay_1 <= 0;
set_delay_3 <= 0;
trig <= 0;
rst <= 1;
#8;
rst <= 0;
#12;
set_delay_1 <= 1;
#8;
set_delay_1 <= 0;
delay <= 4;
#12;
set_delay_3 <= 1;
#8;
set_delay_3 <= 0;
#19
trig <= 1;
#8
trig <= 0;
#60
trig <= 1;
#8
trig <= 0;
#80;
$finish;
end
trigger_delay #(.TRIG_CYCLES(1)) DUT_1 (
.rst(rst),
.clk(clk),
.trigger(trig),
.clean_target_clock(clean_target_clock),
.delay(delay),
.set_delay(set_delay_1),
.delayed_trigger(trig_1)
);
trigger_delay #(.TRIG_CYCLES(3)) DUT_3 (
.rst(rst),
.clk(clk),
.trigger(trig),
.clean_target_clock(clean_target_clock),
.delay(delay),
.set_delay(set_delay_3),
.delayed_trigger(trig_3)
);
endmodule