nutshell-cache-verification/docs/test_plan.md

2.5 KiB
Raw Permalink Blame History

NutShell Cache 测试计划

验证目标

验证 rtl/Cache.v 在处理 CPU 侧 SimpleBus 读写请求时,对缓存命中/缺失、写掩码、替换写回、MMIO 旁路和 back-to-back 请求的可见行为与参考模型一致。

特性矩阵

ID 特性 风险 验证方法 对应实现
F1 冷读 miss/refill refill 顺序、READLST 数据错误 smoke + random CacheCRVGenerator.smoke/random_sequence
F2 写命中/写缺失 脏位、写回、写分配错误 full-mask write 后 read smoke, same_set_conflict
F3 byte mask 部分写 mask 展开/merge 错误 单字节、边界、稀疏、连续 mask mask_corners
F4 同 index 多 tag 冲突 4-way 替换、脏行写回错误 >4 tags 映射同一 set same_set_conflict(tags=7)
F5 MMIO decode/旁路 0x3... 和 0x4...-0x7... 区间误缓存、MMIO 被错误缓存 双窗口读写 + 外部 MMIO 状态变化 mmio_window, test_mmio_second_window_is_uncached
F6 back-to-back hazard 无空拍依赖读写错误 连续读写同 set/word back_to_back_hazards
F7 响应协议 WRITERSP/READLST 命令错误、ready/valid 死锁 Toffee driver/monitor + timeout SimpleBusMasterAgent, SimpleBusRam
F8 coherence probe probe hit/miss 响应错误CPU 侧验证无法发现 定向填充 clean line 后 probe hit空 set probe miss tests/test_coherence.py, NtCacheEnv.coh_agent
F9 flush/burst/size RTL stress flush 忙碌态、burst counter、size 透传未覆盖 refill 期间 flush、raw write burst、size=0..7 tests/test_coverage_stress.py

回归分层

  1. Model unit:不依赖 RTL验证 CRV、Oracle、Scoreboard、故障内存与覆盖率闭合。
  2. Smoke hardware:最短冷读、全写、部分写、邻近 word 检查。
  3. Directed hardwaremask corner、同组冲突、MMIO 双窗口。
  4. Coherence directed hardware:验证 io_out_coh_req/resp probe hit/miss 基本一致性入口。
  5. Random CRV hardware:固定 seed 的可复现随机流,覆盖热点 index、随机 tag、mask 分类和 MMIO。
  6. Fault-injection audit:用 RTL mutant 或故障内存确认验证环境对典型 bug 有检出能力。

退出准则

  • make regression 全部通过。
  • Functional coverage 必达 bin 无缺失;硬件随机测试覆盖率不低于 90%,模型回归目标为 100%。
  • Scoreboard 无 pending 响应,所有硬件响应由 Toffee 比较通过。