feat: complete Palladium Z2 demo for both SA and ICE emulation flows

This commit is contained in:
xuejin.wang
2026-10-19 21:35:38 +08:00
commit 398729ec51
18 changed files with 1347 additions and 0 deletions
+74
View File
@@ -0,0 +1,74 @@
# =============================================================================
# run_xedebug_ice.tcl -- Palladium Z2 ICE 模式上机下载与调试运行脚本
#
# 使用方式:
# 在工程根目录下执行:
# xeDebug -f ice/scripts/run_xedebug_ice.tcl
# 或者启动交互界面后手动执行:
# xeDebug
# XE> source ice/scripts/run_xedebug_ice.tcl
# =============================================================================
# 1) 载入当前硬件设计签名并连接目标 Palladium Z2 Emulator
debug .
if {[info exists env(XE_HOST)]} {
host $env(XE_HOST)
} elseif {[info exists env(XE_HOSTNAME)]} {
host $env(XE_HOSTNAME)
} else {
host scz2_emu
}
# 2) 下载比特流到硬件机台 (xc on / download 兼容处理)
if {[catch {xc on} err]} {
catch {download}
}
# 3) 复位激励时序:拉低复位 -> 跑 20 个时钟周期 -> 释放复位
catch {force z2_demo_ice_top.rst_n_in 0}
run 20
catch {force z2_demo_ice_top.rst_n_in 1}
# 4) 运行时钟推進激励(自检状态机大约在 45 个周期内完成检查并挂起)
run 1000
# 5) 提取并展示 LED 输出判读结果
puts ""
puts "======================================================="
puts " Palladium Z2 ICE 运行测试结果 "
puts "======================================================="
set done 0
set pass 0
set fail 0
set gpio "??"
# 兼容 get 与 value 命令
if {![catch {get -radix bin z2_demo_ice_top.led_done} val]} {
set done $val
set pass [get -radix bin z2_demo_ice_top.led_pass]
set fail [get -radix bin z2_demo_ice_top.led_fail]
set gpio [get -radix hex z2_demo_ice_top.led_gpio]
} elseif {![catch {value z2_demo_ice_top.led_done} val]} {
set done $val
catch {set pass [value z2_demo_ice_top.led_pass]}
catch {set fail [value z2_demo_ice_top.led_fail]}
catch {set gpio [value z2_demo_ice_top.led_gpio]}
}
puts " led_done : $done (测试序列是否完成,预期: 1)"
puts " led_pass : $pass (全硬件检查是否通过,预期: 1)"
puts " led_fail : $fail (是否有硬件检查失败,预期: 0)"
puts " led_gpio : 0x$gpio (跑马灯寄存器旋转值,预期: 0x02)"
puts "-------------------------------------------------------"
if {$pass == 1 && $fail == 0} {
puts " >>> [SUCCESS] ICE DEMO 全部硬件自检测试通过! <<<"
} else {
puts " >>> [FAIL] ICE DEMO 硬件检查未通过,请排查状态机停滞位置 <<<"
catch {puts " FSM State : [get -radix dec z2_demo_ice_top.state]"}
catch {puts " Last Latched: 0x[get -radix hex z2_demo_ice_top.rd_latched]"}
}
puts "======================================================="
puts ""