Hi everyone, I want to write an VHDL SDRAM controller for IS42S16160B-7 32MB SDRAM chip that comes with Terasic DE0-nano FPGA board. First of all, i tried to look at some codes that developed for that purpose, the interesting one was the Hamster code: http://hamsterworks.co.nz/mediawiki/index.php/SDRAM_Memory_Controller But i didn't understand the use of the counter used to make initialization, and also the different values of it. I would like to know if anyone has an idea please. Thanks in advance. Best Regards
Guest
#4059118
I'm not sure if you mean "init_counter", if yes: it ensures the correct initialization, which requires a minimum of e.g. 100us. This detail is specified in the related datasheet and ensures that the related pll, sdram's internal controller etc. runs stable.
Guest
#4059120
And btw.: if this is your first controller, start with hamster's first approach, it's very simple to implement and it's used in several projects.
Thanks Sigi, Yes, it's my first controller. What i don't understand is this part of code:
1 | |
2 | |
3 | |
specially the value of "000000000001000", it doesn't correspond to 100us minimum "init_counter"
And also this part of code:
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | |
21 | |
22 | |
23 | |
24 | |
25 | |
26 | |
27 | |
28 | |
29 | |
30 | |
31 | |
32 | |
33 | |
34 | |
35 | |
36 | |
37 | |
38 | |
I I understand, the "init_counter" value must be: initialization time(100us for example) + tRP(precharge time)+ tRC(auto refresh time)+tMRD(mode register time). Best regards
Guest
#4059872
Hi, yesterday I spent only few minutes to roughly understand the different approaches and I thought/allready think they are more or less easy to understand. And I spent only ~10 seconds to find your initial signal, without trying to understand the code completely. So, after taking a deeper look into the code, my opinion is now: "Ok Jesus, this is rocket science, hard to understand". (init_counter is init with value 8, and then compared with value 130 ??, this makes no sense, there is nothing like "wait for 100 us" ??) My advice is: Take the first approach as inspiration, download a good datasheet from eg MICRON (MT48LC4M32B2.pdf) and start with your own design. All the essential parts (Init, Read, Write, Active, Precharge, Refresh) are "linear", so they are easy to map into a simple FSM. Then download the verilog/VHDL design of the SDRAM and check with a simple testbench the correctness. (or try to find a "good" SDRAM-controller, a good starting point are the classic computing designs like MiniMIG, AtariST etc., almost all 16Bit Computer Designs uses SDRAMs)
Thank you for you advice.
Reply
Please log in before posting.