Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)

Read file from SDRAM

Altera_Forum
Honored Contributor II
1,652 Views

Hi, 

 

I am trying to develop an IP that read a file which will be stored in the SDRAM and then send the data read. I've seen that we can read from the SDRAM with the IORD function but I prefer not to do it with the soft. What I am actually trying to do is to use a DMA to read the data. Is that possible ? How can I proceed ? 

 

Thanks !
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
689 Views

Or maybe by using the flash memory (CFI) instead of the SDRAM ?

0 Kudos
Altera_Forum
Honored Contributor II
689 Views

You can do it many different ways. A couple of options: 

 

1. Add an Avalon-MM Master port to your IP block. Your module would, for example, have a base address control register with the pointer to the file buffer you want to read. 

 

2. Add an Avalon-MM Slave port to your IP block, and use an Altera DMA controller to execute the copy from the memory to your IP block. 

 

Here is one example from Altera which may be a useful illustration of a similar task: 

http://www.altera.com/support/examples/nios2/exm-checksum-acc.html
0 Kudos
Altera_Forum
Honored Contributor II
689 Views

Thanks for your answer :) 

 

--- Quote Start ---  

 

 

2. Add an Avalon-MM Slave port to your IP block, and use an Altera DMA controller to execute the copy from the memory to your IP block. 

 

--- Quote End ---  

 

 

That's the option I've thought of. But as it will be in a file and not in a buffer, what is the address we need to give ? The one of the first word in the file ?
0 Kudos
Altera_Forum
Honored Contributor II
689 Views

You would have to look at the specification for how the file is stored in SDRAM. However the file is getting placed into SDRAM, you need to understand that buffer layout and if it is broken up into multiple sections (pages) then you would need to DMA each of them separately. 

 

If you're simply doing fopen() and fread() the entire contents of a file, then yes you simply supply the address of the first word in your buffer.
0 Kudos
Reply