forked from yashgupta26/AMBA_APB_Protocol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAPB_tb.v
56 lines (44 loc) · 1.08 KB
/
APB_tb.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
module APB_tb;
reg PCLK, PRESETn, Transfer, Wr_Rd;
reg [4:0] Address;
reg [31:0] write_data;
wire [31:0] read_data;
APB_top DUT (PCLK,PRESETn,Transfer,Wr_Rd,Address,write_data,read_data);
initial begin
PCLK = 0;
forever begin
#5 PCLK = ~PCLK;
end
end
initial begin
PRESETn = 1;
Transfer = 1;
//Write Operation 1
Address = 5'b10010;
#10
Wr_Rd = 1;
write_data = 32'hDEADBEEF;
#10
//Write Operation 2
Address = 5'b10101;
Wr_Rd = 1;
write_data = 32'hDABBCAFE;
#30
write_data = 32'hx;
#10
Transfer = 0;
#15 Transfer = 1;
//Read Operation 1
Wr_Rd = 0;
Address = 5'b10010;
//Read Operation 2
#30
Address = 5'b10101;
#20 Transfer = 0;
#20 $finish;
end
initial begin
$dumpfile("APB_wave.vcd");
$dumpvars;
end
endmodule