Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20702 Discussions

Need help regarding RAM initialization

Altera_Forum
Honored Contributor II
1,018 Views

Hello, 

 

I am working on a music player project and would like to preload some songs onto a DE2 board and play them back using eg. KEY's on the board. I am very much a beginner so please be patient.  

 

I have the songs available in WAV format and will convert them to PCM. My questions is: 

 

How does one go about initializing RAM? I'd like to preload the RAM with data from the PCM so that I can read them later on. I've taken a look at the MegaWizard RAM Initializer but am clueless as to what the parameters represent (eg. words, width) and how the parameters relate to what I am trying to accomplish. I imagine that I'd probably want to load from a memory initialization file (.mif), but how does one load PCM onto a .mif file? 

 

Thank you in advance.
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
362 Views

Hi,  

 

MIF files are just text files which specify memory contents and can be used to intializa the FPGA's internal memory. You can see their format here: 

http://quartushelp.altera.com/9.1/mergedprojects/reference/glossary/def_mif.htm 

 

So, you'd need to find or write a small program to convert WAV/PCM into .MIF (or .HEX(. 

That said, the FPGA on the DE2 only has a 52 * 4K RAM, which won't hold much sound. 

 

Thus, if you want to turn the DE2 into a media player, you need to find another strategy. 

 

I suggest either you stream sound data into the DE2 using the USB interface or you load sound data from the SD card reader.
0 Kudos
Altera_Forum
Honored Contributor II
362 Views

Thanks for your response rbugalho.  

 

My sound files are quite small, relatively speaking. I will nevertheless need to sample at a much lower rate than I had intended. I'm trying to avoid the use of USB or SD card. 

 

I think I have found tools to convert between WAV/PCM and .HEX, so I will try to use that to initialize the memory and go from there.
0 Kudos
Reply