VLSI DV Interview Puzzles · All levels
dist After Hard Pruning
After intersecting c_dist with c_clip, compute P(x==3) and P(x==6).
Puzzle
Difficulty: Hard · Puzzle 4 of 6 · Topic: Distribution Puzzles (`dist`, `:=` vs `:/`)
After intersecting c_dist with c_clip, compute P(x==3) and P(x==6).
Code
systemverilog
class pruned_dist;
rand int unsigned x;
constraint c_dist {
x dist { [0:4] := 1, [5:9] := 3 };
}
constraint c_clip { x inside {[3:7]}; }
endclassHint
Remove disallowed values first, then renormalize surviving weights.
Step-by-step solution
diagram
1) Base per-value weights: 0..4 ->1 each, 5..9 ->3 each.
2) c_clip keeps only values 3,4,5,6,7 with weights 1,1,3,3,3.
3) Total surviving weight = 11.
4) P(3)=1/11.
5) P(6)=3/11.Answer
Answer: P(x==3)=1/11 (~9.09%) and P(x==6)=3/11 (~27.27%).
Why candidates get it wrong
People frequently normalize using original full-domain weight instead of the clipped legal domain.
Interviewer follow-up
What if c_clip changes to x inside {[0:4]} only?