DescriptionQ118
Q118DVFollow-up to Q117ASIC interview problem
Cover arbitrary type and priority values
TechniquesDVAssociative arraySparse coverageExpected domain
DifficultyMedium
TopicFunctional Coverage
LanguageSystemVerilog
Requirements5 checkpoints
01
Problem
Types and priorities are arbitrary integer values rather than contiguous ranges starting at zero. Track their cross and determine when every pair from the declared expected sets has been observed.
Class declarationSystemVerilog
class SparseCoverageGapDetector;
function void add_expected_type(int value);
function void add_expected_priority(int value);
function void sample(int type_value, int priority_value);
function bit all_combinations_hit();
endclassExample input and output
Use this case to check your interpretationInput
expected types={2,7}, priorities={1,9}; sample (2,1),(7,9), then invalid (3,1)Output
first_missing=(2,9); invalid sample rejected; all_hit=0Explanation
The sparse universe is the declared Cartesian product, not values inferred from traffic; type 3 lies outside that universe.
02
Requirements (5)
- Receive finite expected type and priority sets and de-duplicate their values.
- Store observed pairs sparsely in associative arrays.
- Reject samples containing a value outside either expected set.
- Support all-hit and first-missing queries.
- Do not infer the expected universe from observed traffic.
