VLSI DV Interview Puzzles · All levels

Three-Branch Kind Selection

Compute tuple-count P(kind==2) without solve-before, then estimate effect of solve kind before len.

Puzzle

Difficulty: Hard · Puzzle 2 of 6 · Topic: solve...before Bias Puzzles

Compute tuple-count P(kind==2) without solve-before, then estimate effect of solve kind before len.

Code

systemverilog
class sb_kind_len;
  rand bit [1:0] kind;
  rand bit [2:0] len;
  constraint c_dom  { kind inside {0,1,2}; }
  constraint c_link {
    if (kind == 0) len == 0;
    else if (kind == 1) len inside {[0:1]};
    else               len inside {[0:7]};
  }
  // compare with and without: solve kind before len;
endclass

Hint

Branch cardinalities are 1, 2, and 8.

Step-by-step solution

diagram
1) Legal tuples by kind: kind0->1 tuple, kind1->2 tuples, kind2->8 tuples, total=11.
2) Baseline tuple pressure gives P(kind==2)=8/11.
3) With solve kind before len, many solvers target kind choice more evenly first (often near 1/3 each), then solve len inside branch.
4) Legal set remains the same in both variants.

Answer

Answer: Without solve-before, P(kind==2)=8/11 (~72.73%); with solve kind before len, observed kind distribution usually moves toward ~1/3 each while legality stays unchanged.

Why candidates get it wrong

Candidates often claim solve-before creates/removes len values; it only changes sampling bias.

Interviewer follow-up

How would you preserve no solve-before but still make kind exactly 1/3 each?

Related topics