Skip to question
SystemVerilogDesignVerificationFirmwareArchitectureASIC Interview Questions→
/Interview questions/Verify a minimum energy-window engine

Q092·Free·Design Verification

Verify a minimum energy-window engine

Difficulty
Medium
Topic
Reference Models
Language
SV
Interview prompt

Question

Implement an exhaustive oracle and four-entry tagged scoreboard core for the shortest contiguous nonnegative energy window whose sum reaches a threshold. N is positive and defaults to 32. Samples are known unsigned 32-bit values, the threshold is unsigned 64-bit, and IDs are known 4-bit values. The maximum possible sum fits in 64 bits for the positive signed-int parameter range of N. Pass the value returned by predict into accept_request only for an accepted transaction. Invoke callbacks serially and process a retiring response before same-edge ID reuse. Observed response fields retain four-state logic so X/Z corruption is compared rather than coerced to zero. Reset clears pending IDs; distinguishing a delayed old response after ID reuse requires an external generation or quarantine rule.

Candidate starting point

Implementation scaffold

class energy_window_model #(int N = 32);
  typedef struct {
    logic        bad_request;
    logic        found;
    logic [31:0] start;
    logic [31:0] length;
  } prediction_t;

  prediction_t expected[bit [3:0]];
  function new();
    if(N<1)$fatal(1,"N must be positive");
  endfunction

  function automatic prediction_t predict(
      int unsigned sample[$], longint unsigned threshold);
  // TODO: Implement this oracle or scoreboard method.
endfunction

  function void accept_request(logic [3:0] id, prediction_t p);
  // TODO: Implement this oracle or scoreboard method.
endfunction

  function void reset_epoch();
  // TODO: Implement this oracle or scoreboard method.
endfunction

  function void accept_response(logic [3:0] id, prediction_t actual);
  // TODO: Implement this oracle or scoreboard method.
endfunction

  function void check_empty();
  // TODO: Implement this oracle or scoreboard method.
endfunction
endclass

// TODO: Identify exact hits, equal-length ties, zero density, response order, stalls, errors and reset coverage.
Reviewed example

Trace one case

Input
energy=[2,1,4,2]; threshold=6
Expected output
found=1; start=2; length=2

Window [4,2] reaches six in two elements, shorter than [2,1,4], and no one-element window qualifies.

What to cover

Requirements

  1. Build an exhaustive widened-arithmetic oracle and treat zero threshold or count above the configured maximum as a bad request.
  2. Return found=0 with zero start and length when no window qualifies; otherwise compare shortest length before lowest start.
  3. Store at most four predictions by transaction ID, compare and retire each response exactly once, and reject duplicate or unknown IDs.
  4. Flush every pending prediction on reset and provide an end-of-test empty check for missing responses.
  5. Identify exact-threshold hits, equal-length ties, zero density, response order, stalls, errors, and reset as follow-up coverage targets.
Exact question handoffPractice Q092

Solve it in the question bank, keep your progress, and reveal the reviewed solution when your access allows.

Open in question bank →
Solution accessEach time you open this Solution, one Practice Credit is used; it is not permanently unlocked. Premium Solution content also uses one credit per opening.
Continue learning

Verification Planning and Models

Review plan structure, stimulus, checkers, reference models, and system-level answers.

  • Reference Models
  • Sliding window
  • Out-of-order
  • Tie-breaking
Verification Planning and Models →
Continue practicing

Related questions

Q1116 · Reference ModelsVerify a dominant-opcode window analyzerMediumP→Q1153 · Reference ModelsModel a recent-ID replay streamHardP→Q969 · Reference ModelsVerify a longest rising-trend acceleratorMediumP→
ASIC.FYI · Learn silicon end to end.info@asic.fyi