Forum Discussion
Altera_Forum
Honored Contributor
17 years agoIf you're going to be using most of the RAM, or at least most of any particular type of RAM, then I recommend laying it all out beforehand. Quartus II defaults tend to do a good job with RAMs that have a depth at a power of 2, especially when including the Megafunction controls for RAM type and MAXIMUM_DEPTH. After that, it's usually odd-sized RAMs that cause a problem.
The problem with a simple algorithm is that there are a lot of parameters. Just going for using the least number of bits often stitches RAMs in a way that makes them slow and uses extra LEs. Doing the same algorithm for each RAM also might make a design run out of a special type of RAM, like M4Ks. And even taking a look at how all the RAMs balanced together may not be enough, since the designer may be floorplanning, and so a block might have more or less of a particular RAM type in its region. I'm not saying Quartus couldn't do a better job, just that there are a lot of variables at play, so when it gets complicated, it can get really complicated. (And yes, I've often cut and paste that whole section into Excel and started analyzing, manipulating, etc.) Note one other issue is that the fitter can spread a RAM out. For example, if a RAM could fit in a single M9K, but the fitter thinks it will get better timing spreading it across two(and assuming another one is available), it can do that move, since there's no downside. But the Fitter RAM Summary now shows it using 2 M9Ks when you think it could fit into one. Just something to watch out for.