Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Bias burst lengths by range

Hardware interview practice

Bias burst lengths by range

EasyConstraintsSystemVerilog

Randomize a burst length from 1 through 16 so lengths 1-4 collectively occur 70% of the time and lengths 5-16 collectively occur 30%.

Try it in the question bankReason first. Then compare.

Keep this exact question selected while you check your answer and review the full solution.

Practice this question →
Reviewed example

Work through one case

Input
randomize burst_len in 1..16 with [1:4] :/ 70 and [5:16] :/ 30
Expected output
One legal randomized result: burst_len=4

The :/ operator distributes each bucket's total weight across its members. A draw of 4 is legal; repeated trials approach the intended 70/30 bucket split, but one solve is non-unique.

What to cover

Requirements

  1. Every value from 1 through 16 must remain legal.
  2. Apply weights to each range as a whole.
  3. Do not accidentally give every member of a range the full range weight.
Continue practicing

Related questions

ConstraintsPick a weighted random enum→Constrained RandomWeighted random values without dist→
asic.fyi · Learn silicon end to end.info@asic.fyi