Skip to the selected question
ASIC.FYI

ASIC Question Bank

1,000+ hardware interview questions
DescriptionQ352
Page ↗
Q352DVNVIDIAASIC interview problem

Constrain one triplicate and seven singletons

TechniquesDVSystemVerilogConstraintsArrays
DifficultyMedium
TopicSystemVerilog Constraints
LanguageSystemVerilog
Requirements4 checkpoints
01

Problem

Randomize ten integers in 0..31 so one selected value occurs exactly three times and every other value occurs once.

Starting declarationSystemVerilog
rand int unsigned arr[10];
rand int unsigned repeated;

Example input and output

Use this case to check your interpretation
Input
repeated=4, arr='{4,9,4,1,6,11,4,2,8,10}
Output
Legal randomization result
Explanation

Four appears exactly three times and all seven remaining values are unique.

02

Requirements (4)

  • Restrict all values and repeated to 0..31.
  • Make exactly three positions equal repeated.
  • Make the other seven values pairwise distinct and different from repeated.
  • Allow the three repeated positions to appear anywhere.