nutshell-cache-verification/docs/coverage_plan.md

1.9 KiB
Raw Permalink Blame History

Functional Coverage 计划

Coverage 实现位于 src/funcov/cache_coverage.py,对每笔 L1 请求采样。当前必达 bin

Coverpoint 必达 bin 目的
cmd READ, WRITE 覆盖 CPU 侧基本操作
addr_space cached, mmio 覆盖缓存路径与 MMIO 旁路路径
mask zero, single-byte, contiguous, sparse, full 覆盖读请求 mask=0 和写掩码 corner
word_offset 0..7 覆盖 64B line 内所有 8 个 word
transition R->R, R->W, W->R, W->W 覆盖连续请求依赖与协议转移
conflict_depth 1,2,3,4,>4 覆盖同 set 内从普通命中到超过 4-way 替换

采样位置

  • Toffee 硬件测试:CacheRefModel.non_block_read/non_block_write 中随 driver hook 采样。
  • 纯模型报告:scripts/run_model_regression.py 直接对 CRV transaction 流采样。

当前覆盖率结果

  • 模型回归:reports/model_coverage.md325 笔请求100.00%。
  • 硬件随机回归:reports/coverage_random_crv.json245 笔请求100.00%。
  • Coherence/stress directedtests/test_coherence.pytests/test_coverage_stress.py 覆盖 probe hit/miss、flush、raw write burst、size 变体;这些 RTL stress tests 不计入 L1 functional coverage 分母。

RTL Code Coverage

RTL coverage 通过 Verilator coverage 数据生成:

make gen_dut
make test-hw
make rtl-coverage

当前 reports/rtl_coverage_summary.md 结果line 78.2%、toggle 92.3%、branch 89.3%、expr 91.5%。默认硬件回归已扩展到 12 个 Toffee case包含 flush、raw write burst、MMIO uncached 和 size field stress。这不是 functional coverage 的替代,而是用于发现未触达实现代码、低活跃分支和工具生成路径。

后续可扩展 coverpoint

  • refill burst 起始 word 旋转顺序。
  • mem/mmio 端口延迟分布和 ready gap。
  • flush 前后命中状态。
  • coherence probe 的 dirty hit release 多 beat 行为。