fix(enc): compile comp_decomp_sync + pipeline_reg in KeyGen tcl

mlkem_top now instantiates comp_decomp_sync (E5), so the shared
xsim_run.tcl must compile it (+ its pipeline_reg dep) before mlkem_top.
This unbreaks 'run_tb.sh top' which failed elaboration with
'Module comp_decomp_sync not found'. run_enc.sh simplified to reuse the
tcl's now-complete compile list (drops its duplicate leaf block).
This commit is contained in:
2026-06-29 03:06:11 +08:00
parent 3bc46f9640
commit 4fee8bded3
2 changed files with 4 additions and 14 deletions

View File

@@ -21,27 +21,15 @@ export LD_PRELOAD="${LD_PRELOAD}${LD_PRELOAD:+:}/usr/lib64/libtinfo.so.5"
cd "$SCRIPT_DIR"
rm -rf xsim.dir .Xil
# Compile every xvlog RTL line from the KeyGen tcl (same datapath), verbatim.
# Compile every xvlog RTL line from the KeyGen tcl (same datapath, now incl.
# pipeline_reg + comp_decomp_sync + mlkem_top), skipping only the KeyGen TB.
TCL="sync_rtl/top/TB/xsim_run.tcl"
while read -r cmd; do
[[ "$cmd" == *tb_mlkem_kg_katK* ]] && continue # skip the KeyGen TB
[[ "$cmd" == *mlkem_top.v* ]] && continue # defer top until comp_decomp compiled
echo " $cmd"
eval "$cmd" || { echo "COMPILE FAILED: $cmd"; exit 1; }
done < <(grep -E '^xvlog ' "$TCL")
# Encaps-only leaf: comp_decomp_sync (compress) + its pipeline_reg dep.
for f in sync_rtl/common/pipeline_reg.v sync_rtl/comp_decomp/comp_decomp_sync.v; do
[[ -f "$f" ]] || continue
echo " xvlog -sv --relax -i . $f"
xvlog -sv --relax -i . "$f" || { echo "COMPILE FAILED: $f"; exit 1; }
done
# Now compile the top (depends on comp_decomp_sync).
echo " xvlog -sv --relax -i . sync_rtl/top/mlkem_top.v"
xvlog -sv --relax -i . sync_rtl/top/mlkem_top.v \
|| { echo "TOP COMPILE FAILED"; exit 1; }
# Compile the encaps TB
echo " xvlog -sv --relax sync_rtl/top/TB/tb_mlkem_enc_katK_xsim.v"
xvlog -sv --relax sync_rtl/top/TB/tb_mlkem_enc_katK_xsim.v \

View File

@@ -20,6 +20,8 @@ xvlog -sv --relax -i . sync_rtl/poly_mul/basecase_mul.v
xvlog -sv --relax -i . sync_rtl/poly_mul/poly_mul_zeta_rom.v
xvlog -sv --relax -i . sync_rtl/poly_mul/poly_mul_sync.v
xvlog -sv --relax -i . sync_rtl/storage/sd_bram.v
xvlog -sv --relax -i . sync_rtl/common/pipeline_reg.v
xvlog -sv --relax -i . sync_rtl/comp_decomp/comp_decomp_sync.v
xvlog -sv --relax -i . sync_rtl/top/mlkem_top.v
# ---- Step 2: compile parametric KAT testbench ----