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
60 lines
2.0 KiB
Tcl
60 lines
2.0 KiB
Tcl
# xsim_run.tcl - Vivado xsim compilation and simulation script for mod_add_sync
|
|
#
|
|
# Compiles mod_add_sync RTL plus the file-based vector testbench and runs simulation.
|
|
# Run from the project root: ~/Dev/mlkem/
|
|
#
|
|
# Prerequisites:
|
|
# source /opt/Xilinx/Vivado/2019.2/settings64.sh
|
|
#
|
|
# Usage:
|
|
# vivado -mode batch -source sync_rtl/mod_add/TB/xsim_run.tcl
|
|
#
|
|
# # Or step-by-step:
|
|
# xvlog -sv sync_rtl/common/pipeline_reg.v
|
|
# xvlog -sv sync_rtl/mod_add/mod_add_sync.v
|
|
# xvlog -sv sync_rtl/mod_add/TB/tb_mod_add_xsim.v
|
|
# xelab tb_mod_add_xsim -s tb_mod_add_xsim
|
|
# xsim tb_mod_add_xsim -R
|
|
|
|
# ================================================================
|
|
# Configuration
|
|
# ================================================================
|
|
set SRC_DIR sync_rtl/mod_add
|
|
set TB_DIR sync_rtl/mod_add/TB
|
|
set COMMON_DIR sync_rtl/common
|
|
|
|
# ================================================================
|
|
# Step 1: Compile all source files (xvlog)
|
|
# ================================================================
|
|
puts "=== Compiling RTL sources ==="
|
|
|
|
# Common pipeline register
|
|
xvlog -sv -include_dirs . ${COMMON_DIR}/pipeline_reg.v
|
|
|
|
# mod_add_sync (includes defines.vh from common/)
|
|
xvlog -sv -include_dirs . ${SRC_DIR}/mod_add_sync.v
|
|
|
|
# ================================================================
|
|
# Step 2: Compile testbench
|
|
# ================================================================
|
|
puts "=== Compiling testbench ==="
|
|
|
|
# File-based vector testbench
|
|
xvlog -sv ${TB_DIR}/tb_mod_add_xsim.v
|
|
|
|
# ================================================================
|
|
# Step 3: Elaborate snapshot (xelab)
|
|
# ================================================================
|
|
puts "=== Elaborating snapshot ==="
|
|
|
|
xelab tb_mod_add_xsim -s tb_mod_add_xsim
|
|
|
|
# ================================================================
|
|
# Step 4: Run simulation
|
|
# ================================================================
|
|
puts "=== Running mod_add_sync file-based vector test ==="
|
|
xsim tb_mod_add_xsim -R
|
|
|
|
puts ""
|
|
puts "=== mod_add_sync simulation complete ==="
|