How to initialize contents of inferred Block RAM (BRAM) in Verilog

You are correct that you should use $readmemh inside an initial block. In order to make it so different instances of the module can have different initialization files, you should use a parameter like so: parameter MEM_INIT_FILE = “”; … initial begin if (MEM_INIT_FILE != “”) begin $readmemh(MEM_INIT_FILE, ram); end end The format is described … Read more