Skip to question
SystemVerilogDesignVerificationFirmwareArchitectureASIC Interview Questions→
/Interview questions/Cover arbitrary type and priority values

Q198·Free·Design Verification

Cover arbitrary type and priority values

Difficulty
Medium
Topic
Functional Coverage
Language
SV
Interview prompt

Question

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. If either expected set is empty, all_combinations_hit returns false and first_missing returns false with both output values zero. Once both sets are nonempty, first_missing returns the first missing pair in ascending type then priority order, or false with zeroed outputs after complete coverage.

Candidate starting point

Implementation scaffold

class SparseCoverageGapDetector;
  local bit expected_type[int];
  local bit expected_prio[int];
  local bit seen[int][int];

  function void add_expected_type(int value);
    // Implement here: add_expected_type.
  endfunction

  function void add_expected_priority(int value);
    // Implement here: add_expected_priority.
  endfunction

  function void sample(int type_value, int priority_value);
    // Implement here: sample.
  endfunction

  function bit all_combinations_hit();
    int type_key, priority_key;
    // Implement here: all_combinations_hit.
  endfunction

  function bit first_missing(output int miss_type,
                             output int miss_prio);
    // Implement here: first_missing.
  endfunction
endclass
Reviewed example

Trace one case

Input
expected types={2,7}, priorities={1,9}; sample (2,1),(7,9), then invalid (3,1)
Expected output
first_missing=(2,9); invalid sample rejected; all_hit=0

The sparse universe is the declared Cartesian product, not values inferred from traffic; type 3 lies outside that universe.

What to cover

Requirements

  1. Receive finite expected type and priority sets and de-duplicate their values.
  2. Store observed pairs sparsely in associative arrays.
  3. Reject samples containing a value outside either expected set.
  4. Support all-hit and first-missing queries.
  5. Do not infer the expected universe from observed traffic.
Exact question handoffPractice Q198

Solve it in the question bank, keep your progress, and reveal the reviewed solution when your access allows.

Open in question bank →
Solution accessEach time you open this Solution, one Practice Credit is used; it is not permanently unlocked. Premium Solution content also uses one credit per opening.
Continue learning

Coverage Strategy and Code Metrics

Review traceability, functional intent, structural metrics, and evidence limits.

  • Functional Coverage
  • Associative array
  • Sparse coverage
  • Expected domain
Coverage Strategy and Code Metrics →
Continue practicing

Related questions

Q178 · Functional CoverageDetect missing type-priority coverageMedium→Q371 · Functional CoverageTrack a sparse three-way packet crossMediumP→Q370 · Functional CoverageReport current cross-coverage percentageEasyP→
ASIC.FYI · Learn silicon end to end.info@asic.fyi