Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Coalesce a frame of DMA ranges

Hardware interview practice

Coalesce a frame of DMA ranges

MediumRTL DesignSystemVerilog

Buffer one frame of up to eight half-open direct-memory-access (DMA) ranges, sort them by start then end, and emit the smallest sorted set covering the same addresses. Merge overlap and exact adjacency.

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
input half-open ranges=[10,20),[5,8),[8,10),[15,25)
Expected output
one output range=[5,25) with out_last=1

Sorting places [5,8) first; exact adjacency at 8 and 10 plus overlap at 15 coalesce every range into one cover.

What to cover

Requirements

  1. Accept 1 through 8 valid ranges satisfying start < end before producing output.
  2. Interpret ranges as [start, end) and merge whenever next_start <= current_end.
  3. Handle arbitrary order, duplicate starts, contained ranges, and adjacent ranges deterministically.
  4. Assert out_last only with the final coalesced token and hold every output field stable while stalled.
asic.fyi · Learn silicon end to end.info@asic.fyi