Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Verify editable command-trace frames

Hardware interview practice

Verify editable command-trace frames

MediumHardware-Software IntegrationSystemVerilog

Write the edit oracle and framing checks for two bounded command streams where each '#' byte removes the previous surviving byte, if any.

Try it in the question bankReason first. Then compare.

Keep this exact question selected while you check your answer and review the full solution.

Practice this question →
Starting point

Question code

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}
Reviewed example

Work through one case

Input
frame A="ab#c"; frame B="ad#c"
Expected output
survivors A="ac", B="ac"; equal=1

Each # removes the immediately previous surviving byte, so both bounded stack models finish with the same sequence.

What to cover

Requirements

  1. Validate pointers and lengths before MMIO and send each nonempty frame only while its FIFO is ready.
  2. Require LAST only on the declared final byte; empty frames perform no FIFO write.
  3. Process accepted bytes with bounded stacks and change the caller's equal result only after successful DONE.
  4. Flush both frames after malformed framing, early START, timeout, abort, or reset and prevent partial results from escaping.
asic.fyi · Learn silicon end to end.info@asic.fyi