vivado中debug怎么调试

vivado中debug怎么调试,第1张

Vivado Logic Analyzer的使用 chipscope中,通常有两种方法设置需要捕获的信号。 1.添加cdc文件,然后在网表中寻找并添加信号 2.添加ICON、ILA和VIO的IP Core 第一种方法,代码的修改量小,适当的保留设计的层级和网线名,图形化界面便于找到 需

用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://outofmemory.cn/bake/11712715.html

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

发表评论

登录后才能评论

评论列表(0条)

保存