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

Subversion Repositories srdydrdy_lib

[/] [srdydrdy_lib/] [trunk/] [examples/] [bridge/] [rtl/] [basic_hashfunc.v] - Diff between revs 4 and 8

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 4 Rev 8
Line 6... Line 6...
 * a natural power of 2.
 * a natural power of 2.
 */
 */
module basic_hashfunc
module basic_hashfunc
  #(parameter input_sz=48,
  #(parameter input_sz=48,
    parameter table_sz=1024,
    parameter table_sz=1024,
    parameter fsz=clogb2(table_sz))
    parameter fsz=$clog2(table_sz))
  (
  (
   input [input_sz-1:0]  hf_in,
   input [input_sz-1:0]  hf_in,
   output reg [fsz-1:0]  hf_out);
   output reg [fsz-1:0]  hf_out);
 
 
  //localparam folds = (input_sz/fsz) + ( (input_sz%fsz) == 0) ? 0 : 1;
  // const function not supported by Icarus Verilog
  localparam folds = num_folds(input_sz, fsz);
  //localparam folds = num_folds(input_sz, fsz);
 
  localparam folds = 5;
 
 
  wire [folds*fsz-1:0]   tmp_array;
  wire [folds*fsz-1:0]   tmp_array;
 
 
  assign tmp_array = hf_in;
  assign tmp_array = hf_in;
 
 
Line 45... Line 46...
          num_folds = num_folds + 1;
          num_folds = num_folds + 1;
        end
        end
    end
    end
  endfunction
  endfunction
 
 
  function integer clogb2;
/* -----\/----- EXCLUDED -----\/-----
    input [31:0] depth;
  function integer clogb2;
    integer      i;
    input [31:0] depth;
    begin
    integer      i;
      i = depth;
    begin
      for (clogb2=0; i>0; clogb2=clogb2+1)
      i = depth;
        i = i >> 1;
      for (clogb2=0; i>0; clogb2=clogb2+1)
    end
        i = i >> 1;
  endfunction // for
    end
 
  endfunction // for
 
 -----/\----- EXCLUDED -----/\----- */
 
 
endmodule // hashfunc
endmodule // hashfunc
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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