Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

lpm_rom Quartus vs ModelSim memory file

I am using a LPM_ROM megafuntion and a memory initialization file. When I use start RTL simulation modelsim the module loads but the memory is blank? Is this normal?

I hoped modelsim would read the mif file, but it doesn't seem to. I manually converted my memory file to format model sim recognized. Not terribly hard, but its annoying to have so many files with the same contents.

Is there a better way?

6 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I've never looked too much into this, but so far I've used LPM_ROM with HEX memory initialization files and both Quartus and ModelSim managed to load the memory contents correctly.

    I've never actually tried using the MIF format and I don't know if it's even supposed to work or not.

    But it may be that you're using the LPM_ROM component from ModelSim's libraries instread of from Altera's Libraries.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks. It works in hex format. I perfer to use the MIF format because it is more readable( it contains an address and data pair per line + each value has its own radix setting). But since I have to use model sim I guess I will use hex format.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Yes, *.hex files are the only way to have memory initialization files understood by Quartus and ModelSim, both.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I upgraded to SP2 Quatus 9.1 / Modelsim ASE 9.5b, and the hex memory files stopped working. However, after copying the mif file into the simulation modelsim directory the mif file works and my hex files dont. I didn't spend to much time debug why the hex failed since I perfer the mif file format, but it was strange event.

    Is there something I need to do to get modelsim to load the mif file from the source directory instead of looking at the local current simulation directory?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Yes, *.hex files are the only way to have memory initialization files understood by Quartus and ModelSim, both.

    --- Quote End ---

    i don't actually think this is true. i will come back with an example. :)
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    what i ended up doing was editing the ROM VHDL template to my liking, loading the memory contents from an array of integers ported (actually generic'ed) down from a package in the top level. it works nicely in Quartus and ModelSim. :cool: