Steps to follow in order to simulate a VHDL model with ModelSim PE Student Edition:
- Start ModelSim
- From menu File select Change Directory (we will denote this sequence
of operations as "File -> Change Directory") and select the directory, for example C:\Student
- File -> New -> Library
A new window, called Create a New Library, pops up. If the working
directory does not contain a previous library, then in the Create New
Library window, you will see:
Library name Work and Library Physical Name Work. Do not change these
names, just click Ok. If a library Work already exists, then you may use
it, and don't need to create a new library. Otherwise, you will see in
the Library window a the library work (empty).
- File -> New -> Source -> VHDL and a new window will appear, offering
you the possibility to edit a VHDL program.
- Edit the VHDL program
- Save the file with a name and with the extension .vhd or .vhdl (e.g., cad1.vhdl )
- The vhd file(s) must be in the same directory with the library WORK
- DO NOT save the vhd file(s) in the directory WORK !!
- Go to menu Compile -> Compile. Normally you should see the .vhd and/or .vhdl files
from the working directory (i.e. C:\Stuent )
- Select your file and compile it.
- If you have errors, try to remove the errors, save the file again
and reocmpile the file. Do this until you remove all errors.
- After you compile all your source files, in the library window you
should see, to the left of the library work, a small rectangle with a
"+" inside it. Click on the + and you will see the entities that you
compiled.
- In order to start the simulation, you can select the Simulate menu, or you can double
click on the top-most entity of your design (from the library window). Normally this is the
entity that "links" all your entities and it should not have inputs. It is recommended to be
a test bench.
- If your simulation model is correct, then new windos will appear. If the ModelSim
licence has expired, the message will be "error loading design", but this error message can
have other causes (e.g., errors in the model).
- In the window named sim, select the top-most entity (e.g.
test_bench) and right click from the mouse. From the menu that appears, select Add Wave.
- A new window, named Wave - Default appears. You will see the signals
from the top-level entity.
- In the main window, change the Run length value from 100 ns to a
value that suits you (e.g. 2000 ns). You may also leave this value
unchanged and increase the simulation length in 100 ns increments (see
next step).
- In the main window, select the Run icon (situated to the right of
the Run length). When you click on the Run, you will see that the
selected signals have been simulated and displayed for the selected run
length. If you repeat the operation, the simulation model will be
simulated for another selected length (e.g., for another 2000 ns in our
case).
- Click with the mouse inside the Wave window and then select the zoom
that suits you (from the main window). You can see eithter the entire
simulation period, or only parte of it.
- Try to understand the evolution in time of the simulated signals and
see if your simulation model was correct.