1 |
29 |
qaztronic |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// Copyright (C) 2015 Authors and OPENCORES.ORG ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// This source file may be used and distributed without ////
|
6 |
|
|
//// restriction provided that this copyright statement is not ////
|
7 |
|
|
//// removed from the file and that any derivative work contains ////
|
8 |
|
|
//// the original copyright notice and the associated disclaimer. ////
|
9 |
|
|
//// ////
|
10 |
|
|
//// This source file is free software; you can redistribute it ////
|
11 |
|
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
12 |
|
|
//// Public License as published by the Free Software Foundation; ////
|
13 |
|
|
//// either version 2.1 of the License, or (at your option) any ////
|
14 |
|
|
//// later version. ////
|
15 |
|
|
//// ////
|
16 |
|
|
//// This source is distributed in the hope that it will be ////
|
17 |
|
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
18 |
|
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
19 |
|
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
20 |
|
|
//// details. ////
|
21 |
|
|
//// ////
|
22 |
|
|
//// You should have received a copy of the GNU Lesser General ////
|
23 |
|
|
//// Public License along with this source; if not, download it ////
|
24 |
|
|
//// from http://www.opencores.org/lgpl.shtml ////
|
25 |
|
|
//// ////
|
26 |
|
|
//////////////////////////////////////////////////////////////////////
|
27 |
|
|
|
28 |
|
|
`timescale 1ps/1ps
|
29 |
|
|
|
30 |
|
|
|
31 |
|
|
module
|
32 |
|
|
the_test(
|
33 |
|
|
input tb_clk,
|
34 |
|
|
input tb_rst
|
35 |
|
|
);
|
36 |
|
|
|
37 |
|
|
// --------------------------------------------------------------------
|
38 |
|
|
//
|
39 |
|
|
localparam A = tb_top.A;
|
40 |
|
|
localparam N = tb_top.N;
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
// --------------------------------------------------------------------
|
44 |
|
|
//
|
45 |
|
|
import axi4_transaction_pkg::*;
|
46 |
|
|
axi4_payload_class payload_h;
|
47 |
|
|
|
48 |
|
|
|
49 |
|
|
// --------------------------------------------------------------------
|
50 |
|
|
//
|
51 |
|
|
logic [(8*N)-1:0] data[];
|
52 |
|
|
logic [1:0] resp;
|
53 |
|
|
|
54 |
|
|
task run_the_test;
|
55 |
|
|
|
56 |
|
|
// --------------------------------------------------------------------
|
57 |
|
|
// insert test below
|
58 |
|
|
// --------------------------------------------------------------------
|
59 |
|
|
$display("^^^---------------------------------");
|
60 |
|
|
$display("^^^ %16.t | Testbench begun.\n", $time);
|
61 |
|
|
$display("^^^---------------------------------");
|
62 |
|
|
// --------------------------------------------------------------------
|
63 |
|
|
|
64 |
|
|
tb_top.tb.timeout_stop(20us);
|
65 |
|
|
// tb_top.tb.timeout_stop(300ns);
|
66 |
|
|
|
67 |
|
|
|
68 |
|
|
// --------------------------------------------------------------------
|
69 |
|
|
wait(~tb_rst);
|
70 |
|
|
|
71 |
|
|
|
72 |
|
|
// --------------------------------------------------------------------
|
73 |
|
|
#100ns;
|
74 |
|
|
|
75 |
|
|
repeat(5)
|
76 |
|
|
begin
|
77 |
|
|
tb_top.bfm.basic_read(32'h1234_0000, 3, data, resp);
|
78 |
|
|
|
79 |
|
|
foreach(data[i])
|
80 |
|
|
$display("^^^ %16.t | %d | 0x%016x |", $time, i, data[i]);
|
81 |
|
|
end
|
82 |
|
|
|
83 |
|
|
tb_top.bfm.basic_read(32'habcd_0000, 0, data, resp);
|
84 |
|
|
$display("^^^ %16.t | 0x%016x |", $time, data[0]);
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
// // --------------------------------------------------------------------
|
88 |
|
|
// tb_top.bfm.basic_read(32'habcd_0000, 0, data, resp);
|
89 |
|
|
// $display("^^^ %16.t | 0x%016x |", $time, data[0]);
|
90 |
|
|
|
91 |
|
|
// --------------------------------------------------------------------
|
92 |
|
|
#100ns;
|
93 |
|
|
|
94 |
|
|
data = new[1];
|
95 |
|
|
data[0] = 64'habba_beef_cafe_1a7e;
|
96 |
|
|
tb_top.bfm.basic_write(32'h1234_0000, 0, data, resp);
|
97 |
|
|
|
98 |
|
|
// --------------------------------------------------------------------
|
99 |
|
|
#100ns;
|
100 |
|
|
|
101 |
|
|
repeat(5)
|
102 |
|
|
begin
|
103 |
|
|
tb_top.bfm.basic_random_write(32'habcd_0000, 0, resp);
|
104 |
|
|
end
|
105 |
|
|
|
106 |
|
|
// --------------------------------------------------------------------
|
107 |
|
|
#100ns;
|
108 |
|
|
|
109 |
|
|
repeat(5)
|
110 |
|
|
begin
|
111 |
|
|
tb_top.bfm.basic_random_write(32'habcd_0000, 3, resp);
|
112 |
|
|
end
|
113 |
|
|
|
114 |
|
|
// --------------------------------------------------------------------
|
115 |
|
|
#100ns;
|
116 |
|
|
|
117 |
|
|
|
118 |
|
|
// --------------------------------------------------------------------
|
119 |
|
|
// insert test above
|
120 |
|
|
// --------------------------------------------------------------------
|
121 |
|
|
|
122 |
|
|
endtask
|
123 |
|
|
|
124 |
|
|
|
125 |
|
|
endmodule
|
126 |
|
|
|