DescriptionQ141
Q141DVASIC interview problem
Bias burst lengths by range
TechniquesRandomizationdistProbability
DifficultyEasy
TopicConstraints
LanguageSystemVerilog
Requirements3 checkpoints
01
Problem
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%.
Example input and output
Use this case to check your interpretationInput
randomize burst_len in 1..16 with [1:4] :/ 70 and [5:16] :/ 30Output
One legal randomized result: burst_len=4Explanation
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.
02
Requirements (3)
- Every value from 1 through 16 must remain legal.
- Apply weights to each range as a whole.
- Do not accidentally give every member of a range the full range weight.
