DescriptionQ942
Q942DVASIC interview problem
Close signed pivot-index coverage
TechniquesPrefix sumSigned arithmeticSemantic coveragePriority
DifficultyMedium
TopicFunctional Coverage
LanguageSystemVerilog
Requirements5 checkpoints
01
Problem
Write a signed reference function and semantic coverage model for a balance-point design that returns the earliest index whose strict-left sum equals its strict-right sum.
Example input and output
Use this case to check your interpretationInput
signed values=[1,7,3,6,5,6]Output
pivot_found=1; pivot_index=3Explanation
At index 3 the strict-left sum is 11 and the strict-right sum is 11; scanning upward makes this the earliest match.
02
Requirements (5)
- Accumulate total and left sums in signed 16-bit-or-wider storage and exclude the candidate element from both sides.
- Return the first match; count zero is legal with no pivot, and a one-element array has pivot zero.
- For count greater than 16, require request_error, pivot_found=0, and pivot_index=0.
- Define coverage sampling at a completed, matched transaction rather than at request issue.
- Cover no, unique, and multiple solutions crossed with first/interior/last position, data-sign class, and count 0/1/16.
