Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Constrain a bounded zig-zag address walk

Hardware interview practice

Constrain a bounded zig-zag address walk

MediumConstraintsSystemVerilog

Randomize 20 addresses from 0 through 255 where every step is 1-8 and the step direction alternates up, down, up, down or vice versa.

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
randomize 20 addresses in 0..255 with alternating step direction and magnitude 1..8
Expected output
One valid result: [100,104,102,108,105,110,109,117,112,118,114,121,115,120,116,123,119,125,122,127]

Every adjacent value differs by 1..8, all values stay in range, and step signs alternate +,- throughout. Other walks are valid.

What to cover

Requirements

  1. Adjacent addresses must never be equal.
  2. The absolute difference of each step must be at most eight.
  3. Starting with the third address, consecutive step directions must differ.
asic.fyi · Learn silicon end to end.info@asic.fyi