![]()
You can use the Mentor Graphics ModelSim-Altera software, provided with the Quartus II software, to perform a functional simulation of a VHDL or Verilog HDL design that contains Altera-specific components with the ModelSim-Altera interface, or with command-line commands.
To perform a functional simulation with the ModelSim-Altera interface:
-
If you have not already done so, set up a project with the ModelSim-Altera software.
-
To compile the Verilog HDL or VHDL Design Files and test bench files (if you are using a test bench):
-
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 Verilog HDL or VHDL Design File.
or
In the Files of Type list, select All Files (*.*), and in the Look in list select the Verilog HDL or VHDL Design File.
|
|
Note: If you have generated a VHDL Output File (.vho) or Verilog Output File (.vo) for use in a functional simulation, you should compile it before proceeding. |
-
Click Compile.
-
Repeat steps 2b to 2d to compile the test bench file(s).
-
Click Done.
-
To load the design:
-
On the Simulate menu, click Simulate. The Simulate dialog box appears.
-
If you are simulating a Verilog HDL design, to specify the ModelSim precompiled libraries:
-
Click the Libraries tab.
-
In the Search Libraries (-L) box, click Add and select the appropriate libraries.
-
Click OK.
-
-
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-Altera software.
|
|
Important: If your design contains the altgxb megafunction or the alt2gxb megafunction, please refer to the appropriate megafunction topic for required settings information. |
To perform a functional simulation with command-line commands:
To use the Mentor Graphics ModelSim-Altera software, provided with the Quartus II software, to perform a functional simulation of a VHDL or Verilog HDL design that contains Altera-specific components using command-line commands:
-
If you have not already done so, set up a ModelSim-Altera project with command-line commands.
-
If your design contains the altgxb megafunction, to map to the precompiled Stratix GX functional simulation model libraries type the following command at the ModelSim prompt:
vmap altgxb /<ModelSim-Altera install directory>/altera/<verilog or vhdl>/altgxb/

Important: If your design contains the altgxb megafunction or the alt2gxb megafunction, please refer to the appropriate megafunction topic for required settings information.
-
To map the VHDL-87-compliant design libraries, type the following commands at the ModelSim prompt:
vmap lpm /<ModelSim-Altera install directory>/altera/vhdl/220model_87/ 
<ModelSim-Altera install directory>/
vmap altera_mf /altera/altera_mf_87/ 
-
To compile the Verilog HDL or VHDL Design Files and test bench files (if you are using a test bench), type the following commands at the ModelSim prompt.
For VHDL designs:
vcom -work work <design name>.vhd
vcom -work work <test bench>.vhd
For Verilog HDL designs:
vlog -work work <design name>.v
vlog -work work <test bench>.v
-
To load the design, type the following commands at the ModelSim prompt.
For VHDL designs:
vsim work.<top-level design entity>
For Verilog HDL designs:
vsim -L altera_mf_ver -L lpm_ver.<top-level design entity>
-
Perform the functional simulation in the ModelSim-Altera software.
|
|
Note: You can use batch files to set up and compile each of the libraries automatically. Copy 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:
|
To continue with the ModelSim-Altera simulation flow and perform a timing simulation, set up a project with the ModelSim-Altera software.

