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. Zero Weight Means Never Chosen

VLSI DV Interview Puzzles · All levels

Zero Weight Means Never Chosen

Given this dist, what is P(x==0) and P(x==4)?

On this page

    Puzzle

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

    Given this dist, what is P(x==0) and P(x==4)?

    Code

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

    Hint

    Translate [4:5] :/ 2 into per-value weights first.

    Step-by-step solution

    Diagram
    1) x=0 has weight 0, so it is effectively excluded.
    2) x=1,2,3 each get weight 1.
    3) [4:5] :/ 2 gives each of 4 and 5 weight 1.
    4) Total non-zero weight=5.
    5) P(x==0)=0 and P(x==4)=1/5.

    Answer

    Answer: x==0 is impossible (0%), and P(x==4)=20%.

    Why candidates get it wrong

    Some candidates think zero weight means 'rare' instead of 'never selected.'

    Interviewer follow-up

    Would adding x inside {[0:5]} change these probabilities?

    Related topics

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

    • Randomization & Constraint Puzzles section

    Previous

    91 / 210

    Next: solve...before Bias Puzzles

    Up next

    Up nextsolve...before Bias Puzzles

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Case A vs Case B vs Trap Variant
    • Small Range with := vs Large Range with :/
    • Loaded Die with Mixed Granularity