Professional Documents
Culture Documents
QII53001-9.0.0
Introduction
An Altera ® Quartus® II software subscription includes a no-cost entry-level software
version of the ModelSim® -Altera software on a PC or UNIX platform. Altera also
offers the ModelSim-Altera Subscription Edition software that has full support for
Altera devices. You can use the ModelSim-Altera Starter Edition software to perform
register transfer level (RTL) functional, post-synthesis, and gate-level timing
simulations for either Verilog HDL or VHDL designs that target an Altera FPGA. This
chapter provides detailed instructions about how to simulate your design in the
ModelSim-Altera version or the Mentor Graphics ® ModelSim software version. This
chapter provides details about the specific libraries that are needed for an RTL
functional, post-synthesis, and gate-level timing simulation.
The following topics are discussed in this chapter:
■ “Background”
■ “Software Compatibility” on page 2–3
■ “Altera Design Flow with ModelSim-Altera or ModelSim Software” on page 2–3
■ “Simulation Libraries” on page 2–4
■ “Simulation Netlist Files” on page 2–12
■ “Perform Simulation Using the ModelSim-Altera Software” on page 2–18
■ “Perform Simulation Using the ModelSim Software” on page 2–38
■ “Simulating Designs that Include Transceivers” on page 2–64
■ “Using the NativeLink Feature with ModelSim-Altera or ModelSim Software” on
page 2–70
■ “Generating a Timing VCD File for PowerPlay” on page 2–78
■ “Viewing a Waveform from a .wlf File” on page 2–78
■ “Scripting Support” on page 2–79
■ “Software Licensing and Licensing Setup in ModelSim-Altera Subscription
Edition” on page 2–80
f For more information about the current Quartus II software version, refer to the
Altera website at www.altera.com.
Background
ModelSim-Altera software is included with your Altera software subscription and can
be licensed for PC, Solaris, or Linux platforms to support either Verilog HDL or
VHDL simulation. ModelSim-Altera software supports RTL functional,
post-synthesis, and gate-level timing simulations for all Altera devices.
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–2 Chapter 2: Mentor Graphics ModelSim Support
Background
Table 2–1 describes the differences between the Mentor Graphics ModelSim SE/PE
and ModelSim-Altera software versions.
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–3
Software Compatibility
Software Compatibility
Table 2–2 shows which ModelSim-Altera and ModelSim software version is
compatible with the Quartus II software versions. ModelSim versions provided
directly from Mentor Graphics do not correspond to specific Quartus II software
versions.
For help with the ModelSim-Altera licensing setup, refer to “Software Licensing and
Licensing Setup in ModelSim-Altera Subscription Edition” on page 2–80.
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–4 Chapter 2: Mentor Graphics ModelSim Support
Simulation Libraries
Figure 2–1. Altera Design Flow with ModelSim-Altera Software, ModelSim Software, and Quartus II Software
ALTERA IP
Design Entry
Verilog Output
File and VHDL .vo/.vho
Output File
Simulation Libraries
Simulation model libraries are required to run a simulation whether you are running
an RTL functional simulation, post-synthesis simulation, or gate-level timing
simulation. In general, running an RTL functional simulation requires the RTL
functional simulation model libraries, while running a post-synthesis or gate-level
timing simulation requires the gate-level timing simulation model libraries. You must
compile the necessary library files before you can run the simulation.
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–5
Simulation Libraries
However, there are a few exceptions where you are also required to compile gate-level
timing simulation library files to perform RTL functional simulation. For example, the
following list shows some of the Altera megafunctions’ gate-level libraries required to
perform an RTL functional simulation using third-party simulators:
■ ALTCLKBUF
■ ALTCLKCTRL
■ ALTDQS
■ ALTDQ
■ ALTDDIO_IN
■ ALTDDIO_OUT
■ ALTDDIO_BIDIR
■ ALTUFM_NONE
■ ALTUFM_PARALLEL
■ ALTUFM_SPI
■ ALTMEMMULT
■ ALTREMOTE_UPDATE
1 To identify which type of simulation libraries are required to run the simulation for a
certain Altera megafunction, refer to the last page in the Altera megafunction
MegaWizard™ Plug-In Manager. This explains which simulation library files are
required to perform an RTL functional simulation for that particular megafunction.
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–6 Chapter 2: Mentor Graphics ModelSim Support
Simulation Libraries
Table 2–3. Pre-Compiled RTL Functional Simulation Libraries in the ModelSim-Altera Software (VHDL)
Pre-Compiled
RTL Simulation Model Library Name Location in ModelSim-Altera
LPM lpm <ModelSim-Altera installation directory>\altera\vhdl\220model\
Altera Megafunction altera_mf <ModelSim-Altera installation directory>\altera\vhdl\altera_mf\
Low-level Primitives altera <ModelSim-Altera installation directory>\altera\vhdl\altera\
ALTGXB Megafunction (Stratix GX) altgxb <ModelSim-Altera installation directory>\altera\vhdl\altgxb\
High-Level Primitives sgate <ModelSim-Altera installation directory>\altera\vhdl\sgate\
Low-Level Primitives alt_vtl <ModelSim-Altera installation directory>\altera\vhdl\alt_vtl\
Table 2–4 shows the pre-compiled library name and the location in the
ModelSim-Altera software for all RTL functional simulation models in Verilog HDL.
Table 2–4. Pre-Compiled RTL Functional Simulation Libraries in the ModelSim-Altera Software (Verilog HDL)
Pre-Compiled
RTL Simulation Model Library Name Location in ModelSim-Altera
LPM lpm_ver <ModelSim-Altera installation directory>\altera\verilog\220model\
Altera Megafunction altera_mf_ver <ModelSim-Altera installation directory>\altera\verilog\altera_mf\
Low-level Primitives altera_ver <ModelSim-Altera installation directory>\altera\verilog\altera\
ALTGXB Megafunction (Stratix GX) altgxb_ver <ModelSim-Altera installation directory>\altera\verilog\altgxb\
High-Level Primitives sgate_ver <ModelSim-Altera installation directory>\altera\verilog\sgate\
Low-Level Primitives alt_ver <ModelSim-Altera installation directory>\altera\verilog\alt_vtl\
Table 2–5. Pre-Compiled Gate-Level Simulation Libraries in the ModelSim-Altera Software (VHDL) (Part 1 of 2)
Device Pre-Compiled
Simulation Model Library Name Location in ModelSim-Altera
Arria ® II arriaii <ModelSim-Altera installation directory>\altera\vhdl\arriaii\
(without transceiver block)
Arria II arriaii_hssi <ModelSim-Altera installation directory>\altera\vhdl\arriaii_hssi\
(with transceiver block)
Arria II arriaii_pcie_hip <ModelSim-Altera installation directory>\altera\vhdl\arriaii_pcie_hip\
(with PCI Express)
Arria GX arriagx <ModelSim-Altera installation directory>\altera\vhdl\arriagx\
(without transceiver block)
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–7
Simulation Libraries
Table 2–5. Pre-Compiled Gate-Level Simulation Libraries in the ModelSim-Altera Software (VHDL) (Part 2 of 2)
Device Pre-Compiled
Simulation Model Library Name Location in ModelSim-Altera
Arria GX arriagx_hssi <ModelSim-Altera installation directory>\altera\vhdl\arriagx_hssi\
(with transceiver block)
Stratix® IV stratixiv <ModelSim-Altera installation directory>\altera\vhdl\stratixiv\
Stratix IV stratixiv_hssi <ModelSim-Altera installation directory>\altera\vhdl\stratixiv_hssi\
(with transceiver block)
Stratix IV stratixiv_pcie_hip <ModelSim-Altera installation directory>\altera\vhdl\stratixiv_pcie_hip
(with PCI Express)
Stratix III stratixiii <ModelSim-Altera installation directory>\altera\vhdl\stratixiii\
Stratix II stratixii <ModelSim-Altera installation directory>\altera\vhdl\stratixii
Stratix II GX stratixiigx <ModelSim-Altera installation directory>\altera\vhdl\stratixiigx
(without transceiver block)
Stratix II GX stratixiigx_hssi <ModelSim-Altera installation directory>\altera\vhdl\stratixiigx_hssi
(with transceiver block)
Stratix stratix <ModelSim-Altera installation directory>\altera\vhdl\stratix
Stratix GX stratixgx <ModelSim-Altera installation directory>\altera\vhdl\stratixgx
(without transceiver block)
Stratix GX stratixgx_gxb <ModelSim-Altera installation directory>\altera\vhdl\stratixgx_gxb
(with transceiver block)
HardCopy® II hardcopyii <ModelSim-Altera installation directory>\altera\vhdl\hardcopyii\
Cyclone ® III cycloneiii <ModelSim-Altera installation directory>\altera\vhdl\cycloneiii\
Cyclone II cycloneii <ModelSim-Altera installation directory>\altera\vhdl\cycloneii
Cyclone cyclone <ModelSim-Altera installation directory>\altera\vhdl\cyclone
MAX II
® maxii <ModelSim-Altera installation directory>\altera\vhdl\maxii
MAX 7000 max <ModelSim-Altera installation directory>\altera\vhdl\max
MAX 3000
APEX™ II apexii <ModelSim-Altera installation directory>\altera\vhdl\apexii
APEX 20K apex20k <ModelSim-Altera installation directory>\altera\vhdl\apex20k
APEX 20KC apex20ke <ModelSim-Altera installation directory>\altera\vhdl\apex20ke
APEX 20KE
Excalibur™
FLEX® 10KE flex10ke <ModelSim-Altera installation directory>\altera\vhdl\flex10ke
ACEX 1K
®
Table 2–6 shows the pre-compiled library name and the location in the
ModelSim-Altera software for all the gate-level simulation models in Verilog HDL.
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–8 Chapter 2: Mentor Graphics ModelSim Support
Simulation Libraries
Table 2–6. Pre-Compiled Gate-Level Simulation Libraries in the ModelSim-Altera Software (Verilog HDL)
Device Pre-Compiled
Simulation Model Library Name Location in ModelSim-Altera
Arria II arriaii_ver <ModelSim-Altera installation directory>\altera\verilog\arriaii\
(without transceiver block)
Arria II arriaii_hssi_ver <ModelSim-Altera installation directory>\altera\verilog\arriaii_hssi\
(with transceiver block)
Arria II arriaii_pcie_hip_ver <ModelSim-Altera installation directory>
(with PCI Express) \altera\verilog\arriaii_pcie_hip\
Arria GX arriagx_ver <ModelSim-Altera installation directory>\altera\verilog\arriagx\
(without transceiver block)
Arria GX arriagx_hssi_ver <ModelSim-Altera installation directory>\altera\verilog\arriagx_hssi\
(with transceiver block)
Stratix IV stratixiv_ver <ModelSim-Altera installation directory>\altera\verilog\stratixiv\
Stratix IV stratixiv_hssi_ver <ModelSim-Altera installation directory>altera\verilog\stratixiv_hssi\
(with transceiver block)
Stratix IV stratixiv_pcie_hip_ver <ModelSim-Altera installation directory>
(with PCI Express) \altera\verilog\stratixiv_pcie_hip\
Stratix III stratixiii_ver <ModelSim-Altera installation directory>\altera\verilog\stratixiii\
Stratix II stratixii_ver <ModelSim-Altera installation directory>\altera\verilog\stratixii
Stratix II GX stratixiigx_ver <ModelSim-Altera installation directory>\altera\verilog\stratixiigx
(without transceiver block)
Stratix II GX stratixiigx_hssi_ver <ModelSim-Altera installation directory>
(with transceiver block) \altera\verilog\stratixiigx_hssi
Stratix stratix_ver <ModelSim-Altera installation directory>\altera\verilog\stratix
Stratix GX stratixgx_ver <ModelSim-Altera installation directory>\altera\verilog\stratixgx
(without transceiver block)
Stratix GX stratixgx_gxb_ver <ModelSim-Altera installation directory>\altera\verilog\stratixgx_gxb
(with transceiver block)
HardCopy II hardcopyii_ver <ModelSim-Altera installation directory>\altera\verilog\hardcopyii\
Cyclone III cycloneiii_ver <ModelSim-Altera installation directory>\altera\verilog\cycloneiii\
Cyclone II cycloneii_ver <ModelSim-Altera installation directory>\altera\verilog\cycloneii
Cyclone cyclone_ver <ModelSim-Altera installation directory>\altera\verilog\cyclone
MAX II maxii_ver <ModelSim-Altera installation directory>\altera\verilog\maxii
MAX 7000 max_ver <ModelSim-Altera installation directory>\altera\verilog\max
MAX 3000
APEX II apexii_ver <ModelSim-Altera installation directory>\altera\verilog\apexii
APEX 20K apex20k_ver <ModelSim-Altera installation directory>\altera\verilog\apex20k
APEX 20KC apex20ke_ver <ModelSim-Altera installation directory>\altera\verilog\apex20ke
APEX 20KE
Excalibur™
FLEX 10KE flex10ke_ver <ModelSim-Altera installation directory>\altera\verilog\flex10ke
ACEX 1K
FLEX 6000 flex6000_ver <ModelSim-Altera installation directory>\altera\verilog\flex6000\
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–9
Simulation Libraries
Table 2–7. RTL Functional Simulation Library Files in the Quartus II Directory (VHDL)
RTL Simulation Model VHDL Libraries
ALTGX Megafunction <path to Quartus II installation directory>\eda\sim_lib\stratixiv_hssi_components.vhd
(Stratix IV GX) <path to Quartus II installation directory>\eda\sim_lib\stratixiv_hssi_atoms.vhd
LPM <path to Quartus II installation directory>\eda\sim_lib\220pack.vhd
<path to Quartus II installation directory>\eda\sim_lib\220model.vhd
<path to Quartus II installation directory>\eda\sim_lib\220model_87.vhd (1)
Altera Megafunction <path to Quartus II installation directory>\eda\sim_lib\altera_mf_components.vhd
<path to Quartus II installation directory>\eda\sim_lib\altera_mf.vhd
<path to Quartus II installation directory>\eda\sim_lib\altera_mf_87.vhd (1)
ALT2GXB Megafunction <path to Quartus II installation directory>\eda\sim_lib\stratixiigx_hssi_components.vhd
(Stratix II GX) <path to Quartus II installation directory>\eda\sim_lib\stratixiigx_hssi_atoms.vhd
<path to Quartus II installation directory>\eda\sim_lib\arriagx_hssi_components.vhd
<path to Quartus II installation directory>\eda\sim_lib\arriagx_hssi_atoms.vhd
ALTGXB Megafunction <path to Quartus II installation directory>\eda\sim_lib\stratixgx_mf_components.vhd
(Stratix GX) <path to Quartus II installation directory>\eda\sim_lib\stratixgx_mf.vhd
High-Level Primitives <path to Quartus II installation directory>\eda\sim_lib\sgate_pack.vhd
<path to Quartus II installation directory>\eda\sim_lib\sgate.vhd
Low-Level Primitives <path to Quartus II installation directory>\eda\sim_lib\altera_primitives_components.vhd
<path to Quartus II installation directory>\eda\sim_lib\altera_primitives.vhd
Note to Table 2–7:
(1) Simulating a design that uses VHDL-1987.
Table 2–8 shows the Verilog RTL simulation model location in the Quartus II
directory.
Table 2–8. RTL Functional Simulation Library Files in the Quartus II Directory (Verilog HDL) (Part 1 of 2)
RTL Simulation Model Verilog HDL Libraries
ALTGX Megafunction (Stratix IV GX) <path to Quartus II installation directory>\eda\sim_lib\stratixiv_hssi_atoms.v
LPM <path to Quartus II installation directory>\eda\sim_lib\220model.v
Altera Megafunction <path to Quartus II installation directory>\eda\sim_lib\altera_mf.v
ALT2GXB Megafunction (Stratix II GX) <path to Quartus II installation directory>\eda\sim_lib\stratixiigx_hssi_atoms.v
<path to Quartus II installation directory>\eda\sim_lib\arriagx_hssi_atoms.v
ALTGXB Megafunction (Stratix GX) <path to Quartus II installation directory>\eda\sim_lib\stratixgx_mf.v
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–10 Chapter 2: Mentor Graphics ModelSim Support
Simulation Libraries
Table 2–8. RTL Functional Simulation Library Files in the Quartus II Directory (Verilog HDL) (Part 2 of 2)
RTL Simulation Model Verilog HDL Libraries
High-Level Primitives <path to Quartus II installation directory>\eda\sim_lib\sgate.v
Low-Level Primitives <path to Quartus II installation directory>\eda\sim_lib\altera_primitives.v
Table 2–9. Gate-Level Timing Simulation Library Files in Quartus II Software (VHDL) (Part 1 of 2)
Device Simulation Model Location in Quartus II Directory Structure
Arria II <Quartus II installation directory>\eda\sim_lib\arriaii_components.vhd
(without transceiver block) <Quartus II installation directory>\eda\sim_lib\arriaii_atoms.vhd
Arria II <Quartus II installation directory>\eda\sim_lib\arriaii_hssi_components.vhd
(with transceiver block) <Quartus II installation directory>\eda\sim_lib\arriaii_hssi_atoms.vhd
Arria II <Quartus II installation directory>\eda\sim_lib\arriaii_pcie_components.vhd
(with PCI Express) <Quartus II installation directory>\eda\sim_lib\arriaii_pcie_atoms.vhd
Arria GX <Quartus II installation directory>\eda\sim_lib\arriagx_components.vhd
(without transceiver block) <Quartus II installation directory>\eda\sim_lib\arriagx_atoms.vhd
Arria GX <Quartus II installation directory>\eda\sim_lib\arriagx_hssi_components.vhd
(with transceiver block) <Quartus II installation directory>\eda\sim_lib\arriagx_hssi_atoms.vhd
Stratix IV <Quartus II installation directory>\eda\sim_lib\stratixiv_components.vhd
<Quartus II installation directory>\eda\sim_lib\stratixiv_atoms.vhd
Stratix IV <Quartus II installation directory>\eda\sim_lib\stratixiv_hssi_components.vhd
(with transceiver block) <Quartus II installation directory>\eda\sim_lib\stratixiv_hssi_atoms.vhd
Stratix IV (with PCI Express) <Quartus II installation directory>\eda\sim_lib\stratixiv_pcie_hip_components.vhd
<Quartus II installation directory>\eda\sim_lib\stratixiv_pcie_hip_atoms.vhd
Stratix III <Quartus II installation directory>\eda\sim_lib\stratixiii_components.vhd
<Quartus II installation directory>\eda\sim_lib\stratixiii_atoms.vhd
Stratix II <Quartus II installation directory>\eda\sim_lib\stratixii_components.vhd
<Quartus II installation directory>\eda\sim_lib\stratixii_atoms.vhd
Stratix II GX <Quartus II installation directory>\eda\sim_lib\stratixiigx_components.vhd
(without transceiver block) <Quartus II installation directory>\eda\sim_lib\stratixiigx_atoms.vhd
Stratix II GX <Quartus II installation directory>\eda\sim_lib\stratixiigx_hssi_components.vhd
(with transceiver block) <Quartus II installation directory>\eda\sim_lib\stratixiigx_hssi_atoms.vhd
Stratix <Quartus II installation directory>\eda\sim_lib\stratix_components.vhd
<Quartus II installation directory>\eda\sim_lib\stratix_atoms.vhd
Stratix GX <Quartus II installation directory>\eda\sim_lib\stratixgx_components.vhd
<Quartus II installation directory>\eda\sim_lib\stratixgx_atoms.vhd
Stratix GX <Quartus II installation directory>\eda\sim_lib\stratixgx_hssi_components.vhd
(with transceiver block) <Quartus II installation directory>\eda\sim_lib\stratixgx_hssi_atoms.vhd
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–11
Simulation Libraries
Table 2–9. Gate-Level Timing Simulation Library Files in Quartus II Software (VHDL) (Part 2 of 2)
Device Simulation Model Location in Quartus II Directory Structure
HardCopy II <Quartus II installation directory>\eda\sim_lib\hardcopyii_components.vhd
<Quartus II installation directory>\eda\sim_lib\hardcopyii_atoms.vhd
Cyclone III <Quartus II installation directory>\eda\sim_lib\cycloneiii_components.vhd
<Quartus II installation directory>\eda\sim_lib\cycloneiii_atoms.vhd
Cyclone II <Quartus II installation directory>\eda\sim_lib\cycloneii_components.vhd
<Quartus II installation directory>\eda\sim_lib\cycloneii_atoms.vhd
Cyclone <Quartus II installation directory>\eda\sim_lib\cyclone.vhd
<Quartus II installation directory>\eda\sim_lib\cyclone_atoms.vhd
MAX II <Quartus II installation directory>\eda\sim_lib\maxii_components.vhd
<Quartus II installation directory>\eda\sim_lib\maxii_atoms.vhd
MAX 7000 <Quartus II installation directory>\eda\sim_lib\max_components.vhd
MAX 3000 <Quartus II installation directory>\eda\sim_lib\max_atoms.vhd
APEX II <Quartus II installation directory>\eda\sim_lib\apexii_components.vhd
<Quartus II installation directory>\eda\sim_lib\apexii_atoms.vhd
APEX 20K <Quartus II installation directory>\eda\sim_lib\apex20k_components.vhd
<Quartus II installation directory>\eda\sim_lib\apex20k_atoms.vhd
APEX 20KC <Quartus II installation directory>\eda\sim_lib\apex20ke_components.vhd
APEX 20KE <Quartus II installation directory>\eda\sim_lib\apex20ke_atoms.vhd
Excalibur
FLEX 6000 <Quartus II installation directory>\eda\sim_lib\flex6000_components.vhd
<Quartus II installation directory>\eda\sim_lib\flex6000_atoms.vhd
FLEX 10KE <Quartus II installation directory>\eda\sim_lib\flex10ke_components.vhd
ACEX 1K <Quartus II installation directory>\eda\sim_lib\flex10ke_atoms.vhd
Table 2–10 shows the Verilog HDL gate-level simulation model location in the
Quartus II directory.
Table 2–10. Gate-Level Timing Simulation Library Files in the Quartus II Software (Verilog HDL) (Part 1 of 2)
Device Simulation Model Location in Quartus II Directory Structure
Arria II <Quartus II installation directory>\eda\sim_lib\arriaii_atoms.v
(without transceiver block)
Arria II <Quartus II installation directory>\eda\sim_lib\arriaii_hssi_atoms.v
(with transceiver block)
Arria II <Quartus II installation directory>\eda\sim_lib\arriaii_pcie_atoms.v
(with PCI Express)
Arria GX <Quartus II installation directory>\eda\sim_lib\arriagx_atoms.v
(without transceiver block)
Arria GX <Quartus II installation directory>\eda\sim_lib\arriagx_hssi_atoms.v
(with transceiver block)
Stratix IV <Quartus II installation directory>\eda\sim_lib\stratixiv_atoms.v
Stratix IV <Quartus II installation directory>\eda\sim_lib\stratixiv_hssi_atoms.v
(with transceiver block)
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–12 Chapter 2: Mentor Graphics ModelSim Support
Simulation Netlist Files
Table 2–10. Gate-Level Timing Simulation Library Files in the Quartus II Software (Verilog HDL) (Part 2 of 2)
Device Simulation Model Location in Quartus II Directory Structure
Stratix IV <Quartus II installation directory>\eda\sim_lib\stratixiv_pcie_hip_atoms.v
(with PCI Express)
Stratix III <Quartus II installation directory>\eda\sim_lib\stratixiii_atoms.v
Stratix II <Quartus II installation directory>\eda\sim_lib\stratixii_atoms.v
Stratix II GX <Quartus II installation directory>\eda\sim_lib\stratixiigx_atoms.v
(without transceiver block)
Stratix II GX <Quartus II installation directory>\eda\sim_lib\stratixiigx_hssi_atoms.v
(with transceiver block)
Stratix <Quartus II installation directory>\eda\sim_lib\stratix_atoms.v
Stratix GX <Quartus II installation directory>\eda\sim_lib\stratixgx_atoms.v
Stratix GX <Quartus II installation directory>\eda\sim_lib\stratixgx_hssi_atoms.v
(with transceiver block)
HardCopy II <Quartus II installation directory>\eda\sim_lib\hardcopyii_atoms.v
Cyclone III <Quartus II installation directory>\eda\sim_lib\cycloneiii_atoms.v
Cyclone II <Quartus II installation directory>\eda\sim_lib\cycloneii_atoms.v
Cyclone <Quartus II installation directory>\eda\sim_lib\cyclone_atoms.v
MAX II <Quartus II installation directory>\eda\sim_lib\maxii_atoms.v
MAX 7000 <Quartus II installation directory>\eda\sim_lib\max_atoms.v
MAX 3000
APEX II <Quartus II installation directory>\eda\sim_lib\apexii_atoms.v
APEX 20K <Quartus II installation directory>\eda\sim_lib\apex20k_atoms.v
APEX 20KC <Quartus II installation directory>\eda\sim_lib\apex20ke_atoms.v
APEX 20KE
Excalibur
FLEX 6000 <Quartus II installation directory>\eda\sim_lib\flex6000_atoms.v
FLEX 10KE <Quartus II installation directory>\eda\sim_lib\flex10ke_atoms.v
ACEX 1K
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–13
Simulation Netlist Files
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–14 Chapter 2: Mentor Graphics ModelSim Support
Simulation Netlist Files
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–15
Simulation Netlist Files
Table 2–11. Default Available Operating Conditions for Stratix III and Cyclone III Devices
Device Family Model Voltage Temperature (°C)
Slow 1100 mV 85°
Stratix III Slow 1100 mV 0°
Fast 1100 mV 0°
Slow 1200 mV 85°
Cyclone III Slow 1200 mV 0°
Fast 1200 mV 0°
If multi-corner timing analysis is not run during full compilation, perform the
following steps to manually generate the simulation netlist files (*.vo or *.vho and
*.sdo) for the three different operating conditions listed in Table 2–11:
1. Generate all the available corner models at all operating conditions. Type the
following command at a command prompt:
quartus_sta <project name> --multicorner r
2. Generate the timing simulation netlist files for all three corners specified in
Table 2–11. Perform steps 2 through 8 in “Generate Gate-Level Timing Simulation
Netlist Files” on page 2–14. The output files are generated in the simulation output
directory.
The following examples show the timing simulation netlist files generated for the
operating conditions of the preceding steps, when Verilog is selected as the output
netlist format:
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–16 Chapter 2: Mentor Graphics ModelSim Support
Simulation Netlist Files
f For more information about running multi-corner timing analysis, refer to the
Quartus II Classic Timing Analyzer or the Quartus II TimeQuest Timing Analyzer chapter
in volume 3 of the Quartus II Handbook.
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–17
Simulation Netlist Files
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–18 Chapter 2: Mentor Graphics ModelSim Support
Perform Simulation Using the ModelSim-Altera Software
When the EDA Simulation Library Compiler finishes, all required libraries are
compiled and stored in the output location you specified. The next time you perform
simulation in ModelSim, you only have to compile your design and testbench files.
You do not have to compile the Altera libraries again.
The EDA Simulation Library Compiler supports only ModelSim SE/PE. It does not
support ModelSim-Altera, because ModelSim-Altera already contains precompiled
libraries.
If you use NativeLink to run the simulation, refer to “Using the NativeLink Feature
with ModelSim-Altera or ModelSim Software” on page 2–70.
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–19
Perform Simulation Using the ModelSim-Altera Software
Use the following instructions to perform an RTL functional simulation for VHDL
designs in the ModelSim-Altera software.
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–20 Chapter 2: Mentor Graphics ModelSim Support
Perform Simulation Using the ModelSim-Altera Software
6. For VHDL designs, if you have not included the libraries’ mapped name in your
design files or sub-files, perform the following steps:
a. Click the Libraries tab.
b. In the Search Libraries text box, click the Add button.
c. Browse to the required pre-compiled library in the ModelSim-Altera software.
You can either click Browse and go to the path <ModelSim-Altera installation
directory>/altera/vhdl/<pre-compiled library> or you can just click the arrow
button to select the <pre-compiled library mapped name>.
Examples of <pre-compiled library> or <pre-compiled library mapped name> are
altera_mf and lpm. The functional RTL simulation libraries are usually
required for performing RTL functional simulation. For the complete set of
libraries, refer to “Pre-Compiled Simulation Libraries in the ModelSim-Altera
Software” on page 2–5.
d. Click OK to add the libraries to the Search Libraries text box.
7. Click OK.
Compile Testbench and VHDL Output File into the Work Library
The following instructions show how you can compile your testbench and *.vho file
into the work library using the ModelSim-Altera GUI.
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–21
Perform Simulation Using the ModelSim-Altera Software
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–22 Chapter 2: Mentor Graphics ModelSim Support
Perform Simulation Using the ModelSim-Altera Software
6. For VHDL designs, if you have not included the libraries’ mapped name in your
design files or sub-files, perform the following steps:
a. Click the Libraries tab.
b. In the Search Libraries text box, click the Add button.
c. Browse to the required pre-compiled library in the ModelSim-Altera software.
You can either click Browse and go to the path <ModelSim-Altera installation
directory>/altera/vhdl/<pre-compiled library> or you can just click the arrow
button to select the <pre-compiled library mapped name>.
Examples of <pre-compiled library> or <pre-compiled library mapped name> are
stratixiii and cycloneiii. The gate-level simulation libraries are usually
required for performing post-synthesis simulation. For the complete set of
libraries, refer to “Pre-Compiled Simulation Libraries in the ModelSim-Altera
Software” on page 2–5.
d. Click OK to add the libraries to the Search Libraries text box.
7. Click OK.
Compile Testbench and VHDL Output File into the Work Library
The following instructions show how you can compile your testbench and *.vho file
into the work library using the ModelSim-Altera GUI.
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–23
Perform Simulation Using the ModelSim-Altera Software
1 You do not have to choose from the Delay list because the Quartus II EDA Netlist
Writer generates the *.sdo file using the same value for the triplet (minimum, typical,
and maximum timing values).
5. Click OK.
6. In the Start Simulation dialog box, click the Design tab. In the Resolution list,
select ps.
7. In the Library list, select and expand the Work library.
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–24 Chapter 2: Mentor Graphics ModelSim Support
Perform Simulation Using the ModelSim-Altera Software
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–25
Perform Simulation Using the ModelSim-Altera Software
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–26 Chapter 2: Mentor Graphics ModelSim Support
Perform Simulation Using the ModelSim-Altera Software
Compile Testbench and Verilog HDL Output File into the Work Library
The following instructions show how you can compile your testbench and Verilog
HDL output file (*.vo) into the work library using the ModelSim-Altera GUI.
To change to the simulation output directory, perform the following steps:
1. In the ModelSim-Altera software, on the File menu, click Change Directory. The
Choose Folder dialog box appears.
2. Browse to the directory where your testbench or *.vo file is located. By default, the
*.vho file is located in <project directory>/simulation/modelsim.
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–27
Perform Simulation Using the ModelSim-Altera Software
3. Click OK.
To create the work library, perform the following steps:
1. In the ModelSim-Altera software, on the File menu, point to New and click
Library. The Create a New Library dialog box appears.
2. Select a new library and a logical mapping to it.
3. In the Library Name box, type the library name Work in the text box.
4. Click OK.
To compile the testbench and Verilog HDL output (*.vo) files into the work library,
perform the following steps:
1. On the Compile menu, click Compile. The Compile Source Files dialog box
appears.
2. Select the library Work. The testbench and Verilog HDL output (*.vo) files should
be compiled into the Work library.
3. Select the testbench and *.vo design files, and click Compile.
4. Click Done.
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–28 Chapter 2: Mentor Graphics ModelSim Support
Perform Simulation Using the ModelSim-Altera Software
Compile Testbench and Verilog HDL Output File into the Work Library
The following instructions show how you can compile your testbench and *.vo file
into the work library using the ModelSim-Altera GUI.
To change to the simulation output directory, perform the following steps:
1. In the ModelSim-Altera software, on the File menu, click Change Directory. The
Choose Folder dialog box appears.
2. Browse to the directory where your testbench or *.vo file is located. By default, the
*.vo file is located in <project directory>/simulation/modelsim.
3. Click OK.
To create the work library, perform the following steps:
1. In the ModelSim-Altera software, on the File menu, point to New and click
Library. The Create a New Library dialog box appears.
2. Select a new library and a logical mapping to it.
3. In the Library Name box, type the library name Work in the text box.
4. Click OK.
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–29
Perform Simulation Using the ModelSim-Altera Software
To compile the testbench and *.vo files into the work library, perform the following
steps:
1. On the Compile menu, click Compile. The Compile Source Files dialog box
appears.
2. Select the library Work. The testbench and *.vo files should be compiled into the
Work library.
3. Select the testbench and *.vo design files, and click Compile.
4. Click Done.
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–30 Chapter 2: Mentor Graphics ModelSim Support
Perform Simulation Using the ModelSim-Altera Software
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–31
Perform Simulation Using the ModelSim-Altera Software
1 To add all signals in your testbench hierarchy, type the following command:
add wave * r
To run the simulation for 100 ps, type the following command:
run 100 ps r
Compile Testbench and VHDL Output File into the Work Library
Before running post-synthesis simulation, generate post-synthesis simulation netlist
files. Refer to the instructions in “Generate Post-Synthesis Simulation Netlist Files” on
page 2–13.
The following instructions show how to compile your testbench and *.vho file into the
work library using the ModelSim-Altera GUI.
To change to the simulation output directory, type the following command:
cd <simulation_output_directory> r
(for example, cd:/designs/modelsim/simulation)
1 This directory contains the *.vho file, which is generated by the netlist writer.
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–32 Chapter 2: Mentor Graphics ModelSim Support
Perform Simulation Using the ModelSim-Altera Software
1 To add all signals in your testbench hierarchy, type the following command:
add wave * r
To run the simulation for 100 ps, type the following command:
run 100 ps r
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–33
Perform Simulation Using the ModelSim-Altera Software
Compile Testbench and VHDL Output File into the Work Library
Before running gate-level simulation, generate gate-level timing simulation netlist
files. Refer to the instructions in “Generate Gate-Level Timing Simulation Netlist
Files” on page 2–14.
The following instructions show how to compile your testbench and *.vho file into the
work library using the ModelSim-Altera GUI.
To change to the simulation output directory, type the following command:
cd <simulation_output_directory> r
(for example, cd:/designs/modelsim/simulation)
1 This directory contains the *.vho file, which is generated by the netlist writer.
1 You do not have to set the value (minimum, average, maximum) for the *.sdo file
because the Quartus II EDA Netlist Writer generates the *.sdo file using the same
value for the triplet (minimum, average, and maximum timing values).
1 If your design under test is instantiated in the testbench file under the i1 label, the
<design instance> should be “i1” (for example, /i1=<my design>.sdo).
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–34 Chapter 2: Mentor Graphics ModelSim Support
Perform Simulation Using the ModelSim-Altera Software
1 To add all signals in your testbench hierarchy, type the following command:
add wave * r
To run the simulation for 100 ps, type the following command:
run 100 ps r
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–35
Perform Simulation Using the ModelSim-Altera Software
1 The <library1> and <library2> variables are the required libraries to compile your
testbench. If you have multiple libraries, use the –L option multiple times in the vsim
command.
1 To add all signals in your testbench hierarchy, type the following command:
add wave * r
To run the simulation for 100 ps, type the following command:
run 100 ps r
Compile Testbench and Verilog Output File into the Work Library
Before running post-synthesis simulation, generate post-synthesis simulation netlist
files. Refer to the instructions in “Generate Post-Synthesis Simulation Netlist Files” on
page 2–13.
The following instructions show how to compile your testbench and *.vo file into the
work library using the ModelSim-Altera software.
To change to the simulation output directory, type the following command:
cd <simulation_output_directory> r
(for example, cd:/designs/modelsim/simulation)
1 This directory contains the *.vo file, which is generated by the netlist writer.
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–36 Chapter 2: Mentor Graphics ModelSim Support
Perform Simulation Using the ModelSim-Altera Software
To compile the testbench and *.v files into the work library, type the following
command:
vlog -work work <my_testbench.v> <my_design_netlists.vo> r
1 The <library1> and <library2> variables are the required libraries to compile your
testbench. Examples of <pre-compiled library> are stratixiii_ver, stratixii_ver, and
stratixiigx_ver. Gate-level libraries are usually required for performing post-synthesis
simulation. If you have multiple libraries, use the -L option multiple times in the
vsim command. For the complete set of libraries, refer to “Pre-Compiled Simulation
Libraries in the ModelSim-Altera Software” on page 2–5.
1 To add all signals in your testbench hierarchy, type the following command:
add wave * r
To run the simulation for 100 ps, type the following command:
run 100 ps r
Compile Testbench and Verilog Output File into the Work Library
Before running gate-level simulation, generate gate-level timing simulation netlist
files. Refer to the instructions in “Generate Gate-Level Timing Simulation Netlist
Files” on page 2–14.
The following instructions show how to compile your testbench and *.vo file into the
work library using the ModelSim-Altera software.
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–37
Perform Simulation Using the ModelSim-Altera Software
1 This directory contains the *.vho file, which is generated by the netlist writer.
1 The <library1> and <library2> variables are the required libraries to compile your
testbench. Examples of pre-compiled libraries are stratixiii_ver, stratixii_ver, and
stratixiigx_ver. Gate-level libraries are usually required for performing gate-level
timing simulation. If you have multiple libraries, use the -L option multiple times in
the vsim command. For the complete set of libraries, refer to “Pre-Compiled
Simulation Libraries in the ModelSim-Altera Software” on page 2–5.
1 To add all signals in your testbench hierarchy, type the following command:
add wave * r
To run the simulation for 100 ps, type the following command:
run 100 ps r
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–38 Chapter 2: Mentor Graphics ModelSim Support
Perform Simulation Using the ModelSim Software
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–39
Perform Simulation Using the ModelSim Software
1 For example, the library name for Altera megafunctions is altera_mf, and the library
name for LPM is lpm. To see all the functional simulation library files, refer to “RTL
Functional Simulation Libraries” on page 2–6.
4. Click OK.
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–40 Chapter 2: Mentor Graphics ModelSim Support
Perform Simulation Using the ModelSim Software
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–41
Perform Simulation Using the ModelSim Software
1 For example, the library name for Stratix III family is stratixiii. To see all the gate-level
timing simulation library files, refer to “Gate-Level Simulation Library Files” on
page 2–10.
4. Click OK.
1 The stratixiii_components.vhd and stratixiii.vhd model files are compiled into the
stratixiii library.
Compile Testbench and VHDL Output File into the Work Library
The following instructions show you how to compile your testbench and *.vho file
into the work library using the ModelSim GUI.
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–42 Chapter 2: Mentor Graphics ModelSim Support
Perform Simulation Using the ModelSim Software
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–43
Perform Simulation Using the ModelSim Software
4. On the Processing menu, point to Run and click Run 100 ps to run the simulation
for 100 ps.
1 For example, the library name for Stratix III family is stratixiii. To see all gate-level
timing simulation library files, refer to “Gate-Level Simulation Libraries” on page 2–6.
4. Click OK.
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–44 Chapter 2: Mentor Graphics ModelSim Support
Perform Simulation Using the ModelSim Software
1 You do not have to choose from the Delay list because the Quartus II EDA
Netlist Writer generates the *.sdo file using the same value for the triplet
(minimum, typical, and maximum timing values).
5. Click OK.
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–45
Perform Simulation Using the ModelSim Software
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–46 Chapter 2: Mentor Graphics ModelSim Support
Perform Simulation Using the ModelSim Software
1 For example, the library name for Altera megafunctions is altera_mf_ver, and the
library name for LPM is lpm_ver. To see all the functional simulation library files,
refer to “RTL Functional Simulation Libraries” on page 2–6.
4. Click OK.
1 The altera_mf.v model files should be compiled into the altera_mf_ver library. The
220model.v model files should be compiled into the lpm_ver library.
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–47
Perform Simulation Using the ModelSim Software
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–48 Chapter 2: Mentor Graphics ModelSim Support
Perform Simulation Using the ModelSim Software
1 For example, the library name for Stratix III family is stratixiii. To see all the gate-level
timing simulation library files, refer to “Gate-Level Simulation Library Files” on
page 2–10.
4. Click OK.
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–49
Perform Simulation Using the ModelSim Software
1 The stratixiii_atoms.v model files should be compiled into the stratixiii_ver library.
Compile Testbench and Verilog Output File into the Work Library
The following instructions show you how to compile your testbench and *.vo into the
work library using the ModelSim GUI.
To create the work library, perform the following steps:
1. In the ModelSim software, on the File menu, point to New and click Library. The
Create a New Library dialog box appears.
2. Select a new library and a logical mapping to it.
3. In the Library Name box, type the library name Work in the text box.
4. Click OK.
To compile the testbench file and *.vo file into the work library, perform the following
steps:
1. On the Compile menu, click Compile. The Compile Source Files dialog box
appears.
2. Select the library Work. The testbench and *.vo file should be compiled into the
Work library.
3. Select the testbench and *.vo design files, and click Compile.
4. Click Done.
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–50 Chapter 2: Mentor Graphics ModelSim Support
Perform Simulation Using the ModelSim Software
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–51
Perform Simulation Using the ModelSim Software
3. In the Library Name box, type the library name of the newly created library.
1 For example, the library name for Stratix III family is stratixiii. To see all the gate-level
timing simulation library files, refer to “Gate-Level Simulation Library Files” on
page 2–10.
4. Click OK.
1 The stratixiii_atoms.v model files should be compiled into the stratixiii_ver library.
Compile Testbench and Verilog Output File into the Work Library
The following instructions show you how to compile your testbench and *.vo file into
the work library using the ModelSim GUI.
To create the work library, perform the following steps:
1. In the ModelSim software, on the File menu, point to New and click Library. The
Create a New Library dialog box appears.
2. Select a new library and a logical mapping to it.
3. In the Library Name box, type the library name Work in the text box.
4. Click OK.
To compile the testbench file and Verilog HDL output file (*.vo) into the work library,
perform the following steps:
1. On the Compile menu, click Compile. The Compile Source Files dialog box
appears.
2. Select the library Work. The testbench and *.vo file should be compiled into the
Work library.
3. Select the testbench and *.vo design files and click Compile.
4. Click Done.
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–52 Chapter 2: Mentor Graphics ModelSim Support
Perform Simulation Using the ModelSim Software
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–53
Perform Simulation Using the ModelSim Software
1 For example, the library name for Altera megafunction is altera_mf, and the library
name for LPM is lpm. To see all the functional simulation library files, refer to “RTL
Functional Simulation Library Files” on page 2–9.
To create simulation libraries for altera_mf, lpm, and altera, type the following
commands:
vlib altera_mf r
vmap altera_mf altera_mf r
vlib lpm r
vmap lpm lpm r
vlib altera r
vmap altera altera r
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–54 Chapter 2: Mentor Graphics ModelSim Support
Perform Simulation Using the ModelSim Software
Example 2–1.
vcom -work altera_mf <Quartus II installation directory> \
/eda/sim_lib/altera_mf_components.v <Quartus II installation directory> \
/eda/sim_lib/altera_mf.vhd r
If you are using the EDA Simulation Library Compiler, skip the steps for creating and
compiling the simulation libraries.
1 To add all signals in your testbench hierarchy, type the following command:
add wave * r
To run the simulation for 100 ps, type the following command:
run 100 ps r
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–55
Perform Simulation Using the ModelSim Software
1 For example, the library name for the Stratix III family is stratixiii. To see all the
gate-level timing simulation library files, refer to “Gate-Level Simulation Libraries”
on page 2–6.
Example 2–2.
vcom -work stratixiii <Quartus II installation directory> \
/eda/sim_lib/stratixiii_atoms_components.vhd <Quartus II installation directory> \
/eda/sim_lib/stratixiii_atoms.vhd r
If you are using the EDA Simulation Library Compiler, skip the steps for creating and
compiling the simulation libraries.
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–56 Chapter 2: Mentor Graphics ModelSim Support
Perform Simulation Using the ModelSim Software
Compile Testbench and VHDL Output Files into the Work Library
The following commands show how to compile your testbench and *.vho file into the
work library using the ModelSim software.
To create the work library, type the following commands:
vlib work r
vmap work work r
To compile the testbench and *.vho file into the work library, type the following
command:
vcom -work work <my_testbench.vhd> <my_design_files.vho> r
1 To add all signals in your testbench hierarchy, type the following command:
add wave * r
To run the simulation for 100 ps, type the following command:
run 100 ps r
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–57
Perform Simulation Using the ModelSim Software
1 For example, the library name for the Stratix III family is stratixiii. To see all the
gate-level timing simulation library files, refer to “Gate-Level Simulation Libraries”
on page 2–6.
Example 2–3.
vcom -work stratixiii <Quartus II installation directory> \
/eda/sim_lib/stratixiii_atoms_components.vhd <Quartus II installation directory> \
/eda/sim_lib/stratixiii_atoms.vhd r
Be sure that the user-compiled libraries are stored using the same path as the design
and testbench files you want to compile.
Compile Testbench and VHDL Output Files into the Work Library
The following commands show how to compile your testbench and *.vho file into the
work library using the ModelSim GUI.
To create the work library, type the following commands:
vlib work r
vmap work work r
To compile the testbench and *.vho file into the work library, type the following
command:
vcom -work work <my_testbench.vht> <my_design_files.vho> r
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–58 Chapter 2: Mentor Graphics ModelSim Support
Perform Simulation Using the ModelSim Software
1 You do not have to set the value (minimum, average, maximum) for the *.sdo file
because the Quartus II EDA Netlist Writer generates the *.sdo file using the same
value for the triplet (minimum, average, and maximum timing values).
1 If your design under test is instantiated in the testbench file under the i1 label, the
<design instance> should be “i1” (for example, /i1=<my design>.sdo).
1 To add all signals in your testbench hierarchy, type the following command:
add wave * r
To run the simulation for 100 ps, type the following command:
run 100 ps r
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–59
Perform Simulation Using the ModelSim Software
1 For example, the library name for Altera megafunction is altera_mf_ver, and the
library name for LPM is lpm_ver. To see all the functional simulation library files,
refer to “RTL Functional Simulation Library Files” on page 2–9.
To create simulation libraries for altera_mf, lpm_ver, and altera_ver, type the
following commands:
vlib altera_mf_ver r
vmap altera_mf altera_mf_ver r
vlib lpm_ver r
vmap lpm lpm_ver r
vlib altera_ver r
vmap altera altera_ver r
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–60 Chapter 2: Mentor Graphics ModelSim Support
Perform Simulation Using the ModelSim Software
1 The <library1> and <library2> variables are the required libraries to compile your
testbench. If you have multiple libraries, use the -L option multiple times in the vsim
command.
1 To add all signals in your testbench hierarchy, type the following command:
add wave * r
To run the simulation for 100 ps, type the following the command:
run 100 ps r
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–61
Perform Simulation Using the ModelSim Software
1 For example, the library name for the Stratix III family is stratixiii_ver. To see all the
gate-level timing simulation library files, refer to “Gate-Level Simulation Libraries”
on page 2–6.
Compile Testbench and Verilog Output Files into the Work Library
The following commands show how to compile your testbench and *.vo file into the
work library using the ModelSim software.
To create the work library, type the following commands:
vlib work r
vmap work work r
To compile the testbench and *.vo file into the work library, type the following
command:
vlog -work work <my_testbench.vt> <my_design_netlists.vo> r
1 The <library1> and <library2> variables are the libraries you compiled previously (for
example, stratixiii or stratixiigx) that are required to compile your testbench.
Gate-level libraries are usually required for performing post-synthesis simulation. If
you have multiple libraries, use the -L option multiple times in the vsim command.
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–62 Chapter 2: Mentor Graphics ModelSim Support
Perform Simulation Using the ModelSim Software
1 To add all signals in your testbench hierarchy, type the following command:
add wave * r
To run the simulation for 100 ps, type the following the command:
run 100 ps r
1 This directory contains the *.vo file, which is generated by the netlist writer.
1 For example, the library name for the Stratix III family is stratixiii_ver. To see all the
gate-level timing simulation library files, refer to “Gate-Level Simulation Libraries”
on page 2–6.
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–63
Perform Simulation Using the ModelSim Software
Compile Testbench and Verilog Output Files into the Work Library
The following commands show how to compile your testbench and *.vo file into the
work library using the ModelSim command line.
To create the work library, type the following commands:
vlib work r
vmap work work r
To compile the testbench and *.vo files into the work library, type the following
command:
vlog -work work <my_testbench.v> <my_design_netlists.vo> r
1 The <library1> and <library2> variables are the libraries you compiled previously (for
example, stratixiii_ver or stratixiigx_ver) that are required to compile your testbench.
Gate-level libraries are usually required for performing gate-level timing
simulation. If you have multiple libraries, use the -L option multiple times in the
vsim command.
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–64 Chapter 2: Mentor Graphics ModelSim Support
Simulating Designs that Include Transceivers
1 To add all signals in your testbench hierarchy, type the following command:
add wave * r
To run the simulation for 100 ps, type the following the command:
run 100 ps r
1 The stratixiigx_mf model file references the lpm and sgate libraries. If you are using
ModelSim PE/SE, you must create these libraries to perform a simulation.
Example 2–4.
vcom -work <my design>.vhd <my testbench>.vhd r
vsim -L lpm -L altera_mf -L sgate -L altgxb work.<my testbench> r
If you are using ModelSim SE/PE, you must compile the necessary libraries before
you can simulate the designs. To compile and simulate the design, type the
commands in Example 2–5 at the ModelSim command prompt.
Example 2–5.
vcom -work altera_mf altera_mf_components.vhd altera_mf.vhd r
vcom -work lpm 220pack.vhd 220model.vhd r
vcom -work sgate sgate_pack.vhd sgate.vhd r
vcom -work altgxb stratixgx_mf.vhd stratixgx_mf_components.vhd r
vcom -work <my design>.vhd <my testbench>.vhd r
vsim -L lpm -L altera_mf -L sgate -L altgxb work.<my testbench> r
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–65
Simulating Designs that Include Transceivers
Example 2–6.
vlog -work <my design>.v <my testbench>.v r
vsim -L lpm_ver -L altera_mf_ver -L sgate_ver -L altgxb work.<my testbench> r
If you are using ModelSim SE/PE, you must compile the necessary libraries before
you can simulate the designs. To compile and simulate the design, type the
commands in Example 2–7 at the ModelSim command prompt.
Example 2–7.
vlib work_ver r
vlib lpm_ver r
vlib altera_mf_ver r
vlib sgate_ver r
vlib altgxb_ver r
vlog -work lpm_ver 220model.v r
vlog -work altera_mf_ver altera_mf.v r
vlog -work sgate_ver sgate.v r
vlog -work altgxb_ver stratixgx_mf.v r
vlog -work <my design>.v <my testbench>.v r
vsim -L lpm_ver -L sgate_ver-L altgxb_ver work.<my testbench> r
1 The stratixgx_hssi_atoms model file references the lpm and sgate libraries. If you are
using ModelSim PE/SE, you must create these libraries to perform a simulation.
Example 2–8.
vcom -work <my design>.vho <my testbench>.vhd r
vsim -L lpm -L altera_mf -L sgate -L stratixgx -L stratixgx_gxb \
-sdftyp <design instance>=<path to .sdo file>.sdo work.<my testbench> \
-t ps - +transport_int_delays+transport_path_delays r
If you are using ModelSim SE/PE, you must compile the necessary libraries before
you can simulate the designs. To compile and simulate the design, type the
commands in Example 2–9 at the ModelSim command prompt.
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–66 Chapter 2: Mentor Graphics ModelSim Support
Simulating Designs that Include Transceivers
Example 2–9.
vcom -work lpm 220pack.vhd 220model.vhd r
vcom -work altera_mf altera_mf_components.vhd altera_mf.vhd r
vcom -work sgate sgate_pack.vhd sgate.vhd r
vcom -work stratixgx stratixgx_atoms.vhd stratixgx_components.vhd r
vcom -work stratixgx_gxb stratixgx_hssi_atoms.vhd \
stratixgx_hssi_components.vhd r
vcom -work <my design>.vho <my testbench>.vhd r
vsim -L lpm -L altera_mf -L sgate -L stratixgx -L stratixgx_gxb \
-sdftyp <design instance>=<path to .sdo file>.sdo work.<my testbench> \
-t ps +transport_int_delays +transport_path_delays r
Example 2–10.
vlog -work <my design>.vo <my testbench>.v r
vsim -L lpm_ver -L altera_mf_ver -L sgate_ver -L stratixgx_ver -L \
stratixgx_gxb_ver work.<my testbench> -t ps +transport_int_delays \
+transport_path_delays r
If you are using ModelSim SE/PE, you must compile the necessary libraries before
you can simulate the designs. To compile and simulate the design, type the
commands in Example 2–11 at the ModelSim command prompt.
Example 2–11.
vlog -work lpm_ver 220model.v r
vlog -work altera_mf_ver altera_mf.v r
vlog -work sgate_ver sgate.v r
vlog -work stratixgx_ver stratixgx_atoms.v r
vlog -work stratixgx_gxb_ver stratixgx_hssi_atoms.v r
vlog -work <my design>.vo <my testbench>.v r
vsim -L lpm_ver -L altera_mf_ver -L sgate_ver -L stratixgx_ver \
-L stratixgx_gxb_ver work.<my testbench> -t ps +transport_int_delays \
+transport_path_delays r
1 The stratixiigx_hssi_atoms model file references the lpm and sgate libraries. If you
are using ModelSim PE/SE, you must create these libraries to perform a simulation.
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–67
Simulating Designs that Include Transceivers
Example 2–12.
vcom -work work <alt2gxb entity name>.vho r
vcom -work <my design>.vhd <my testbench>.vhd r
vsim -L lpm -L altera_mf -L sgate -L stratixgx_hssi work.<my design> r
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–68 Chapter 2: Mentor Graphics ModelSim Support
Simulating Designs that Include Transceivers
If you are using ModelSim SE/PE, you must compile the necessary libraries before
you can simulate the designs. To compile and simulate the design, type the
commands in Example 2–13 at the ModelSim command prompt.
Example 2–13.
vcom -work lpm 220pack.vhd 220model.vhd r
vcom -work altera_mf altera_mf_components.vhd altera_mf.vhd r
vcom -work sgate sgate_pack.vhd sgate.vhd r
vcom -work stratixiigx_hssi stratixiigx_hssi_components.vhd \
stratixiigx_hssi_atoms.vhd r
vcom -work work <alt2gxb entity name>.vho r
vcom -work <my design>.vhd <my testbench>.vhd r
vsim -L lpm -L altera_mf -L sgate -L stratixgx_hssi work.<my testbench> r
Example 2–14.
vlog -work work <alt2gxb module name>.vo r
vlog -work <my design>.v <my testbench>.v r
vsim -L lpm_ver -L altera_mf_ver -L sgate_ver -L stratixgx_hssi_ver \
work.<my testbench> r
If you are using ModelSim SE/PE, you must compile the necessary libraries before
you can simulate the designs. To compile and simulate the design, type the
commands in Example 2–15 at the ModelSim command prompt.
Example 2–15.
vlog -work lpm_ver 220model.v r
vlog -work altera_mf_ver altera_mf.v r
vlog -work sgate_ver sgate.v r
vlog -work stratixiigx_hssi_ver stratixiigx_hssi_atoms.v r
vlog -work work <alt2gxb module name>.vo r
vlog -work <my design>.v <my testbench>.v r
vsim -L lpm_ver -L altera_mf_ver -L sgate_ver -L stratixgx_hssi_ver \
work.<my testbench> r
1 The stratixiigx_hssi_atoms model file references the lpm and sgate libraries. If you
are using ModelSim PE/SE, you must create these libraries to perform a simulation.
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–69
Simulating Designs that Include Transceivers
Example 2–16.
vcom -work <my design>.vho <my testbench>.vhd r
vsim -L lpm -L altera_mf -L sgate -L stratixiigx -L stratixiigx_hssi \
-sdftyp <design instance>=<path to .sdo file>.sdo work.<my testbench> \
-t ps +transport_int_delays +transport_path_delays r
If you are using ModelSim SE/PE, you must compile the necessary libraries before
you can simulate the designs. To compile and simulate the design, type the
commands in Example 2–17 at the ModelSim command prompt.
Example 2–17.
vcom -work lpm 220pack.vhd 220model.vhd r
vcom -work altera_mf altera_mf_components.vhd altera_mf.vhd r
vcom -work sgate sgate_pack.vhd sgate.vhd r
vcom -work stratixiigx stratixiigx_atoms.vhd \
stratixiigx_components.vhd r
vcom -work stratixiigx_hssi stratixiigx_hssi_components.vhd \
stratixiigx_hssi_atoms.vhd r
vcom -work <my design>.vho <my testbench>.vhd r
vsim -L lpm -L altera_mf -L sgate -L stratixiigx -L stratixiigx_hssi \
-sdftyp <design instance>=<path to .sdo file>.sdo work.<my testbench> \
-t ps +transport_int_delays +transport_path_delays r
Example 2–18.
vlog -work <my design>.vo <my testbench>.v r
vsim -L lpm_ver -L altera_mf_ver -L sgate_ver -L stratixiigx_ver \
-L stratixiigx_hssi_ver work.<my testbench> -t ps \
+transport_int_delays +transport_path_delays r
If you are using ModelSim SE/PE, you must compile the necessary libraries before
you can simulate the designs. To compile and simulate the design, type the
commands in Example 2–19 at the ModelSim command prompt.
Example 2–19.
vlog -work lpm_ver 220model.v r
vlog -work altera_mf_ver altera_mf.v r
vlog -work sgate_ver sgate.v r
vlog -work stratixiigx_ver stratixiigx_atoms.v r
vlog -work stratixiigx_hssi_ver stratixiigx_hssi_atoms.v r
vlog -work <my design>.vo <my testbench>.v r
vsim -L lpm_ver -L altera_mf_ver -L sgate_ver -L stratixiigx_ver \
-L stratixiigx_hssi_ver work.<my testbench> -t ps \
+transport_int_delays +transport_path_delays r
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–70 Chapter 2: Mentor Graphics ModelSim Support
Using the NativeLink Feature with ModelSim-Altera or ModelSim Software
Transport Delays
By default, the ModelSim software filters out all pulses that are shorter than the
propagation delay between primitives. Turning on the transport delay options in the
ModelSim software prevents the simulation tool from filtering out these pulses. Use
the following options to ensure that all signal pulses are seen in the simulation results.
+transport_path_delays
Use this option when the pulses in your simulation are shorter than the delay within a
gate-level primitive.
+transport_int_delays
Use this option when the pulses in your simulation are shorter than the interconnect
delay between gate-level primitives.
The +transport_path_delays and +transport_int_delays options are also used by
default in the NativeLink feature for gate-level timing simulation.
f For more information about either of these options, refer to the ModelSim-Altera
Command Reference installed with the ModelSim software.
The following ModelSim software command shows the command line syntax to
perform a gate-level timing simulation with the device family library:
vsim -t 1ps -L stratixii -sdftyp /i1=filtref_vhd.sdo work.filtref_vhd_vec_tst \
+transport_int_delays +transport_path_delays
Setting Up NativeLink
To run ModelSim automatically from the Quartus II software using the NativeLink
feature, you must specify the path to your simulation tool by performing the
following steps:
1. On the Tools menu, click Options. The Options dialog box appears.
2. In the Category list, select EDA Tool Options.
3. Double-click the entry under Location of executable beside the name of your EDA
Tool.
4. Type or browse to the directory containing the executables of your EDA tool.
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–71
Using the NativeLink Feature with ModelSim-Altera or ModelSim Software
1 For ModelSim-Altera software and ModelSim SE/PE, executable files are stored in the
win32aloem and win32 directories, respectively.
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–72 Chapter 2: Mentor Graphics ModelSim Support
Using the NativeLink Feature with ModelSim-Altera or ModelSim Software
4. If your design is written entirely in Verilog HDL or VHDL, the NativeLink feature
automatically chooses the correct language and Altera simulation libraries. If your
design is written with mixed languages, the NativeLink feature uses the default
language specified in the Format for output netlist list. To change the default
language when there is a mixed language design, under EDA Netlist Writer
options, in the Format for output netlist list, select VHDL or Verilog. Table 2–12
shows the design languages for output netlists and simulation models.
1 For mixed language simulation, choose the same language that was used to
generate your megafunctions to ensure correct parameter passing between
the megafunctions and the Altera libraries. For example, if your
ALTSYNCRAM megafunction was generated in VHDL, choose VHDL as
the format for the output netlist.
1 For more information about the EDA Simulation Library Compiler, refer to
“Compile Libraries Using the EDA Simulation Library Compiler” on
page 2–17.
7. Click OK.
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–73
Using the NativeLink Feature with ModelSim-Altera or ModelSim Software
8. On the Processing menu, point to Start and click Start Analysis & Elaboration to
perform an Analysis and Elaboration. This command collects all your file name
information and builds your design hierarchy in preparation for simulation.
9. On the Tools menu, point to Run EDA Simulation Tool and click EDA RTL
Simulation to automatically run ModelSim, compile all necessary design files, and
complete a simulation.
10. If you want to run ModelSim in command-line mode when running it
automatically after full compilation, perform the following steps:
a. On the Simulation page, click More NativeLink Settings. The More
NativeLink Settings dialog box appears.
b. Under Existing option settings, click Launch third-party EDA tool in
command-line mode.
c. In the Setting field, select On.
d. Click OK.
11. If you want to generate only the .do script without launching ModelSim during
the NativeLink process, you can perform the following steps:
a. On the Simulation page, click More NativeLink Settings. The More
NativeLink Settings dialog box appears.
b. Under Existing option settings, click Generate third-party EDA tool
command scripts without running the EDA tool.
c. In the Setting field, select On.
If you turn this option on and run NativeLink, the .do file for ModelSim
simulation is generated without launching ModelSim. You can then run the
simulation by typing the following command:
do <your_design_name>_run_msim_rtl_level_<verilog/vhdl>.do
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–74 Chapter 2: Mentor Graphics ModelSim Support
Using the NativeLink Feature with ModelSim-Altera or ModelSim Software
6. If you have testbench files or macro scripts, enter the information under
NativeLink settings.
7. If you have compiled libraries using the EDA Simulation Library Compiler,
perform the following steps:
a. On the Simulation page, click More EDA Netlist Writer Settings. The More
EDA Netlist Writer Settings dialog box appears.
b. Under Existing option settings, click Location of user compiled simulation
library.
c. In the Setting field, type the path that contains the pre-compiled libraries that
are generated from the EDA Simulation Library Compilation tool; for example,
c:<design_path>/simulation/modelsim.
8. Click OK.
9. On the Processing menu, point to Start and click Start EDA Netlist Writer to
generate a simulation netlist of your design.
1 If you must run full compilation after you set the EDA Tool Settings, the
Start EDA Netlist Writer command is not required.
10. On the Tools menu, point to Run EDA Simulation Tool and click EDA Gate Level
Simulation to automatically run ModelSim, compile all necessary design files, and
complete a simulation.
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–75
Using the NativeLink Feature with ModelSim-Altera or ModelSim Software
12. If you want to generate only the .do script without launching ModelSim during
the NativeLink process, you can perform the following steps:
a. On the Simulation page, click More NativeLink Settings. The More
NativeLink Settings dialog box appears.
b. Under Existing option settings, click Generate third-party EDA tool
command scripts without running the EDA tool.
c. In the Setting field, select On.
If you turn this option on and run the NativeLink, the .do file for the simulation
process is generated without showing the results in the GUI. You can then run the
simulation by typing the following command:
do <your_design_name>_run_msim_rtl_level_<verilog/vhdl>.do
Setting Up a Testbench
You can use NativeLink to compile your design files and testbench files, and run an
EDA simulation tool to automatically perform a simulation.
To set up NativeLink for simulation, perform the following steps:
1. On the Assignments menu, click Settings. The Settings dialog box appears.
2. In the Category list, click the “+” icon to expand EDA Tool Settings and select
Simulation. The Simulation page appears.
3. Under NativeLink settings, select None, Compile test bench, or Script to
compile test bench (Table 2–13).
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–76 Chapter 2: Mentor Graphics ModelSim Support
Using the NativeLink Feature with ModelSim-Altera or ModelSim Software
4. If you select Compile test bench, select your testbench setup from the Compile
test bench list. You can use different testbench setups to specify different test
scenarios. If there are no testbench setups entered, create a testbench setup by
performing the following steps:
a. Click Test Benches. The Test Benches dialog box appears.
b. Click New. The New Test Bench Settings dialog box appears.
c. In the Test Bench name box, type in the testbench setup name that identifies
the different testbench setups.
d. In the Test level module box, type in the top-level testbench entity name. For
example, for a Quartus II-generated VHDL testbench, type in <Vector Waveform
File name>_vhd_vec_tst.
e. In the Instance box, type in the full instance path to the top level of your FPGA
design. For example, for a Quartus II-generated VHDL testbench, type in i1.
f. Under Simulation period, select Run simulation until all vector stimuli are
used or specify the end time of the simulation.
g. Under Test bench files, browse and add all your testbench files in the File
name box. Use the Up and Down button to reorder your files. The script used
by NativeLink compiles the files in order from top to bottom.
1 You can also specify the library name and HDL version to compile the
testbench file. NativeLink compiles the testbench to a library name using
the specified HDL version.
h. Click OK.
i. In the Test Benches dialog box, click OK.
5. Under NativeLink settings, turn on Use script to set up simulation and browse to
your script. Your script is executed to set up and run simulation after loading the
design using the vsim command.
6. If you choose Script to compile test bench, browse to your script and click OK.
Creating a Testbench
In the Quartus II software, you can create a Verilog HDL or VHDL testbench from a
Vector Waveform File. The generated testbench includes the behavior of the input
stimulus and applies it to your instantiated top-level FPGA design.
1. On the File menu, click Open. The Open dialog box appears.
2. Click the Files of type arrow and select Waveform/Vector Files. Select your Vector
Waveform File.
3. Click Open.
4. On the File menu, click Export. The Export dialog box appears.
5. Click the Save as type arrow and select VHDL Test Bench File (*.vht) or Verilog
Test Bench File (*.vt).
6. Turn on Add self-checking code to file to check your simulation results against
your Vector Waveform File.
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–77
Using the NativeLink Feature with ModelSim-Altera or ModelSim Software
7. Click Export. Your VHDL or Verilog HDL testbench file is generated in your
project directory.
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–78 Chapter 2: Mentor Graphics ModelSim Support
Generating a Timing VCD File for PowerPlay
f For more information about using the timing *.vcd file for power estimation, refer to
the PowerPlay Power Analysis chapter in volume 3 of the Quartus II Handbook.
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–79
Scripting Support
7. On the Add menu, click Wave and then click Selected Signals.
You cannot view a waveform from a .vcd file in ModelSim directly. The .vcd file must
first be converted to a .wlf file.
1. Use the vcd2wlf command to convert the file. For example, type the following on
a command-line:
vcd2wlf <example>.vcd <example>.wlf r
2. After you convert the .vcd file to a .wlf file, follow the procedures for viewing a
waveform from a .wlf file through ModelSim.
You can also convert your .wlf file to a .vcd file by using the wlf2vcd command.
Scripting Support
You can run procedures and create settings described in this chapter in a Tcl script.
You can also run some procedures at the command line prompt.
f For more information about Tcl scripting, refer to the Tcl Scripting chapter in volume 2
of the Quartus II Handbook.
f For more information about command line scripting, refer to the Command Line
Scripting chapter in volume 2 of the Quartus II Handbook.
For detailed information about scripting command options, refer to the Qhelp
command line and Tcl API help browser. To access this information, type the
following command to start the Qhelp browser:
quartus_sh --qhelp r
Tcl Commands
Use the following Tcl commands to set the output format to Verilog HDL, the
simulation tool to ModelSim for Verilog HDL, and to generate a functional netlist:
set_global_assignment-name EDA_SIMULATION_TOOL "ModelSim (Verilog)" r
set_global_assignment-name EDA_GENERATE_FUNCTIONAL_NETLIST ON r
Command Prompt
Use the following command to generate a simulation output file for the ModelSim
simulator. Specify VHDL or Verilog HDL for the format:
quartus_eda <project name> --simulation=on --format=<format> \
--tool=ModelSim --functional r
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–80 Chapter 2: Mentor Graphics ModelSim Support
Software Licensing and Licensing Setup in ModelSim-Altera Subscription
Tcl Commands
Use one of the following Tcl commands:
■ set_global_assignment -name EDA_SIMULATION_TOOL \
"ModelSim-Altera (Verilog)" r
■ set_global_assignment -name EDA_SIMULATION_TOOL \
"ModelSim-Altera (VHDL)" r
■ set_global_assignment -name EDA_SIMULATION_TOOL \
"ModelSim (Verilog)" r
■ set_global_assignment -name EDA_SIMULATION_TOOL \
"ModelSim (VHDL)" r
Command Line
Generate a simulation output file for the ModelSim simulator by specifying VHDL or
Verilog HDL for the format by typing the following command at the command
prompt:
quartus_eda <project name> --simulation=on --format=<format> \
--tool=ModelSim r
1 The USB software guard is not supported by versions earlier than Mentor Graphics
ModelSim software 5.8d.
You can obtain a license for the ModelSim-Altera Subscription Edition software from
the Altera website at www.altera.com. Get licensing information for the
Mentor Graphics ModelSim software directly from Mentor Graphics. Refer to
Figure 2–4 for the set-up process.
1 For ModelSim-Altera software versions prior to 5.5b, use the PCLS utility included
with the software to set up the license.
For the Quartus II software version 8.1 and later, the no-cost entry level of the
ModelSim-Altera software does not require a license file. However, you must request
a license file to use the ModelSim-Altera Subscription Edition software.
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–81
Conclusion
Start
Initial Installation
Using
the ModelSim-Altera yes
Starter Edition
software?
no
no
End
LM_LICENSE_FILE Variable
Altera recommends setting the LM_LICENSE_FILE environment variable to the
location of the license file. For example, the value for the LM_LICENSE_FILE
environment variable should point to <path to license file>\license.dat.
f For more information about setting up the license for ModelSim-Altera Subscription
Edition software, refer to AN 340: Altera Software Licensing.
Conclusion
Using the ModelSim and ModelSim-Altera simulation software within the Altera
FPGA design flow enables Altera software users to easily and accurately perform RTL
functional simulations, post-synthesis simulations, and gate-level simulations on their
designs. Proper verification of designs at the functional, post-synthesis, and post
place-and-route stages using the ModelSim and ModelSim-Altera software helps
ensure design functionality and success and, ultimately, a quick time-to-market.
Referenced Documents
This chapter references the following documents:
■ AN 340: Altera Software Licensing
■ Command Line Scripting chapter in volume 2 of the Quartus II Handbook
■ PowerPlay Power Analysis chapter in volume 3 of the Quartus II Handbook
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–82 Chapter 2: Mentor Graphics ModelSim Support
Document Revision History
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation
Chapter 2: Mentor Graphics ModelSim Support 2–83
Document Revision History
f For previous versions of the Quartus II Handbook, refer to the Quartus II Handbook
Archive.
© March 2009 Altera Corporation Quartus II Handbook Version 9.0 Volume 3: Verification
2–84 Chapter 2: Mentor Graphics ModelSim Support
Document Revision History
Quartus II Handbook Version 9.0 Volume 3: Verification © March 2009 Altera Corporation