chore(task): archive 06-27-fix-kg-compute

This commit is contained in:
2026-06-27 01:38:45 +08:00
parent 3284aa443f
commit e3470c92e1
4 changed files with 48 additions and 0 deletions

View File

@@ -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 数值完全匹配