这里会显示出您选择的修订版和当前版本之间的差别。
后一修订版 | 前一修订版 | ||
icore4tx_fpga_7 [2020/05/14 17:23] fmj 创建 |
icore4tx_fpga_7 [2022/04/01 11:37] (当前版本) sean |
||
---|---|---|---|
行 2: | 行 2: | ||
|技术支持电话|**0379-69926675-801**||| | |技术支持电话|**0379-69926675-801**||| | ||
|技术支持邮件|Gingko@vip.163.com||| | |技术支持邮件|Gingko@vip.163.com||| | ||
- | |技术论坛|http://www.eeschool.org||| | ||
^ 版本 ^ 日期 ^ 作者 ^ 修改内容 ^ | ^ 版本 ^ 日期 ^ 作者 ^ 修改内容 ^ | ||
| V1.0 | 2020-04-28 | gingko | 初次建立 | | | V1.0 | 2020-04-28 | gingko | 初次建立 | | ||
行 28: | 行 27: | ||
==== 四、锁相环IP核调用步骤 ==== | ==== 四、锁相环IP核调用步骤 ==== | ||
1、新建工程,命名为PLL。 | 1、新建工程,命名为PLL。 | ||
- | {{ :icore4tx:icore4tx_fpga_7_1.png?direct&400 |图7.1}} | + | {{ :icore4tx:icore4tx_fpga_7_1.png?direct |图7.1}} |
2、添加PLL核文件,在工程目录区右键单击,选则New Source…。 | 2、添加PLL核文件,在工程目录区右键单击,选则New Source…。 | ||
- | {{ :icore4tx:icore4tx_fpga_7_2.png?direct&400 |图7.2}} | + | {{ :icore4tx:icore4tx_fpga_7_2.png?direct |图7.2}} |
3、窗口左侧栏选中“IP(CORE Generator & Arichitecture Wizard)”右侧栏给文件命名为pll,点击Next。 | 3、窗口左侧栏选中“IP(CORE Generator & Arichitecture Wizard)”右侧栏给文件命名为pll,点击Next。 | ||
- | {{ :icore4tx:icore4tx_fpga_7_3.png?direct&400 |图7.3}} | + | {{ :icore4tx:icore4tx_fpga_7_3.png?direct |图7.3}} |
4、弹出的New Source Wizard 窗口中点击“FPGA Features and Design”前面的“+”,然后点击“Clocking”前面的“+”,点击选中“Clocking Wizard”。然后点击Next。 | 4、弹出的New Source Wizard 窗口中点击“FPGA Features and Design”前面的“+”,然后点击“Clocking”前面的“+”,点击选中“Clocking Wizard”。然后点击Next。 | ||
- | {{ :icore4tx:icore4tx_fpga_7_4.png?direct&400 |图7.4}} | + | {{ :icore4tx:icore4tx_fpga_7_4.png?direct |图7.4}} |
5、点击Finish进入PLL软核参数设置界面,Clocking Features里面勾选Frequency Synthesis(可以让PLL有多个不同的输出时钟)和Phase alignment(相位校准);Input Clock Information里输入时钟的值设置为25MHz(iCore4tx的外部晶振输入时钟是25MHz),其他保持默认,然后点击Next。 | 5、点击Finish进入PLL软核参数设置界面,Clocking Features里面勾选Frequency Synthesis(可以让PLL有多个不同的输出时钟)和Phase alignment(相位校准);Input Clock Information里输入时钟的值设置为25MHz(iCore4tx的外部晶振输入时钟是25MHz),其他保持默认,然后点击Next。 | ||
- | {{ :icore4tx:icore4tx_fpga_7_5.png?direct&400 |图7.5}} | + | {{ :icore4tx:icore4tx_fpga_7_5.png?direct |图7.5}} |
6、 输出时钟设置界面,默认1个输出时钟,总共可以设置6个输出时钟信号,只需在时钟信号前面打勾,即可使能输出时钟信号,还可以设置每个输出时钟的频率、相位、占空比、驱动等信息。这里我们设置如下图所示,然后点击Next。 | 6、 输出时钟设置界面,默认1个输出时钟,总共可以设置6个输出时钟信号,只需在时钟信号前面打勾,即可使能输出时钟信号,还可以设置每个输出时钟的频率、相位、占空比、驱动等信息。这里我们设置如下图所示,然后点击Next。 | ||
- | {{ :icore4tx:icore4tx_fpga_7_6.png?direct&400 |图7.6}} | + | {{ :icore4tx:icore4tx_fpga_7_6.png?direct |图7.6}} |
7、 RESET表示异步复位信号,LOCKED是PLL输出时钟稳定工作的指示信号,iCore4tx没有外部复位信号,这里两个选项可以不同勾选,直接点击Next。 | 7、 RESET表示异步复位信号,LOCKED是PLL输出时钟稳定工作的指示信号,iCore4tx没有外部复位信号,这里两个选项可以不同勾选,直接点击Next。 | ||
- | {{ :icore4tx:icore4tx_fpga_7_7.png?direct&400 |图7.7}} | + | {{ :icore4tx:icore4tx_fpga_7_7.png?direct |图7.7}} |
8、 对输入时钟的相关设置,保持默认,直接点击Next。 | 8、 对输入时钟的相关设置,保持默认,直接点击Next。 | ||
- | {{ :icore4tx:icore4tx_fpga_7_8.png?direct&400 |图7.8}} | + | {{ :icore4tx:icore4tx_fpga_7_8.png?direct |图7.8}} |
9、 本页对输入输出时钟进行命名,可以不做修改, 点击Next;本实验中将名字修改如下图中所示: | 9、 本页对输入输出时钟进行命名,可以不做修改, 点击Next;本实验中将名字修改如下图中所示: | ||
- | {{ :icore4tx:icore4tx_fpga_7_9.png?direct&400 |图7.9}} | + | {{ :icore4tx:icore4tx_fpga_7_9.png?direct |图7.9}} |
10、 点击Genarate生成PLL IP核。 | 10、 点击Genarate生成PLL IP核。 | ||
- | {{ :icore4tx:icore4tx_fpga_7_10.png?direct&400 |图7.10}} | + | {{ :icore4tx:icore4tx_fpga_7_10.png?direct |图7.10}} |
11、 可以看到工程目录里已经添加了PLL IP核文件,点击选中PLL IP核文件,再双击CORE Generator下的View HDL Instantiationtemplate,可以在编辑区看到PLL IP核的例化模板。 | 11、 可以看到工程目录里已经添加了PLL IP核文件,点击选中PLL IP核文件,再双击CORE Generator下的View HDL Instantiationtemplate,可以在编辑区看到PLL IP核的例化模板。 | ||
- | {{ :icore4tx:icore4tx_fpga_7_11.png?direct&400 |图7.11}} | + | {{ :icore4tx:icore4tx_fpga_7_11.png?direct |图7.11}} |
12、 新建顶层文件;在工程目录栏右键单击,选择New Source…。 | 12、 新建顶层文件;在工程目录栏右键单击,选择New Source…。 | ||
- | {{ :icore4tx:icore4tx_fpga_7_12.png?direct&400 |图7.12}} | + | {{ :icore4tx:icore4tx_fpga_7_12.png?direct |图7.12}} |
13、 弹出窗口左侧点击选中Verilog Module,右侧输入顶层模块的文件名:pll_top。 | 13、 弹出窗口左侧点击选中Verilog Module,右侧输入顶层模块的文件名:pll_top。 | ||
- | {{ :icore4tx:icore4tx_fpga_7_13.png?direct&400 |图7.13}} | + | {{ :icore4tx:icore4tx_fpga_7_13.png?direct |图7.13}} |
14、 设置顶层模块名字和输入输出信号,然后点击Next,之后点击Finish。 | 14、 设置顶层模块名字和输入输出信号,然后点击Next,之后点击Finish。 | ||
- | {{ :icore4tx:icore4tx_fpga_7_14.png?direct&400 |图7.14}} | + | {{ :icore4tx:icore4tx_fpga_7_14.png?direct |图7.14}} |
15、 可以在编辑区看到生成的顶层文件的内容。 | 15、 可以在编辑区看到生成的顶层文件的内容。 | ||
- | {{ :icore4tx:icore4tx_fpga_7_15.png?direct&400 |图7.15}} | + | {{ :icore4tx:icore4tx_fpga_7_15.png?direct |图7.15}} |
16、 给工程分配引脚,引脚绑定信息如下。 | 16、 给工程分配引脚,引脚绑定信息如下。 | ||
- | {{ :icore4tx:icore4tx_fpga_7_16.png?direct&400 |图7.16}} | + | <code verilog> |
+ | # PlanAhead Generated physical constraints | ||
+ | NET "clk_25M" LOC = P8; | ||
+ | NET "clk_1" LOC = F13; //普通IO引脚 | ||
+ | NET "clk_2" LOC = G11; //普通IO引脚 | ||
+ | NET "clk_3" LOC = F14; //普通IO引脚 | ||
+ | |||
+ | </code> | ||
17、 Spartan6 FPGA中PLL产生的时钟是不能直接连接到FPGA的普通IO的,不过可以通过在PLL输出时钟信号和普通IO之间增加ODDR2模块缓冲的方式解决。 | 17、 Spartan6 FPGA中PLL产生的时钟是不能直接连接到FPGA的普通IO的,不过可以通过在PLL输出时钟信号和普通IO之间增加ODDR2模块缓冲的方式解决。 | ||
* 在顶层文件中添加如下内容,并修改引脚信息即可: | * 在顶层文件中添加如下内容,并修改引脚信息即可: | ||
- | 18、 将PLL IP核例化到顶层文件中,并修改信号名称;由于PLL的输出时钟信号有三个,所以这里要调用三个ODDR2模块,每个输出信号引脚都需要一个ODDR2模块缓冲。编辑后点击保存并编译,完成后如下图所示: | ||
+ | <code verilog> | ||
+ | ODDR2 #( | ||
+ | .DDR_ALIGNMENT("NONE"), // Sets output alignment to "NONE", "C0" or "C1" | ||
+ | .INIT(1'b0), // Sets initial state of the Q output to 1'b0 or 1'b1 | ||
+ | .SRTYPE("SYNC") // Specifies "SYNC" or "ASYNC" set/reset | ||
+ | ) ODDR2_PLL输出时钟名 ( | ||
+ | .Q(oddr2_I/O管脚名), // 1-bit DDR output data | ||
+ | .C0(PLL输出时钟名), // 1-bit clock input | ||
+ | .C1(~PLL输出时钟名), // 1-bit clock input | ||
+ | .CE(1'b1), // 1-bit clock enable input | ||
+ | .D0(1'b1), // 1-bit data input (associated with C0) | ||
+ | .D1(1'b0), // 1-bit data input (associated with C1) | ||
+ | .R(1'b0), // 1-bit reset input | ||
+ | .S(1'b0) // 1-bit set input | ||
+ | ); | ||
+ | |||
+ | </code> | ||
+ | 18、 将PLL IP核例化到顶层文件中,并修改信号名称;由于PLL的输出时钟信号有三个,所以这里要调用三个ODDR2模块,每个输出信号引脚都需要一个ODDR2模块缓冲。编辑后点击保存并编译,完成后如下图所示: | ||
+ | {{ :icore4tx:icore4tx_fpga_7_16.png?direct |图7.16}} | ||
==== 五、实验步骤及实验结果 ==== | ==== 五、实验步骤及实验结果 ==== | ||
- | {{ :icore4tx:icore4tx_fpga_7_17.png?direct |图7.17}} | + | {{ :icore4tx:icore4tx_fpga_7_17.png?direct&400 |图7.17}} |
- | 1、将硬件正确连接,如图7.18所示。 | + | 1、将硬件正确连接,如图7.17所示。\\ |
+ | 2、将编写好的代码进行编译和下载;\\ | ||
+ | 3、以100MHz时钟作为采样时钟,对其他所有输出时钟信号进行采样;\\ | ||
+ | 4、观察其实验结果,如图7.18所示。\\ | ||
{{ :icore4tx:icore4tx_fpga_7_18.png?direct |图7.18}} | {{ :icore4tx:icore4tx_fpga_7_18.png?direct |图7.18}} | ||
- | 2、将编写好的代码进行编译和下载; | ||
- | 3、以100MHz时钟作为采样时钟,对其他所有输出时钟信号进行采样; | ||
- | 4、观察其实验结果,如图7.19所示。 | ||
- | {{ :icore4tx:icore4tx_fpga_7_19.png?direct |图7.19}} | ||
==== 六、拓展实验 ==== | ==== 六、拓展实验 ==== |