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

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • How to Use This Puzzle Bank
  • SystemVerilog Language Puzzles25
  • Difficulty Guide
  • Full Topic Map
  • Interview-Day Tips
  • OOP & Testbench Puzzles25
  • Concurrency & Timing Puzzles25
  • Randomization & Constraint Puzzles25
    • Constraint Solving Order Puzzles
    • Distribution Puzzles (`dist`, `:=` vs `:/`)
      • Case A vs Case B vs Trap Variant
      • Small Range with := vs Large Range with :/
      • Loaded Die with Mixed Granularity
      • dist After Hard Pruning
      • Boolean dist Cascading into Value dist
      • Zero Weight Means Never Chosen
    • solve...before Bias Puzzles
    • randomize() with Puzzles
    • Randomization & Constraint Puzzles: Tricky Q&A
  • SVA Assertion Puzzles25
  • Functional Coverage Puzzles25
  • Logic & Aptitude Puzzles25
  • Scenario & Debug Puzzles25
  • Interview Prep: Puzzle Rounds5
  • DV Puzzle Cheatsheet
Loading lesson

‹Distribution Puzzles (`dist`, `:=` vs `:/`)
  1. Topics
  2. DV Interview Puzzles
  3. Randomization & Constraint Puzzles
  4. Distribution Puzzles (`dist`, `:=` vs `:/`)
  5. Small Range with := vs Large Range with :/

VLSI DV Interview Puzzles · All levels

Small Range with := vs Large Range with :/

Compute P(x==0) and P(x==7).

On this page

    Puzzle

    Difficulty: Hard · Puzzle 2 of 6 · Topic: Distribution Puzzles (`dist`, `:=` vs `:/`)

    Compute P(x==0) and P(x==7).

    Code

    design.sv
    1
    2
    3
    4
    5
    6
    class dist_mix1;
      rand int unsigned x;
      constraint c {
        x dist { [0:1] := 4, [2:9] :/ 4 };
      }
    endclass

    Hint

    The second range has 8 values, so :/ splits the total weight across 8.

    Step-by-step solution

    Diagram
    1) Values 0,1 each get weight 4 from :=.
    2) Values 2..9 each get weight 4/8=0.5 from :/.
    3) Total weight = 2*4 + 8*0.5 = 12.
    4) P(x==0)=4/12=1/3.
    5) P(x==7)=0.5/12=1/24.

    Answer

    Answer: P(x==0)=1/3 (~33.33%) and P(x==7)=1/24 (~4.17%).

    Why candidates get it wrong

    Candidates often incorrectly give both ranges equal per-value probability because both clauses use weight 4.

    Interviewer follow-up

    If [2:9] changes to :=4, what does P(x==7) become?

    Related topics

    • Back to Distribution Puzzles (`dist`, `:=` vs `:/`)

    • Randomization & Constraint Puzzles section

    Previous

    87 / 210

    Next: Loaded Die with Mixed Granularity

    Up next

    Up nextLoaded Die with Mixed Granularity

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • dist After Hard Pruning
    • Boolean dist Cascading into Value dist
    • Zero Weight Means Never Chosen