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.
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
systemverilog
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;
endclassHint
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?