Quartus® Prime Standard Edition User Guide: Design Compilation

ID 683283
Date 10/22/2021
Public
Document Table of Contents

3.5.9. RAM Initialization File—for Inferred Memory

The ram_init_file attribute specifies the initial contents of an inferred memory with a .mif. The attribute takes a string value containing the name of the RAM initialization file.

The ram_init_file attribute is supported for ROM too.

Table 43.   Applying a ram_init_file Attribute
HDL Code
Verilog-1995
reg [7:0] mem[0:255] /* synthesis ram_init_file 
= " my_init_file.mif" */;
 Verilog-2001
(* ram_init_file = "my_init_file.mif" *) reg [7:0] mem[0:255];
VHDL6
type mem_t is array(0 to 255) of unsigned(7 downto 0);
signal ram : mem_t;
attribute ram_init_file : string;
attribute ram_init_file of ram : 
signal is "my_init_file.mif";
6 You can also initialize the contents of an inferred memory by specifying a default value for the corresponding signal. In Verilog HDL, you can use an initial block to specify the memory contents. Quartus® Prime Integrated Synthesis automatically converts the default value into a .mif for the inferred RAM.