1 |
49 |
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 |
|
|
|
29 |
|
|
module tb_top();
|
30 |
|
|
|
31 |
|
|
// --------------------------------------------------------------------
|
32 |
|
|
// test bench clock & reset
|
33 |
|
|
wire clk_200mhz;
|
34 |
|
|
wire tb_clk = clk_200mhz;
|
35 |
|
|
wire tb_rst;
|
36 |
|
|
|
37 |
|
|
tb_base #(.PERIOD(5_000)) tb(clk_200mhz, tb_rst);
|
38 |
|
|
|
39 |
|
|
|
40 |
|
|
// --------------------------------------------------------------------
|
41 |
|
|
//
|
42 |
|
|
wire tb_rst_s;
|
43 |
|
|
wire aclk = tb_clk;
|
44 |
|
|
wire aresetn = ~tb_rst_s;
|
45 |
|
|
|
46 |
|
|
sync_reset
|
47 |
|
|
sync_reset_i(aclk, tb_rst, tb_rst_s);
|
48 |
|
|
|
49 |
|
|
|
50 |
|
|
// --------------------------------------------------------------------
|
51 |
|
|
//
|
52 |
|
|
import tb_axis_upsizer_class_pkg::*;
|
53 |
|
|
|
54 |
|
|
|
55 |
|
|
// --------------------------------------------------------------------
|
56 |
|
|
//
|
57 |
|
|
axis_if #(.N(AVF_N), .U(AVF_U)) axis_in(.*);
|
58 |
|
|
axis_if #(.N(AVF_N * S), .U(AVF_U * S)) axis_out(.*);
|
59 |
|
|
|
60 |
|
|
|
61 |
|
|
// --------------------------------------------------------------------
|
62 |
|
|
//
|
63 |
|
|
axis_upsizer
|
64 |
|
|
#(
|
65 |
|
|
.N(AVF_N), // data bus width in bytes
|
66 |
|
|
.I(1), // TID width
|
67 |
|
|
.D(1), // TDEST width
|
68 |
|
|
.U(AVF_U), // TUSER width
|
69 |
|
|
.S(S), // tdata size multiplier
|
70 |
|
|
.USE_TSTRB(0), // set to 1 to enable, 0 to disable
|
71 |
|
|
.USE_TKEEP(0), // set to 1 to enable, 0 to disable
|
72 |
|
|
.BYTES_PER_TUSER(0) // bytes per tuser bit. Set to 0 for transfer based.
|
73 |
|
|
)
|
74 |
|
|
dut(.*);
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
// --------------------------------------------------------------------
|
78 |
|
|
// sim models
|
79 |
|
|
// | | | | | | | | | | | | | | | | |
|
80 |
|
|
// \|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/
|
81 |
|
|
// ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
|
82 |
|
|
|
83 |
|
|
// --------------------------------------------------------------------
|
84 |
|
|
//
|
85 |
|
|
axis_checker #(.N(AVF_N * S), .I(1), .D(1), .U(AVF_U))
|
86 |
|
|
axis_checker_i(.*);
|
87 |
|
|
|
88 |
|
|
|
89 |
|
|
// --------------------------------------------------------------------
|
90 |
|
|
//
|
91 |
|
|
axis_if #(.N(AVF_N * S), .U(AVF_U)) avf_axis_in_if(.*);
|
92 |
|
|
|
93 |
|
|
assign axis_out.tready = avf_axis_in_if.tready;
|
94 |
|
|
assign avf_axis_in_if.tvalid = axis_out.tvalid;
|
95 |
|
|
assign avf_axis_in_if.tdata = axis_out.tdata;
|
96 |
|
|
assign avf_axis_in_if.tuser = {axis_out.tuser[(AVF_U*S)-1], axis_out.tuser[1:0]};
|
97 |
|
|
assign avf_axis_in_if.tlast = axis_out.tlast;
|
98 |
|
|
|
99 |
|
|
|
100 |
|
|
// --------------------------------------------------------------------
|
101 |
|
|
//
|
102 |
|
|
tb_axis_upsizer_class a_h;
|
103 |
|
|
|
104 |
|
|
initial
|
105 |
|
|
a_h = new(.avf_axis_in_if(avf_axis_in_if), .avf_axis_out_if(axis_in));
|
106 |
|
|
|
107 |
|
|
|
108 |
|
|
// --------------------------------------------------------------------
|
109 |
|
|
//
|
110 |
|
|
|
111 |
|
|
// ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
|
112 |
|
|
// /|\-/|\-/|\-/|\-/|\-/|\-/|\-/|\-/|\-/|\-/|\-/|\-/|\-/|\-/|\-/|\-/|\
|
113 |
|
|
// | | | | | | | | | | | | | | | | |
|
114 |
|
|
// sim models
|
115 |
|
|
// --------------------------------------------------------------------
|
116 |
|
|
|
117 |
|
|
|
118 |
|
|
// --------------------------------------------------------------------
|
119 |
|
|
// debug wires
|
120 |
|
|
|
121 |
|
|
|
122 |
|
|
// --------------------------------------------------------------------
|
123 |
|
|
// test
|
124 |
|
|
the_test test( tb_clk, tb_rst );
|
125 |
|
|
|
126 |
|
|
initial
|
127 |
|
|
begin
|
128 |
|
|
|
129 |
|
|
test.run_the_test();
|
130 |
|
|
|
131 |
|
|
$display("^^^---------------------------------");
|
132 |
|
|
$display("^^^ %16.t | Testbench done.", $time);
|
133 |
|
|
$display("^^^---------------------------------");
|
134 |
|
|
|
135 |
|
|
$display("^^^---------------------------------");
|
136 |
|
|
|
137 |
|
|
$stop();
|
138 |
|
|
|
139 |
|
|
end
|
140 |
|
|
|
141 |
|
|
endmodule
|
142 |
|
|
|
143 |
|
|
|
144 |
|
|
|