Recently playing Altera FPGA, when I use Quartus II comes with the IP core generated ROM, there are various problems, so in the online various search data, finally solved my problem. Here to do a summary, to facilitate their future inspection.
Quartus II and Ise have some differences in simulation and initialization, here's a brief introduction to the initialization and simulation steps for both: 1. Create and emulate ROM with Quartus II
STEP1: Generate a ROM under Quatus II project
STEP2: Writing a. mif file as a ROM initialization file
STEP3: Copy the. mif file to the Modelsim project
STEP4: Perform Modelsim simulation
Initialization file. mif file writing needs to follow a certain format, a lot of articles are introduced, I also summarize here: initialization files generally have a. hex file and a. mif file, but generally it is written with a text file initialized data, and then the suffix to. MIF, which is easy to use, it is more widely used. start by looking at the contents of a simple MIF file (you can open the MIF file with Notepad and see the code inside):
depth=256; The vertical capacity of the memory is the number of data stored, in this case 256
width=8; The horizontal width of the% memory is the number of bits per data, 8 bits wide
Address_radix=dec; % set Address base value (actual is the address with what number of binary representation) can be set to Bin (binary), OCT (octal), DEC (decimal), Hex (hex)
Data_radix=dec; % Set Data base value Ibid.
The address and data values in the% data area are consistent with the values set here, that is, if you set the
%dec then, the address and data of the data area are expressed in decimal.
CONTENT% Start Data area
BEGIN
0:0; % front is address, followed by data, all in decimal notation (Dec above)
1:1;
...% if expressed as such [0..255]:10; This means that from 0 to 255 are data 10.
255:255;
END; % End
2. Create and emulate ROM with Ise
STEP1: Generate a ROM under ISE engineering
STEP2: Writing the. Coe file as the initialization file for the ROM
This step differs from Quartus II because the initialization file for the ROM in Quartus II is. MIF or. Hex, and the initialization file for the ROM in the Ise is a. Coe file, so you need to write a. coe file. The format of the. Coe file is simple, Here is the contents of a. Coe file:
memory_initialization_radix=16; The data format that represents the ROM content is 16 binary
Memory_initialization_vector=
0a,
0b,
0c; Each data is separated by a comma or a space or line break, and the last data is followed by a semicolon
STEP3: A. mif file is generated when the ROM is instantiated with the core generator, which is the initialization file required by Modelsim for ROM emulation and copies the. mif file to the Modelsim project.
STEP4: Perform Modelsim simulation
Some summary of the initialization and emulation of ROM in Quartus and Ise