Escolar Documentos
Profissional Documentos
Cultura Documentos
1
separately and placed for different directories. This is done when creating new projects
discussed in the next section.
On the left side of the interface, under the project tab is the frame listing of the
files that pertain to the opened project. The Library frame lists the entities of the project
(that have been compiled). To the right is the ModelSim shell frame. It is an extension
of the Unix shell, so both ModelSim and Unix commands can be executed.
2
File > New > Source > VHDL
This will open up an empty text editor configured to highlight VHDL syntax. After
writing the code for the entity and its architecture, save the file with a .vhd extension (it
is suggested to make the filename same with its entity name to avoid confusion). To add
this file into the project select from the top menu:
Project > Add File to Project
A new file icon should appear in the file frame box on the left.
C. Compiling projects.
Select the file from the project files list frame and right click on it. Select compile to just
compile this file or compile all for all the files in the current project. If there are errors
within the code or the project, a red failure message will be displayed. Otherwise, all is
well and no red warning or error messages are displayed.
To simulate, first the entity design has to be loaded into the simulator. Do this by
selecting from the menu:
Design > Load Design...
A new window will appear listing all the entities (not filenames) that are in the work
library. Select the entity to be simulated and click Load.
Often times it will be necessary to create entities with
multiple architectures, such as shown in the figure on the
left. The decoder entity here has four different
architectures within it. In this case, the architecture has to
be specified for the simulation. Expand the tree for the
entity, select the architecture to be simulated, and then click
Load.
The force is defined in value-time pairs, where the signal will changed to the value at the
given time in nanoseconds . The repeat part is optional, and is commonly used to
generate a clock. So, for example:
force clk 0 0, 1 50 -repeat 100
3
This creates a clock force with a 50% duty cycle and a period of 100ns (10Mhz clock).
Also, the values have to be set according to the input type required by the entity. For
example, if the input required a hexadecimal input, the value can be set as hexadecimal:
force inA 16#0 0, 16#C 600, 16#8 1100
The “16” denotes the radix for hexadecimal, and the ‘#’ separates the base and the value.
Other examples:
10#9 - Decimal radix
2#111 - Binary radix
“1234” - Character literal sequence (remember the quotes)
When all the input forces have been initialized, save the file (any filename will do) and
quit the text editor.
Next, the forces data has to be loaded into the simulator by typing:
• do forces_filename
This executes the force commands stored in the filename. The forces can also be entered
at the prompt, instead of from a file, for quick changes in the time-value pairs.
4
V. The Waveform
Be familiar with the top toolbar, they are very helpful in results analysis and debugging
the code.
5
VI. The Listing Form
Listing form is used to see the events of the simulation or to see changes occurring to a
value at what time. The left column is the time column – time elapsed, along with the
delta delay. The right column is the value at the given time and delta delay.