Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21611 Discussions

ROM initialization

Altera_Forum
Honored Contributor II
3,593 Views

Hi, I need to initialize a ROM. I will probably use the Cyclone EP1C6 device. My questions are: 

1. Is there a dedicated memory\way of declaration for ROM\RAM or can I just define it in my code in the same way I define other constants (i.e. an arrays of constant <constant-name> : type := <value>;)? 

2. The datasheet says: "When configured as RAM or ROM, you can use an initialization file to pre-load the memory contents." Can I get some explanation on how to do that? 

 

Thanks in advance
0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
1,953 Views

1. Yes. Which HDL are you using? There are coding guidelines in the quartus handbook - Volume 1 Section III chapter 10. But declaring a constant array is a simple way of doing it. You can even use a complex function to initialise the array. 

 

2. If you use the megawizard, you can specify a .mif file. If you declare an array/constant like above, I think you can use attributes to specify the array to read. Annoyingly, Quartus only allows you to read .txt files in Verilog (I have asked for support in VHDL, but they havent been forthcoming yet).
0 Kudos
Altera_Forum
Honored Contributor II
1,953 Views

Hi Tricky, 

I'm using VHDL. BTW I couldn't find the coding lines you mentioned - there is only chapter 7 in section III. 

Anyway, I understand that it's ok to simply define an array? If there are no advantages using the megawizard I suppose that I'll go for that solution. 

 

Thanks
0 Kudos
Altera_Forum
Honored Contributor II
1,953 Views

Heres a direct link: 

http://www.altera.com/literature/hb/qts/qts_qii51007.pdf 

 

The megawizard is required if you need a dual port dual clocked memory, but if its a single port ROM it can be overkill. Just stick with defining a constant. And dont think it has to be an array of std_logic_vector either. You can use integers, signed, unsigned, ufixed, sfixed, boolean. Use the most appropriate type.
0 Kudos
Altera_Forum
Honored Contributor II
1,953 Views

Got it, thanks.

0 Kudos
Altera_Forum
Honored Contributor II
1,953 Views

for ROM/RAM i use the HDL templates under Edit > Insert Template, seasoned to taste

0 Kudos
Altera_Forum
Honored Contributor II
1,953 Views

 

--- Quote Start ---  

for ROM/RAM i use the HDL templates under Edit > Insert Template, seasoned to taste 

--- Quote End ---  

 

 

You learned me something new, thx.
0 Kudos
Reply