Forum Discussion
Are you using the tool generated compile/simulation script - msim_setup.tcl ? If not, then copy the hex/mif file to the simulation directory from where you invoke modelsim and then run the simulation.
If using the msim_setup.tcl script, there's a section in the script that does the file copy for all memory init files.. you will have to include your ROM hex/mif file in that section and then start the compile/simulation using that script.
Here's what the file copy part of script looks like (msim_setup.tcl)
alias file_copy {
echo "\[exec\] file_copy"
file copy -force $QSYS_SIMDIR/submodules/nios_timer_system_nios_cpu_cpu_ociram_default_contents.dat ./
file copy -force $QSYS_SIMDIR/submodules/nios_timer_system_nios_cpu_cpu_ociram_default_contents.hex ./
file copy -force $QSYS_SIMDIR/submodules/nios_timer_system_nios_cpu_cpu_ociram_default_contents.mif ./
file copy -force $QSYS_SIMDIR/submodules/nios_timer_system_nios_cpu_cpu_rf_ram_a.dat ./
file copy -force $QSYS_SIMDIR/submodules/nios_timer_system_nios_cpu_cpu_rf_ram_a.hex ./
file copy -force $QSYS_SIMDIR/submodules/nios_timer_system_nios_cpu_cpu_rf_ram_a.mif ./
file copy -force $QSYS_SIMDIR/submodules/nios_timer_system_nios_cpu_cpu_rf_ram_b.dat ./
file copy -force $QSYS_SIMDIR/submodules/nios_timer_system_nios_cpu_cpu_rf_ram_b.hex ./
file copy -force $QSYS_SIMDIR/submodules/nios_timer_system_nios_cpu_cpu_rf_ram_b.mif ./
file copy -force $QSYS_SIMDIR/submodules/nios_timer_system_system_RAM.hex ./
}The last line in that is what I added in after generating the NIOS SW code that resides in the on-chip RAM. What this line does is copy the generated hex file to the simulation folder from where the simulator can pick it up during simulation.