Pipeline ML-KEM datapath bottlenecks
This commit is contained in:
32
run_tb.sh
32
run_tb.sh
@@ -12,8 +12,8 @@
|
||||
# ./run_tb.sh enc 4 1 # Encaps K=4, only CASE=1
|
||||
# ./run_tb.sh dec # ML-KEM Decaps: all K, all cases (0..2)
|
||||
# ./run_tb.sh dec 2 0 # Decaps K=2, only CASE=0
|
||||
# ./run_tb.sh hello # hello_world end-to-end (single instance)
|
||||
# ./run_tb.sh hello two # hello_world end-to-end (two instances)
|
||||
# ./run_tb.sh hello [K] # hello_world end-to-end (single instance; K=2/3/4)
|
||||
# ./run_tb.sh hello two [K] # hello_world end-to-end (two instances; K=2/3/4)
|
||||
# ./run_tb.sh --list
|
||||
#
|
||||
# 'top' (KeyGen), 'enc' (Encaps) and 'dec' (Decaps) share the same RTL datapath;
|
||||
@@ -41,7 +41,7 @@ if [ "$1" = "--list" ]; then
|
||||
done
|
||||
echo " enc (ML-KEM Encaps; shares the 'top' RTL/tcl, enc testbench)"
|
||||
echo " dec (ML-KEM Decaps; shares the 'top' RTL/tcl, dec testbench)"
|
||||
echo " hello (ML-KEM hello_world end-to-end; 'hello two' for two instances)"
|
||||
echo " hello (ML-KEM hello_world end-to-end; optional K=2/3/4, 'hello two [K]' for two instances)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -286,12 +286,24 @@ fi
|
||||
|
||||
# ML-KEM hello_world end-to-end. Reuses the 'top' RTL compile list, then runs a
|
||||
# self-checking protocol TB (no KAT vectors): single instance by default, or two
|
||||
# instances (genenc + dec) with 'hello two'. Prints each step's inputs/outputs.
|
||||
# instances (genenc + dec) with 'hello two'. Optional K selects ML-KEM-512/768/1024.
|
||||
run_hello_selected() {
|
||||
local tcl_file="$1" variant="$2"
|
||||
local tcl_file="$1" arg1="$2" arg2="$3"
|
||||
set +e
|
||||
rm -rf xsim.dir .Xil
|
||||
|
||||
local variant="" ksel="2"
|
||||
if [ "$arg1" = "two" ]; then
|
||||
variant="two"
|
||||
[ -n "$arg2" ] && ksel="$arg2"
|
||||
elif [ -n "$arg1" ]; then
|
||||
ksel="$arg1"
|
||||
fi
|
||||
case "$ksel" in
|
||||
2|3|4) ;;
|
||||
*) echo "ERROR: hello K must be 2, 3, or 4 (got '$ksel')"; return 1 ;;
|
||||
esac
|
||||
|
||||
local tb snap
|
||||
if [ "$variant" = "two" ]; then
|
||||
tb=tb_mlkem_two_inst_xsim; snap=mlkem_two
|
||||
@@ -308,15 +320,15 @@ run_hello_selected() {
|
||||
echo " xvlog -sv --relax sync_rtl/top/TB/$tb.v"
|
||||
xvlog -sv --relax "sync_rtl/top/TB/$tb.v" || { echo "HELLO TB COMPILE FAILED"; return 1; }
|
||||
|
||||
echo " xelab $tb -s $snap --timescale 1ns/1ps"
|
||||
xelab "$tb" -s "$snap" --timescale 1ns/1ps || { echo "ELAB FAILED"; return 1; }
|
||||
echo " xelab $tb -generic_top KP=$ksel -s ${snap}_k${ksel} --timescale 1ns/1ps"
|
||||
xelab "$tb" -generic_top "KP=$ksel" -s "${snap}_k${ksel}" --timescale 1ns/1ps || { echo "ELAB FAILED"; return 1; }
|
||||
|
||||
xsim "$snap" -R
|
||||
xsim "${snap}_k${ksel}" -R
|
||||
}
|
||||
|
||||
if [ "$MODULE" = "hello" ]; then
|
||||
run_hello_selected "$TCL_FILE" "$SEL_K" # SEL_K position carries the variant ('two')
|
||||
run_hello_selected "$TCL_FILE" "$SEL_K" "$SEL_CASE" # args are [K] or [two] [K]
|
||||
exit $?
|
||||
fi
|
||||
|
||||
execute_tcl "$TCL_FILE"
|
||||
execute_tcl "$TCL_FILE"
|
||||
|
||||
Reference in New Issue
Block a user