diff --git a/.trellis/tasks/archive/2026-06/06-27-fix-kg-compute/check.jsonl b/.trellis/tasks/archive/2026-06/06-27-fix-kg-compute/check.jsonl new file mode 100644 index 0000000..9dd3234 --- /dev/null +++ b/.trellis/tasks/archive/2026-06/06-27-fix-kg-compute/check.jsonl @@ -0,0 +1 @@ +{"_example": "Fill with {\"file\": \"\", \"reason\": \"\"}. Put spec/research files only — no code paths. Run `python3 .trellis/scripts/get_context.py --mode packages` to list available specs. Delete this line once real entries are added."} diff --git a/.trellis/tasks/archive/2026-06/06-27-fix-kg-compute/implement.jsonl b/.trellis/tasks/archive/2026-06/06-27-fix-kg-compute/implement.jsonl new file mode 100644 index 0000000..9dd3234 --- /dev/null +++ b/.trellis/tasks/archive/2026-06/06-27-fix-kg-compute/implement.jsonl @@ -0,0 +1 @@ +{"_example": "Fill with {\"file\": \"\", \"reason\": \"\"}. Put spec/research files only — no code paths. Run `python3 .trellis/scripts/get_context.py --mode packages` to list available specs. Delete this line once real entries are added."} diff --git a/.trellis/tasks/archive/2026-06/06-27-fix-kg-compute/prd.md b/.trellis/tasks/archive/2026-06/06-27-fix-kg-compute/prd.md new file mode 100644 index 0000000..1ea62f5 --- /dev/null +++ b/.trellis/tasks/archive/2026-06/06-27-fix-kg-compute/prd.md @@ -0,0 +1,20 @@ +# 修复 KeyGen 计算路径 + +## Goal +修复 `mlkem_top.v` 中 KeyGen 的占位状态,实现 t_hat、pk、sk 的实际计算,使 `./run_tb.sh top` 中 KeyGen 产生非零输出。 + +## Current Issues +1. KeyGen 的 t_hat 计算(poly_mul + poly_arith)是占位:`phase_done <= 1'b1` +2. `pk_o_r` / `sk_o_r` 从未被赋值(默认 0) +3. `rng_valid_i` 竞态(可能已跨过,仿真确认 FSM 在跑) + +## Fix Plan +1. 实现 `S_KG_TMUL_LOAD/COMP/OUT` 状态 → 调用 poly_mul_sync 计算 t_hat +2. 实现 `S_KG_ADD` → 调用 poly_arith_sync +3. 在 `S_KG_DONE` 中赋值 `pk_o_r = {t_hat polys, rho}` 和 `sk_o_r = {s_hat polys}` +4. 验证:`./run_tb.sh top` KeyGen 输出非零 + +## Out of Scope +- Encaps/Decaps 修复 +- pk/sk ByteEncode 编码(先输出 raw 12-bit coeffs) +- KAT 数值完全匹配 diff --git a/.trellis/tasks/archive/2026-06/06-27-fix-kg-compute/task.json b/.trellis/tasks/archive/2026-06/06-27-fix-kg-compute/task.json new file mode 100644 index 0000000..3ae5c89 --- /dev/null +++ b/.trellis/tasks/archive/2026-06/06-27-fix-kg-compute/task.json @@ -0,0 +1,26 @@ +{ + "id": "fix-kg-compute", + "name": "fix-kg-compute", + "title": "修复KeyGen计算路径并输出正确的pk/sk", + "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": {} +} \ No newline at end of file