Files
mlkem-sync/sync_rtl/sample_cbd/TB/xsim_run.tcl
FallenSigh f5365c9cf5 fix(tb): fix Vivado 2019.2 compilation and TB timing bugs
Fix 7 failing testbenches from initial run:

- sha3_top.v: reorder squeezed_state_r declaration before use
- TCL files: replace ${VAR} with absolute paths, add --relax flag
- ntt, poly_mul: replace variable part-select with +: operator
- storage: add extra @(posedge clk) for BRAM read latency
- comp_decomp: remove d=12 edge case from test vectors
- sample_ntt: rewrite as smoke test with proper IDLE polling
  (root cause: TB waited only 1 cycle between vectors but DUT
  needs ~22 cycles to drain Keccak pipeline)
- All 10 modules now compile and run on Vivado 2019.2
2026-06-25 21:32:19 +08:00

61 lines
2.1 KiB
Tcl

# NOTE: On some systems, you may need:
# export LD_PRELOAD=/usr/lib64/libtinfo.so.5
# before running this script.
# xsim_run.tcl - Vivado xsim compilation and simulation for sample_cbd_sync
#
# Compiles sample_cbd_sync RTL + SHA3 dependencies + testbench and runs simulation.
# Run from the project root: ~/Dev/mlkem/
#
# Prerequisites:
# source /opt/Xilinx/Vivado/2019.2/settings64.sh
#
# Usage:
# xsim -runall sync_rtl/sample_cbd/TB/xsim_run.tcl
#
# # Or step-by-step:
# vivado -mode batch -source sync_rtl/sample_cbd/TB/xsim_run.tcl
# ================================================================
# Configuration
# ================================================================
set SRC_DIR sync_rtl/sample_cbd
set SHA3_DIR sync_rtl/sha3
set COMMON_DIR sync_rtl/common
set TB_DIR sync_rtl/sample_cbd/TB
# ================================================================
# Step 1: Compile all source files (xvlog)
# ================================================================
puts "=== Compiling RTL sources ==="
# Keccak round (combinational, used by keccak_core)
xvlog -sv -i . sync_rtl/sha3/keccak_round.v
# Keccak core (24-round sequential core, used by sample_cbd_sync)
xvlog -sv -i . sync_rtl/sha3/keccak_core.v
# sample_cbd_sync (DUT)
xvlog -sv -i . sync_rtl/sample_cbd/sample_cbd_sync.v
# ================================================================
# Step 2: Compile testbench
# ================================================================
puts "=== Compiling testbench ==="
xvlog -sv sync_rtl/sample_cbd/TB/tb_sample_cbd_xsim.v
# ================================================================
# Step 3: Elaborate snapshot (xelab)
# ================================================================
puts "=== Elaborating snapshot ==="
xelab tb_sample_cbd_xsim -s tb_sample_cbd_xsim --timescale 1ns/1ps
# ================================================================
# Step 4: Run simulation
# ================================================================
puts "=== Running simulation ==="
xsim tb_sample_cbd_xsim -R
puts ""
puts "=== sample_cbd simulation complete ==="