| 1 |
34 |
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 |
|
|
|
| 29 |
|
|
module
|
| 30 |
|
|
riffa_axis_test_pattern
|
| 31 |
|
|
#(
|
| 32 |
|
|
N, // RIFFA data bus width in bytes
|
| 33 |
|
|
W = 4, // word width in bytes
|
| 34 |
|
|
WPB = N / W // number of words per beat
|
| 35 |
|
|
)
|
| 36 |
|
|
(
|
| 37 |
|
|
riffa_chnl_if chnl_in,
|
| 38 |
|
|
input [31:0] tx_len,
|
| 39 |
|
|
input clk,
|
| 40 |
|
|
input reset
|
| 41 |
|
|
);
|
| 42 |
|
|
|
| 43 |
|
|
// --------------------------------------------------------------------
|
| 44 |
|
|
//
|
| 45 |
|
|
localparam I = 0; // TID width
|
| 46 |
|
|
localparam D = 0; // TDEST width
|
| 47 |
|
|
localparam U = 3; // TUSER width
|
| 48 |
|
|
localparam RW = (N/4); // width of the RIFFA bus in 32 bit words
|
| 49 |
|
|
|
| 50 |
|
|
|
| 51 |
|
|
// --------------------------------------------------------------------
|
| 52 |
|
|
//
|
| 53 |
|
|
wire aclk = clk;
|
| 54 |
|
|
wire aresetn = ~reset;
|
| 55 |
|
|
|
| 56 |
|
|
|
| 57 |
|
|
// --------------------------------------------------------------------
|
| 58 |
|
|
//
|
| 59 |
|
|
axis_if #(.N(N), .I(I), .D(D), .U(U)) axis_out(.*);
|
| 60 |
|
|
|
| 61 |
|
|
axis_test_patern #(.N(N), .W(W), .WPB(WPB))
|
| 62 |
|
|
axis_test_patern_i(.*);
|
| 63 |
|
|
|
| 64 |
|
|
|
| 65 |
|
|
// --------------------------------------------------------------------
|
| 66 |
|
|
//
|
| 67 |
|
|
wire tx_ready = 1;
|
| 68 |
|
|
wire tx_last = 1;
|
| 69 |
|
|
wire acked;
|
| 70 |
|
|
wire [30:0] tx_off = 0;
|
| 71 |
|
|
wire [30:0] tx_index;
|
| 72 |
|
|
wire tx_done = (tx_index >= tx_len - RW);
|
| 73 |
|
|
|
| 74 |
|
|
riffa_chn_tx #(.N(N))
|
| 75 |
|
|
riffa_chn_tx_i(.*);
|
| 76 |
|
|
|
| 77 |
|
|
|
| 78 |
|
|
// --------------------------------------------------------------------
|
| 79 |
|
|
//
|
| 80 |
|
|
assign axis_out.tready = chnl_in.tx_data_ren & acked;
|
| 81 |
|
|
|
| 82 |
|
|
|
| 83 |
|
|
// --------------------------------------------------------------------
|
| 84 |
|
|
//
|
| 85 |
|
|
assign chnl_in.rx_clk = clk;
|
| 86 |
|
|
assign chnl_in.tx_clk = clk;
|
| 87 |
|
|
assign chnl_in.rx_reset = reset;
|
| 88 |
|
|
assign chnl_in.tx_reset = reset;
|
| 89 |
|
|
assign chnl_in.tx_last = tx_last;
|
| 90 |
|
|
assign chnl_in.tx_len = tx_len;
|
| 91 |
|
|
assign chnl_in.tx_off = tx_off;
|
| 92 |
|
|
assign chnl_in.tx_data_valid = axis_out.tvalid & acked;
|
| 93 |
|
|
assign chnl_in.tx_data = axis_out.tdata;
|
| 94 |
|
|
|
| 95 |
|
|
// --------------------------------------------------------------------
|
| 96 |
|
|
//
|
| 97 |
|
|
endmodule
|
| 98 |
|
|
|
| 99 |
|
|
|
| 100 |
|
|
|
| 101 |
|
|
|