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.
Now that we know the work library is there, let's make sure your Verilog files are compiled correctly.
- Go to the "Compile" menu → Click "Compile".
- Select your .v files from where they are saved.
- Look at the "Library" column in the compile window.
- It should say "work" (if not, select "work").
- Click "Compile", then "Done".
Alternatively, you can compile manually by typing:
vlog -work work myfile.v
(Replace myfile.v with your actual file name.)
After compiling, check if files were added to work:
- Open "Library" tab on the left.
- Click the "+" next to "work".
- You should see your compiled modules listed.
If the work library is still empty, your files might not be compiled correctly.
If files are getting created outside of work, it may be due to incorrect paths.
- Look at the path where your .v files are saved.
- Make sure they are in your ModelSim project folder.
- Check where ModelSim is compiling to:
- Open Compile → Compile Options.
- Ensure the "Library" is set to "work".
If your files are compiled correctly but still not appearing in simulation:
- Go to "Simulate" → "Start Simulation".
- Expand the "work" library.
- Select your top module.
- Click "OK".