Forum Discussion

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

Quartus II and Modelsim directory paths for memory init files

I have created four memory instances using the Megawizard Plug-In Manager. The RTL files are named dpdspram.vhd, dsp_rom.vhd, dsp_rom1.vhd and ram_dsp.vhd. I have also defined initialization files for each:

dpdspram <= Zero1.hex

dsp_rom <= coef.hex

dsp_rom1 <= coef1.hex

ram_dsp <= ram.hex

All of the files (RTL and hex) are in the folder SAHW_FPGA/filter/hdl.

When I created the memories in the Plug-In Manager, the tool wants to use the directory SAHW_FPGA as the base directory. This means that in the .vhd files, the component mapping pointed to ./filter/hdl/<hex file>. So for example in dsp_rom.vhd the component declaration uses:

init_file => "./filter/hdl/coef.hex"

Thus it appears that Quartus wants to use SAHW_FPGA as the root directory for the Plug-In Manager.

In ModelSim I have created a library, called Filter_modelsim which is in the SAHW_FPGA folder. That library includes all of the memory RTL files as well as the RTL for the filter components which use these memories. When I simulate my system in ModelSim, I get the following error:

Failed to open VHDL file "./filter/hdl/coef.hex" in rb mode.

This happens for each of the hex files. The results of a pwd command in the ModelSim transcript window is:

C:/Users/pbaltz/Documents/SAHW_FPGA/filter

Thus it appears that Modelsim wants to use SAHW_FPGA/filter as the root directory.

So the problem I'm having is that ModelSim and Quartus want to use different root directories, so that they can't both find the .hex files.

How can I modify the Modelsim root directory to match the Quartus setting? Or is the another way to accomplish what I am trying to do?

Thanks,

-phil

5 Replies

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

    ask wizard to put hex file in modelsim root directory.

    Though the hex will be pointed at as modelsim directory/hex but I assume modelsim ignores the path and will see it at its root.

    There might be other ways of doing it...let us see
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    There might also be issue with your relative path.

    try a folder for hex at same level as both fpga and sim folders.

    thus will have path ../folder/hex which should be correct from sim as well.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    ask wizard to put hex file in modelsim root directory.

    Though the hex will be pointed at as modelsim directory/hex but I assume modelsim ignores the path and will see it at its root.

    There might be other ways of doing it...let us see

    --- Quote End ---

    Kaz,

    Thanks. I'd like to keep the .hex files in the same directory as the .vhd source files for easy portability. I've decided to create a new ModelSim project using the default work library which points to the SAHW_FPGA as root. This works for both ModelSim and Quartus, so I think I've solved my problem.

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

    If you wanted all in one folder then there would no problem but many of us want synthesis separate from sim and this where clash occurs. As you have seen modlsim can read rtl files since they are pointed at in compilation statements yet hex files are pointed at by quartus. So one might have to do one folder for hex files at same level as synthesis and sim then the pointer will be correct from sim level.

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

    I have separate folders for Quartus sources and Modelsim projects and also want to keep .mif/.hex files in the same dedicated folder than the Megawizards vhdl generated files.

    Instead of a managing a common directory for both Modelsim and quartus, my tcl modelsim script makes a copy of the .mif/.hex files to the Modelsim project directory and it's ok.