Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Verify a DMA flood-fill transaction

Hardware interview practice

Verify a DMA flood-fill transaction

HardHardware-Software IntegrationSystemVerilog

Write the oracle and transaction checks for firmware driving a direct memory access (DMA) engine that recolors the seed's four-connected region in bounded static RAM (SRAM).

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 { FILL_OK, FILL_BAD_ARG, FILL_HW_ERROR, FILL_TIMEOUT } fill_status_t;
fill_status_t flood_fill(uint32_t base, uint8_t w, uint8_t h,
                         uint8_t x, uint8_t y, uint8_t color,
                         uint32_t timeout);
// BASE,W,H,X,Y,COLOR,CMD{START,ABORT},STATUS{BUSY,DONE,ERR,ERR_CODE}
Reviewed example

Work through one case

Input
3x3 image=[[1,1,0],[1,0,0],[0,1,1]], seed=(0,0), new_color=7
Expected output
[[7,7,0],[7,0,0],[0,1,1]]

Only the three four-connected old-color pixels touching the seed are recolored; the separate bottom-right region remains unchanged.

What to cover

Requirements

  1. Validate base alignment, dimensions 1 through 16, seed coordinates, and final-address arithmetic before MMIO.
  2. Snapshot the image at accepted START and recolor only pixels connected to the seed through up, down, left, or right moves.
  3. Treat equal old and new colors as a successful no-op and keep every bus access within the image.
  4. Stop on the first fault, distinguish hardware error and timeout, and forbid late status or writes after abort or reset.
Continue practicing

Related questions

Hardware-Software IntegrationVerify an in-place DMA merge transaction→ConstraintsConstrain a DMA transfer to one 4KB page→FirmwareDMA descriptor-ring submission→
asic.fyi · Learn silicon end to end.info@asic.fyi