DescriptionQ875
Q875FWDVASIC interview problem
Predict and safely read a build-tag prefix service
TechniquesFWDVMMIOStringsScoreboard
DifficultyEasy
TopicHardware-Software Integration
LanguageSystemVerilog
Requirements4 checkpoints
01
Problem
Write the reference predictor and safe firmware transaction sequence for a memory-mapped I/O (MMIO) service that returns the longest common byte prefix of up to eight bounded build tags.
Type declarationSystemVerilog
typedef enum { LCP_OK, LCP_BAD_ARG, LCP_HW_ERROR, LCP_TIMEOUT } lcp_status_t;
lcp_status_t lcp_run(const char tag[8][16], const uint8_t len[8],
uint8_t count, char out[17], uint8_t *out_len);
// TAG_SEL, TAG_DATA, TAG_LEN[0:7], COUNT
// CMD{START,ABORT}, STATUS{BUSY,DONE,ERR}, RESULT_LEN, RESULT_DATAExample input and output
Use this case to check your interpretationInput
tags=["asic-fyi","asic-flow","asic"], lengths=[8,9,4]Output
RESULT_LEN=4; firmware output="asic\0"Explanation
All three byte strings match through index 3 and the shortest tag ends there; only firmware appends the terminator.
02
Requirements (4)
- Validate pointers, count 1 through 8, and active lengths 0 through 16 before any register access.
- Write each selected tag and length in order; START must snapshot the programmed inputs.
- Read exactly RESULT_LEN bytes, reject a result length above 16, and append one firmware-only terminator.
- Give ERR priority over DONE and preserve both caller outputs after hardware error, timeout, abort, or reset.
