Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Constrain five non-overlapping address windows

Hardware interview practice

Constrain five non-overlapping address windows

MediumSystemVerilog ConstraintsSystemVerilog

Randomize five sorted, non-overlapping 16-byte windows inside byte addresses 0 through 1023. Every base must be 4-byte aligned.

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 →
Starting point

Question code

rand bit [9:0] base[5];
Reviewed example

Work through one case

Input
base='{0,16,64,128,1008}
Expected output
Legal result

Each base is aligned; adjacent inclusive windows do not overlap; the last window ends at 1023.

What to cover

Requirements

  1. Align every base to four bytes.
  2. Keep each inclusive window [base, base+15] within 0..1023.
  3. Sort bases in strictly increasing order.
  4. Require neighboring windows to be disjoint.
Continue practicing

Related questions

SystemVerilog ConstraintsConstrain one triplicate and seven singletons→ConstraintsConstrain three disjoint child arrays→ConstraintsConstrain a DMA transfer to one 4KB page→
asic.fyi · Learn silicon end to end.info@asic.fyi