Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Verify a retained-memory water accelerator

Hardware interview practice

Verify a retained-memory water accelerator

HardReference ModelsSystemVerilog

Write the water oracle and register checks for an accelerator whose retained static RAM (SRAM) stores elevations and whose control registers respond in exactly two cycles.

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

interface rain_if(input logic clk);
  logic rst_n, cfg_valid, cfg_ready, cfg_write;
  logic [9:0] cfg_addr;
  logic [31:0] cfg_wdata, cfg_rdata;
  logic cfg_rsp_valid, cfg_rsp_ready, cfg_rsp_err;
  logic result_valid, result_ready, result_error;
  logic [19:0] total_water;
  logic [11:0] peak_water;
  logic [5:0] peak_index;
endinterface
Reviewed example

Work through one case

Input
LEN=5; retained HEIGHT=[0,2,0,2,0]
Expected output
total_water=2; largest_per_index=2; peak_index=2

Only the center valley traps water, and the retained SRAM contents survive control reset semantics.

What to cover

Requirements

  1. Model one pending register request with a response exactly two cycles later and stable fields under response backpressure.
  2. For legal lengths, cross-check an O(N squared) scan against prefix/suffix maxima; preserve the total and break peak ties toward the lowest index.
  3. A bad length produces one zeroed error result; busy writes have no state effect, and valid results meet the 3 times LEN plus 12 bound.
  4. Reset cancels register and job responses and clears control state while retaining the complete HEIGHT memory model.
asic.fyi · Learn silicon end to end.info@asic.fyi