当前位置:网站首页>The use of DDR3 (Naive) in Xilinx VIVADO (3) simulation test
The use of DDR3 (Naive) in Xilinx VIVADO (3) simulation test
2022-08-04 11:13:00 【chylinne】
1. Overview
This paper conducts Testbench simulation on the previously configured MIG IP core based on user interface (Naive) and the designed read-write module, and verifies the consistency of write/read data through waveform data.
2, DDR3 emulation file call
Since the physical ports in the MIG IP core (such as ddr3_dq, ddr3_dqs_n, ddr3_dqs_p, ddr3_addr, etc.) need to be connected to the DDR3 chip, we also need to connect these interfaces to a specific DDR simulation module during simulation, so that theEmulates the operation of a DDR3 chip.
Before running the simulation, we need to add the header file ddr3_model_parameters.vh and the DDR3 simulation module file ddr3_model.sv into the project, as shown in the following figure.These two files can be copied from the official routines of the MIG IP core.Select the MIG IP core (mig_7series_0) added in the project, then right-click and select Open IP Example Design to download the official example.These two files can be found in the import directory in the official routine.

3, Testbench code design
The previous article introduced the design of the read-write state machine, which can be briefly summarized as follows:
Idle state IDLE (4'b0001), write data state WRITE (4'b0010), write read interval state WAIT (4'b0100), read data state READ (4'b1000).The write operation is to write 0~511 in sequence, the address starts from 0, and the address increases by 8.The read operation starts from address 0, increases the address by 8, and counts, and the count value should be equal to the read data value.
So in Testbench, we just need to set a system clock of 50 MHz, and then make sure that the top layer under test (ddr3_rw_top) and the DDR3 emulation module (ddr3_model) are wired correctly.The Testbench code looks like this:
`timescale 1ns/100psmodule tb_ddr3_rw_top();reg sys_clk;reg sys_rst_n;wire[15:0] ddr3_dq;wire [1:0] ddr3_dqs_n;wire[1:0] ddr3_dqs_p;wire[13:0] ddr3_addr;wire[2:0] ddr3_ba;wire ddr3_ras_n;wire ddr3_cas_n;wire ddr3_we_n;wire ddr3_reset_n;wire[0:0] ddr3_ck_p;wire [0:0] ddr3_ck_n;wire[0:0] ddr3_cke;wire [0:0] ddr3_cs_n;wire[1:0] ddr3_dm;wire[0:0] ddr3_odt;wire error_flag;initial beginsys_clk = 1'b0;sys_rst_n <= 1'b0;#50sys_rst_n <= 1'b1;endalways #10 sys_clk = ~sys_clk;ddr3_rw_top ddr3_rw_top_inst(.sys_clk (sys_clk),.sys_rst_n (sys_rst_n),.ddr3_dq (ddr3_dq),.ddr3_dqs_n (ddr3_dqs_n),.ddr3_dqs_p (ddr3_dqs_p),.ddr3_addr (ddr3_addr),.ddr3_ba (ddr3_ba),.ddr3_ras_n (ddr3_ras_n),.ddr3_cas_n (ddr3_cas_n),.ddr3_we_n (ddr3_we_n),.ddr3_reset_n (ddr3_reset_n),.ddr3_ck_p (ddr3_ck_p),.ddr3_ck_n (ddr3_ck_n),.ddr3_cke (ddr3_cke),.ddr3_cs_n (ddr3_cs_n),.ddr3_dm (ddr3_dm),.ddr3_odt (ddr3_odt),.error_flag (error_flag));ddr3_model ddr3_model_inst (.rst_n (sys_rst_n),.ck (ddr3_ck_p),.ck_n (ddr3_ck_n),.cke (ddr3_cke),.cs_n (ddr3_cs_n),.ras_n (ddr3_ras_n),.cas_n (ddr3_cas_n),.we_n (ddr3_we_n),.dm_tdqs (ddr3_dm),.ba (ddr3_ba),.addr (ddr3_addr),.dq (ddr3_dq),.dqs (ddr3_dqs_p),.dqs_n (ddr3_dqs_n),.tdqs_n(),.odt (ddr3_odt));endmodule4. Test results
(1) Overview
As shown in the red box in the figure below, the init_calib_complete output by the DDR3 chip is pulled high, indicating that the DDR3 initialization is successful.The data verification result error_flag is all 0, indicating that the reading and writing are correct.Among them, the condition for error_flag to be pulled high (set to 1) is: when the DDR3 output read is valid, the read count value ≠ the read data value.

(2) Write start
As shown in the red box in the figure below, cur_state is the current state of the state machine, and 2 represents the write state.The given address app_addr starts from 0 and increases by 8.When the write enable app_wdf_wren is pulled high, the data app_wdf_data (0, 1, 2...) is written.

(3) End of writing
As shown in the red box in the figure below, cur_state is the current state of the state machine, and 2 represents the write state.When the write enable app_wdf_wren is high, the data app_wdf_data (509, 510, 511...) is written, 512 cannot be written because app_wdf_wren is pulled low.

(4) Start of reading
As shown in the red box in the figure below, cur_state is the current state of the state machine, and 8 represents the read state.When the read valid app_rd_data_valid output by DDR3 is high, the data corresponding to the previously input address can be read out. The red box reads app_rd_data data 0, 1, 2 ..., and the counter rd_cnt also starts to count, and the two valuesThe same, the description reads correctly.

(5) End of reading
As shown in the red box in the figure below, when the app_rd_data_valid output by DDR3 is high, the read data is valid, and the data is read in the red box... 509, 510, 511.The data 480 (or other data) outputted later can be ignored, because app_rd_data_valid has been pulled low by DDR3 at this time, and the data is invalid.

边栏推荐
- 美摄问答室|美映 VS 美摄云剪辑
- vector中函数emplace_back的实现原理
- 浅析深度学习在图像处理中的应用趋势及常见技巧
- Graphic and text hands-on tutorial--ESP32 MQTT docking EMQX local server (VSCODE+ESP-IDF)
- 华为云安全云脑,让企业云化运营更放心
- Mysql——》类型转换符binary
- MySQL最大建议行数2000w, 靠谱吗?
- iMeta | German National Cancer Center Gu Zuguang published a complex heatmap visualization method
- 【LeetCode】1403.非递增顺序的最小子序列
- 从零开始Blazor Server(7)--使用Furion权限验证
猜你喜欢

解析treeSet集合进行自定义类的排序

Meishe Q&A Room | Meiying VS Meishe Cloud Editing

onlyoffice设置跟踪变化trackChanges默认为对自己启动

C language * Xiaobai's adventure

【虹科案例】基于3D相机组装家具

Xilinx VIVADO 中 DDR3(Naive)的使用(3)仿真测试

Maple 2022 software installation package download and installation tutorial

【Idea系列】idea配置

命令模式(Command)

【黄啊码】MySQL入门—1、SQL 的执行流程
随机推荐
Heap Sort
中介者模式(Mediator)
map的一道题目<单词识别>
MySQL 45 讲 | 11 怎么给字符串字段加索引?
浅析深度学习在图像处理中的应用趋势及常见技巧
小程序容器加快一体化在线政务服务平台建设
AWS Lambda related concepts and implementation approach
什么是终端特权管理
Oracle中对临时表空间执行shrink操作
Camunda overall architecture and related concepts
onlyoffice设置跟踪变化trackChanges默认为对自己启动
*SEO*
ORB-SLAM3中的优化
Mysql——》类型转换符binary
【LeetCode】899.有序队列
知其然,知其所以然,JS 对象创建与继承
Leetcode刷题——路径总和
图文手把手教程--ESP32 MQTT对接EMQX本地服务器(VSCODE+ESP-IDF)
面试蚂蚁(P7)竟被MySQL难倒,奋发图强后二次面试入职蚂蚁金服
萌宠来袭,如何让“吸猫撸狗”更有保障?