Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Verify an in-place DMA merge transaction

Hardware interview practice

Verify an in-place DMA merge transaction

EasyHardware-Software IntegrationSystemVerilog

Write the merge oracle and transaction checks for firmware driving a direct memory access (DMA) engine that merges two sorted 16-bit arrays into reserved buffer A.

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

typedef enum { DMA_OK, DMA_BAD_ARG, DMA_HW_ERROR, DMA_TIMEOUT } dma_status_t;
dma_status_t dma_merge_u16(uint32_t a, uint8_t m, uint8_t a_cap,
                           uint32_t b, uint8_t n, uint32_t timeout);
// A_ADDR, B_ADDR, M, N, A_CAP, CMD{START,ABORT}
// STATUS{BUSY,DONE,ERR,ERR_CODE}; ERR_CODE{BAD_DESC,READ_FAULT,WRITE_FAULT}
Reviewed example

Work through one case

Input
A storage=[1,4,7,_,_,_], m=3, capacity=6; B=[2,4,9], n=3
Expected output
A after DMA=[1,2,4,4,7,9]

The merge is sorted, preserves both copies of 4, and writes only inside the reserved six-element A destination.

What to cover

Requirements

  1. Validate lengths, destination capacity, alignment, address wrap, and nonoverlap before touching registers.
  2. Require A to be a valid destination whenever m+n is nonzero and B to be valid whenever n is nonzero.
  3. Snapshot both active inputs at accepted START and keep every write inside A[0:m+n).
  4. Stop after the first memory fault; map faults and timeout distinctly and suppress late completion after abort or reset.
Continue practicing

Related questions

Hardware-Software IntegrationVerify a DMA flood-fill transaction→Firmware AlgorithmsIntersect redundant-core fault lists→ConstraintsConstrain a DMA transfer to one 4KB page→
asic.fyi · Learn silicon end to end.info@asic.fyi