feat(tb): add Vivado XSIM Verilog testbenches for all 10 sync modules

Add file-based vector testbenches ( + ) for:
- mod_add_sync, rng_sync, poly_arith_sync, comp_decomp_sync
- s_bram/sd_bram, sha3_chain_top
- ntt_core, poly_mul_sync
- sample_cbd_sync, sample_ntt_sync

Each module includes:
- tb_<module>_xsim.v: Vivado XSIM testbench
- gen_vectors.py: Python vector generator (stdlib only)
- vectors/<module>_input.hex: test input vectors
- xsim_run.tcl: compile + elaborate + simulate script
This commit is contained in:
2026-06-25 20:48:38 +08:00
parent ae5f0ca048
commit d4c3fc86fc
42 changed files with 7745 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
# xsim_run.tcl - Vivado xsim compilation and simulation script
#
# Compiles s_bram, sd_bram, and tb_storage_xsim testbench.
# Run from the project root: ~/Dev/mlkem/
#
# Prerequisites:
# source /opt/Xilinx/Vivado/2019.2/settings64.sh
#
# Usage:
# xsim -runall xsim_run.tcl
# vivado -mode batch -source xsim_run.tcl
# ================================================================
# Configuration
# ================================================================
set SRC_DIR sync_rtl/storage
set TB_DIR sync_rtl/storage/TB
# ================================================================
# Step 1: Compile RTL sources (xvlog)
# ================================================================
puts "=== Compiling RTL sources ==="
xvlog -sv ${SRC_DIR}/s_bram.v
xvlog -sv ${SRC_DIR}/sd_bram.v
# ================================================================
# Step 2: Compile testbench
# ================================================================
puts "=== Compiling testbench ==="
xvlog -sv ${TB_DIR}/tb_storage_xsim.v
# ================================================================
# Step 3: Elaborate snapshot (xelab)
# ================================================================
puts "=== Elaborating snapshot ==="
xelab tb_storage_xsim -s tb_storage_xsim
# ================================================================
# Step 4: Run simulation
# ================================================================
puts "=== Running storage test ==="
xsim tb_storage_xsim -R
puts ""
puts "=== Storage simulation complete ==="