Skip to content

ollycassidy13/MAX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MAX

SystemVerilog

A parameterizable SystemVerilog module for finding the maximum value and its index from chunked input data.

Features

  • Configurable input width and chunk size
  • Balanced tree reduction for optimal timing
  • Optional pipelining and input/output registers
  • Support for signed/unsigned comparison
  • Configurable tie-breaking (first vs last index wins)
  • LSB-first or MSB-first chunking

Usage

max_idx_tree #(
    .TOTAL_WIDTH      (60),
    .CHUNK_WIDTH      (6),
    .REQUIRE_MULTIPLE (1),
    .SIGNED_COMPARE   (0),
    .TIE_HIGH_INDEX   (0),
    .PIPE_STAGES      (0),
    .REGISTER_INPUT   (0),
    .REGISTER_OUTPUT  (0),
    .MSB_FIRST        (0)
) max_finder (
    .clk(clk),
    .rst_n(rst_n),
    .ce_i(1'b1),
    .valid_i(valid),
    .din(data_in),
    .valid_o(valid_out),
    .idx_o(max_index),
    .val_o(max_value)
);

Testing

Compile and run the testbench (combinational):

bash run_max_idx_tree_tb.sh

About

A parameterizable SystemVerilog module for finding the maximum value and its index from chunked input data.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors