Forum Discussion

paramProd's avatar
paramProd
Icon for Community Manager rankCommunity Manager
1 hour ago

ModelSim_FA

I have ModelSim open and Quartus Prime Lite v. 22.1, while I'm simulating,  I often make changes back to the Quartus, but when I reload the design into ModelSim, it cold-archives the initial HDL file and references that file instead of the changes I make in Quartus. No matter how many times I recompile the code for both the wrapper function and main entity, it always goes back to the original? How is this possible? Does ModelSim copy the file into it's own directory and simply references it? 

I've spent days trying to figure this out, wihtout creating a new project and adding the changed code to it, how can I force it to use the updated files?

1 Reply

  • ai_responder's avatar
    ai_responder
    Icon for Community Manager rankCommunity Manager

    This is a well-known pain point in the Quartus + ModelSim NativeLink flow, and there are a couple of things happening that explain what you're seeing.
    **There is actually a documented bug in Quartus Prime Lite 22.1**
    Due to a problem in the Quartus® Prime Lite Edition software version 22.1, you may see an error when running the NativeLink simulation flow:
    "Sourced NativeLink script .../quartus/common/tcl/internal/nativelink/modelsim.tcl missing"
    The workaround is to download and replace the `qnativelinkflow.tcl` file located at the `/quartus/common/tcl/internal/nativelink` directory, then relaunch the simulation. This problem is fixed beginning with Quartus® Prime Lite Edition version 23.1. Sourced NativeLink script /quartus/common/tcl/internal/nativelink/modelsim.tcl missing"

    This bug can cause the NativeLink flow to silently fall back to stale simulation artifacts, which would explain why your changes never seem to take effect.
    **How ModelSim actually references your HDL**
    ModelSim doesn't simply read your source `.v`/`.vhd` files directly at simulation time — it compiles them into its own library directories first. The simulation tool bundled with Quartus Prime Lite Edition is Questa* – Altera FPGA Starter Edition. Intel Quartus Prime Standard Edition User Guide Platform Designer The generated setup script that drives this is `msim_setup.tcl`. The `mentor/` directory contains a ModelSim script `msim_setup.tcl` to set up and run a simulation. Intel Quartus Prime Standard Edition User Guide Platform Designer When you invoke the NativeLink flow, Quartus regenerates this script and the compiled library targets — but if the 22.1 bug is preventing the script from being sourced correctly, the old compiled libraries are what ModelSim sees.
    **How to force ModelSim to pick up your changes — without a new project**

    1. First, fix the 22.1 bug by applying the qnativelinkflow.tcl patch referenced above, or upgrade to 23.1 where it's resolved.
    2. After every Quartus recompilation, don't just reload in ModelSim — you must re-run the full simulation setup script. To compile the design and generate the .do file, click Processing > Start Compilation. The Messages window indicates when compilation is complete. Then click Tools > Run Simulation Tool > RTL Simulation ModelSim – FPGA Edition Simulation Quick-Start Quartus Prime Standard Edition — this re-invokes the NativeLink flow, regenerates the .do/msim_setup.tcl, and recompiles your updated HDL into ModelSim's work library from scratch.
    3. If running from the ModelSim command line, re-source the generated mentor/msim_setup.tcl (or re-execute the .do file) rather than just doing a restart or reload. A restart only re-runs the simulation on already-compiled library contents — it does not recompile changed source.
    The `modelsim.ini` file stores the location of libraries, startup files, and other default settings for ModelSim. The command `vmap -c` can be used in the command-line window to copy the `modelsim.ini` file from the installation directory to the current working directory. If you do not use this command, all library mappings will be made to the `modelsim.ini` file in the installation directory. Altera recommends using `vmap -c` at the start of every new project How do I copy the modelsim.ini file into my working directory? — if your library mappings are pointing at a shared installation-level `modelsim.ini`, stale compiled libraries there could also be what you're hitting.
    **Bottom line:** The 22.1 NativeLink bug is almost certainly the root cause. Apply the `qnativelinkflow.tcl` fix, then always trigger re-simulation via **Tools > Run Simulation Tool > RTL Simulation** in Quartus (not Restart inside ModelSim) after any source change — that's what forces a full recompile into fresh library directories.


    Note: To continue using AI Responder, please start your next inquiry with ai_responder

    Disclaimer (Beta): The AI Responder is currently provided as a beta feature. AI-generated responses may contain errors or omissions. Please verify technical guidance with official Altera documentation before implementation.

    Thank you very much.