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
65 lines
2.1 KiB
Tcl
65 lines
2.1 KiB
Tcl
# xsim_run.tcl - Vivado xsim compilation and simulation script
|
|
#
|
|
# Compiles sha3_chain_top with all SHA3 dependencies plus testbench.
|
|
# Run from the project root: ~/Dev/mlkem/
|
|
#
|
|
# Dependencies:
|
|
# sync_rtl/sha3/keccak_round.v (combinational Keccak round)
|
|
# sync_rtl/sha3/keccak_core.v (24-round Keccak core)
|
|
# sync_rtl/sha3/sha3_top.v (SHA3 G/H/J top wrapper)
|
|
# sync_rtl/sha3_chain/sha3_chain_top.v (ML-KEM G function)
|
|
#
|
|
# Prerequisites:
|
|
# source /opt/Xilinx/Vivado/2019.2/settings64.sh
|
|
#
|
|
# Usage:
|
|
# xsim -runall xsim_run.tcl
|
|
# vivado -mode batch -source xsim_run.tcl
|
|
|
|
# ================================================================
|
|
# Configuration
|
|
# ================================================================
|
|
set SHA3_DIR sync_rtl/sha3
|
|
set SHA3_CHAIN_DIR sync_rtl/sha3_chain
|
|
set TB_DIR sync_rtl/sha3_chain/TB
|
|
|
|
# ================================================================
|
|
# Step 1: Compile RTL sources (xvlog)
|
|
# ================================================================
|
|
puts "=== Compiling SHA3 RTL sources ==="
|
|
|
|
# Core Keccak module (combinational round)
|
|
xvlog -sv ${SHA3_DIR}/keccak_round.v
|
|
|
|
# Keccak core (24-round sequential core)
|
|
xvlog -sv ${SHA3_DIR}/keccak_core.v
|
|
|
|
# SHA3 top wrapper (G/H/J modes)
|
|
xvlog -sv ${SHA3_DIR}/sha3_top.v
|
|
|
|
# sha3_chain_top (ML-KEM G function)
|
|
xvlog -sv ${SHA3_CHAIN_DIR}/sha3_chain_top.v
|
|
|
|
# ================================================================
|
|
# Step 2: Compile testbench
|
|
# ================================================================
|
|
puts "=== Compiling testbench ==="
|
|
|
|
xvlog -sv ${TB_DIR}/tb_sha3_chain_xsim.v
|
|
|
|
# ================================================================
|
|
# Step 3: Elaborate snapshot (xelab)
|
|
# ================================================================
|
|
puts "=== Elaborating snapshot ==="
|
|
|
|
xelab tb_sha3_chain_xsim -s tb_sha3_chain_xsim
|
|
|
|
# ================================================================
|
|
# Step 4: Run simulation
|
|
# ================================================================
|
|
puts "=== Running sha3_chain test ==="
|
|
xsim tb_sha3_chain_xsim -R
|
|
|
|
puts ""
|
|
puts "=== sha3_chain simulation complete ==="
|