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. Mode Branch Collapse Under Extra Relation

VLSI DV Interview Puzzles · All levels

Mode Branch Collapse Under Extra Relation

Find legal tuples and compare P(mode==1) with and without solve mode before x,y.

On this page

    Puzzle

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

    Find legal tuples and compare P(mode==1) with and without solve mode before x,y.

    Code

    design.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    class sb_mode_xy;
      rand bit mode;
      rand bit [1:0] x;
      rand bit [1:0] y;
      constraint c {
        (mode == 0) -> (x == 0);
        (mode == 1) -> (y == 3);
        x + y <= 3;
      }
      // Variant: solve mode before x, y;
    endclass

    Hint

    Enumerate mode=0 and mode=1 branches separately.

    Step-by-step solution

    Diagram
    1) mode=0 forces x=0; y can be 0..3 -> 4 tuples.
    2) mode=1 forces y=3 and x+y<=3, so x must be 0 -> 1 tuple.
    3) Total tuples=5, so baseline P(mode==1)=1/5.
    4) With solve mode before x,y, mode is typically chosen near 50/50 first, then branch solved, so observed P(mode==1) rises toward ~1/2.
    5) Legal set remains the same.

    Answer

    Answer: Baseline P(mode==1)=20%; solve mode before x,y often raises it toward ~50% while preserving legality.

    Why candidates get it wrong

    Candidates often overlook how a cross-constraint (x+y<=3) can collapse one branch cardinality.

    Interviewer follow-up

    What additional constraint would make both mode branches have equal tuple count?

    Related topics

    • Back to solve...before Bias Puzzles

    • Randomization & Constraint Puzzles section

    Previous

    96 / 210

    Next: When solve-before Is Mostly Redundant

    Up next

    Up nextWhen solve-before Is Mostly Redundant

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Classic a->b Bias Shift
    • Three-Branch Kind Selection
    • Reverse Bias with solve b before a