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).
996 B
996 B
修改 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:
- 将
data_i = 512'd0替换为指定值{248'd0, 8'd2, 256'h6dbbc4375136df3b07f7c70e639e223e177e7fd53b161b3f4d57791794f12624} - 删除
G_EXPECTED_HASH参数和自检比较逻辑,改为仅打印hash_o结果 - 更新顶部的注释说明
预期输出
运行后打印 hash_o 的值,可通过 Python 参考实现 SHA_3.G(d, k) 交叉验证。