Simulation in Modelsim requires the addition of a simulation library provided by Quartus, due to the following three areas:
· Quartus does not support testbench;
• Called Altera functions such as megafunction or the LPM library;
• Timing simulation is done under Modelsim.
The following is an example of Altera devices, how to add Altera's simulation library in Modelsim, Quartus II software with the Altera simulation library, just take it to Modelsim to compile a bit, the steps are as follows:
1. Set the Emulation library path
Open the Modelsim installation directory (I use the Modelsim SE 6.5 version, installed in the D:\ModelSim_6.5b directory), new folder Altera, we are in this directory to store pre-compiled various Altera libraries.
Start Modelsim SE 6.5, and execute the "File"/"Change Directory" command in the main window to move the path to the Altera folder. Or, execute CD d:/modelsim_6.5b/altera on the command line.
2. Create a new library
The path to the simulation library files provided in Quartus II is ... \altera\91\quartus\eda\sim_lib, each library file provides two forms:. V (Verilog) format and. VHD (VHDL) format, Choose to use it according to the language you are using. The files used to compile the repository are 220model.v, 220model.vhd,220pack.vhd,altera_mf.v, altera_mf.vhd,altera_mf_ Components.vhd,altera_primitives.v, altera_primitives.vhd,altera_primitives_components.vhd file. Many of the online tutorials are compiled with these files, which is suitable for Verilog and VHDL mixed simulations, but if only one language, such as Verilog, is completely unnecessary to compile. The following is an example of how to build a precompiled library using ALTERA_MF.V in this directory.
Note: Modelsim in the simulation library can be divided into two categories: the first class is the work library (working), the default is the "working" directory, the Works directory contains all the compiled design units under the current project, the compilation must be built before a job library, and each compiled and only one work library The second class is the resource pool (Resource), which stores the design units that can be referenced by the current compilation and allows multiple resource libraries during compilation.
Select the "File"/"New"/"library" command in the main window and create a new one named ALTERA_MF.
3. Compiling the Library
For convenience, create a new directory src under the Altera folder, and copy the files used to compile the repository into the SRC folder.
Select "Compile"/"Compile" command in the main menu, pop up the Compile Source Files dialog box, choose the library name you just created ALTERA_MF, look for the scope you choose Altera_ MF.V file, just now you have copied it to the ... \altera\src directory. Executes the compile command.
Continue to add the remaining libraries according to the methods described in steps 2 and 3. After the add is complete as shown.
4. Configuring the Modelsim.ini File
This step is to add the previously created library to the system library, and you will not have to add it again later.
Modelsim the read-only attribute of the configuration file Modelsim.ini under the root of the installation is removed and opened with Notepad or another text-editing program. Under [library], modify the path of the previously added library. Note the changes are turned off and changed back to the read-only property.
Note: The emulation library path set in the 1th step must be in the Modelsim installation directory in order for the business to be able to this relative path.
Altera_primitives = $MODEL _tech/. /altera/altera_primitives
220model = $MODEL _tech/. /altera/220model
ALTERA_MF = $MODEL _tech/. /altera/altera_mf
5. Add altera underlying hardware primitive emulation library (ATOM)
In time-series simulations, you must load the emulation library (ATOM) of the underlying hardware primitives that correspond to the specific Altera devices used.
The above compiled Altera three repository files: 220MODEL.V,ALTERA_MF.V,ALTERA_PRIMITIVES.V, after compilation passed. Based on the specific device model we have chosen, we continue compiling the underlying primitives for the device we need, such as the cycloneii we chose to use, so we compiled the CYCLONEII_ATOMS.V.
Of course, in the specific simulation, but also pay attention to these compiled simulation library added to the current project, specifically: Open the Start Simulation window, the relevant simulation library add in the libraries bar, and then you can be related to the simulation.
For timing simulations, you should also add the associated. SDO delay file to the SDF column and then simulate it.
Add Alter Library to Modesim (or compile the library file into the emulation folder each time you simulate)