Hardware interview practice
Verify a word-path search peripheral
Write the path oracle and transaction checks for firmware driving a memory-mapped I/O (MMIO) peripheral that finds the first nonrepeating path spelling an uppercase word in an 8x8 board.
Starting point
Question code
typedef struct packed { byte unsigned row, col; } coord_t;
function automatic bit first_word_path(
input byte unsigned board[8][8],
input int rows, cols,
input byte unsigned word[$],
ref coord_t path[$]
);Reviewed example
Work through one case
Input
board 2x3=[[A,B,C],[D,E,F]]; word="ABE"Expected output
found=1; first path=[(0,0),(0,1),(1,1)]Row-major start order selects A, then the required up-right-down-left neighbor order reaches B and E without reusing a cell.
What to cover
Requirements
- Validate dimensions, word length, active uppercase bytes, and address arithmetic before START; allow a null path when only status is requested.
- Copy inputs at accepted idle START, try start cells in row-major order, and visit neighbors up, right, down, then left; the first full path wins.
- Apply the stated invalid-setting precedence, produce a bounded error completion with zero path, and reject configuration writes while busy.
- Keep completed status and path stable until the next accepted job or reset; IRQ clear changes only the interrupt, and reset cancels all work.
