1 |
32 |
qaztronic |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// Copyright (C) 2017 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 the_test(input tb_clk, input tb_rst);
|
32 |
|
|
|
33 |
|
|
// --------------------------------------------------------------------
|
34 |
|
|
//
|
35 |
|
|
import tb_chnl_convolution_pkg::*;
|
36 |
|
|
import riffa_agent_class_pkg::*;
|
37 |
|
|
import riffa_bfm_class_pkg::*;
|
38 |
|
|
|
39 |
|
|
|
40 |
|
|
// --------------------------------------------------------------------
|
41 |
|
|
//
|
42 |
|
|
task automatic send_frame;
|
43 |
|
|
riffa_transaction_class #(N) tr_h;
|
44 |
|
|
int width = 32;
|
45 |
|
|
int height = 16;
|
46 |
|
|
int len = (width * height) / 4;
|
47 |
|
|
|
48 |
|
|
tr_h = new(len, 0, 1);
|
49 |
|
|
tr_h.random(len, 0, 1);
|
50 |
|
|
|
51 |
|
|
tr_h.data[0] = 0;
|
52 |
|
|
tr_h.data[0][10:0] = width; // rFrameWidth
|
53 |
|
|
tr_h.data[0][42:32] = height; // rFrameHeight
|
54 |
|
|
|
55 |
|
|
$display("^^^ %16.t | %m | %d", $time, tr_h.data.size());
|
56 |
|
|
|
57 |
|
|
tb_top.a_h.queue_tx(tr_h);
|
58 |
|
|
|
59 |
|
|
endtask
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
// --------------------------------------------------------------------
|
63 |
|
|
//
|
64 |
|
|
task run_the_test;
|
65 |
|
|
|
66 |
|
|
// --------------------------------------------------------------------
|
67 |
|
|
// insert test below
|
68 |
|
|
// --------------------------------------------------------------------
|
69 |
|
|
$display("^^^---------------------------------");
|
70 |
|
|
$display("^^^ %16.t | Testbench begun.\n", $time);
|
71 |
|
|
$display("^^^---------------------------------");
|
72 |
|
|
// --------------------------------------------------------------------
|
73 |
|
|
|
74 |
|
|
// --------------------------------------------------------------------
|
75 |
|
|
tb_top.tb.timeout_stop(500us);
|
76 |
|
|
|
77 |
|
|
// --------------------------------------------------------------------
|
78 |
|
|
wait(~tb_rst);
|
79 |
|
|
|
80 |
|
|
// --------------------------------------------------------------------
|
81 |
|
|
#200ns;
|
82 |
|
|
|
83 |
|
|
// --------------------------------------------------------------------
|
84 |
|
|
send_frame();
|
85 |
|
|
tb_top.a_h.wait_for_tx();
|
86 |
|
|
|
87 |
|
|
// --------------------------------------------------------------------
|
88 |
|
|
#1us;
|
89 |
|
|
send_frame();
|
90 |
|
|
tb_top.a_h.wait_for_tx();
|
91 |
|
|
|
92 |
|
|
|
93 |
|
|
// --------------------------------------------------------------------
|
94 |
|
|
#1us;
|
95 |
|
|
|
96 |
|
|
|
97 |
|
|
// --------------------------------------------------------------------
|
98 |
|
|
// insert test above
|
99 |
|
|
// --------------------------------------------------------------------
|
100 |
|
|
|
101 |
|
|
endtask
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
endmodule
|
105 |
|
|
|