2

For example, I have behavioral definition of ROM:

ENTITY rom_4x4_behavioral IS
    PORT (address   : IN NATURAL RANGE 0 TO 7;
          q         : OUT STD_LOGIC_VECTOR(3 DOWNTO 0));
END entity;

ARCHITECTURE rom_4x4_behavioral_arch OF rom_4x4_behavioral IS 
    SUBTYPE word IS STD_LOGIC_VECTOR(3 DOWNTO 0); 
    TYPE memory IS ARRAY(7 downto 0) OF word; 
    SIGNAL rom : memory;     
    SIGNAL addr_reg : NATURAL RANGE 0 TO 7; 
BEGIN 
    PROCESS (address)    
    BEGIN 
        addr_reg <= address; 
    END process; 
    q <= rom(addr_reg); 
END rom_4x4_behavioral_arch;

What do I have to do to initialize rom signal using .mif file?

Alter Me
  • 33
  • 5

1 Answers1

0

Writing a .mif file parser in VHDL would be a lot of work to do.

If you are using the Quartus-II toolchain, then you could also generate a ROM by the Megawizard Plugin Manager (see menu tools). In the wizard you can specifiy the organization of your ROM as well as the .mif file with the initial data.

If you don't want to use that or if you are using other toolchains, then a text file in (Xilinx) .mem format would be another option. A sample implementation of how to read initialization data from such a text file can be found in the VHDL Library PoC in the namespace PoC.mem.ocrom.

Martin Zabel
  • 3,589
  • 3
  • 19
  • 34