PDA

View Full Version : İnitialization Ram with VHDL



cagri3534
October 25th, 2010, 11:40 PM
Hi,

As you know, in Verilog, initialize $readmemh code is initialized Ram simply. I searched a VHDL code like this but i can't get. Do you help me to find this code? If you know a sample, can you share with me ?

Thanks.

Tricky
October 26th, 2010, 12:33 AM
In quartus, there are only 2 ways to initialise a ram using VHDL:

1. using a function to set all values.
2. Use a mif file in conjuntion with a megawizard generated altsyncram.

Annoyingly, you cannot use textio to read data in from a text file (like you can with verilog and X based FPGAs).

waiyung
November 8th, 2010, 10:17 PM
If this is for simulation purpose, then initialize the memory content when u create them, but you need to use simulator like ModelSim

If this is an actual circuit then you MUST use mif file to initialize memory content. The programmer tool will initialize the memory when it programs the FPGA.

torkomani21
February 23rd, 2011, 08:28 AM
Hey

Can you help me, how can i use a .mif file to initialize a RAM, can you give me the steps to do in the programming phase with vhdl language ... or give me an exemple of that (how i should write) ....

thank's in advance ........

Tricky
February 23rd, 2011, 08:32 AM
Go to the megawizard
create a ram with the specifications you need and specify a mif file to initialise the ram from.

torkomani21
February 24th, 2011, 02:30 AM
thank's but can you tell me where can i found the megawizard because i am a new user of the quartus II ???

Tricky
February 24th, 2011, 02:39 AM
Tools menu -> megawizard

torkomani21
February 24th, 2011, 06:24 AM
thank you it is working fine (i think) just another questions can i write the resulte in a file like .mif using a RAM ?? if there is another way please tell me about it
thank's again .....

Tricky
February 24th, 2011, 06:32 AM
what results? from a testbench or from a real board?

torkomani21
February 24th, 2011, 06:57 AM
from a simulation ( i have an image in jpg ==> i trasnfert it in mif file ligne by ligne ) then i have a bloc creating in vhdl who will read from the ROM the pixels one by one and do some processing and give in result another value for the pixel (like a convolution) me i want to write this result in a file so i can use it after in MATLAB.

I hope i was clear .........

Tricky
February 24th, 2011, 07:32 AM
VHDL allows you to read and write from text files using the std.textio library

thepancake
February 24th, 2011, 11:02 AM
If this is for simulation purpose, then initialize the memory content when u create them, but you need to use simulator like ModelSim

If this is an actual circuit then you MUST use mif file to initialize memory content. The programmer tool will initialize the memory when it programs the FPGA.

can you elaborate why you must use a .mif in Quartus? i use initialized contents after declaring the RAM/ROM specifically because it works in synthesis and simulation. the Quartus II HDL templates are also built this way