DescriptionQ813
Q813FWDVASIC interview problem
Verify editable command-trace frames
TechniquesFWDVFramed streamsStackBackpressure
DifficultyMedium
TopicHardware-Software Integration
LanguageSystemVerilog
Requirements4 checkpoints
01
Problem
Write the edit oracle and framing checks for two bounded command streams where each '#' byte removes the previous surviving byte, if any.
Type declarationSystemVerilog
typedef enum { EDIT_OK, EDIT_BAD_ARG, EDIT_HW_ERROR, EDIT_TIMEOUT } edit_status_t;
edit_status_t compare_edited(const uint8_t *a, uint8_t na,
const uint8_t *b, uint8_t nb,
bool *equal, uint32_t timeout);
// A_FIFO/B_FIFO{DATA,LAST}, CMD{A_LEN,B_LEN,START,ABORT}
// STATUS{A_READY,B_READY,BUSY,DONE,ERR}, RESULT{EQUAL}Example input and output
Use this case to check your interpretationInput
frame A="ab#c"; frame B="ad#c"Output
survivors A="ac", B="ac"; equal=1Explanation
Each # removes the immediately previous surviving byte, so both bounded stack models finish with the same sequence.
02
Requirements (4)
- Validate pointers and lengths before MMIO and send each nonempty frame only while its FIFO is ready.
- Require LAST only on the declared final byte; empty frames perform no FIFO write.
- Process accepted bytes with bounded stacks and change the caller's equal result only after successful DONE.
- Flush both frames after malformed framing, early START, timeout, abort, or reset and prevent partial results from escaping.
