Skip to the selected question
ASIC.FYI

ASIC Question Bank

1,000+ hardware interview questions
DescriptionQ1088
Page ↗
Q1088DesignASIC interview problem

Measure the maximum gain in a sample stream

TechniquesRunning minimumStreaming reductionTie breaking
DifficultyHard
TopicStreaming RTL
LanguageSystemVerilog
Requirements4 checkpoints
01

Problem

For each framed stream of unsigned samples, report the maximum nonnegative later-minus-earlier gain and its endpoints. Return zero and indices (0,0) when no positive gain exists.

Example input and output

Use this case to check your interpretation
Input
accepted sample frame=[7,1,5,2,6]
Output
max_gain=5; start_index=1; end_index=4
Explanation

The running minimum becomes value 1 at index 1, and later value 6 gives the largest strictly later gain.

02

Requirements (4)

  • Support frames of one through MAX_SAMPLES accepted samples.
  • Use strictly earlier and later endpoints for every positive result.
  • Break gain ties by earliest start index and then earliest end index.
  • Advance the sample index only on a handshake and hold all result fields stable under backpressure.