Q092FreeDesign Verification
Verify a minimum energy-window engine
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.
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.Trace one case
energy=[2,1,4,2]; threshold=6found=1; start=2; length=2Window [4,2] reaches six in two elements, shorter than [2,1,4], and no one-element window qualifies.
Requirements
- Build an exhaustive widened-arithmetic oracle and treat zero threshold or count above the configured maximum as a bad request.
- Return found=0 with zero start and length when no window qualifies; otherwise compare shortest length before lowest start.
- Store at most four predictions by transaction ID, compare and retire each response exactly once, and reject duplicate or unknown IDs.
- Flush every pending prediction on reset and provide an end-of-test empty check for missing responses.
- Identify exact-threshold hits, equal-length ties, zero density, response order, stalls, errors, and reset as follow-up coverage targets.
