chore(task): archive 06-27-mlkem-top-tb

This commit is contained in:
2026-06-27 01:07:40 +08:00
parent 0e6798beb5
commit 09efbef423
4 changed files with 80 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
{"file": ".trellis/spec/rtl/xsim-tb-conventions.md", "reason": "XSIM TB quality checks"}

View File

@@ -0,0 +1,2 @@
{"file": ".trellis/spec/rtl/xsim-tb-conventions.md", "reason": "XSIM TB conventions"}

View File

@@ -0,0 +1,50 @@
# mlkem_top KAT Testbench
## Goal
编写 `mlkem_top` 的 KAT (Known Answer Test) testbench使用 FIPS 203 标准测试向量验证 KeyGen/Encaps/Decaps 正确性。
## Data Source
`/home/fallensigh/Dev/ml-kem-r/test_data/kat_MLKEM_512.rsp`
- 100 个测试向量 (count 0-99)
- 每个向量包含d, z, msg, pk, sk, ct, ss
- NIST FIPS 203 标准格式
## Requirements
1. Python `gen_vectors.py` 解析 KAT 文件,生成 `mlkem_top_input.hex``mlkem_top_expected.hex`
2. Verilog `tb_mlkem_top_xsim.v`
- 读取输入向量 (d, z, msg)
- 驱动 KeyGen → 验证 pk, sk
- 驱动 Encaps → 验证 ct, ss
- 驱动 Decaps → 验证 ss
- 超时看门狗
- pass/fail 统计
## Decisions
* 先用 ML-KEM-512 (k=2),后续扩展 768/1024
* 文件向量模式,遵循现有 TB 风格
* 自检模式:与 KAT 期望值逐个字节比较
## Test Flow (per vector)
1. 复位
2. KeyGen: d → verify pk, sk
3. Encaps: msg → verify ct, ss
4. Decaps: ct → verify ss (output matches ss from encaps)
## Acceptance Criteria
* [ ] 至少 count=0 的 KeyGen 通过
* [ ] 至少 count=0 的 Encaps 通过
* [ ] at least basic Decaps consistency
* [ ] xvlog 编译通过
* [ ] xsim 仿真通过
## Out of Scope
* 全部 100 个向量(先做前 5 个)
* ct_n 无效密文测试
* ML-KEM-768/1024

View File

@@ -0,0 +1,26 @@
{
"id": "mlkem-top-tb",
"name": "mlkem-top-tb",
"title": "编写mlkem_top的KAT testbench",
"description": "",
"status": "completed",
"dev_type": null,
"scope": null,
"package": null,
"priority": "P2",
"creator": "FallenSigh",
"assignee": "FallenSigh",
"createdAt": "2026-06-27",
"completedAt": "2026-06-27",
"branch": null,
"base_branch": "main",
"worktree_path": null,
"commit": null,
"pr_url": null,
"subtasks": [],
"children": [],
"parent": null,
"relatedFiles": [],
"notes": "",
"meta": {}
}