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. Classic a->b Bias Shift

VLSI DV Interview Puzzles · All levels

Classic a->b Bias Shift

For this class, compare no-solve-before vs solve a before b. What is the legal set, and how does P(a==0) usually move?

On this page

    Puzzle

    Difficulty: Medium · Puzzle 1 of 6 · Topic: solve...before Bias Puzzles

    For this class, compare no-solve-before vs solve a before b. What is the legal set, and how does P(a==0) usually move?

    Code

    design.sv
    1
    2
    3
    4
    5
    6
    7
    8
    class sb_puzzle;
      rand bit a;
      rand bit [3:0] b;
    
      constraint c_rel { (a == 0) -> (b == 0); }
      // Variant 1: no solve-before
      // Variant 2: solve a before b;
    endclass

    Hint

    Count legal tuples first, then reason about order-induced bias.

    Step-by-step solution

    Diagram
    1) Legal tuples: (a=0,b=0) is 1 tuple; (a=1,b=0..15) is 16 tuples; total=17.
    2) Legal set is identical with or without solve-before.
    3) Tuple-count baseline gives P(a=0)=1/17 without explicit balancing.
    4) With solve a before b, many solvers pick a near 50/50 first, then solve b in that branch, so observed P(a=0) often moves toward 1/2.

    Answer

    Answer: Legal tuples stay the same (17 total), but solve a before b typically shifts a from heavily 1-biased (~16/17 tuple pressure) toward near 50/50.

    Why candidates get it wrong

    Calling solve-before a legality constraint is incorrect; it is mainly a distribution steering hint.

    Interviewer follow-up

    How can you force exact 50/50 on a without relying on solver heuristics?

    Related topics

    • Back to solve...before Bias Puzzles

    • Randomization & Constraint Puzzles section

    Previous

    92 / 210

    Next: Three-Branch Kind Selection

    Up next

    Up nextThree-Branch Kind Selection

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Reverse Bias with solve b before a
    • m<n Cardinality Bias
    • Mode Branch Collapse Under Extra Relation