Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Enforce uniqueness within each group

Hardware interview practice

Enforce uniqueness within each group

MediumConstraintsSystemVerilog

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

Try it in the question bankReason first. Then compare.

Keep this exact question selected while you check your answer and review the full solution.

Practice this question →
Reviewed example

Work through one case

Input
two groups of three values, legal values 0..9
Expected output
One valid randomized result: group0=[1,4,7], group1=[0,5,9]

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

What to cover

Requirements

  1. Groups may be 0 or 1.
  2. IDs may range from 0 through 255.
  3. The same ID may appear once in each different group.
asic.fyi · Learn silicon end to end.info@asic.fyi