Recently, I made an IP Core debugging, But it called the syncram of Altera. In this way, Modelsim cannot be directly simulated, while quartuⅱ does not support the simulation of tesbbench, therefore, to simulate in Modelsim, you must add these simulation libraries of Altera to ModelSim.
Generally, the simulation library provided by Quartus needs to be added to Modelsim for simulation. The reasons are as follows:
· Quartus does not support testbench;
· Calls the Altera functions such as megafunction or LPM library;
· Time series simulation should be performed under ModelSim.
The following uses the Altera device as an example to describe how to add the simulation library of Altera to Modelsim. The simulation library of Altera is included in the Quartus II software.
Compile Modelsim as follows:
1. Set the simulation LIBRARY PATH
Open the Modelsim installation directory (I used Modelsim se 6.2 and installed it under the D: \ Modelsim \ installfiles directory), and create a folder named Altera, in this directory, we store various pre-compiled Altera libraries.
Start Modelsim se 6.2 and run the [file]/[Change directory] command in the main window to transfer the path to the Altera folder. Or run cd d:/Modelsim/installfiles/Altera in the command line.
2. Create a database
The path for storing the simulation library file provided in Quartus II is .. \ Altera \ 80 \ Quartus \ EDA \ sim_lib. Each library file provides two forms:. V (OpenGL)
And. vhd (VHDL. The files used to compile the resource library include 220model. V, 220model. vhd, 220pack. vhd, altera_mf.v, altera_mf.vhd, altera_mf_components.vhd, altera_primitives.vhd, and ultimate. Many tutorials on the Internet compile these files together, which is applicable to the mixed simulation of using both the language and the language. However, if you only use one language, such as the language, you do not need to compile all the files. The following uses altera_mf.v in this directory as an example to describe how to create a pre-compiled library.
Note: The simulation library in Modelsim can be divided into two categories: the first category is the working, and the default value is the "work" directory, the work directory contains all the compiled design units in the current project. A work library must be created before compilation, and each compilation has only one work library. The second class is the resource library ), stores design units that can be referenced by the current compilation. Multiple resource libraries are allowed during compilation.
In the main window, select file/New/library to create a new database named altera_mf.
3. Compile the library
To facilitate the creation of the Directory Src in the Altera folder, copy the files used to compile the resource library to the SRC folder.
Select the "compile"/"compile" command in the main menu. The "compile source files" dialog box is displayed. Select the name of the database you just created in the library.
Select the altera_mf.v file for the range. You copied it to the directory... \ Altera \ SRC. Execute the compilation command.
Add the remaining databases as described in steps 2 and 3. As shown in.
4. Configure the ModelSim. ini file
This step is to add the previously created Library to the system library, and you do not need to add it again later.
Remove the read-only attribute of the configuration file ModelSim. ini under the root directory of Modelsim, and open it with notepad or other text editing programs. Under [library], modify the previous
Path of the added library. Make sure to disable the modification and change it back to the read-only attribute.
Note: the path of the simulation library set in step 1 must be in the installation directory of Modelsim before the relative path can be created.
Altera_primitives = $ model_tech/../Altera/altera_primitives
220 model = $ model_tech/../Altera/220 Model
Altera_mf = $ model_tech/../Altera/altera_mf
5. Add the Intel underlying hardware primitive simulation Library (atom)
During time series simulation, the simulation Library (atom) corresponding to the underlying hardware primitives of the specific Altera device must be loaded ).
The preceding three resource library files are compiled: 220model. V, altera_mf.v, and altera_primitives.v. Based on the specific device model we selected, we will continue to compile the required device base-level primitive simulation library file. For example, we chose to use cycloneii, So we compiled cycloneii_atoms.v.
In addition, during simulation, you must add the compiled libraries to the current project to call the related LPM cores. The operations are as follows: in the libraries column of the Start simulation window, add,
Then, select the top-level entity of the current project in the Work directory for simulation.
If you want to perform time series simulation, you should also add the. SDO latency file in the SDF column.