I'm playing with a BeMicroMAX10 that I've had for a while. Last time I used it was in Quartus web (free) v15, now using v21.1.0 (also free).
I was getting an error at compile with error initialization. In the platform designer (old qsys?) I add on-board ROM or RAM and I click the textbox for memory initialization. Anyhow ... I got rid of the error by clicking the box below to give it a name. If I click the boxes or don't click the boxes the total memory bits usage does not change. So, what does memory initialization actually do? I wonder if it really sets the value of each memory cell to a certain hex value? This sounds silly unless it is needed for some reason. When using microcontrollers I always assume the value of uninitialized memory is a random value.
It's an FPGA, so you can program the contents of memories with whatever values you want when you program the device. You need to associate a .hex or a .mif file with a particular memory for this to work, and you can do that in the IP parameter editor for the memory or with a synthesis attribute in your HDL code.
If you don't have a .hex or .mif file, make sure you disable memory initialization in the parameter editor.
- I disagree. The answer from sstrell does not address the issue of why you would need the memory initialized. Although I thank sstrell for his time and effort. I haven't figure the stuff out yet but the answer seems to be in booting nios. Combining the elf file with the sof file to get a pof and program the pof where nios will boot and copy either some or all of the application to RAM. This copying seems to need the memory init option set. As I said earlier, not sure how the whole booting thing works yet. There are several options available. AN730 seems to talk about it. I also have some old notes about this but I'm not sure I'm gonna get into the flash IP and boot options yet. I'm still adding components to the platform designer and using the byte blaster option to program the max10. This program goes away after power down the kit because I'm not programming the flash with any boot option as discussed in AN730. It is slow going but steady. Thanks guys.
Memory initialization is useful for many things: test and debug, error insertion, source code and source data. It's also required if you are creating a ROM (vs. a RAM).
Your initial question mentioned nothing about Nios, so I was answering based on just the use of memory blocks on their own in an FPGA design.