当前位置:网站首页>SDRAM Controller Design (two design methods of digital controller)
SDRAM Controller Design (two design methods of digital controller)
2022-07-29 01:12:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
FPGA And SDRAM controller Design ( Two ): Refresh
This time, we need to solve the refresh problem left last time , stay 100us After that, you need to refresh twice before setting the mode register . The star SDRAM The chip needs every 64ms Yes 8192 That's ok ( Column address 10- position , Line address 13 position ) Each storage capacitor of is refreshed once , Because not refreshing the charging will leak the current and cause the loss of stored information . The refresh time of each line is 64/8192 ≈ 7810ns, Note that the refresh is in behavioral units , There is a counter inside the chip , This counter is not directly driven by the clock , It is AUTO PRECHARGE drive , Every time atuoprecharge Command this counter to add 1, We can't see it or set it directly , This counter is initialized as soon as it is powered on, which we don't need to care about , What we have to do is 7810ns Just perform a refresh operation . The read and write are performed within two refresh intervals , This will be discussed in the next section .
The design idea of the refresh module is : The refresh command state machine and a counter generated by the refresh flag , On this basis, a master state machine should be added , That is, a module that controls when to power on and refresh read / write .
Refresh the state transition graph :
Refresh state machine design
`include "head.v"
module ref_fsm(
ref_done,ref_en,clk,ref_bus,soft_rst_n
);// Refresh state machine
input clk;
input ref_en;
input soft_rst_n;
output reg ref_done;
output [19:0] ref_bus;
reg [12:0] ref_a;
reg [1:0] ref_ba;
reg [3:0] ref_cmd;
reg ref_cke;
assign ref_bus = {ref_cmd,ref_a,ref_ba,ref_cke};
reg [14:0] cnt;
reg [1:0] state;
localparam s0 = 2'b00;
localparam s1 = 2'b01;
localparam s2 = 2'b10;
always @(posedge clk)
begin
if(soft_rst_n == 1'b0)
begin
ref_done <= 1'b0;
ref_ba <= 'd0;
ref_cmd <= `NOP;
ref_cke <= 1'b0;
cnt <= 'd0;
state <= s0;
end
else
case(state)
s0 : if(ref_en == 1'b0)
begin
ref_done <= 1'b0;
state <= s0;
end
else
begin
ref_cmd <= `PRE;
ref_a[10] <= 1'b1;
ref_done <= 1'b0;
state <= s1;
ref_cke <= 1'b1;//add
end
s1 : if(cnt < `tRP - 1)
begin
cnt <= cnt + 1'b1;
ref_cmd <= `NOP;
state <= s1;
end
else
begin
cnt <= 'd0;
ref_cmd <= `REF;
state <= s2;
end
s2 : if(cnt < `tRFC - 1)
begin
cnt <= cnt + 1'b1;
ref_cmd <= `NOP;
state <= s2;
end
else
begin
cnt <= 'd0;
ref_done <= 1'b1;
state <= s0;
end
endcase
end
endmoduleTiming module design
`include "head.v"
module ref_time(
clk,soft_rst_n,rt_en,rt_flag
);// Refresh timer
input clk;
input rt_en;
input soft_rst_n;
output reg rt_flag;
reg [9:0] cnt;
always @(posedge clk)begin
if(soft_rst_n == 1'b0)
begin
cnt <= 'd0;
rt_flag <= 1'b0;
end
else if(rt_en == 1'b1 )
if(cnt < 780)
begin
cnt <= cnt + 1'b1;
rt_flag <= 1'b0;
end
else begin
cnt <= 'd0;
rt_flag <= 1'b1;
end
end
endmodulePublisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/129213.html Link to the original text :https://javaforall.cn
边栏推荐
- solidity实现智能合约教程(5)-NFT拍卖合约
- ThinkPHP high imitation blue cloud disk system program
- 面试官:程序员,请你告诉我是谁把公司面试题泄露给你的?
- system verilog常用语法
- The method of tracking the real-time market of London Silver
- 表达式求值
- 时序预测 | MATLAB实现TCN时间卷积神经网络的时间序列预测
- 【mysql】字符串转int
- “index [hotel/jXLK5MTYTU-jO9WzJNob4w] already exists“
- 小程序毕设作品之微信校园浴室预约小程序毕业设计成品(7)中期检查报告
猜你喜欢

ThinkPHP高仿蓝奏云网盘系统程序

How to explain JS' bind simulation implementation to your girlfriend

Solid smart contract tutorial (5) -nft auction contract

Spark 3.0 中七个必须知道的 SQL 性能优化

Classification prediction | MATLAB realizes time series classification prediction of TCN time convolution neural network
![[Jenkins' notes] introduction, free space; Continuous integration of enterprise wechat; Allure reports, continuous integration of email notifications; Build scheduled tasks](/img/0f/f75603616bd54039f8ccfa3e024768.png)
[Jenkins' notes] introduction, free space; Continuous integration of enterprise wechat; Allure reports, continuous integration of email notifications; Build scheduled tasks

mysql分表之后怎么平滑上线?

Self made | a 16 bit RISC architecture CPU is self-made by hand

MySQL stored procedure realizes the creation of a table (copy the structure of the original table and create a new table)

小程序毕设作品之微信校园浴室预约小程序毕业设计成品(8)毕业设计论文模板
随机推荐
散列表 ~
How to carry out engineering implementation of DDD Domain Driven Design
MySQL stored procedure realizes the creation of a table (copy the structure of the original table and create a new table)
用CDO进行nc数据的不规则裁剪
Wechat campus bathroom reservation applet graduation design finished product (8) graduation design thesis template
Wechat campus bathroom reservation for the finished product of applet graduation design (7) mid term inspection report
mysql存储过程 实现创建一张表(复制原表的结构新建的表)
RHCE命令练习(一)
Intel带你初识视觉识别--OpenVINO
Definition of double linked list~
Seven marketing strategies of NFT project
Method of converting inline elements to block elements
[unity] configure unity edit C as vscode
Solid smart contract tutorial (5) -nft auction contract
如何给女友讲明白JS的bind模拟实现
(perfect solution) why is the effect of using train mode on the train/val/test dataset good, but it is all very poor in Eval mode
分类预测 | MATLAB实现TCN时间卷积神经网络的时序分类预测
Day2: 130 questions in three languages
SystemVerilog-连接和复制运算符
Django使用MySQL数据库已经存在的数据表方法