Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutRoadmapCareersInternshipsFAQContactPrivacyTerms
Skip to lesson

Course contents

  • How to Use This Puzzle Bank
  • SystemVerilog Language Puzzles25
  • Difficulty Guide
  • Full Topic Map
  • Interview-Day Tips
  • Study Route: One Week Before the Interview
  • Study Route: Two Weeks
  • Study Route: Four Weeks (Full Course)4
  • OOP & Testbench Puzzles25
  • Concurrency & Timing Puzzles25
  • Randomization & Constraint Puzzles25
  • SVA Assertion Puzzles25
  • Functional Coverage Puzzles25
    • Covergroup and Coverpoint Puzzles
      • Auto vs explicit bins with illegal transition context
      • Default bin is not scored
      • Bin array math with mixed declarations
      • Transition bin sequence counting
      • illegal_bins vs ignore_bins accounting
      • Same traffic, different denominator
    • Cross Coverage Puzzles
    • Coverage Options Puzzles
    • Coverage Closure and Sampling Timing Puzzles
    • Functional Coverage Puzzles: Tricky Q&A
  • Logic & Aptitude Puzzles25
  • Scenario & Debug Puzzles25
  • UVM Testbench Puzzles25
  • Clock, Reset & CDC Puzzles25
  • Bus and Interface Protocol Puzzles25
  • Interview Prep: Puzzle Rounds7
  • DV Puzzle Cheatsheet
Loading lesson

←Covergroup and Coverpoint Puzzles
  1. Topics
  2. DV Interview Puzzles
  3. Functional Coverage Puzzles
  4. Covergroup and Coverpoint Puzzles
  5. Bin array math with mixed declarations
On this page

    VLSI DV Interview PuzzlesAll levels

    Bin array math with mixed declarations

    Compute total bin count and final percentage for this coverpoint with array bins and scalar bins. Options: none set (all defaults: at_least = 1, weight = 1, auto_bin_max = 64).

    Puzzle

    Difficulty: Medium · Puzzle 3 of 6 · Topic: Covergroup and Coverpoint Puzzles

    Compute total bin count and final percentage for this coverpoint with array bins and scalar bins. Options: none set (all defaults: at_least = 1, weight = 1, auto_bin_max = 64).

    Code

    design.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    covergroup cg with function sample(bit [4:0] len);
      cp_len: coverpoint len {
        bins lo[4]    = {[0:15]};
        bins med      = {[16:23]};
        bins big[]    = {[24:31]};
      }
    endgroup
    
    initial begin
      cg c = new();
      c.sample(0);
      c.sample(7);
      c.sample(12);
      c.sample(18);
      c.sample(24);
      c.sample(26);
      c.sample(31);
    end

    Hint

    lo[4] gives 4 bins over 0..15, while big[] over 24..31 creates one bin per value.

    Step-by-step solution

    Diagram
    1) lo[4] contributes 4 bins, med contributes 1, big[] contributes 8 -> total 13 bins.
    2) Hits: lo bins hit by 0,7,12 (lo[0], lo[1], lo[3]) -> 3 of 4; med hit by 18 -> 1 of 1; big bins hit by 24,26,31 -> 3 of 8.
    3) Total hit bins = 3 + 1 + 3 = 7.
    4) Coverage = 7/13 = 53.85%.

    Answer

    Answer: Total bins = 13, hit bins = 7, so coverage is 53.85%.

    How this was checked

    Checked by running a model of the rule in a Python model. A model of the bin-array rule: lo[4] gives 4 bins, big[] gives 8, so 7 of 13 bins are hit.

    Why candidates get it wrong

    big[] over [24:31] is eight bins (one per value), so three hits there are 3 of 8, not one aggregated bin. Counting big as a single bin would inflate the result to 5/6 = 83.33%.

    Interviewer follow-up

    If big[] were changed to bins big = {[24:31]}, what would the new percentage be with the same samples? Model answer: The coverpoint then has 4 + 1 + 1 = 6 bins and 5 are hit (lo[0], lo[1], lo[3], med, big), so 5/6 = 83.33%.

    Say it out loud

    I would expand the array bins first: the total is 13 bins and 7 are hit, so coverage is 53.85 percent. The array over 24 to 31 gives eight bins, one per value, so three hits there are three of eight, not one bin. The trap is treating that array as a single bin, which would inflate the result to 83.33 percent. Next I would list which of the six uncovered bins are real holes.

    Related topics

    • Auto Bins vs Explicit Bins

    • Bin Design Strategy

    • Back to Covergroup and Coverpoint Puzzles

    • Functional Coverage Puzzles section

    Previous

    138 / 293

    Next: Transition bin sequence counting

    Up next

    Up nextTransition bin sequence counting

    Sign in to save progress

    Practice this lessonPrevious lessonReport an error

    See also

    • Auto vs explicit bins with illegal transition context
    • illegal_bins vs ignore_bins accounting
    • Same traffic, different denominator