DescriptionQ043
Q043DesignASIC interview problem
Find a target-sum operand pair
TechniquesBounded searchPriorityArithmetic width
DifficultyMedium
TopicRTL Datapaths
LanguageSystemVerilog
Requirements4 checkpoints
01
Problem
Design a bounded operand-bank unit that finds two distinct valid entries whose unsigned sum equals a target. Return the lexicographically earliest pair of indices.

Example input and output
Use this case to check your interpretationInput
W=4; valid values by index=[2,7,4,5]; target=9Output
found=1; idx_a=0; idx_b=1Explanation
Pairs (0,1) and (2,3) both sum to nine in W+1 bits, so lexicographic priority selects the lower first index.
02
Requirements (4)
- Support a parameterized bank with at least two entries and return idx_a < idx_b.
- Add in W+1 bits so W-bit wraparound cannot create a false match.
- Capture a request only while idle, pulse done for one cycle, and return zero indices when no pair exists.
- When several pairs match, choose the lowest idx_a and then the lowest idx_b.
