-
Notifications
You must be signed in to change notification settings - Fork 3
/
hdlcrev_testbench.v
99 lines (81 loc) · 5.07 KB
/
hdlcrev_testbench.v
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
// synopsys translate_off
`timescale 1 ns / 1 ps
// synopsys translate_on
module hdlcrev_testbench(
);
reg clk ;
reg rst_n ;
reg datar ;
reg flagr ;
reg [7 :0] ramd ;
reg [8:0] rama ;
reg hwr ;
reg interrupt ;
integer i;
always #8 clk = ~clk;
initial begin
clk = 1;
rst_n = 0;
datar = 1;
flagr = 0;
#128
rst_n = 1;
#16 flagr =1;
#16 datar =0; #16 datar =1;#16 datar =1; #16 datar =1;#16 datar =1;#16 datar =1; #16 datar =1;#16 datar =0;
#16 datar =0; #16 datar =1;#16 datar =1; #16 datar =1;#16 datar =1;#16 datar =1; #16 datar =1;#16 datar =0;
#16 datar =0; #16 datar =1;#16 datar =1; #16 datar =1;#16 datar =1;#16 datar =1; #16 datar =1;#16 datar =0;
#16 datar =0; #16 datar =1;#16 datar =1; #16 datar =1;#16 datar =1;#16 datar =1; #16 datar =1;#16 datar =0;
//flagr =0;
#16 datar =0; #16 datar =1;#16 datar =0; #16 datar =1;#16 datar =0;#16 datar =1; #16 datar =0;#16 datar =0;
#16 datar =1; #16 datar =1;#16 datar =0; #16 datar =1;#16 datar =1;#16 datar =1; #16 datar =0;#16 datar =1;
#16 datar =1; #16 datar =1;#16 datar =0; #16 datar =0;#16 datar =1;#16 datar =1; #16 datar =0;#16 datar =0;
#16 datar =1; #16 datar =1;#16 datar =0; #16 datar =1;#16 datar =1;#16 datar =1; #16 datar =0;#16 datar =1;
#16 datar =1; #16 datar =1;#16 datar =0; #16 datar =0;#16 datar =1;#16 datar =1; #16 datar =0;#16 datar =0;
#16 datar =0; #16 datar =1;#16 datar =0; #16 datar =1;#16 datar =0;#16 datar =1; #16 datar =0;#16 datar =0;
#16 datar =1; #16 datar =1;#16 datar =0; #16 datar =1;#16 datar =1;#16 datar =1; #16 datar =0;#16 datar =1;
#16 datar =1; #16 datar =1;#16 datar =0; #16 datar =0;#16 datar =1;#16 datar =1; #16 datar =0;#16 datar =0;
#16 datar =1; #16 datar =1;#16 datar =0; #16 datar =1;#16 datar =1;#16 datar =1; #16 datar =0;#16 datar =1;
#16 datar =1; #16 datar =1;#16 datar =0; #16 datar =0;#16 datar =1;#16 datar =1; #16 datar =0;#16 datar =0;
#16 datar =0; #16 datar =1;#16 datar =1; #16 datar =1;#16 datar =1;#16 datar =1; #16 datar =1;#16 datar =0;
#16 datar =0; #16 datar =1;#16 datar =1; #16 datar =1;#16 datar =1;#16 datar =1; #16 datar =1;#16 datar =0;
#16 datar =0; #16 datar =1;#16 datar =1; #16 datar =1;#16 datar =1;#16 datar =1; #16 datar =1;#16 datar =0;
#16 datar =0; #16 datar =1;#16 datar =1; #16 datar =1;#16 datar =1;#16 datar =1; #16 datar =1;#16 datar =0;
/*******************************第二次接收*********************/
#16000 flagr =1;
#16 datar =0; #16 datar =1;#16 datar =1; #16 datar =1;#16 datar =1;#16 datar =1; #16 datar =1;#16 datar =0;
#16 datar =0; #16 datar =1;#16 datar =1; #16 datar =1;#16 datar =1;#16 datar =1; #16 datar =1;#16 datar =0;
#16 datar =0; #16 datar =1;#16 datar =1; #16 datar =1;#16 datar =1;#16 datar =1; #16 datar =1;#16 datar =0;
#16 datar =0; #16 datar =1;#16 datar =1; #16 datar =1;#16 datar =1;#16 datar =1; #16 datar =1;#16 datar =0;
//flagr =0;
for (i=0;i<100;i=i+1)
begin
#16 datar =0; #16 datar =1;#16 datar =0; #16 datar =1;#16 datar =0;#16 datar =1; #16 datar =0;#16 datar =0;
#16 datar =1; #16 datar =1;#16 datar =0; #16 datar =1;#16 datar =1;#16 datar =1; #16 datar =0;#16 datar =1;
#16 datar =1; #16 datar =1;#16 datar =0; #16 datar =0;#16 datar =1;#16 datar =1; #16 datar =0;#16 datar =0;
#16 datar =1; #16 datar =1;#16 datar =0; #16 datar =1;#16 datar =1;#16 datar =1; #16 datar =0;#16 datar =1;
#16 datar =1; #16 datar =1;#16 datar =0; #16 datar =0;#16 datar =1;#16 datar =1; #16 datar =0;#16 datar =0;
end
#16 datar =0; #16 datar =1;#16 datar =1; #16 datar =1;#16 datar =1;#16 datar =1; #16 datar =1;#16 datar =0;
#16 datar =0; #16 datar =1;#16 datar =1; #16 datar =1;#16 datar =1;#16 datar =1; #16 datar =1;#16 datar =0;
#16 datar =0; #16 datar =1;#16 datar =1; #16 datar =1;#16 datar =1;#16 datar =1; #16 datar =1;#16 datar =0;
#16 datar =0; #16 datar =1;#16 datar =1; #16 datar =1;#16 datar =1;#16 datar =1; #16 datar =1;#16 datar =0;
#128000
$finish;
end
initial
begin
$dumpfile("hdlcrev_testbench.vcd");
$dumpvars(0,hdlcrev_testbench);
$display("hdlcrev_testbench!");
end
hdlcrev u_hdlcrev(
. rst_n ( rst_n ), // 复位,低有效
. clkr ( clk ), // 串口时钟
. datar ( datar ), // 数据
. flagr ( flagr ), // 接收触发信号
. ramd ( ramd ), // [7:0] 接收缓存数据信号
. rama ( rama ), // [8:0] 接收缓存地址信号
. hwr ( hwr ), // 接收缓存写信号
. interrupt ( interrupt ) // 接收完成中断信号
);
endmodule