System ILA
硬件调试的关键在于以所需的调试逻辑来检测内核。以下主题探讨的是可用于列出可用内核端口的 v++
连接器选项、在选定端口上启用 System Integrated Logic Analyzer (ILA) 核以及启用 AXI Protocol Checker 调试核用于检查协议违例。
ILA 核可提供对硬件上运行的计算单元实例 (CU) 的传输事务级可视性。ILA 核还可用于捕获和查看感兴趣的 AXI 流量。ILA 可在一个或多个信号上提供定制事件触发,允许以系统速度进行波形捕获。波形可在查看器中进行分析,并用于调试硬件,以便查找协议违例或性能问题。它对于调试各种难题(例如,应用挂起)也同样至关重要。
捕获的数据可使用 Vivado 工具通过赛灵思虚拟线缆 (XVC) 来访问。欲知详情,请参阅 Vivado Design Suite 用户指南:编程和调试(UG908)。
ILA 核可添加到现有 RTL 内核中,以在该设计内启用调试功能,或者可由 v++
编译器在链接阶段自动插入。v++
命令可提供 --debug
选项(如 --debug 选项 中所述)以将位于接口处的 System ILA 核连接到内核,用于调试和性能监控。
-–debug
选项可启用 ILA IP 核插入,其语法如下:
--debug.chipscope <cu_name>[:<interface_name>]>
<interface_name>
为可选,如果不指定该选项,则将分析 CU 上的所有端口。您可以使用 --debug.list_ports
选项来返回内核上的接口名称,以搭配 --debug
选项一起使用。对于扁平设计或者在主模式下包含多个 Debug Bridge 的任何设计,此流程将不会选择其中任一 Debug Bridge 来拼接调试核,需要通过约束来定义连接。以 Samsung Smart SSD U.2 平面 shell 为例,启用通过调试 (ILA) 选项来生成内核时,静态区域与动态区域之间并没有分区。必须指定从需接受调试的内核 AXI 端口到动态区域中的用户 Debug Bridge 的连接。
要指定此连接,您必须在 v++
命令行中提供以下选项:
--advanced.paramcompiler.userPostDebugProfileOverlayTcl=<path to post_dbg_profile_overlay.tcl >
在 post_dbg_profile_overlay.tcl 内,此文件必须通过连接调试核命令来调用 XDC 文件,并提及其处理顺序。
例如,以下提供了 post_dbg_profile_overlay.tcl 文件中的内容。
read_xdc < path to the connect_debug_core.xdc file>
set_property used_in_implementation TRUE [get_files <path to the connect_debug_core.xdc file>]
set_property PROCESSING_ORDER EARLY [get_files <path to the connect_debug_core.xdc file>]]
在 connect_debug_core.xdc 文件中,您必须指定 connect_debug_cores 约束。
例如:
connect_debug_cores -master [get_cells -hierarchical -filter {NAME =~ *debug_bridge_xsdbm/inst/xsdbm}]
-slaves [get_cells -hierarchical -filter {NAME =~ level0_i/ulp/system_ila_0}]
AXI Protocol Checker
AXI Protocol Checker 核用于监控 AXI 接口。将其连接到接口上时,它会主动检查协议违例并指示发生了哪些违例。您可在设计中为所有 CU 或者特定 CU 和端口分配该核。
-–debug
选项用于启用 AXI Protocol Checker 插入,其语法如下:
--debug.protocol all
协议检查器可通过关键字 all
或 <cu_name>:<interface_name>
来指定。
--debug.list_ports
选项可指定为返回内核上端口的实际名称,以搭配 protocol
或 chipscope
一起使用。以下提供的流程示例可供您用于为设计添加 ILA 或协议检查器:
- 将内核源文件编译到 XO 文件中,使用
-g
选项来检测内核的调试功能:v++ -c -g -k <kernel_name> --platform <platform> -o <kernel_xo_file>.xo <kernel_source_files>
- 将内核编译到 XO 文件中之后,使用
--debug.list_ports
会导致v++
编译器打印内核的有效计算单元和端口组合列表:v++ -l -g --platform <platform> --connectivity.nk <kernel_name>:<compute_units>:<kernel_nameN> --debug.list_ports <kernel_xo_file>.xo
- 在目标端口上通过将
list_ports
替换为相应的--debug.chipscope
或--debug.protocol
命令语法来添加 ILA 或 AXI 调试核:v++ -l -g --platform <platform> --connectivity.nk <kernel_name>:<compute_units>:<kernel_nameN> --debug.chipscope <compute_unit_name>:<interface_name> <kernel_xo_file>.xo
v++
命令行或配置文件中可多次指定 --debug
选项以指定多个 CU 和接口。构建设计后,您可使用 Vivado 硬件管理器 (Hardware Manager) 来调试设计,如 利用 ChipScope 调试 中所述。