Files
mlkem-sync/run_hello.sh
FallenSigh ee2bf1cda8 test(top): two-instance hello_world TB (genenc + dec split)
Add tb_mlkem_two_inst_xsim: runs the hello_world protocol across TWO mlkem_top
instances, modeling the real two-party split:
  * u_genenc: KeyGen THEN Encaps on one instance. KeyGen writes ek into its own
    ek_bram and Encaps reuses it directly (no re-streaming) -> shared_key, ct.
  * u_dec: Decaps on a separate instance, receiving dk + ct streamed over from
    u_genenc via the input ports.

Verifies A.shared_key == B.recovered_key and 'hello world' round-trips. Output
matches the single-instance TB and the Rust reference (key=ced0c031a4bee34a...).

run_hello.sh gains a 'two' arg to select this TB; default stays single-instance.
2026-06-29 22:15:39 +08:00

26 lines
996 B
Bash
Executable File

#!/usr/bin/env bash
# run_hello.sh - compile + run an ML-KEM hello_world hardware testbench.
# ./run_hello.sh single-instance protocol (default)
# ./run_hello.sh two two-instance (genenc + dec) protocol
set -e
cd "$(dirname "$0")"
source /opt/Xilinx/Vivado/2019.2/settings64.sh >/dev/null 2>&1
export LD_PRELOAD="/usr/lib64/libtinfo.so.5"
rm -rf xsim.dir .Xil
if [ "$1" = "two" ]; then
TB=tb_mlkem_two_inst_xsim; SNAP=mlkem_two
else
TB=tb_mlkem_hello_world_xsim; SNAP=mlkem_hello
fi
# compile the RTL (every non-TB xvlog line from the shared tcl)
grep -E '^xvlog ' sync_rtl/top/TB/xsim_run.tcl | grep -v 'TB/tb_' | while read -r cmd; do
eval "$cmd" >/dev/null
done
xvlog -sv --relax sync_rtl/top/TB/$TB.v >/dev/null
xelab $TB -s $SNAP --timescale 1ns/1ps >/dev/null 2>&1
xsim $SNAP -R 2>/dev/null | grep -vE '^(#|INFO|Time resolution|run -all|exit|xsim|Vivado|====.*Simulator|SW Build|IP Build|Copyright|Tool Version|Start of|source |## )' | sed '/^$/N;/^\n$/D'