Generating ROM Data for MAX+plusII

When generating an internal ROM in an Altera FPGA, the memory contents can be specified in a Memory Initialization File (.mif). The format is shown here and also available (rom8x8.mif) as a starting point. This file is used with the Megawizard Plug-in Manager to create a ROM module to instantiate in a design.
-- MEMORY INITIALIZATION FILE 
-- EXAMPLE DATA FOR AN 8x8 ROM

WIDTH = 8;  % WIDTH OF OUTPUT IS REQUIRED, ENTER A DECIMAL VALUE %
DEPTH = 8;  % DEPTH OF MEMORY IS REQUIRED, ENTER A DECIMAL VALUE %

ADDRESS_RADIX = HEX;  % Address and data radixes are optional, default is hex %
DATA_RADIX = HEX;     % Valid radixes = BIN,DEC,HEX or OCT  %

CONTENT BEGIN
        0       :       07;  % ADDRESS :  VALUE %
        1       :       06;
        2       :       05;
        3       :       04;
        4       :       03;
        5       :       02;
        6       :       01;
        7       :       00;
END;

-- SHORTCUTS FOR SPECIFYING CONTENTS 
--   [0..FF]    :       0;   % Range--Every address from 0 to FF = 0%
--      D       :       7;      % Single address--Address D = 7 %
--      6       :       9 C 8;  % Range starting from specific address--%
-- If there are multiple values for the same address only the last value is used

To generate a ROM module using this example in MAX+plusII:

File->MegaWizard Plug-In Manager

Select "Create a new custom megafunction variation"

Click Next

Select Verilog HDL

Select storage-> LPM_ROM

Enter an output name such as "rom8x8"

Click Next

Select '3' for width of q output for this example

Uncheck 'address input port' under "Which ports should be registered?"

Click Next

Browse to the rom8x8.mif file that was created or downloaded from above

Click Next

A summary page shows the files to be created

Click Finish


Last modified: 2004-03-16 Frank Honoré