Skip to the selected question
ASIC.FYI

ASIC Question Bank

1,000+ hardware interview questions
DescriptionQ451
Page ↗
Q451DVASIC interview problem

Constrain ten unique multiples of three

TechniquesDVSystemVerilogConstraintsUniqueModulo
DifficultyEasy
TopicConstrained Random
LanguageSystemVerilog
Requirements4 checkpoints
01

Problem

Write SystemVerilog constraints for ten distinct randomized byte values, each inside 1 through 100 and divisible by three.

Class declarationSystemVerilog
class multiples_packet;
  rand bit [7:0] values[10];
endclass

Example input and output

Use this case to check your interpretation
Input
Randomize values[10] under the range, modulo, and uniqueness constraints
Output
'{3, 6, 9, 12, 15, 18, 21, 24, 27, 30} is one legal result
Explanation

Every element lies in 1 through 100, every remainder modulo three is zero, and no value repeats.

02

Requirements (4)

  • 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.