Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Verify a channel-capacity optimizer

Hardware interview practice

Verify a channel-capacity optimizer

MediumMemory SystemsSystemVerilog

Write an independent oracle for a software-programmed static random-access memory (SRAM) optimizer. For endpoints left < right, area is min(height[left], height[right]) times (right - left); return the maximum and the first maximizing pair visited by the specified two-pointer walk.

Try it in the question bankReason first. Then compare.

Keep this exact question selected while you check your answer and review the full solution.

Practice this question →
Reviewed example

Work through one case

Input
programmed heights = [1, 8, 6, 2, 5, 4, 8, 3, 7]
Expected output
maximum_area=49; left_index=1; right_index=8

The limiting height is 7 across a width of 7; the two-pointer visit order reaches this first maximizing pair.

What to cover

Requirements

  1. Compute the true maximum across every endpoint pair, then emulate a walk beginning at both ends: advance left when the left height is less than or equal to the right height, otherwise decrement right.
  2. Return the first pair visited by that walk whose area equals the mathematical maximum.
  3. Treat counts outside 2 through 32 as bad_count with zero area and indices.
  4. Use widened unsigned arithmetic for the product and make the equal-height branch explicit.
  5. Treat accepted-write Register Abstraction Layer (RAL) prediction, start priority, response hold, reset retention, and stale-response checks as follow-up environment design.
Continue practicing

Related questions

Memory SystemsVerify a RAM-based duplicate-ID detector→Reference ModelsTriage an end-of-frame run bug→Reference ModelsDebug a signed sliding-window peak→
asic.fyi · Learn silicon end to end.info@asic.fyi