DescriptionQ862
Q862DVASIC interview problem
Randomize weighted onehot-or-zero requests
TechniquesRandomizationOnehotDistribution
DifficultyMedium
TopicConstraints
LanguageSystemVerilog
Requirements3 checkpoints
01
Problem
Randomize an 8-bit request that is onehot 80% of the time and all zero 20% of the time, with an index naming the active bit.
Example input and output
Use this case to check your interpretationInput
randomize active with 80:20 active/inactive weighting, 8-bit req, and 3-bit idxOutput
One valid active result: idx=5, req=8'b0010_0000Explanation
Exactly req[5] is asserted. The inactive result req=0,idx=0 and seven other active indices remain valid, so one solve is non-unique.
02
Requirements (3)
- When active, exactly one request bit must be set.
- When inactive, both req and idx must be zero.
- When active, req[idx] must be the asserted bit.
