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
      • Implication vs Partitioned Branches
      • Bidirectional Solving of x+y==10
      • if-else with Overlap on One Value
      • Three-Variable Implication Chain
      • Relational Pair Counting
      • Array Size Coupled to Content
    • Distribution Puzzles (`dist`, `:=` vs `:/`)
    • 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

‹Constraint Solving Order Puzzles
  1. Topics
  2. DV Interview Puzzles
  3. Randomization & Constraint Puzzles
  4. Constraint Solving Order Puzzles
  5. Implication vs Partitioned Branches

VLSI DV Interview Puzzles · All levels

Implication vs Partitioned Branches

Compare req_a vs req_b. Assuming unbiased tuple selection from legal solutions, compute P(kind==1) in each class and explain why they differ.

On this page

    Puzzle

    Difficulty: Medium · Puzzle 1 of 6 · Topic: Constraint Solving Order Puzzles

    Compare req_a vs req_b. Assuming unbiased tuple selection from legal solutions, compute P(kind==1) in each class and explain why they differ.

    Code

    design.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    class req_a;
      rand bit [1:0] kind;       // 0:READ, 1:WRITE
      rand bit [3:0] burst;
    
      constraint c_kind  { kind inside {0,1}; }
      constraint c_legal { burst inside {[1:8]}; }
      constraint c_link  { (kind == 1) -> (burst inside {[1:3]}); }
    endclass
    
    class req_b;
      rand bit [1:0] kind;
      rand bit [3:0] burst;
    
      constraint c_kind  { kind inside {0,1}; }
      constraint c_legal { burst inside {[1:8]}; }
      constraint c_link  {
        if (kind == 1) burst inside {[1:3]};
        else           burst inside {[4:8]};
      }
    endclass

    Hint

    Count satisfying (kind,burst) tuples per class before discussing solver heuristics.

    Step-by-step solution

    Diagram
    1) req_a legal tuples: kind=0 allows burst 1..8 (8 tuples), kind=1 allows 1..3 (3 tuples), total=11.
    2) req_b legal tuples: kind=1 allows 3 tuples, kind=0 allows 5 tuples (4..8), total=8.
    3) Tuple-weighted probabilities are P_a(kind=1)=3/11 and P_b(kind=1)=3/8.
    4) Both snippets are declarative; the difference comes from legal-space partitioning, not runtime execution order.

    Answer

    Answer: P(kind==1) is 3/11 (~27.27%) for req_a and 3/8 (37.5%) for req_b under tuple counting.

    Why candidates get it wrong

    Many candidates claim implication is evaluated later in time; it is solved simultaneously with all constraints.

    Interviewer follow-up

    How would you modify req_b so kind is exactly 50/50 without changing legal burst values?

    Related topics

    • Back to Constraint Solving Order Puzzles

    • Randomization & Constraint Puzzles section

    Previous

    80 / 210

    Next: Bidirectional Solving of x+y==10

    Up next

    Up nextBidirectional Solving of x+y==10

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • if-else with Overlap on One Value
    • Three-Variable Implication Chain
    • Relational Pair Counting