Q147FreeDesign Verification
Scoreboard a maximum-interval accelerator
Question
Verify a bounded accelerator that accepts up to 16 signed samples and returns the greatest-sum contiguous interval. Build the reference prediction and in-order scoreboard around the request and response handshakes. All inputs are sampled at posedge clk and are known values stable around that edge. count is from 0 through 16. Responses are in request order; a request and its response may be accepted on the same edge when no older response is pending. Reset is sampled active low and cancels queued requests. Any rsp_valid requires a queued request, including when rsp_ready is low. The interface has no transaction IDs, so a numerically identical stale response after a new request cannot be distinguished by this checker alone.
Implementation scaffold
module maximum_interval_checker (
input logic clk, rst_n, req_valid, req_ready,
input logic [4:0] count,
input logic signed [11:0] sample[16],
input logic rsp_valid, rsp_ready, result_valid,
input logic signed [15:0] best_sum,
input logic [4:0] best_start, best_end
);
typedef struct {
bit result_valid;
logic signed [15:0] best_sum;
logic [4:0] best_start;
logic [4:0] best_end;
} interval_exp_t;
function automatic interval_exp_t predict_interval(
input logic [4:0] count,
input logic signed [11:0] samples [16]
);
interval_exp_t p = '{default:'0};
longint signed best, sum;
// TODO: Compute the accepted snapshot prediction with the required sum and tie rules.
endfunction
interval_exp_t expected_q[$];
always @(posedge clk) begin : sample_transactions
interval_exp_t exp;
// TODO: Implement sample_transactions using the supplied state and interface.
end
property p_response_stable;
// TODO: Enforce valid and payload stability through sampled response stalls, with sampled reset cancellation.
endproperty
a_response_stable: assert property (p_response_stable);
endmoduleTrace one case
accepted signed samples=[-2,3,4,-1]; response is stalled for two cyclesresult_valid=1; best_sum=7; best_start=1; best_end=2; payload remains stable during both blocked edgesExhaustive nonempty intervals select [3,4]; the queued prediction is consumed only when the response handshake occurs.
Requirements
- Snapshot inputs only when req_valid and req_ready are both high, and evaluate every nonempty interval using signed arithmetic at least 16 bits wide.
- Break equal-sum ties by the lowest start index and then the lowest end index; count zero predicts result_valid low and zero result fields.
- Queue one expectation per accepted request and compare exactly once per accepted response.
- Require rsp_valid and its payload to remain stable while the response is stalled.
- Flush canceled expectations on reset and reject any orphan response before the first post-reset request.
