Block Preview

Introduction

This block continuously monitors an input data stream to find either the maximum or minimum value within a specified search window. It outputs both the peak value and its position (index) within the window.

The component operates in two modes:

  • MAX mode: Finds the largest value in the window
  • MIN mode: Finds the smallest value in the window

This is useful for peak detection, envelope tracking, and statistical analysis of streaming data.

Pin Description

IN Input Variable bit BIT VECTOR
Streaming input data to be analyzed. Width: Input bits (2 to 2048 bits) Sampled on each rising clock edge when CE is high.
Default: Must be connected
WINDOW Input Integer bit INT
Number of samples in the search window (integer value). Defines how many consecutive samples are examined. Can be dynamically changed between acquisitions.
Default: Must be connected
START Input 1 bit BIT
Acquisition start trigger (1-bit). Rising edge initiates a new search window. Can be pulsed or held high.
Default: Must be connected
CE Input 1 bit BIT
Clock enable for sampling (1-bit). When high, component samples IN on each clock. Can be tied to ‘1’ for continuous operation.
Default: Must be connected
CLK Input 1 bit BIT
System clock input. All operations are synchronous to this clock. Required for this component (always present).
Default: Must be connected
VALUE Output Variable bit BIT VECTOR
Peak value output (maximum or minimum found in window). Width: Input bits (same as IN) Valid when DV is high.
POSITION Output 16 bit BIT VECTOR
Index of peak value within the window (16-bit unsigned). Range: 0 to WINDOW-1 Valid when DV is high.
DV Output 1 bit BIT
Data valid flag (1-bit). High when VALUE and POSITION outputs contain valid results (asserted after WINDOW samples have been processed).
TRACKHOLD Output 1 bit BIT

Acquisition status indicator (1-bit).

  • ‘1’ = Tracking mode (actively acquiring samples)
  • ‘0’ = Hold mode (window complete, holding results)

Properties

Property window

Input bits InputSize

Set the number of bits of the input

Number of bits for the input data and peak value output. Range: 2-2048 bits.

Default: 16

Range: 2 – 2048

Input sign InputSign

Select the sign/unsign of the input

Selects input interpretation: UNSIGNED (default) or SIGNED (two’s complement). Affects how values are compared.

Default: UNSIGNED

Options: UNSIGNED SIGNED

Find Mode Mode

Select if algorith look for MAX or MIN

Peak detection mode: MAX (find maximum value) or MIN (find minimum value) within the window.

Default: MAX

Options: MAX MIN

Functional description

The Find Max/Min component implements a sliding window peak detector. It examines a configurable number of consecutive samples and identifies the extreme value (maximum or minimum) and its location.

Operation Sequence

  1. START signal initiates a new search window
  2. Component samples input on each clock when CE (clock enable) is high
  3. Compares each new sample against the current peak value
  4. Updates peak value and position when a new extreme is found
  5. After WINDOW samples, asserts DV (data valid) and outputs results
  6. TRACKHOLD indicates acquisition state (track vs. hold)

Peak Finding Algorithm

MAX mode: $$ \mathrm{VALUE} = \max_{i=0}^{W-1} \mathrm{IN}[i] $$

MIN mode: $$ \mathrm{VALUE} = \min_{i=0}^{W-1} \mathrm{IN}[i] $$

Where $W$ is the window size.

Position Tracking

The POSITION output indicates the index (0 to WINDOW-1) where the peak was found. If multiple samples have the same peak value, the position of the first occurrence is reported.

Latency and Timing

The component always has 1 clock cycle of latency (registered operation).

Property Latency (clock cycles)
Find Max/Min 1

Processing time = WINDOW × (number of clock cycles between CE pulses)

Control Signals

  • START: Rising edge begins a new acquisition window
  • CE: Clock enable for sampling (typically ‘1’ for continuous operation)
  • TRACKHOLD: Status output (‘1’ = tracking/acquiring, ‘0’ = holding result)
  • DV: Data valid output (‘1’ when results are valid after window completion)

Typical use cases

  • Peak/valley detection in waveform analysis
  • Envelope detection in signal processing
  • Finding extrema in ADC data streams
  • Statistical analysis of sensor readings
  • Trigger generation based on maximum/minimum values