Some summary about the initialization and simulation of ROM in Quartus and ISE

Some summary about the initialization and simulation of ROM in Quartus and ISE

Recently, I was playing with Altera's FPGA. When I used the IP core that comes with the Quartus II to generate the ROM, there were various problems, so I searched various information on the Internet and finally solved my problem. Here is a brief summary for future reference.

There are some differences between Quartus II and ISE in simulation and initialization. Here is a brief introduction to the initialization and simulation steps of the two: 1. Create and simulate ROM with Quartus II

    Step1: Generate a ROM under the Quatus II project

 

    Step2: Write a .mif file as the initialization file of the ROM

    Step3: Copy the .mif file to the Modelsim project

    Step4: Perform Modelsim simulation

The initialization file .mif file needs to be written in a certain format. Many articles have introduced it. I will also summarize it here: The initialization file generally includes a .hex file and a .mif file, but the initialization data is generally written in a text file. Then change the suffix to .mif, which is simple and convenient, so it is widely used. First look at the content 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 how much data is stored, in this case it is 256

WIDTH=8 ; % The horizontal width of the memory is how many bits of each data, 8 bits wide

ADDRESS_RADIX=DEC ; % Set the base value of the address (actually, what hexadecimal number is used for the address) It can be set to BIN (binary), OCT (octal), DEC (decimal), HEX (hexadecimal)

DATA_RADIX=DEC ; % set the data base value as above

The address and data value in the % data area should be consistent with the value set here, that is, if set here

%DEC Then, the address and data of the data area should be expressed in decimal.

CONTENT % start data area

BEGIN

       0:0; % is preceded by the address, followed by the data, both expressed in decimal (DEC above)

       1:1;     

……% If it is expressed as this [0..255]:10; it means that from 0 to 255 are all data 10.

      255:255;

END; % end

2. Create and emulate ROM with ISE

    Step1: Generate a ROM under the ISE project

 

    Step2: Write the .coe file as the initialization file of the ROM

 

    This step is different from Quartus II, because the initialization file of ROM in Quartus II is .mif or .hex, while the initialization file of ROM in ISE is .coe file, so you need to write .coe file. The format of the .coe file is very simple. The following is the content of a .coe file:

 

    MEMORY_INITIALIZATION_RADIX=16; //The data format of the ROM content is hexadecimal
    MEMORY_INITIALIZATION_VECTOR=

 

    0a,      
    0b,
    0c; //Separate each data with a comma or space or newline, and add a semicolon after the last data

 

    Step3: After the ROM is instantiated with Core Generator, a .mif file will be generated, which is the initialization file required by Modelsim for ROM simulation. Copy the .mif file to the Modelsim project.

 

    Step4: Perform Modelsim simulation

Reprinted from: https://www.cnblogs.com/geekite/p/5040642.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324748056&siteId=291194637