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

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [axi4_stream_lib/] [src/] [recursive_axis_catenate.sv] - Diff between revs 36 and 51

Show entire file | Details | Blame | View Log

Rev 36 Rev 51
Line 32... Line 32...
    N, // data bus width in bytes
    N, // data bus width in bytes
    I = 1, // TID width
    I = 1, // TID width
    D = 1, // TDEST width
    D = 1, // TDEST width
    U = 1, // TUSER width
    U = 1, // TUSER width
    U_IS_EOP = -1,
    U_IS_EOP = -1,
    MA, // mux select width
    MN // number of inputs to mux
    MD = 2 ** MA
 
  )
  )
  (
  (
    axis_if         axis_in [MD-1:0],
    axis_if axis_in[MN-1:0],
    axis_if         axis_out,
    axis_if         axis_out,
    input           aclk,
    input           aclk,
    input           aresetn
    input           aresetn
  );
  );
 
// --------------------------------------------------------------------
 
// synthesis translate_off
 
  initial begin
 
    assert(MN > 0) else $fatal;
 
  end
 
// synthesis translate_on
 
// --------------------------------------------------------------------
 
 
 
  // --------------------------------------------------------------------
 
  localparam MA = $clog2(MN);    // mux select width
 
  localparam MH = 2 ** (MA - 1); // half of ceil(number of inputs)
 
  localparam MR = MN - MH;       // upper remainder
 
 
  // --------------------------------------------------------------------
  // --------------------------------------------------------------------
  //
 
  generate
  generate
    if(MA == 1)
    if(MN == 1) begin : one
    begin: catenate_gen
      axis_alias axis_alias_i(axis_in[0], axis_out);
 
    end
 
    else if(MN == 2) begin : two
      axis_catenate #(.N(N), .I(I), .D(D), .U(U), .U_IS_EOP(U_IS_EOP))
      axis_catenate #(.N(N), .I(I), .D(D), .U(U), .U_IS_EOP(U_IS_EOP))
        axis_catenate_i(.*);
        axis_catenate_i(.*);
    end
    end
    else
    else begin: recurse
    begin: recursive_catenate_gen
 
      // --------------------------------------------------------------------
 
      //
 
      axis_if #(.N(N), .I(I), .D(D), .U(U)) axis_catenate_out[1:0](.*);
      axis_if #(.N(N), .I(I), .D(D), .U(U)) axis_catenate_out[1:0](.*);
 
 
      recursive_axis_catenate
      recursive_axis_catenate
        #(
        #( .N(N)
          .N(N),
        ,  .I(I)
          .I(I),
        ,  .D(D)
          .D(D),
        ,  .U(U)
          .U(U),
        ,  .U_IS_EOP(U_IS_EOP)
          .U_IS_EOP(U_IS_EOP),
        ,  .MN(MH)
          .MA(MA - 1)
 
        )
        )
        catenate_lo
        catenate_lo
        (
        ( .axis_in(axis_in[MH-1:0]),
          .axis_in(axis_in[(MD/2)-1:0]),
 
          .axis_out(axis_catenate_out[0]),
          .axis_out(axis_catenate_out[0]),
          .*
          .* );
        );
 
 
 
      // --------------------------------------------------------------------
      if(MR == 1) begin : one
      //
        axis_alias axis_alias_i(axis_in[MH], axis_catenate_out[1]);
 
      end
 
      else if(MR == 2) begin : two
 
        axis_catenate #(.N(N), .I(I), .D(D), .U(U), .U_IS_EOP(U_IS_EOP))
 
          axis_catenate_i
 
          ( .axis_in(axis_in[MH+1:MH]),
 
            .axis_out(axis_catenate_out[1]),
 
            .* );
 
      end
 
      else begin : more
      recursive_axis_catenate
      recursive_axis_catenate
        #(
          #( .N(N)
          .N(N),
          ,  .I(I)
          .I(I),
          ,  .D(D)
          .D(D),
          ,  .U(U)
          .U(U),
          ,  .U_IS_EOP(U_IS_EOP)
          .U_IS_EOP(U_IS_EOP),
          ,  .MN(MR)
          .MA(MA - 1)
 
        )
        )
        catenate_hi
        catenate_hi
        (
          ( .axis_in(axis_in[MN-1:MN-MR]),
          .axis_in(axis_in[MD-1:(MD/2)]),
 
          .axis_out(axis_catenate_out[1]),
          .axis_out(axis_catenate_out[1]),
          .*
            .* );
        );
      end
 
 
      // --------------------------------------------------------------------
      axis_catenate #(.N(N), .I(I), .D(D), .U(U), .U_IS_EOP(U_IS_EOP))
      //
 
      axis_catenate
 
        #(
 
          .N(N),
 
          .I(I),
 
          .D(D),
 
          .U(U),
 
          .U_IS_EOP(U_IS_EOP)
 
        )
 
        axis_catenate_i(.axis_in(axis_catenate_out), .*);
        axis_catenate_i(.axis_in(axis_catenate_out), .*);
    end
    end
  endgenerate
  endgenerate
 
 
 
 
// --------------------------------------------------------------------
// --------------------------------------------------------------------
//
 
endmodule
endmodule
 
 

powered by: WebSVN 2.1.0

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