Skip to the selected question
ASIC.FYI

ASIC Question Bank

1,000+ hardware interview questions
DescriptionQ879
Q879DVASIC interview problem

Enforce uniqueness within each group

TechniquesRandomizationConditional uniquenessNested foreach
DifficultyMedium
TopicConstraints
LanguageSystemVerilog
Requirements3 checkpoints
01

Problem

Randomize group and ID arrays so items in the same group always have different IDs.

Example input and output

Use this case to check your interpretation
Input
two groups of three values, legal values 0..9
Output
One valid randomized result: group0=[1,4,7], group1=[0,5,9]
Explanation

Values are unique within each group. Cross-group reuse would remain legal if the constraint is intentionally scoped per group.

02

Requirements (3)

  • Groups may be 0 or 1.
  • IDs may range from 0 through 255.
  • The same ID may appear once in each different group.