Files

41 lines
1.6 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/sh
# =============================================================================
# run_local_ice.sh -- 本地免硬件验证 ICE 自检状态机逻辑
# =============================================================================
set -e
cd "$(dirname "$0")/../.."
mkdir -p ice/sim_local
echo "=========================================================="
echo " 本地离线验证 ICE 自检状态机 (z3_demo_ice_top) "
echo "=========================================================="
if command -v iverilog >/dev/null 2>&1; then
echo "使用 Icarus Verilog 进行本地编译与仿真..."
iverilog -g2005 -DLOCAL_SIM -o ice/sim_local/z3_demo_ice.vvp \
ice/rtl/z3_demo_top.v \
ice/rtl/z3_demo_ice_top.v \
ice/tb/tb_z3_demo_ice.v
vvp ice/sim_local/z3_demo_ice.vvp | tee ice/sim_local/ice_run.log
[ -f ice/sim_local/z3_demo_ice.vcd ] || [ -f z3_demo_ice.vcd ] && mv -f z3_demo_ice.vcd ice/sim_local/ 2>/dev/null || true
elif command -v xrun >/dev/null 2>&1; then
echo "使用 Cadence xrun 进行本地仿真..."
xrun -64bit -define LOCAL_SIM -access +rwc \
ice/rtl/z3_demo_top.v \
ice/rtl/z3_demo_ice_top.v \
ice/tb/tb_z3_demo_ice.v \
-logfile ice/sim_local/ice_run.log
else
echo "未检测到 iverilog 或 xrun!"
exit 1
fi
echo ""
if grep -q "ICE Self-Check FSM Passed Successfully" ice/sim_local/ice_run.log; then
echo "===> [SUCCESS] ICE 状态机本地验证全部通过!"
else
echo "===> [FAIL] ICE 验证未通过,请查看日志: ice/sim_local/ice_run.log"
exit 1
fi