Vivado DDR3仿真记录

1、 init_calib_complete信号无法拉高 

DDR3相关例程进行仿真时出现init_calib_complete一直未变成高电平,正常情况下,init_calib_complete一般在110us左右就会变为高电平,如果在仿真跑到200us后init_calib_complete仍未变成高电平,这种情况下可以将仿真停下来了不用继续仿真了。

解决方法:

1、打开Modelsim,等待初始化完毕,然后可以看到transcript会提示很多warning,然后我们可以锁定问题:

# WARNING: sim_tb_top.ddr3_top.u_mig_7series_0.u_mig_7series_0_mig.u_memc_ui_top_std.mem_intfc0.ddr_phy_top0.u_ddr_mc_phy_wrapper.u_ddr_mc_phy: The required delay though the phaser_in to internally match the aux_out clock  to ddr clock exceeds the maximum allowable delay. The clock edge  will occur at the output registers of aux_out 556.77 ps before the ddr clock  edge. If aux_out is used for memory inputs, this may violate setup or hold time.
# WARNING: Behavioral models for independent clock FIFO configurations do not model synchronization delays. The behavioral models are functionally correct, and will represent the behavior of the configured FIFO. See the FIFO Generator User Guide for more information.
# WARNING: Behavioral models for independent clock FIFO configurations do not model synchronization delays. The behavioral models are functionally correct, and will represent the behavior of the configured FIFO. See the FIFO Generator User Guide for more information.
# ** Error (suppressible): (vsim-8630) Infinity results from division operation.
#    Time: 0 fs  Iteration: 0  Process: /sim_tb_top/mem_rnk[0]/mem/gen_mem[0]/u_comp_ddr3/#ASSIGN#532 File: ../../../../imports/ddr3_model.sv Line: 532
# Warning : input CLKIN1 period and attribute CLKIN1_PERIOD on PLLE2_ADV instance sim_tb_top.ddr3_top.u_mig_7series_0.u_mig_7series_0_mig.u_ddr3_infrastructure.plle2_i are not same.
# Warning: [Unisim MMCME2_ADV-20] Input CLKIN1 period and attribute CLKIN1_PERIOD are not same. Instance sim_tb_top.ddr3_top.u_mig_7series_0.u_mig_7series_0_mig.u_ddr3_infrastructure.gen_mmcm.mmcm_i 
# Warning: Invalid average CLKIN frequency detected = 3200.008 MHz
#     on PHASER_REF instance sim_tb_top.ddr3_top.u_mig_7series_0.u_mig_7series_0_mig.u_memc_ui_top_std.mem_intfc0.ddr_phy_top0.u_ddr_mc_phy_wrapper.u_ddr_mc_phy.ddr_phy_4lanes_0.u_ddr_phy_4lanes.phaser_ref_i at time 339062.0 ps ps.
#     The valid CLKIN frequency range is:
#         Minimum = 400.000 MHz
#         Maximum = 1066.000 MHz

按照提示,给Mig IP核的时钟应该为400MHz,然而这里却检测到了3200MHz的时钟,我们回到Mig IP核设定的地方:MIG IP核的时钟应给到400MHz(2500ps)。

然后找到仿真文件中与时钟相关的设置:

  parameter CLKIN_PERIOD          = 5000;

  initial   sys_clk_i = 1'b0;

  always    sys_clk_i = #(CLKIN_PERIOD/8.0) ~sys_clk_i;

sys_clk_时钟周期变成了CLKIN_PERIOD/8.0=5000/8=625ps(3200MHz)。因此将代码进行如下更改,之后时钟就会变为400MHz。

sys_clk_i = #(CLKIN_PERIOD/2.0) ~sys_clk_i;

最后可以看到init_calib_complete信号在第106us时拉高。

AMD Customer Community

DDR3 MIG IP 初始化不拉高,init_calib_complete一直未变高解决方法 - Vivado仿真相关问题 - 芯路恒电子技术论坛 - Powered by Discuz!

https://zhuanlan.zhihu.com/p/105720960

2、app_rdy没有拉高

将Mig IP核的其他UI信号添加进来以后发现,其实app_rdy其实已经拉高了,但是之后被迅速拉低,后来发现app_cmd在写进几个数据后,一直在读数据。 

而在UG586第96页中描述了app_rdy信号没有被声明的原因:一直发送读命令,且读buffer处于满状态。那么接下来就要检查DDR3的读写状态机了。

后来发现,是数据还没有进入有效写状态(写入视频数据,在经过行/场同步+后沿信号后才写入视频数据),状态机一直保持在读状态没法跳转到空闲状态。于是添加了一句: state_cnt   <= DDR3_DONE;之后app_cmd就跳出了读状态了。

这个问题之后困扰了我两天,然后Xilinx的论坛翻到了这篇回答:app_sr_req、app_ref_req 、 app_zq_req这几个信号要置零;

Widget (xilinx.com)

我跑去看了看代码,这几个信号确实没有置零:

 经过修改之后的代码如下:

最后app_rdy终于如愿被拉起来了: 

3、 app_sr_req、app_ref_req 、 app_zq_req

这三个信号在UG586的描述如下所示:

app_sr_req

UG586对这个信号的功能没做具体描述,默认置0即可。

app_ref_req

DRAM刷新信号,如果不需要刷新DRAM,默认置0即可。

app_zq_req

ZQ校准信号,如果不需要ZQ校准功能,默认置0即可

 从原理上解释什么是DDR的ZQ校准? - 知乎 (zhihu.com)

4、IP_Flow:19-3664 



Vivado 2015.1 - [IP_Flow 19-3664] IP xxxx generated file not found (xilinx.com)

5、executing simulate step 

我使用Modelsim跑仿真,会出现一直在卡在executing simulate step的情况。

这个时候就要切换回Vivado自带的仿真软件,此时可以发现Vivado会报错,然后你就可以根据信息进行debug。

6、AXI接口下的MIG IP核初始化

s_axi_awready(图中的M_AXI_WR_awready信号)一直没有拉高

7、状态机书写错误 

三段式状态机,第三段实现数据输出的话,应为assign组合逻辑输出,如果为时序逻辑输出,判断条件不应为current_state,而是next_state;

8、 M_AXI_AWREADY信号拉低时间过长

 M_AXI_AWREADY在 M_AXI_AWVAILD拉高以后,竟然拉低了超过100个时钟。

经过测试以后, M_AXI_AWREADY过长的拉起时间是正常的。

9、 AXI写地址握手失败

 

在仿真过程中发现AXI写地址仿真失败,一直无法进入写数据状态,经过分析发现,在AWVALID信号拉高以后,AWREADY需要先拉低,然后再拉高。AWVALID直到AWREADY拉高以后,仍然需要保持高电平。

而我的问题在于AWVALID在AWREADY重新拉高后,AWVALID信号没有拉高,因此未能未能正常握手成功。

 

因此在之后,更改代码,如下图所示:将AWVALID一直保持到AWREADY拉高以后。之后MIG开始正常读写了。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值