Files
mlkem-sync/.trellis/tasks/06-27-sha3-g-test-specific-input/prd.md
FallenSigh 4997657d7e test(comp_decomp): add ML-KEM-1024 d=11/d=5 compress/decompress cases
Adds 4 Verilator cases covering d_u=11 and d_v=5 (ML-KEM-1024), which the
RTL already supports (d is 5-bit, products fit 24 bits). comp_decomp now
120/120 vectors. Also ignore .omo/ session runtime cache and archive the
06-27-sha3-g-test-specific-input trellis task.

Verified all 10 modules pass both frameworks:
- Verilator: 4334/4334 vectors
- XSIM (Vivado 2019.2): all 11 testbenches green, separate committed vectors
Oracles independently cross-checked vs hashlib (G/H/J/PRF) and FIPS 203
Alg 7/8/9/10/12 (sample_ntt, sample_cbd, ntt, poly_mul).
2026-06-27 21:04:57 +08:00

31 lines
996 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 修改 sha3 TB 测试 G 模式指定输入
## 需求
修改 `sync_rtl/sha3/TB/tb_sha3_xsim_simple.v`,将其中硬编码的测试向量替换为指定的 d、k 值,测试 sha3_top 的 G (SHA3-512) 模式。
## 测试输入
```
d = 0x6dbbc4375136df3b07f7c70e639e223e177e7fd53b161b3f4d57791794f12624 (256-bit)
k = 2 (8-bit)
mode = G (2'b00)
```
在 RTL 中G 模式的输入格式为 `data_i[263:0] = {d[255:0], k[7:0]}`d 在低位k 在高位),即:
```
data_i = {248'd0, 8'd2, 256'h6dbbc4375136df3b07f7c70e639e223e177e7fd53b161b3f4d57791794f12624}
```
## 修改方案
修改 `tb_sha3_xsim_simple.v`
1.`data_i = 512'd0` 替换为指定值 `{248'd0, 8'd2, 256'h6dbbc4375136df3b07f7c70e639e223e177e7fd53b161b3f4d57791794f12624}`
2. 删除 `G_EXPECTED_HASH` 参数和自检比较逻辑,改为仅打印 `hash_o` 结果
3. 更新顶部的注释说明
## 预期输出
运行后打印 `hash_o` 的值,可通过 Python 参考实现 `SHA_3.G(d, k)` 交叉验证。