mirror of
https://github.com/WangXuan95/FPGA-DDR-SDRAM.git
synced 2025-01-17 20:02:52 +08:00
update
This commit is contained in:
parent
3a71549cb8
commit
9bf35a21cd
30
README.md
30
README.md
@ -409,7 +409,7 @@ AXI4 总线的地址(awaddr和araddr)统一是字节地址,模块会根据
|
||||
| :---- | :--- |
|
||||
| tb_ddr_sdram_ctrl.sv | 仿真顶层 |
|
||||
| axi_self_test_master.sv | 是 AXI4 主机,通过 AXI4 先把有规律的数据写入 DDR1,然后读回,比较读回的数据是否符合规律,并对不匹配的情况进行计数。 |
|
||||
| micron_ddr_sdram_model.v | [MICRON 公司提供的 DDR1 仿真模型](https://www.micron.com/products/dram/ddr-sdram/part-catalog/mt46v64m8p-5b) |
|
||||
| micron_ddr_sdram_model.sv | [MICRON 公司提供的 DDR1 仿真模型](https://www.micron.com/products/dram/ddr-sdram/part-catalog/mt46v64m8p-5b) |
|
||||
|
||||
该仿真工程的行为和自测程序一样, axi_self_test_master.sv 作为 AXI4 主机,将有规律的数据写入 DDR1 中,只不过不是全部写入,而是只写入 DDR1 的前 16KB (因为仿真模型的存储空间有限),然后一轮一轮地反复读出数据,比较是否有不匹配的数据,若有,则在 error 信号上产生一个时钟周期的高电平。
|
||||
|
||||
@ -421,23 +421,19 @@ AXI4 总线的地址(awaddr和araddr)统一是字节地址,模块会根据
|
||||
|
||||
## 修改仿真参数
|
||||
|
||||
以上仿真默认配置的参数是使用 MT46V64M8 ,即 ROW_BITS=13,COL_BITS=11,DQ_BITS=8。
|
||||
以上仿真默认配置的参数是使用 MT46V64M8 ,即 ROW_BITS=13,COL_BITS=11,DQ_BITS=8 。如果想对其它型号的 DDR1 芯片进行仿真,你需要在 tb_ddr_sdram_ctrl.sv 里修改它们。对于 MICRON 公司的 DDR1 系列,这些参数应该这样修改:
|
||||
|
||||
如果想对其它型号的 DDR1 芯片进行仿真,你需要在 tb_ddr_sdram_ctrl.sv 和 micron_ddr_sdram_model.v 里修改它们(注意两个文件要同步修改!)
|
||||
|
||||
对于 MICRON 公司的 DDR1 系列,这些参数应该这样修改:
|
||||
|
||||
| 芯片名称 | BA_BITS | ROW_BITS | COL_BITS | DQ_LEVEL | DQ_BITS
|
||||
| :--: | :--: | :--: | :--: | :--: | :--: |
|
||||
| MT46V64M4 | 2 | 13 | 11 | 0 | 4 |
|
||||
| MT46V128M4 | 2 | 13 | 12 | 0 | 4 |
|
||||
| MT46V256M4 | 2 | 14 | 12 | 0 | 4 |
|
||||
| MT46V32M8 | 2 | 13 | 10 | 1 | 8 |
|
||||
| MT46V64M8 | 2 | 13 | 11 | 1 | 8 |
|
||||
| MT46V128M8 | 2 | 14 | 11 | 1 | 8 |
|
||||
| MT46V16M16 | 2 | 13 | 9 | 2 | 16 |
|
||||
| MT46V32M16 | 2 | 13 | 10 | 2 | 16 |
|
||||
| MT46V64M16 | 2 | 14 | 10 | 2 | 16 |
|
||||
| 芯片名称 | BA_BITS | ROW_BITS | COL_BITS | DQ_LEVEL |
|
||||
| :--: | :--: | :--: | :--: | :--: |
|
||||
| MT46V64M4 | 2 | 13 | 11 | 0 |
|
||||
| MT46V128M4 | 2 | 13 | 12 | 0 |
|
||||
| MT46V256M4 | 2 | 14 | 12 | 0 |
|
||||
| MT46V32M8 | 2 | 13 | 10 | 1 |
|
||||
| MT46V64M8 | 2 | 13 | 11 | 1 |
|
||||
| MT46V128M8 | 2 | 14 | 11 | 1 |
|
||||
| MT46V16M16 | 2 | 13 | 9 | 2 |
|
||||
| MT46V32M16 | 2 | 13 | 10 | 2 |
|
||||
| MT46V64M16 | 2 | 14 | 10 | 2 |
|
||||
|
||||
另外,你可以修改 tb_ddr_sdram_ctrl.sv 的第 18 和 19 行来修改仿真时的突发读写的长度。
|
||||
|
||||
|
@ -1,11 +1,4 @@
|
||||
/****************************************************************************************
|
||||
*
|
||||
* File Name: ddr.v
|
||||
* Version: 6.00
|
||||
* Model: BUS Functional
|
||||
*
|
||||
* Dependencies: ddr_parameters.v
|
||||
*
|
||||
* Description: Micron SDRAM DDR (Double Data Rate)
|
||||
*
|
||||
* Limitation: - Doesn't check for 8K-cycle refresh.
|
||||
@ -78,23 +71,22 @@
|
||||
* 6.00 BAS 05/31/2007 - Updated 128Mb, 256Mb, 512Mb, and 1024Mb parameter sheets
|
||||
****************************************************************************************/
|
||||
|
||||
// DO NOT CHANGE THE TIMESCALE
|
||||
// MAKE SURE YOUR SIMULATOR USE "PS" RESOLUTION
|
||||
// DO NOT CHANGE THE TIMESCALE, MAKE SURE YOUR SIMULATOR USE "PS" RESOLUTION
|
||||
`timescale 1ps/1ps
|
||||
|
||||
module micron_ddr_sdram_model (Clk, Clk_n, Cke, Cs_n, Ras_n, Cas_n, We_n, Ba , Addr, Dm, Dq, Dqs);
|
||||
|
||||
`define sg5B
|
||||
module micron_ddr_sdram_model #(
|
||||
parameter BA_BITS = 2,
|
||||
parameter ROW_BITS = 13,
|
||||
parameter COL_BITS = 11,
|
||||
parameter DQ_LEVEL = 1
|
||||
) (
|
||||
Clk, Clk_n, Cke, Cs_n, Ras_n, Cas_n, We_n, Ba , Addr, Dm, Dq, Dqs
|
||||
);
|
||||
|
||||
parameter no_halt = 1; // If set to 1, the model won't halt on command sequence/major errors
|
||||
parameter DEBUG = 1; // Turn on DEBUG message
|
||||
|
||||
|
||||
parameter BA_BITS = 2; // Set this parmaeter to control how many Bank Address bits are used
|
||||
parameter ROW_BITS = 13; // Set this parameter to control how many Address bits are used
|
||||
parameter COL_BITS = 11; // Set this parameter to control how many Column bits are used
|
||||
parameter DQ_BITS = 8; // Set this parameter to control how many Data bits are used
|
||||
|
||||
parameter DQ_BITS = 4<<DQ_LEVEL;
|
||||
|
||||
parameter ADDR_BITS = ROW_BITS;
|
||||
|
||||
@ -105,6 +97,8 @@ module micron_ddr_sdram_model (Clk, Clk_n, Cke, Cs_n, Ras_n, Cas_n, We_n, Ba , A
|
||||
parameter DQS_BITS = (DQ_BITS + 4) / 8;
|
||||
parameter DM_BITS = DQS_BITS;
|
||||
|
||||
`define sg5B
|
||||
|
||||
`ifdef sg5B // Timing Parameters for -5B (CL = 3)
|
||||
parameter tCK = 5.0; // tCK ns Nominal Clock Cycle Time
|
||||
parameter tDQSQ = 0.4; // tDQSQ ns DQS-DQ skew, DQS to last DQ valid, per group, per access
|
@ -10,11 +10,23 @@
|
||||
|
||||
module tb_ddr_sdram_ctrl();
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
// self test error signal, 1'b1 indicates error
|
||||
// -------------------------------------------------------------------------------------
|
||||
wire error;
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------------------
|
||||
// simulation control
|
||||
// -----------------------------------------------------------------------------------------------------------------------------
|
||||
initial $dumpvars(0, tb_ddr_sdram_ctrl);
|
||||
initial #200000000 $finish; // simulation for 200us
|
||||
initial begin
|
||||
#200000000; // simulation for 200us
|
||||
if(error)
|
||||
$display("*** Error: there are mismatch when read out and compare!!! see wave for detail.");
|
||||
else
|
||||
$display("validation successful !!");
|
||||
$finish;
|
||||
end
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
// DDR-SDRAM parameters
|
||||
@ -23,6 +35,7 @@ localparam BA_BITS = 2;
|
||||
localparam ROW_BITS = 13;
|
||||
localparam COL_BITS = 11;
|
||||
localparam DQ_LEVEL = 1;
|
||||
|
||||
localparam DQ_BITS = (4<<DQ_LEVEL);
|
||||
localparam DQS_BITS = ((1<<DQ_LEVEL)+1)/2;
|
||||
|
||||
@ -81,11 +94,6 @@ wire rready;
|
||||
wire rlast;
|
||||
wire [D_WIDTH-1:0] rdata;
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
// self test error signal, 1'b1 indicates error
|
||||
// -------------------------------------------------------------------------------------
|
||||
wire error;
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
// meta AXI4 master for testing
|
||||
// -------------------------------------------------------------------------------------
|
||||
@ -173,7 +181,12 @@ ddr_sdram_ctrl #(
|
||||
// -------------------------------------------------------------------------------------
|
||||
// MICRON DDR-SDRAM simulation model
|
||||
// -------------------------------------------------------------------------------------
|
||||
micron_ddr_sdram_model ddr_model_i (
|
||||
micron_ddr_sdram_model #(
|
||||
.BA_BITS ( BA_BITS ),
|
||||
.ROW_BITS ( ROW_BITS ),
|
||||
.COL_BITS ( COL_BITS ),
|
||||
.DQ_LEVEL ( DQ_LEVEL )
|
||||
) ddr_model_i (
|
||||
.Clk ( ddr_ck_p ),
|
||||
.Clk_n ( ddr_ck_n ),
|
||||
.Cke ( ddr_cke ),
|
||||
|
@ -1,5 +1,5 @@
|
||||
del sim.out dump.vcd
|
||||
iverilog -g2005-sv -o sim.out tb_ddr_sdram_ctrl.sv axi_self_test_master.sv micron_ddr_sdram_model.v ../RTL/ddr_sdram_ctrl.sv
|
||||
iverilog -g2005-sv -o sim.out tb_ddr_sdram_ctrl.sv axi_self_test_master.sv micron_ddr_sdram_model.sv ../RTL/ddr_sdram_ctrl.sv
|
||||
vvp -n sim.out
|
||||
del sim.out
|
||||
pause
|
Loading…
x
Reference in New Issue
Block a user