feat(poly_arith): implement synchronous PolyAdd/PolySub streaming module

Phase 2.3: Polynomial modular addition and subtraction.
- poly_arith_sync.v: mode=0 add (a+b mod Q), mode=1 sub (a-b mod Q)
- Pure streaming (1 coeff/cycle, no BRAM needed)
- Uses pipeline_reg for valid/ready handshake

Verified: 10/10 vectors bit-exact vs Python reference
This commit is contained in:
2026-06-24 23:12:59 +08:00
parent 39dd36994b
commit 209ca90fb1
4 changed files with 368 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
{
"module": "poly_arith",
"rtl_top": "sync_rtl/poly_arith/poly_arith_sync.v",
"rtl_deps": ["sync_rtl/common/pipeline_reg.v"],
"tb_cpp": "sync_rtl/poly_arith/TB/tb_poly_arith.cpp",
"simulator": "verilator",
"timeout_s": 30,
"cases": [
{
"id": "add",
"description": "Polynomial modular addition: (A[i] + B[i]) mod Q for 256 coeffs, 5 random vectors",
"params": {"mode": "add"},
"num_vectors": 5,
"tolerance": "bit_exact"
},
{
"id": "sub",
"description": "Polynomial modular subtraction: (A[i] - B[i]) mod Q for 256 coeffs, 5 random vectors",
"params": {"mode": "sub"},
"num_vectors": 5,
"tolerance": "bit_exact"
}
]
}