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

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [axi4_stream_lib/] [src/] [recursive_axis_switch.sv] - Rev 36

Compare with Previous | Blame | View Log

//////////////////////////////////////////////////////////////////////
////                                                              ////
//// Copyright (C) 2017 Authors and OPENCORES.ORG                 ////
////                                                              ////
//// This source file may be used and distributed without         ////
//// restriction provided that this copyright statement is not    ////
//// removed from the file and that any derivative work contains  ////
//// the original copyright notice and the associated disclaimer. ////
////                                                              ////
//// This source file is free software; you can redistribute it   ////
//// and/or modify it under the terms of the GNU Lesser General   ////
//// Public License as published by the Free Software Foundation; ////
//// either version 2.1 of the License, or (at your option) any   ////
//// later version.                                               ////
////                                                              ////
//// This source is distributed in the hope that it will be       ////
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
//// PURPOSE.  See the GNU Lesser General Public License for more ////
//// details.                                                     ////
////                                                              ////
//// You should have received a copy of the GNU Lesser General    ////
//// Public License along with this source; if not, download it   ////
//// from http://www.opencores.org/lgpl.shtml                     ////
////                                                              ////
//////////////////////////////////////////////////////////////////////


module
  recursive_axis_switch
  #(
    N, // data bus width in bytes
    I = 1, // TID width
    D = 1, // TDEST width
    U = 1, // TUSER width
    SA, // mux select width
    SD = 2 ** SA
  )
  (
    input   [SA-1:0] select,
    axis_if axis_in,
    axis_if axis_out[SD-1:0],
    input   aclk,
    input   aresetn
  );

  // --------------------------------------------------------------------
  //
  generate
    if(SA == 1)
    begin: switch_gen
      axis_switch #(.N(N), .I(I), .D(D), .U(U))
        axis_switch_i(.*);
    end
    else
    begin: recursive_switch_gen

      // --------------------------------------------------------------------
      //
      axis_if #(.N(N), .I(I), .D(D), .U(U)) axis_switch_out[1:0](.*);

      axis_switch #(.N(N), .I(I), .D(D), .U(U))
        axis_switch_i
        (
          .select(select[SA-1]),
          .axis_out(axis_switch_out),
          .*
        );


      // --------------------------------------------------------------------
      //
      recursive_axis_switch #(.N(N), .I(I), .D(D), .U(U), .SA(SA - 1))
        switch_lo
        (
          .select(select[SA-2:0]),
          .axis_in(axis_switch_out[0]),
          .axis_out(axis_out[(SD/2)-1:0]),
          .*
        );


      // --------------------------------------------------------------------
      //
      recursive_axis_switch #(.N(N), .I(I), .D(D), .U(U), .SA(SA - 1))
        switch_hi
        (
          .select(select[SA-2:0]),
          .axis_in(axis_switch_out[1]),
          .axis_out(axis_out[SD-1:(SD/2)]),
          .*
        );
    end
  endgenerate


// --------------------------------------------------------------------
//
endmodule

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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