1.基于BASYS3板子,有如下代码:
module top(
input clk,
input rst,
output test_clk
);
parameter DIV_CNT = 2; reg clk25M; reg [31:0] cnt = 0; always@(posedge clk)begin if (cnt==DIV_CNT-1) begin clk25M <= ~clk25M; cnt <= 0; end else begin cnt <= cnt + 1'b1; end end assign test_clk = rst ? 1'b0 : clk25M;
管脚配置XDC文件内容如下:
set_property PACKAGE_PIN W5 [get_ports clk] set_property IOSTANDARD LVCMOS33 [get_ports clk] set_property PACKAGE_PIN V17 [get_ports rst] set_property IOSTANDARD LVCMOS33 [get_ports rst] set_property PACKAGE_PIN L1 [get_ports test_clk] set_property IOSTANDARD LVCMOS33 [get_ports test_clk]
2.占击左侧Run Synthesis,综合
![](http://upload-images.jianshu.io/upload_images/1249025-437992b3d94577b3.png-blog?imageMogr2/auto-orient/strip%7CimageView2/2/w/209)
3.完成之后,再点击 Open Synthesized Design,打开之后,点Tools下的Set Up Debug...
![](http://upload-images.jianshu.io/upload_images/1249025-cd29c66e7e859a78.png-blog?imageMogr2/auto-orient/strip%7CimageView2/2/w/408)
如下
![](http://upload-images.jianshu.io/upload_images/1249025-32ffd24cdb49caf7.png-blog?imageMogr2/auto-orient/strip%7CimageView2/2/w/656)
4.选择Find Nets to Add...
![](http://upload-images.jianshu.io/upload_images/1249025-a9105e0ea653ef3e.png-blog?imageMogr2/auto-orient/strip%7CimageView2/2/w/656)
5.点OK
![](http://upload-images.jianshu.io/upload_images/1249025-b18cf4e51498e84c.png-blog?imageMogr2/auto-orient/strip%7CimageView2/2/w/700)
6.选中想要观察的信号,点OK
![](http://upload-images.jianshu.io/upload_images/1249025-1c609923d019eed4.png-blog?imageMogr2/auto-orient/strip%7CimageView2/2/w/514)
7.出现红色,在红色地方右键。
![](http://upload-images.jianshu.io/upload_images/1249025-0b1cf08bdfdf1b47.png-blog?imageMogr2/auto-orient/strip%7CimageView2/2/w/656)
8.选择Select Clock Domain
![](http://upload-images.jianshu.io/upload_images/1249025-e61093fc0df79807.png-blog?imageMogr2/auto-orient/strip%7CimageView2/2/w/700)
9.选择ALL_CLOCK,然后选择clk_IBUF或clk_IBUF_BUFG
![](http://upload-images.jianshu.io/upload_images/1249025-793361caa9a1acf2.png-blog?imageMogr2/auto-orient/strip%7CimageView2/2/w/560)
10.选择合适的采集深度,1024通常够用
![](http://upload-images.jianshu.io/upload_images/1249025-0d7e90be362de84f.png-blog?imageMogr2/auto-orient/strip%7CimageView2/2/w/656)
11.Finish
![](http://upload-images.jianshu.io/upload_images/1249025-48ce04b1ebb87871.png-blog?imageMogr2/auto-orient/strip%7CimageView2/2/w/656)
12.点击左侧的Generate Bitstream
![](http://upload-images.jianshu.io/upload_images/1249025-64ea9a0d64548fe1.png-blog?imageMogr2/auto-orient/strip%7CimageView2/2/w/229)
13.完成后,点Open Hardware Manager
![](http://upload-images.jianshu.io/upload_images/1249025-feebc23fc60feed3.png-blog?imageMogr2/auto-orient/strip%7CimageView2/2/w/224)
14.将板子连接到电脑上,然后Open Target -> Auto Connect
![](http://upload-images.jianshu.io/upload_images/1249025-19339a13df9bc890.png-blog?imageMogr2/auto-orient/strip%7CimageView2/2/w/539)
15.在xc7a35t上面,右键->Program Device...
![](http://upload-images.jianshu.io/upload_images/1249025-ca3604e487dc74fd.png-blog?imageMogr2/auto-orient/strip%7CimageView2/2/w/470)
16.Program
![](http://upload-images.jianshu.io/upload_images/1249025-7a3da8454fc4dbd7.png-blog?imageMogr2/auto-orient/strip%7CimageView2/2/w/610)
17.点击Trigger
![](http://upload-images.jianshu.io/upload_images/1249025-6835586035bf09e4.png-blog?imageMogr2/auto-orient/strip%7CimageView2/2/w/415)
18.会自动弹出波形
![](http://upload-images.jianshu.io/upload_images/1249025-c50e6852e58b768d.png-blog?imageMogr2/auto-orient/strip%7CimageView2/2/w/700)
19.此时,只有test_clk信号,没有rst信号。在Debug Probes区域中,rst_IBUF上右键
![](http://upload-images.jianshu.io/upload_images/1249025-c71b8f583d127377.png-blog?imageMogr2/auto-orient/strip%7CimageView2/2/w/557)
20.Add Probes to Wave Form
![](http://upload-images.jianshu.io/upload_images/1249025-25fc16d405eefa3e.png-blog?imageMogr2/auto-orient/strip%7CimageView2/2/w/398)
21.即可看到rst也在波形中了,添加其它信号类似
![](http://upload-images.jianshu.io/upload_images/1249025-f2786af168830a61.png-blog?imageMogr2/auto-orient/strip%7CimageView2/2/w/700)
22.鼠标点住rst_IBUF,拖拽到图中区域放开鼠标
![](http://upload-images.jianshu.io/upload_images/1249025-c3cf6318156673a2.png-blog?imageMogr2/auto-orient/strip%7CimageView2/2/w/700)
23.rst_IBUF信号会出现在框中
![](http://upload-images.jianshu.io/upload_images/1249025-82619ca6d63be80f.png-blog?imageMogr2/auto-orient/strip%7CimageView2/2/w/389)
24.点开Compare Value下拉菜单,设置如下,点击OK
![](http://upload-images.jianshu.io/upload_images/1249025-83c8fa07bea15100.png-blog?imageMogr2/auto-orient/strip%7CimageView2/2/w/495)
25.把BASYS3板子上的SW0,拔到上面。点击Run Trigger按钮
![](http://upload-images.jianshu.io/upload_images/1249025-04d2dc6eb60a67ac.png-blog?imageMogr2/auto-orient/strip%7CimageView2/2/w/448)
26.注意到这里应该显示Wait...
![](http://upload-images.jianshu.io/upload_images/1249025-d9f28911b26b6189.png-blog?imageMogr2/auto-orient/strip%7CimageView2/2/w/408)
27.此时,在板子上,把SW0拔下来。注意到,这里会一闪而过Full,然后又显示Idle。如果没观察到,可以从25步骤再重来
![](http://upload-images.jianshu.io/upload_images/1249025-e50d0b0b837993ff.png-blog?imageMogr2/auto-orient/strip%7CimageView2/2/w/378)
28.再打开波形,如下图
![](http://upload-images.jianshu.io/upload_images/1249025-313fe1f3d6fc54e0.png-blog?imageMogr2/auto-orient/strip%7CimageView2/2/w/700)
29.回到这个界面,将Trigger Position 设置为500。再重复24-28步骤。然后再观察波形中,第500个周期,波形前后数据的变化
![](http://upload-images.jianshu.io/upload_images/1249025-6be4b6eb4d301456.png-blog?imageMogr2/auto-orient/strip%7CimageView2/2/w/700)
作者:Craftor
链接:https://www.jianshu.com/p/aaae0524877e
來源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。