Skip to the selected question
ASIC.FYI

ASIC Question Bank

1,000+ hardware interview questions
DescriptionQ024
Page ↗
Q024ArchASIC interview problem

Optimize nonadjacent bank activation

TechniquesDynamic programmingPowerTie-breakingBounded search
DifficultyMedium
TopicHardware Algorithms
LanguageSystemVerilog
Requirements5 checkpoints
01

Problem

Choose a maximum-benefit subset of static random-access memory (SRAM) banks when adjacent banks may not be active in the same maintenance interval. Return the total score and exact selection mask.

Example input and output

Use this case to check your interpretation
Input
benefit by bank = [5, 1, 4, 9, 2]
Output
score=14; selected_mask=5'b01001; selected_count=2
Explanation

Banks 0 and 3 are nonadjacent and total 14, which exceeds every other legal subset.

02

Requirements (5)

  • Accept a frame of 1 to 16 unsigned eight-bit benefits; the first and last banks are not adjacent.
  • Select no adjacent pair and maximize the total benefit.
  • On a score tie, prefer fewer selected banks; if still tied, prefer the mask that selects the first differing lower-index bank.
  • Clear mask bits above the frame length and return the selected-bank popcount.
  • Hold the final score, mask, and count stable while stalled.