Hardware interview practice
Constrain ten unique multiples of three
Write SystemVerilog constraints for ten distinct randomized byte values, each inside 1 through 100 and divisible by three.
Starting point
Question code
class multiples_packet;
rand bit [7:0] values[10];
endclassReviewed example
Work through one case
Input
Randomize values[10] under the range, modulo, and uniqueness constraintsExpected output
'{3, 6, 9, 12, 15, 18, 21, 24, 27, 30} is one legal resultEvery element lies in 1 through 100, every remainder modulo three is zero, and no value repeats.
What to cover
Requirements
- Constrain every element to the inclusive range [1:100].
- Constrain every element to be divisible by 3.
- Require all ten elements to be unique.
- Show how the caller checks randomize() success.
