Forum Discussion

lggram's avatar
lggram
Icon for New Contributor rankNew Contributor
11 months ago

Modelsim - work (empty) problem

Hello, I'm a user trying to use modelsim. When I try to add simulation after compiling files. I'm having trouble with the work library showing up as empty. I think .v files or .mpf files should be created within work, but they always get created outside of it. Please help me... I don't know much about computers, so please explain in detail. Thank you.

6 Replies

  • Step 1 Make Sure the Work Library Exists

    Without the work folder, all compiled files may go to the wrong places. Check ModelSim’s preferences to ensure that the working folder is set correctly. To examine the log screen, look at the bottom of the interface; type the following command.


    vlib work


    If the library already exists, ModelSim will say so. If it does not, this command will create it.


    At the bottom of the interface, there is a window named transcript. Let's open ModelSim first to verify if the library exists.

    Type the command vlib work.

    Now let’s check to see if “work” appears.


    Step 2: Compile Your Verilog Files into the Work Library

    Now that we know the work library is there, let's make sure your Verilog files are compiled correctly.

    Method 1: Using the GUI

    1. Go to the "Compile" menu → Click "Compile".
    2. Select your .v files from where they are saved.
    3. Look at the "Library" column in the compile window.
    • It should say "work" (if not, select "work").
    1. Click "Compile", then "Done".

    Method 2: Using Commands

    Alternatively, you can compile manually by typing:

    vlog -work work myfile.v

    (Replace myfile.v with your actual file name.)


    Step 3: Verify the Work Library is Not Empty

    After compiling, check if files were added to work:

    1. Open "Library" tab on the left.
    2. Click the "+" next to "work".
    3. You should see your compiled modules listed.

    If the work library is still empty, your files might not be compiled correctly.

    Step 4: Check Your File Paths

    If files are getting created outside of work, it may be due to incorrect paths.

    1. Look at the path where your .v files are saved.
    • Make sure they are in your ModelSim project folder.
    1. Check where ModelSim is compiling to:
    • Open Compile → Compile Options.
    • Ensure the "Library" is set to "work".

    Step 5: Load Simulation Properly

    If your files are compiled correctly but still not appearing in simulation:

    1. Go to "Simulate" → "Start Simulation".
    2. Expand the "work" library.
    3. Select your top module.
    4. Click "OK".

    • lggram's avatar
      lggram
      Icon for New Contributor rankNew Contributor

      I still haven't solved the work(empty) phenomenon. But your advice was a hint, so I was able to proceed with the simulation I wanted. Thank you. However, this is only a temporary measure, and I don't know how long I can proceed with all the work I want. Let me explain my situation now.
      When I create a project, I get work(empty), but I'm using the fact that if I create a source and store it directly in the work folder, I can compile it. Why does saving a project directly in the work folder get workempty and the source file is possible?

  • Checking the understanding:

    When you create a project, ModelSim automatically generates a work library, but in your case, it shows as empty even though you expect it to contain compiled files.

    However, when you manually save and compile a source file into work, ModelSim recognizes it and allows simulation.

    This means the library exists, but ModelSim’s project system isn’t linking to it properly.


    If the understanding is correct, here are some possible Causes and Fixes

    1. Your Work Library Is Not Set as the Active Library

    Even though the work directory exists, ModelSim might not be treating it as the active library. Try setting it manually:


    Command:

    vmap work work

    This explicitly tells ModelSim to map the work library to the correct folder.


    2. The Project Is Using a Different Work Library Path

    Your project might be looking at the wrong work directory.


    Open Project Settings and check where the "work" library is mapped.

    Also, check the Compile Options to ensure compiled files are going into work.

    Instead of manually placing source files into work, try moving them to the project folder and compiling from there.

    3. Your Project Might Have Corrupted or Misconfigured Settings

    Sometimes, ModelSim's internal settings can become misconfigured. Try these steps:


    Close ModelSim and delete the modelsim.ini file in your project directory.

    Restart ModelSim, and it will regenerate modelsim.ini with default settings.

    Run:

    vlib work

    vmap work work

    Then try recompiling.

    4. ModelSim Might Be Using a Different Default Library

    In the Library tab, right-click and check the library settings.

    Ensure that work is the default library for compilation.


  • As we do not receive any response from you on the previous answer that we have provided. Please login to ‘https://supporttickets.intel.com/s/?language=en_US’, view details of the desire request, and post a feed/response within the next 15 days to allow me to continue to support you. After 15 days, this thread will be transitioned to community support. The community users will be able to help you on your follow-up questions.