Forum Discussion
How to Infer a ROM's Contents from a file?
- 8 years ago
You could initialize the memory using MIF file or Intel HEX file. I would suggest you replace your ROM code with one of Intel's 1-port ROM Megafunctions. When you use the megafunctions, there's an option to initialize the memory using MIF or HEX files.
Migrating the small ROM/RAMs to using Intel megafunctions may help resolving such issues.
-Abraham
Unfortunately, Quartus has been lacking the ability to infer the ram contents using textio for years - I raised an enhancement request on this 10 years ago - afaik this is still not possible!!!!
You can use the ram_init_file attribute to read the contents of a .mif file during synthesis, but it wont load it during simulation. The only way to load it during simulation is with an init function (like the one you posted - but this only would need to be removed from synthesis) or by using the altsyncram megafunction and specifying an init_file generic to the .mif file