Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
16556 Discussions

reading Memory initialisation file problem

Altera_Forum
Honored Contributor II
1,242 Views

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
0 Kudos
7 Replies
Altera_Forum
Honored Contributor II
504 Views

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.

0 Kudos
Altera_Forum
Honored Contributor II
504 Views

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.
0 Kudos
Altera_Forum
Honored Contributor II
504 Views

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.

0 Kudos
Altera_Forum
Honored Contributor II
504 Views

 

--- 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.
0 Kudos
Altera_Forum
Honored Contributor II
504 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
504 Views

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.
0 Kudos
Altera_Forum
Honored Contributor II
504 Views

An alternate method is to use the copy command with a double "\\". Specific example Below:  

copy ..\\..\\..\\vivado\\14_5\\LM_Cases\\5_params\\Optimized1\\impl\\verilog\\*.dat
0 Kudos
Reply