| 1 |
28 |
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 |
|
|
module
|
| 29 |
|
|
axis_mux
|
| 30 |
|
|
#(
|
| 31 |
36 |
qaztronic |
N, // data bus width in bytes
|
| 32 |
|
|
I = 1, // TID width
|
| 33 |
|
|
D = 1, // TDEST width
|
| 34 |
|
|
U = 1, // TUSER width
|
| 35 |
28 |
qaztronic |
USE_TSTRB = 0, // set to 1 to enable, 0 to disable
|
| 36 |
|
|
USE_TKEEP = 0 // set to 1 to enable, 0 to disable
|
| 37 |
|
|
)
|
| 38 |
|
|
(
|
| 39 |
36 |
qaztronic |
input select,
|
| 40 |
|
|
axis_if axis_in[1:0],
|
| 41 |
31 |
qaztronic |
axis_if axis_out,
|
| 42 |
|
|
input aclk,
|
| 43 |
|
|
input aresetn
|
| 44 |
28 |
qaztronic |
);
|
| 45 |
|
|
|
| 46 |
|
|
// --------------------------------------------------------------------
|
| 47 |
|
|
//
|
| 48 |
36 |
qaztronic |
axis_if #(.N(N), .I(I), .D(D), .U(U)) axis_mux_out(.*);
|
| 49 |
28 |
qaztronic |
|
| 50 |
36 |
qaztronic |
assign axis_in[0].tready = select ? 0 : axis_mux_out.tready;
|
| 51 |
|
|
assign axis_in[1].tready = select ? axis_mux_out.tready : 0;
|
| 52 |
28 |
qaztronic |
|
| 53 |
36 |
qaztronic |
assign axis_mux_out.tvalid = select ? axis_in[1].tvalid : axis_in[0].tvalid;
|
| 54 |
|
|
assign axis_mux_out.tdata = select ? axis_in[1].tdata : axis_in[0].tdata;
|
| 55 |
|
|
assign axis_mux_out.tstrb = select ? axis_in[1].tstrb : axis_in[0].tstrb;
|
| 56 |
|
|
assign axis_mux_out.tkeep = select ? axis_in[1].tkeep : axis_in[0].tkeep;
|
| 57 |
|
|
assign axis_mux_out.tlast = select ? axis_in[1].tlast : axis_in[0].tlast;
|
| 58 |
|
|
assign axis_mux_out.tid = select ? axis_in[1].tid : axis_in[0].tid;
|
| 59 |
|
|
assign axis_mux_out.tdest = select ? axis_in[1].tdest : axis_in[0].tdest;
|
| 60 |
|
|
assign axis_mux_out.tuser = select ? axis_in[1].tuser : axis_in[0].tuser;
|
| 61 |
28 |
qaztronic |
|
| 62 |
|
|
|
| 63 |
|
|
// --------------------------------------------------------------------
|
| 64 |
|
|
//
|
| 65 |
|
|
axis_register_slice
|
| 66 |
|
|
#(
|
| 67 |
|
|
.N(N),
|
| 68 |
|
|
.I(I),
|
| 69 |
|
|
.D(D),
|
| 70 |
|
|
.U(U),
|
| 71 |
36 |
qaztronic |
.USE_TSTRB(0),
|
| 72 |
|
|
.USE_TKEEP(0)
|
| 73 |
28 |
qaztronic |
)
|
| 74 |
|
|
axis_register_slice_i
|
| 75 |
|
|
(
|
| 76 |
36 |
qaztronic |
.axis_in(axis_mux_out), // slave
|
| 77 |
|
|
.axis_out(axis_out), // master
|
| 78 |
28 |
qaztronic |
.*
|
| 79 |
|
|
);
|
| 80 |
|
|
|
| 81 |
|
|
|
| 82 |
36 |
qaztronic |
// --------------------------------------------------------------------
|
| 83 |
|
|
//
|
| 84 |
28 |
qaztronic |
endmodule
|
| 85 |
|
|
|
| 86 |
|
|
|