Hardware interview practice
Verify a shared-memory spiral readout
Write the spiral oracle and transaction checks for firmware driving a peripheral that freezes a rectangular static RAM (SRAM) tile at START and copies it into a guarded destination.
Starting point
Question code
function automatic void spiral_reference(
input int unsigned image[][],
input int unsigned rows,
input int unsigned cols,
ref int unsigned expected[$]
);Reviewed example
Work through one case
Input
frozen 2x3 source=[[1,2,3],[4,5,6]] with guard words around a six-word destinationExpected output
destination writes=[1,2,3,6,5,4]; exactly six writes; both guards unchangedThe accepted START snapshot is traversed clockwise and no DMA write escapes the validated destination interval.
What to cover
Requirements
- Validate dimensions, alignment, accessible ranges, non-overlap, and address arithmetic before register access; perform the required cache and barrier sequence.
- Predict from the source image copied at accepted START and compare exactly rows times columns destination writes.
- Stop after the first bus fault, reject busy START without changing state, and prevent any write or completion after reset.
- Check persistent completion interrupt behavior, timeout across tick wrap, and unchanged guard words around the destination.
