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

Design a ram in fpga

Altera_Forum
Honored Contributor II
1,728 Views

Question1:I want to design a ram in fpga? BUt What is the Maximum Size for Ram in FPGA? How do I determinate it?And how to analyze how many resources it occupy? 

Question2: whether can a Ram is realized in cpld? what is difference between cpld and Fpga?
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
978 Views

Regarding the first question. You can implement a bank of registers on a fpga using logic elements. But u can't implement a ram using logic elements. Instead, you have specialized blocks of rams. The datasheet of the fpga tell you how many Kbits or Mbits of RAM this device has. There are vhdl templates to instantiate RAM o ROM modules.

0 Kudos
Altera_Forum
Honored Contributor II
978 Views

Answer1: Designing RAM in an FPGA / CPLD is pretty straightforward as each bit (generally) costs 1 LE. Advantages are that it's a) fast and b) available to other designs other than altera. For instance, this is how you'd create an 8x8 RAM in verilog: 

 

reg [7:0] ram [0:7]; 

 

You'd still need to write the interface (clk, we, output wires) but that's basically it. Note that this will take up 8x8=64 LE's, so it's not very efficient. A MAX2-240 would only be able to implement around 200 (if that) bits, which is the main disadvantage of doing it this way. Unfortunately, most CPLD's don't have block-ram so it's the only way to handle it. 

 

Answer2: Yes, you can create RAM in a CPLD but it'd kill your LE count. Most FPGA's have block-ram, which is dedicated memory for this kind of stuff. It's generally registered and FAST. The IP megawizard allows you to create a whole bunch of different designs, from dual-ported to fifo's to shift-registers. The amount of RAM you can implement depends on the device. Generally, the more memory you want, the more expensive the FPGA. 

 

In short, if you want a large amount of RAM in your design, you'll need external memory. 

 

-Mux
0 Kudos
Altera_Forum
Honored Contributor II
978 Views

:)THaks for your help,and i get it. 

--- Quote Start ---  

Regarding the first question. You can implement a bank of registers on a fpga using logic elements. But u can't implement a ram using logic elements. Instead, you have specialized blocks of rams. The datasheet of the fpga tell you how many Kbits or Mbits of RAM this device has. There are vhdl templates to instantiate RAM o ROM modules. 

--- Quote End ---  

0 Kudos
Altera_Forum
Honored Contributor II
978 Views

THaks for your help,and i get it.

0 Kudos
Reply