UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Explorer
Explorer
120 Views
Registered: ‎01-15-2019

How to initialize Block RAM, which is instantiated in RTL?

Hi All,

I have a Block RAM, which is implemented in RTL, here is the code:

(* ram_style = "block" *)  reg [RAM_WIDTH-1:0] BRAM [0:RAM_DEPTH-1];
  reg [RAM_WIDTH-1:0] ram_data = {RAM_WIDTH{1'b0}};

  // The following code either initializes the memory values to a specified file or to all zeros to match hardware
  generate
    if (INIT_FILE != "") begin: use_init_file
      initial
        $readmemh(INIT_FILE, BRAM, 0, RAM_DEPTH-1);
    end else begin: init_bram_to_zero
      integer ram_index;
      initial
        for (ram_index = 0; ram_index < RAM_DEPTH; ram_index = ram_index + 1)
          BRAM[ram_index] = {RAM_WIDTH{1'b0}};
    end
  endgenerate

How can I initialize this RAM? What format should be the initialization file? Can I initialize just a part of RAM? How? 

Thank you!

 

0 Kudos
1 Reply
Xilinx Employee
Xilinx Employee
101 Views
Registered: ‎01-30-2019

Re: How to initialize Block RAM, which is instantiated in RTL?

0 Kudos