- Replace -include_dirs . with -i . (Vivado 2019.2 syntax)
- Add --timescale 1ns/1ps to all xelab commands
- Add LD_PRELOAD comment for ncurses compatibility
- Add run_tb.sh convenience script
Usage: ./run_tb.sh mod_add
./run_tb.sh --list
- Update spec with Vivado 2019.2 compatibility notes
65 lines
2.2 KiB
Tcl
65 lines
2.2 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 script for comp_decomp_sync
|
|
#
|
|
# Compiles comp_decomp_sync RTL + dependencies + testbench and runs simulation.
|
|
# Run from the project root: ~/Dev/mlkem/
|
|
#
|
|
# Prerequisites:
|
|
# source /opt/Xilinx/Vivado/2019.2/settings64.sh
|
|
#
|
|
# Usage examples:
|
|
# # Step-by-step (from Tcl):
|
|
# xsim -runall xsim_run.tcl
|
|
#
|
|
# # Or via Vivado batch mode:
|
|
# vivado -mode batch -source xsim_run.tcl
|
|
#
|
|
# # Or manually:
|
|
# xvlog -sv sync_rtl/common/pipeline_reg.v sync_rtl/comp_decomp/comp_decomp_sync.v sync_rtl/comp_decomp/TB/tb_comp_decomp_xsim.v
|
|
# xelab tb_comp_decomp_xsim -s tb_comp_decomp_xsim
|
|
# xsim tb_comp_decomp_xsim -R
|
|
|
|
# ================================================================
|
|
# Configuration
|
|
# ================================================================
|
|
set RTL_DIR sync_rtl
|
|
set DUT_DIR sync_rtl/comp_decomp
|
|
set TB_DIR sync_rtl/comp_decomp/TB
|
|
|
|
# ================================================================
|
|
# Step 1: Compile all source files (xvlog)
|
|
# ================================================================
|
|
puts "=== Compiling RTL sources for comp_decomp_sync ==="
|
|
|
|
# Common dependency (pipeline register)
|
|
xvlog -sv -i . ${RTL_DIR}/common/pipeline_reg.v
|
|
|
|
# DUT (comp_decomp_sync) — uses `include "sync_rtl/common/defines.vh"
|
|
xvlog -sv -i . ${DUT_DIR}/comp_decomp_sync.v
|
|
|
|
# ================================================================
|
|
# Step 2: Compile testbench
|
|
# ================================================================
|
|
puts "=== Compiling testbench ==="
|
|
|
|
xvlog -sv ${TB_DIR}/tb_comp_decomp_xsim.v
|
|
|
|
# ================================================================
|
|
# Step 3: Elaborate snapshot (xelab)
|
|
# ================================================================
|
|
puts "=== Elaborating snapshot ==="
|
|
|
|
xelab tb_comp_decomp_xsim -s tb_comp_decomp_xsim --timescale 1ns/1ps
|
|
|
|
# ================================================================
|
|
# Step 4: Run simulation
|
|
# ================================================================
|
|
puts "=== Running comp_decomp_sync XSIM test ==="
|
|
xsim tb_comp_decomp_xsim -R
|
|
|
|
puts ""
|
|
puts "=== Simulation complete ==="
|