Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - vhdl coding for fetching into memory

 
Thread Tools Search this Thread
Old 08-28-2008, 10:04 AM   #1
Default vhdl coding for fetching into memory


as there is readmemh in verilog to read a file and put it into
memory... is there any relevant thing in VHDL which can do this.


shweta
  Reply With Quote
Old 08-28-2008, 06:12 PM   #2
Mike Treseler
 
Posts: n/a
Default Re: vhdl coding for fetching into memory
shweta wrote:
> as there is readmemh in verilog to read a file and put it into
> memory... is there any relevant thing in VHDL which can do this.


Not exactly.
I would declare and use a constant array something like:

type small_rom is array (0 to 2**a_length -1)
of unsigned(d_length-1 downto 0);
constant this_rom : small_rom :=
(
0 => x"00",
1 => x"01",
2 => x"02",
3 => x"04",
4 => x"08",
5 => x"10",
6 => x"20",
7 => x"40",
98 => x"AA",
99 => x"BB",
others => x"42"
);

-- Mike Treseler


Mike Treseler
  Reply With Quote
Old 08-28-2008, 07:36 PM   #3
Kevin Neilson
 
Posts: n/a
Default Re: vhdl coding for fetching into memory
shweta wrote:
> as there is readmemh in verilog to read a file and put it into
> memory... is there any relevant thing in VHDL which can do this.


It depends on the synthesizer. Here is a snippet from an example in the
XST user's guide that initializes a ROM from a file. I haven't tried it
myself:

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...

-Kevin


Kevin Neilson
  Reply With Quote
Old 09-02-2008, 10:34 AM   #4
gramador
 
Posts: n/a
Default Re: vhdl coding for fetching into memory
On 28 Aug., 11:04, shweta <shwetadeshmuk...@gmail.com> wrote:
> as there is readmemh in verilog to read a file and put it into
> memory... is there any relevant thing in VHDL which can do this.


The memory blocks you instantiate for Altera fpga have a generic
option where you can specify a init file (hex or mif format).
I'm pretty sure that I've seen this for Xilinx too.
Of course, this is not VHDL related. But perhaps what you want.

Regards
Torsten


gramador
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
OCZ 6GB Triple-Channel 1333 MHz DDR3 Memory Kit Admin Front Page News 0 02-16-2009 01:27 PM
memory upgrade -D- A+ Certification 1 02-03-2007 01:01 AM
Re: What memory to use? me A+ Certification 0 12-14-2004 03:33 AM
Re: Memory stick question Nildram A+ Certification 1 01-14-2004 02:41 PM
Half memory: lost? Joe A+ Certification 4 09-04-2003 08:57 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46