55:132/22C:160, Spring 2011

Using the ModelSim Verilog Environment


Note: For information on how to activate your Engineering CSS account (assuming that you do not already have an active account) and how to access the ModelSim Verilog tools, see the Class News link of this web site.  Once you have your account activated, follow the instructions on this page.

This page will give you a quick help to set up your CSS Linux environment to work with the ModelSim Verilog tools that are a part of the Mentor Graphics tool suite.

The tool used is named ModelSim6.5b_1 and it works with either VHDL or Verilog codes.

Using Verilog will be very similar to classical programming languages (such as C). You will perform the following steps:

Before starting to write Verilog code you need to do a few easy operations:

. To avoid having to source this file every time you start a session on your workstation, you can add the source command line in your .bashrc file (which is in your home directory):

. /usr/css/etc/mentor_setup.sh
Make sure you type the file's path correctly!  Once again, note that there is a space between the dot and the slash.

Important note: if you do not want to add this information to your .bashrc file, you have to type the source command every time you start a session!
 

You can now write Verilog modules using a text editor. Once you have saved a Verilog file (e.g. my_test.v) into your verilog_dir directory, you should do the following steps, with verilog_dir as your working directory:


If the compilation is successful, you will have a result that will look similar to this:

Model Technology ModelSim SE vlog 6.5b_1 Compiler 2009.07 Jul 14, 2009

-- Compiling module your_module_name

...

Top level modules: your_top_level_module_name(s)

If compilation failed, appropriate error messages will be displayed. You will not be able to simulate a Verilog code that has not been compiled successfully. Also remember that even if you know you have a syntactically correct code, you must compile it before running it.


$vsim -c top_level_module_name
In this case, you will get a command prompt of the form
VSIM>
You can run the simulation for a specified number of time steps by typing the run command at this prompt. For instance to run for 100 time steps, type:
VSIM> run 100

·  You now have the basics needed to write, compile and run/simulate a Verilog application. . You are encouraged to try the tool yourself since it is probably the most efficient way for you to get familiar to it.


Last Update: Feb  17, 2010 JGK