FVO — Formal Verification Online
Lesson 16.5 · Advanced Abstraction Techniques

Abstract neighbours: protocol stubs

Verifying a DMA engine does not require the real memory controller behind it — only a component that behaves like one at the interface: it accepts requests, answers in order within some latency, and returns data. A small non-deterministic stub with free inputs and a few assumptions explores every legal timing, which the real controller (with its own fixed timing) would not.

protocol stub (sketch)
// memory stub: answers each request after 1..MAX_LAT cycles, in order, with free data
module mem_stub #(parameter int MAX_LAT = 4, parameter int OUT = 4) (
  input  logic        clk, rst,
  input  logic        req_vld,          // from the DUT
  output logic        req_rdy,
  output logic        rsp_vld,          // to the DUT
  input  logic        rsp_vld_free,     // free: the tool decides when to answer
  output logic [31:0] rsp_data,
  input  logic [31:0] rsp_data_free     // free: any data
);
  logic [$clog2(OUT+1)-1:0] pending;
  logic [$clog2(MAX_LAT+1)-1:0] waited;
  assign req_rdy  = (pending < OUT);
  assign rsp_vld  = rsp_vld_free && pending != 0;
  assign rsp_data = rsp_data_free;
  always_ff @(posedge clk)
    if (rst) begin pending <= '0; waited <= '0; end
    else begin
      pending <= pending + (req_vld && req_rdy) - rsp_vld;
      waited  <= (pending == 0 || rsp_vld) ? '0 : waited + 1'b1;
    end
  // promise: never make the DUT wait longer than MAX_LAT for the oldest answer
  am_latency: assume property (@(posedge clk) disable iff (rst) pending != 0 && waited == MAX_LAT |-> rsp_vld_free);
endmodule

Closing the loop

The stub encodes assumptions about the real controller: in-order responses, at most OUT outstanding, latency at most MAX_LAT. Each must become an assertion on the real controller in its own FPV run (or be justified from its spec). Otherwise the DMA proof rests on promises nobody checked.

Discussion

No comments yet.

Was this page helpful?

Tip: select any text on the page before clicking Report and it will be quoted in your report.