Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Constrain a DMA transfer to one 4KB page

Hardware interview practice

Constrain a DMA transfer to one 4KB page

MediumConstraintsSystemVerilog

Constrain a randomized DMA transaction with a 64-bit address, a 64-to-4096-byte length in 64-byte units, and LINEAR or FIXED burst type. Incrementing transfers may not cross a 4KB page.

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
burst_type=LINEAR, 4 KiB page size, length_bytes=128
Expected output
One valid randomized result: addr=0x1803, final_byte=0x1882

Both endpoints lie in page 0x1000..0x1FFF. Alignment is not part of this question, so any other start that stays inside the page is also legal.

What to cover

Requirements

  1. Length must be within 64 through 4096 bytes and divisible by 64.
  2. For LINEAR bursts, the last byte must remain in the same 4KB page as the first byte.
  3. A FIXED burst may contain at most 256 bytes.
  4. Allow a 4096-byte LINEAR transfer only when the start address is page aligned.
Continue practicing

Related questions

ConstraintsConstrain three disjoint child arrays→ConstraintsGenerate a temporal hazard-safe instruction stream→SystemVerilog ConstraintsConstrain one triplicate and seven singletons→
asic.fyi · Learn silicon end to end.info@asic.fyi