Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Verify keypad expansion and FIFO draining

Hardware interview practice

Verify keypad expansion and FIFO draining

MediumHardware-Software IntegrationSystemVerilog

Write the ordered-string predictor and transaction plan for a memory-mapped keypad expander with a 16-entry first-in, first-out (FIFO) result queue.

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 { KP_OK, KP_BAD_ARG, KP_HW_ERROR, KP_TIMEOUT } kp_status_t;
kp_status_t keypad_expand(const char *digits, size_t len,
    char (*out)[5], size_t out_cap, size_t *out_count,
    uint32_t timeout_ticks);
// DIGITS,LENGTH,CONTROL.START,STATUS{BUSY,DONE,ERROR,FIFO_COUNT}
// RESULT_DATA,RESULT_LEN,IRQ_STATUS.DONE,IRQ_CLEAR
Reviewed example

Work through one case

Input
digits="23"
Expected output
9 outputs in order: ["ad","ae","af","bd","be","bf","cd","ce","cf"]

The 3x3 Cartesian product follows keypad letter order, making the generated stream dictionary ordered.

What to cover

Requirements

  1. Validate one through four digits from 2 through 9 and calculate the exact output count before MMIO.
  2. Generate strings in dictionary order using abc through wxyz and drain the 16-entry FIFO while the job is still active.
  3. Pop exactly one result per accepted data read and publish out_count only after all expected entries and DONE are observed.
  4. Handle sticky status, busy START rejection, unsigned timer wrap, reset, timeout, and incomplete completion distinctly.
Continue practicing

Related questions

RTL DesignBuild a synchronous FIFO and race-free BFM→Performance AnalysisSize a FIFO under an unstable sustained rate→RTL DesignImplement a synchronous FIFO with exact boundary behavior→
asic.fyi · Learn silicon end to end.info@asic.fyi