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. Bidirectional Solving of x+y==10

VLSI DV Interview Puzzles · All levels

Bidirectional Solving of x+y==10

For this class, what is P(x==0)? Why is the solver not 'choosing x first, then computing y' procedurally?

On this page

    Puzzle

    Difficulty: Easy · Puzzle 2 of 6 · Topic: Constraint Solving Order Puzzles

    For this class, what is P(x==0)? Why is the solver not 'choosing x first, then computing y' procedurally?

    Code

    design.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    class sum_pair;
      rand int unsigned x;
      rand int unsigned y;
      constraint c_dom {
        x inside {[0:10]};
        y inside {[0:10]};
      }
      constraint c_eq { x + y == 10; }
    endclass

    Hint

    Each x value determines exactly one y value in the domain.

    Step-by-step solution

    Diagram
    1) For each x in 0..10, y is fixed to 10-x and remains in 0..10.
    2) That gives exactly 11 legal tuples.
    3) Exactly one tuple has x==0, so P(x==0)=1/11.
    4) The equality is bidirectional relation solving, not assignment sequencing.

    Answer

    Answer: P(x==0)=1/11 (~9.09%), and x/y are solved as a joint relation rather than left-to-right execution.

    Why candidates get it wrong

    Interviewees often say 'y depends on x only'; in constraints, either variable can be decided first by the solver.

    Interviewer follow-up

    What is P(x is even), and does adding solve x before y change the legal set?

    Related topics

    • Back to Constraint Solving Order Puzzles

    • Randomization & Constraint Puzzles section

    Previous

    81 / 210

    Next: if-else with Overlap on One Value

    Up next

    Up nextif-else with Overlap on One Value

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Three-Variable Implication Chain
    • Relational Pair Counting
    • Array Size Coupled to Content