DescriptionQ117
Q117DVASIC interview problem
Detect missing type-priority coverage
TechniquesDVCross coverageBitmapMissing bin
DifficultyMedium
TopicFunctional Coverage
LanguageSystemVerilog
Requirements5 checkpoints
01
Problem
Given packets containing type, size, and priority fields, track the type-by-priority cross without built-in covergroups. Report whether every expected pair has been observed and return the first missing pair.
Class declarationSystemVerilog
class CoverageGapDetector;
function new(int num_types, int num_prios);
function void sample(packet_t p);
function bit all_combinations_hit();
function void first_missing(output int miss_type,
output int miss_prio);
endclassExample input and output
Use this case to check your interpretationInput
type_count=2, priority_count=2; sample (0,0),(0,1),(1,0)Output
all_combinations_hit=0; first_missing=(1,1)Explanation
Three unique pairs set three cells in the dense 2x2 domain, leaving the row-major final pair unobserved.
02
Requirements (5)
- Validate both lower and upper bounds of the sampled type and priority values.
- Count repeated observations of the same pair only once.
- Implement all_combinations_hit and first_missing queries.
- Use storage proportional to the declared dense domain and reject invalid constructor dimensions.
- Do not use a SystemVerilog covergroup.
