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 |
38 |
qaztronic |
defparam axis_mux_out.N = N; // why are these needed for recursive modules?
|
49 |
37 |
qaztronic |
defparam axis_mux_out.I = I;
|
50 |
|
|
defparam axis_mux_out.D = D;
|
51 |
|
|
defparam axis_mux_out.U = U;
|
52 |
|
|
axis_if axis_mux_out(.*);
|
53 |
|
|
// axis_if #(.N(N), .I(I), .D(D), .U(U)) axis_mux_out(.*);
|
54 |
28 |
qaztronic |
|
55 |
36 |
qaztronic |
assign axis_in[0].tready = select ? 0 : axis_mux_out.tready;
|
56 |
|
|
assign axis_in[1].tready = select ? axis_mux_out.tready : 0;
|
57 |
28 |
qaztronic |
|
58 |
36 |
qaztronic |
assign axis_mux_out.tvalid = select ? axis_in[1].tvalid : axis_in[0].tvalid;
|
59 |
|
|
assign axis_mux_out.tdata = select ? axis_in[1].tdata : axis_in[0].tdata;
|
60 |
|
|
assign axis_mux_out.tstrb = select ? axis_in[1].tstrb : axis_in[0].tstrb;
|
61 |
|
|
assign axis_mux_out.tkeep = select ? axis_in[1].tkeep : axis_in[0].tkeep;
|
62 |
|
|
assign axis_mux_out.tlast = select ? axis_in[1].tlast : axis_in[0].tlast;
|
63 |
|
|
assign axis_mux_out.tid = select ? axis_in[1].tid : axis_in[0].tid;
|
64 |
|
|
assign axis_mux_out.tdest = select ? axis_in[1].tdest : axis_in[0].tdest;
|
65 |
|
|
assign axis_mux_out.tuser = select ? axis_in[1].tuser : axis_in[0].tuser;
|
66 |
28 |
qaztronic |
|
67 |
|
|
|
68 |
|
|
// --------------------------------------------------------------------
|
69 |
|
|
//
|
70 |
38 |
qaztronic |
defparam axis_register_slice_i.N = N; // why are these needed for recursive modules?
|
71 |
37 |
qaztronic |
defparam axis_register_slice_i.I = I;
|
72 |
|
|
defparam axis_register_slice_i.D = D;
|
73 |
|
|
defparam axis_register_slice_i.U = U;
|
74 |
28 |
qaztronic |
axis_register_slice
|
75 |
37 |
qaztronic |
// #(
|
76 |
|
|
// .N(N),
|
77 |
|
|
// .I(I),
|
78 |
|
|
// .D(D),
|
79 |
|
|
// .U(U),
|
80 |
|
|
// .USE_TSTRB(0),
|
81 |
|
|
// .USE_TKEEP(0)
|
82 |
|
|
// )
|
83 |
28 |
qaztronic |
axis_register_slice_i
|
84 |
|
|
(
|
85 |
36 |
qaztronic |
.axis_in(axis_mux_out), // slave
|
86 |
|
|
.axis_out(axis_out), // master
|
87 |
28 |
qaztronic |
.*
|
88 |
|
|
);
|
89 |
|
|
|
90 |
|
|
|
91 |
36 |
qaztronic |
// --------------------------------------------------------------------
|
92 |
|
|
//
|
93 |
28 |
qaztronic |
endmodule
|
94 |
|
|
|
95 |
|
|
|