Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7923025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T17:10:03+00:00 2026-06-03T17:10:03+00:00

I am simulating a processor based design where the program memory contents are held

  • 0

I am simulating a processor based design where the program memory contents are held in a BRAM. I am realizing the program memory using VHDL (inferring BRAMs). I am trying to avoid CoreGen because I want to keep the design portable. Eventually this design will go to an FPGA.

I am looking to see if there is a way to initialize memory contents of the BRAMs using VHDL generics ? I understand that Coregen uses COE file to initialize the BRAM but do we have a VHDL code based way to do this ?

Let me know your alternate suggestions as well.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T17:10:05+00:00Added an answer on June 3, 2026 at 5:10 pm

    Yes it is certainly possible. Take a look at the Xilinx Synthesis Tool (XST) User guide, specifically page 187.

    The code they recommend to do this is reproduced below. They have notes in the user guide regarding the formatting of the file that will be read. Note that this code doesn’t directly use generics, but I could imagine that you could possibly set a constant or generic to hold the name of the filename…

    --
    -- Initializing Block RAM from external data file
    --
    library ieee;
    use ieee.std_logic_1164.all;
    use ieee.std_logic_unsigned.all;
    use std.textio.all;
    
    entity rams_20c is
    port(clk : in std_logic;
       we : in std_logic;
       addr : in std_logic_vector(5 downto 0);
       din : in std_logic_vector(31 downto 0);
       dout : out std_logic_vector(31 downto 0));
    end rams_20c;
    architecture syn of rams_20c is
       type RamType is array(0 to 63) of bit_vector(31 downto 0);
       impure function InitRamFromFile (RamFileName : in string) return RamType is
          FILE RamFile : text is in RamFileName;
          variable RamFileLine : line;
          variable RAM : RamType;
       begin
          for I in RamType’range loop
             readline (RamFile, RamFileLine);
             read (RamFileLine, RAM(I));
          end loop;
          return RAM;
       end function;
    signal RAM : RamType := InitRamFromFile("rams_20c.data");
    begin
       process (clk)
       begin
          if clk’event and clk = ’1’ then
             if we = ’1’ then
                RAM(conv_integer(addr)) <= to_bitvector(din);
             end if;
             dout <= to_stdlogicvector(RAM(conv_integer(addr)));
          end if;
       end process;
    end syn;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am in the process of simulating a distributed system using LXC (LinuX Containers).
In my program I am simulating a N-body system for a large number of
I'm using Altera Quartus 2 to do a custom 8 bit processor and it
I am downloading a dynamic file in my application, simulating ajax using iframes. What
I have been working on a program, simulating a small database where I could
I am trying to write source based on the Game Of Life simulation concept.
Simulating the web Client/web server interaction in a winform using a webbrowser object in
I am simulating ajax file download using iframe, the request goes to tomcat app(servlet)
i am trying to create a football simulation program. i have a main class
For my university process I'm simulating a process called random sequential adsorption. One of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.