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 `:/`)
    • solve...before Bias Puzzles
      • Classic a->b Bias Shift
      • Three-Branch Kind Selection
      • Reverse Bias with solve b before a
      • m<n Cardinality Bias
      • Mode Branch Collapse Under Extra Relation
      • When solve-before Is Mostly Redundant
    • 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

‹solve...before Bias Puzzles
  1. Topics
  2. DV Interview Puzzles
  3. Randomization & Constraint Puzzles
  4. solve...before Bias Puzzles
  5. Three-Branch Kind Selection

VLSI DV Interview Puzzles · All levels

Three-Branch Kind Selection

Compute tuple-count P(kind==2) without solve-before, then estimate effect of solve kind before len.

On this page

    Puzzle

    Difficulty: Hard · Puzzle 2 of 6 · Topic: solve...before Bias Puzzles

    Compute tuple-count P(kind==2) without solve-before, then estimate effect of solve kind before len.

    Code

    design.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    class sb_kind_len;
      rand bit [1:0] kind;
      rand bit [2:0] len;
      constraint c_dom  { kind inside {0,1,2}; }
      constraint c_link {
        if (kind == 0) len == 0;
        else if (kind == 1) len inside {[0:1]};
        else               len inside {[0:7]};
      }
      // compare with and without: solve kind before len;
    endclass

    Hint

    Branch cardinalities are 1, 2, and 8.

    Step-by-step solution

    Diagram
    1) Legal tuples by kind: kind0->1 tuple, kind1->2 tuples, kind2->8 tuples, total=11.
    2) Baseline tuple pressure gives P(kind==2)=8/11.
    3) With solve kind before len, many solvers target kind choice more evenly first (often near 1/3 each), then solve len inside branch.
    4) Legal set remains the same in both variants.

    Answer

    Answer: Without solve-before, P(kind==2)=8/11 (~72.73%); with solve kind before len, observed kind distribution usually moves toward ~1/3 each while legality stays unchanged.

    Why candidates get it wrong

    Candidates often claim solve-before creates/removes len values; it only changes sampling bias.

    Interviewer follow-up

    How would you preserve no solve-before but still make kind exactly 1/3 each?

    Related topics

    • Back to solve...before Bias Puzzles

    • Randomization & Constraint Puzzles section

    Previous

    93 / 210

    Next: Reverse Bias with solve b before a

    Up next

    Up nextReverse Bias with solve b before a

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • m<n Cardinality Bias
    • Mode Branch Collapse Under Extra Relation
    • When solve-before Is Mostly Redundant