Forum Discussion

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

reading Memory initialisation file problem

Hi...

I have written a project which require a look up table which is stored in ROM i have created a .mif file to intialise the data in ROM

I am using Modelsim for simulation.

in the project folder i have project files, testbech and .mif file...

when i run the project it is not getting data from mif file.............what could be the problem please suggest.

Thanks

7 Replies

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

    Make the the megafunction file points to the correct path of the file. It doesn't matter if the mif file is in the project folder.

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

    It is common problem when having mif file relative path determined from Quartus level (in megawizard) then moving to ModelSim the path may become wrong from ModelSim relative level.

    The remedy is to make the path same from either Quartus or ModelSim folder i.e. put the mif at same level as both folders.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    If you launch your simulation with a tcl script, you could also insert lines to copy the mif file from your quartus directory to the modelsim project one.

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

    --- Quote Start ---

    It is common problem when having mif file relative path determined from Quartus level (in megawizard) then moving to ModelSim the path may become wrong from ModelSim relative level.

    The remedy is to make the path same from either Quartus or ModelSim folder i.e. put the mif at same level as both folders.

    --- Quote End ---

    they are in the same folder. mif file is not getting compiled .please tell me how to put mif file in the work directory.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I meant same level (not same folder) i.e. your structure like this:

    - quartus (folder

    - ModelSim(folder)

    - files(folder)

    then put mif in files folde1. so that way the path in Megawizard becomes:

    ../files/name.mif

    which is correct from modelsim as well.

    You may also just copy mif inside modelsim folder
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Here is a TCL code example to copy all .hex and .mif files from a quartus directory to a modelsim one (workdir) :

    set workdir $yourmodelsimdirectory

    set memoryfilesdir $yourmemoryfilesdirectory

    foreach datadir [list "$workdir"] {

    foreach datatype [list "hex" "mif"] {

    foreach g [glob -nocomplain "$yourmemoryfilesdir*.$datatype"] {

    file copy -force $g .

    }

    }

    }

    You just have to adjust the paths set in bold to your directory structure.