Q179FreeDesign Verification
Expire memory expectations without full scans
Question
Replace the full pending-memory scan with an ordered expiration queue while preserving per-address matching. Use a fixed positive 32-bit timeout. Callbacks are serialized: record expected writes and process all DUT observations for a cycle, then call tick() exactly once to advance one cycle and expire ages at least timeout. The total number of error reports in one checker lifetime is at most 2^31 - 1. Supported checker storage is at most 2,147,483,647 retained expectation objects in total at any time, including matched objects still awaiting expiration. Count each object once even when both indexes reference it. The caller honors that storage premise before admitting another golden_write; it introduces no DUT overflow-reporting behavior.

Implementation scaffold
class expected_txn;
longint addr;
int data;
int unsigned born;
bit matched = 0;
function new(longint addr, int data, int unsigned born);
this.addr = addr;
this.data = data;
this.born = born;
endfunction
endclass
class DeadlineMemoryChecker;
expected_txn by_addr[longint][$];
expected_txn deadlines[$];
int unsigned cycle = 0;
local int unsigned timeout;
int errors = 0;
function new(int unsigned timeout = 100);
if (timeout == 0) $fatal(1, "timeout must be positive");
this.timeout = timeout;
endfunction
function void golden_write(longint addr, int data);
expected_txn t = new(addr, data, cycle);
// Implement here: golden_write.
endfunction
function void dut_write(longint addr, int data);
// Implement here: dut_write.
endfunction
function void tick();
// Implement here: tick.
endfunction
function int error_count(); return errors; endfunction
function void end_of_test_check();
// Implement here: end_of_test_check.
endfunction
endclassTrace one case
timeout=5; expect A at cycle 0 and B at cycle 2; match B at cycle 3; tick through cycles 5 and 7A adds one timeout report at cycle 5. B adds none when its marked entry retires at cycle 7.Both lookup structures contain the same objects. The matched flag is visible to expiration without searching for B in the global queue.
Requirements
- Store the same transaction object in the per-address queue and the expiration queue.
- Match one address/data expectation per DUT write, and mark its object so expiration can skip it lazily.
- Examine only expired objects at the expiration queue head; do not scan unrelated addresses each tick.
- Use a fixed timeout and insert expectations in call order; unsigned age subtraction must work across the 32-bit cycle-counter wrap.
- Count unexpected DUT writes, unmatched expirations, and unmatched entries at end of test. Finalization clears both structures and must not report already matched or expired entries again.
