DescriptionQ200
Q200FWDVASIC interview problem
Verify a DMA flood-fill transaction
TechniquesFWDVDMAFlood fillMemory safety
DifficultyEasy
TopicHardware-Software Integration
LanguageSystemVerilog
Requirements4 checkpoints
01
Problem
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).
Type declarationSystemVerilog
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}Example input and output
Use this case to check your interpretationInput
3x3 image=[[1,1,0],[1,0,0],[0,1,1]], seed=(0,0), new_color=7Output
[[7,7,0],[7,0,0],[0,1,1]]Explanation
Only the three four-connected old-color pixels touching the seed are recolored; the separate bottom-right region remains unchanged.
02
Requirements (4)
- Validate base alignment, dimensions 1 through 16, seed coordinates, and final-address arithmetic before MMIO.
- Snapshot the image at accepted START and recolor only pixels connected to the seed through up, down, left, or right moves.
- Treat equal old and new colors as a successful no-op and keep every bus access within the image.
- Stop on the first fault, distinguish hardware error and timeout, and forbid late status or writes after abort or reset.
