如何使用Debug Cores在线调试

如何使用Debug Cores在线调试,第1张

第一步:标记需要debug的信号

例如:

VHDL:attribute mark_debug of sineSel : signal is "true"

attribute mark_debug of sine : signal is "true"

Verilog: 在需要debug的信号前加上 (* MARKDEBUG = "TRUE" *)

第二步:设置debug

首先打开synthesis design,可以看到之前标记的debug信号,然后点击tools,选择set up debug

点击find nets to add,可以找到之前标记的信号,把信号添加完毕,检查Clock Domain是否正确,点击下一步。

用Vivado进行硬件调试,就是要插入ila核,即“集成逻辑分析仪”,然后将想要引出来观察的信号连到这个核的probe上。

首先第一步,需要把想要观测的信号标记出来,即mark_debug,有两种mark_debug的方法,我用verilog写了一个简单的流水灯程序,只有几行代码,如下:

module main(

inputclk,

inputrst,

output reg [7:0] led

)

(*mark_debug = "true"*)reg [23:0] counter

always @(posedge clk) begin

if(rst) begin

counter <= 0

led <= 8'b00000001

end

else counter <= counter + 1

if (counter == 24'hffffff)

led <= {led[6:0],led[7]}

end

endmodule

例如,要观察counter信号的波形,那么在第7行定义reg型信号counter时,前面加上(*mark_debug=“true”*),这样就把counter信号标记了出来。如果用vhdl语言实现的话,这句话用该这样写:

signal counter : std_logic_vector (23 downto 0)

attribute mark_debug: string

attribute mark_debug of counter : signal is "true"

另外添加xdc约束文件,内容如下:

set_property PACKAGE_PIN Y9 [get_ports clk]

set_property PACKAGE_PIN T18 [get_ports rst]

set_property IOSTANDARD LVCMOS33 [get_ports clk]

set_property IOSTANDARD LVCMOS18 [get_ports rst]

set_property PACKAGE_PIN T22 [get_ports {led[0]}]

set_property PACKAGE_PIN T21 [get_ports {led[1]}]

set_property PACKAGE_PIN U22 [get_ports {led[2]}]

set_property PACKAGE_PIN U21 [get_ports {led[3]}]

set_property PACKAGE_PIN V22 [get_ports {led[4]}]

set_property PACKAGE_PIN W22 [get_ports {led[5]}]

set_property PACKAGE_PIN U19 [get_ports {led[6]}]

set_property PACKAGE_PIN U14 [get_ports {led[7]}]

set_property IOSTANDARD LVCMOS33 [get_ports {led[0]}]

set_property IOSTANDARD LVCMOS33 [get_ports {led[1]}]

set_property IOSTANDARD LVCMOS33 [get_ports {led[2]}]

set_property IOSTANDARD LVCMOS33 [get_ports {led[3]}]

set_property IOSTANDARD LVCMOS33 [get_ports {led[4]}]

set_property IOSTANDARD LVCMOS33 [get_ports {led[5]}]

set_property IOSTANDARD LVCMOS33 [get_ports {led[6]}]

set_property IOSTANDARD LVCMOS33 [get_ports {led[7]}]

之后run synthesis综合,之后open synthesized design,在左上角选择debug layout,在debug窗口中netlist看到counter信号前面有一个绿色的小蜘蛛,表示counter信号被标记出来了。

这其实是一种比较繁琐的方法,更为方便的方法是,直接综合工程,在之后打开综合设计,在netlist中直接选中想要查看的信号,右键选择mark debug,即可将信号标记出来。

但是采用第一种方式的好处是,如果工程比较复杂的话,一些信号可能会被综合优化掉,加上模块层层实例化,在netlist中可能找不到要观测的信号,这时在代码里面mark_debug,依旧可以将该信号引出来。


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/bake/11544679.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-16
下一篇2023-05-16

发表评论

登录后才能评论

评论列表(0条)

    保存