OpenCores
URL https://opencores.org/ocsvn/qaz_libs/qaz_libs/trunk

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [axi4_stream_lib/] [src/] [axis_switch.sv] - Blame information for rev 47

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 36 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
  axis_switch
31
  #(
32
    N,      // data bus width in bytes
33
    I = 1,  // TID width
34
    D = 1,  // TDEST width
35
    U = 1   // TUSER width
36
  )
37
  (
38
    input   select,
39
    axis_if axis_in,
40
    axis_if axis_out[1:0],
41
    input   aclk,
42
    input   aresetn
43
  );
44
 
45
  // --------------------------------------------------------------------
46
  //
47
  axis_if #(.N(N), .I(I), .D(D), .U(U)) axis_fanout[1:0](.*);
48
 
49
 
50
  // --------------------------------------------------------------------
51
  //
52
  assign axis_fanout[0].tdata  = axis_in.tdata;
53
  assign axis_fanout[0].tstrb  = axis_in.tstrb;
54
  assign axis_fanout[0].tkeep  = axis_in.tkeep;
55
  assign axis_fanout[0].tlast  = axis_in.tlast;
56
  assign axis_fanout[0].tid    = axis_in.tid;
57
  assign axis_fanout[0].tdest  = axis_in.tdest;
58
  assign axis_fanout[0].tuser  = axis_in.tuser;
59
 
60
 
61
  // --------------------------------------------------------------------
62
  //
63
  assign axis_fanout[1].tdata  = axis_in.tdata;
64
  assign axis_fanout[1].tstrb  = axis_in.tstrb;
65
  assign axis_fanout[1].tkeep  = axis_in.tkeep;
66
  assign axis_fanout[1].tlast  = axis_in.tlast;
67
  assign axis_fanout[1].tid    = axis_in.tid;
68
  assign axis_fanout[1].tdest  = axis_in.tdest;
69
  assign axis_fanout[1].tuser  = axis_in.tuser;
70
 
71
 
72
  // --------------------------------------------------------------------
73
  //
74
  assign axis_in.tready = select ? axis_fanout[1].tready : axis_fanout[0].tready;
75
 
76
 
77
  // --------------------------------------------------------------------
78
  //
79
  assign axis_fanout[0].tvalid = axis_in.tvalid & (select == 0);
80
  assign axis_fanout[1].tvalid = axis_in.tvalid & (select == 1);
81
 
82
 
83
  // --------------------------------------------------------------------
84
  //
85 38 qaztronic
  defparam axis_register_slice_lo.N = N; // why are these needed for recursive modules?
86 36 qaztronic
  defparam axis_register_slice_lo.I = I;
87
  defparam axis_register_slice_lo.D = D;
88
  defparam axis_register_slice_lo.U = U;
89
  defparam axis_register_slice_lo.USE_TSTRB = 0;
90
  defparam axis_register_slice_lo.USE_TKEEP = 0;
91
  axis_register_slice
92
    // #(
93
      // .N(N),
94
      // .I(I),
95
      // .D(D),
96
      // .U(U),
97
      // .USE_TSTRB(0),
98
      // .USE_TKEEP(0)
99
    // )
100
    axis_register_slice_lo
101
    (
102
      .axis_in(axis_fanout[0]),
103
      .axis_out(axis_out[0]),
104
      .*
105
    );
106
 
107
 
108
  // --------------------------------------------------------------------
109
  //
110
  // why does questasim need these for recursive modules?
111
  defparam axis_register_slice_hi.N = N;
112
  defparam axis_register_slice_hi.I = I;
113
  defparam axis_register_slice_hi.D = D;
114
  defparam axis_register_slice_hi.U = U;
115
  defparam axis_register_slice_hi.USE_TSTRB = 0;
116
  defparam axis_register_slice_hi.USE_TKEEP = 0;
117
  axis_register_slice
118
    // #(
119
      // .N(N),
120
      // .I(I),
121
      // .D(D),
122
      // .U(U),
123
      // .USE_TSTRB(0),
124
      // .USE_TKEEP(0)
125
    // )
126
    axis_register_slice_hi
127
    (
128
      .axis_in(axis_fanout[1]),
129
      .axis_out(axis_out[1]),
130
      .*
131
    );
132
 
133
 
134
// --------------------------------------------------------------------
135
//
136
endmodule
137
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.