![]()
You can run the Mentor Graphics ModelSim PE or SE software to perform a functional simulation of a VHDL or Verilog HDL design that contains Altera-specific components from the ModelSim interface or with command-line commands.
To perform a functional simulation with the ModelSim interface:
-
If you have not already done so, set up a project with the ModelSim software.
-
To map the design libraries to your work library:
-
On the File menu, point to New and click Library (File menu). The Create a New Library dialog box appears.
-
Type
lpmin the Library Name box, type the name of the work library in the Library Maps to box, and then click OK. -
Repeat steps 2a and 2b to map
altera_mfto the work library.
-
-
To compile the functional simulation libraries, Verilog HDL or VHDL Design Files, and test bench files (if you are using a test bench):
|
|
Important: If your design contains the altgxb megafunction or the alt2gxb megafunction, please refer to the appropriate megafunction topic for required settings information. |
-
-
On the Compile menu, click Compile.
-
In the Library list of the Compile HDL Source Files dialog box, select the work library.
-
In the File name list, type the directory path and file name of the functional simulation libraries.
or
In the Files of Type list, select All Files (*.*), and in the Look in list select the Verilog HDL or VHDL Design File.
-
Click Compile.
-
|
|
Note: For VHDL designs that use the 220model.vhd library, turn on Use Explicit Declarations under Default Options in the Compile dialog box. |
-
-
Repeat steps 4b to 4d to compile the Verilog HDL or VHDL Design File.
-
Repeat steps 4b to 4d to compile the test bench file(s).
-
Click Done.
-
-
To load the design:
-
On the Simulate menu, click Simulate. The Simulate dialog box appears.
-
In the Name list, click the + icon to expand the work directory.
-
Select the top-level design file to simulate.
-
Click Add.
-
Click Load.
-
-
Perform the functional simulation in the ModelSim software.
To perform a functional simulation with the ModelSim software with command-line commands:
|
|
Note: You can use batch files to set up and compile each of the libraries automatically. Place all the commands displayed in the ModelSim-Altera or ModelSim PE or SE main window into a text file and name the file with a .do extension (that is, <file name>.do). Use this script to recompile the libraries if you update them. To run a macro script:
|
-
If you have not already done so, perform Setting Up a ModelSim Project with Command-Line Commands.
-
To compile the functional simulation libraries, VHDL or Verilog HDL design file, and optional test bench file, type the following commands at the ModelSim prompt:
Map to library work:
vlib lpm 
vlib altera 
vlib sgate 
vmap lpm work 
vmap altera work 
vmap sgate work 
For VHDL 87-compliant designs:
vcom -work work <path to library>/220pack.vhd 
vcom [-87] -explicit -work work <path to library>/220model_87.vhd 
vcom -work work <path to library>/altera_mf_components.vhd 
vcom [-87] -work work <path to library>/altera_mf_87.vhd 
vcom -work work <design name>.vhd 
vcom -work work <test bench>.vhd 
For VHDL 93-compliant designs:
vcom -93 -work work <path to library>/220pack.vhd 
vcom -explicit -work work <path to library>/220model.vhd 
vcom -work work <path to library>/altera_mf_components.vhd 
vcom -93 -work work <path to library>/altera_mf.vhd
vcom -work work <design name>.vhd <test bench>
vcom -work work .vhd 
For Verilog HDL designs:
vlog -work work <path to library>/220model.v 
vlog -work work <path to library>/altera_mf.v 
vlog -work work <design name>.v 
vlog -work work <test bench>.v
|
|
Note: If the design contains the altgxb megafunction, you must also compile the stratixgx_mf functional simulation libraries. |
-
Load the VHDL or Verilog HDL design file or test bench file for the design into the ModelSim software by typing one of the following commands at the command prompt:
-
vsim<work library>.<design name>
or
vsim<work library>.<top-level design entity>
|
|
Important: If your design contains the altgxb megafunction or the alt2gxb megafunction, please refer to the appropriate megafunction topic for required settings information. |
-
Perform the functional simulation in the ModelSim software.
To continue with the ModelSim simulation flow, set up a project with the ModelSim software.


