Forum Discussion
Arria 10 M20k block usage- More block with less memory bits?
Hello I have a design that fits on the Arria 10 GX dev board with chip 10AX11552F4sI1SG which has 2713 M20K blocks.
The total memory bits for this design are 36,171,984, all 2713 blocks are used.
I am moving this design to a smaller Arria 10, 10AX066H2F34I2sG, which has 2131 M20K blocks.
I reduced the memory usage to 32,961,368 memory bits, BUT here is where I am getting really confused. The fitter fails and says it now needs 2845 M20k blocks more than the design when it used 36,171,984 memory bits.
How can the same design, with reduced memory, need more M20k blocks than the original design? Any suggestions are greatly appreciated.
This project is being compiled in Quartus Pro 23.4.0.
29 Replies
- KennyT_altera
Super Contributor
I’m glad that your question has been addressed, I now transition this thread to community support. If you have a new question, Please login to ‘https://supporttickets.intel.com/s/?language=en_US’, view details of the desire request, and post a feed/response within the next 15 days to allow me to continue to support you. After 15 days, this thread will be transitioned to community support. The community users will be able to help you on your follow-up questions.
- TSchu3
Occasional Contributor
Thanks for all the follow ups and suggestions. I have no further questions at this time.
- KennyT_altera
Super Contributor
Understand that manually adjusting each component is not a scalable long-term solution. A more efficient approach is to explore global settings, macros, or scripting to minimize maintenance overhead. Future versions of Quartus may introduce improved heuristics to address this issue more effectively. However, without a project available for experimentation, testing and refining scripts is currently not feasible. This remains a limitation we can manage for now.
- KennyT_altera
Super Contributor
Does the above recommendation help?
- TSchu3
Occasional Contributor
Yes, it does help to an extent. I can manipulate Quartus into using different types of memory or logic on a component by component basis. This is very time consuming and not really scalable. Any changes to the design require additional requirements.
It seems to be the best we are going to get at this time, since I am un-able to send the design to you for review.
Thanks
- KennyT_altera
Super Contributor
I’m truly sorry to hear that you're unsatisfied with the answer.
Unfortunately, without access to the design, it will be challenging to narrow down the issue precisely. However, here are some additional key considerations that might help you troubleshoot the increased M20K usage:
Understanding Device-Specific Fitting Differences
Different Architectures Affect Fitting Strategies:
- M20K Usage Variation:
- The way Quartus utilizes M20Ks is device-specific and influenced by the internal architecture of the target FPGA. Even for the same design, different devices may lead to different allocations of M20Ks, logic elements (LEs), or MLABs.
- Trade-offs Between M20Ks and LEs:
- Quartus may adjust the balance between M20K usage and LE-based logic, depending on constraints and heuristics tied to the target device.
What This Means in Your Case:
- On the larger FPGA, Quartus had more routing flexibility, allowing it to optimize M20K usage more efficiently.
- On the smaller Arria 10 FPGA, Quartus might be adopting a more conservative approach, leading to less efficient packing and a higher M20K count. This could cause some RAMs to shift unnecessarily from MLABs (logic-based memory) to M20Ks.
Suggested Actions to Improve M20K Usage
- Specify RAM Type Explicitly with the ramstyle Attribute:
- This attribute can guide Quartus to optimize M20K or MLAB usage more effectively.
- For Critical FIFOs (Reduce Wasted M20Ks):
- Use the following directive to maximize M20K usage and avoid inefficient logic consumption:
- (* ramstyle = "no_rw_check, M20K" *) reg [31:0] my_fifo_ram [0:1023];
- This forces Quartus to reuse partially filled M20Ks instead of allocating additional, unnecessary blocks.
- For Small RAM Instances (Shift to Logic):
- To avoid over-consuming M20Ks for smaller RAMs, encourage Quartus to fit them into logic:
- (* ramstyle = "no_rw_check, logic" *) reg [31:0] small_ram [0:63];
- This can help reduce M20K usage by utilizing available logic resources instead.
- Review MLAB Usage Settings:
- If Quartus isn’t efficiently using MLABs (640-bit blocks), explicitly specify them for smaller RAMs and FIFOs:
- (* ramstyle = "MLAB" *) reg [31:0] my_small_fifo [0:31];
- This helps offload memory from M20Ks to MLABs, improving overall resource balance.
Next Steps for Verification:
Once you’ve applied these strategies, check the following to evaluate their impact:
- RAM Summary Report and Fitter Report:
- These reports will show whether M20K usage improves after modifying the RAM style.
- Chip Planner Analysis:
- Open the Chip Planner tool to inspect how memory blocks are packed. Look for any inefficient packing or routing issues that might be contributing to inflated memory usage.
By applying these adjustments and reviewing the updated reports, you may achieve better memory resource optimization in the smaller FPGA.
- KennyT_altera
Super Contributor
Do you have more question>
- TSchu3
Occasional Contributor
I remain very unsatisfied with the proposed possibilities. The most recent ( Best Fit vs Safe Fit) cannot be confirmed or checked. I also don't even have a definition for the two options.
Either way it does nothing to explain why the Quartus compilation claims that the design needs MORE memory bits on the small chip than on the larger (see my first post). If we had a situation where the smaller chip did not fit but the number of memory bits required was consistent then I could understand why it wasn't working. But that is not the case.
- KennyT_altera
Super Contributor
Unfortunately, Quartus does not provide a user-accessible setting or report that lets you explicitly choose or see whether "AUTO" is operating in a "Best-Fit" or "Safe-Fit" mode.
- KennyT_altera
Super Contributor
Thanks for your feedback, here are some reasoning behind:
On the larger FPGA, Quartus has more total resources (ALMs + M20Ks) to distribute memory more flexibly.
On the smaller FPGA, it might prioritize M20Ks for timing, routing, or stability reasons, avoiding MLABs unless explicitly forced.
Different Default "Auto" Settings Per Device
Quartus may have different default optimization strategies for different device sizes.
Some device families default to MLAB for small FIFOs, while others default to M20K, even when set to "Auto".
MLAB Timing Constraints in Smaller FPGA
If Quartus predicted MLAB timing to be worse on the smaller FPGA, it may have avoided them unless explicitly forced.
The smaller FPGA may have different routing congestion issues that caused Quartus to prefer M20Ks.
Platform Designer Defaults Might Differ Per Target Device
The Platform Designer's "Auto" setting may not be purely a Quartus decision—it could be pre-optimized per FPGA family.
The larger FPGA might default to "best-fit" (MLAB + M20K mix), while the smaller FPGA defaults to "safe-fit" (M20K only).
- TSchu3
Occasional Contributor
Is it possible to change the setting for 'AUTO' from 'Best-Fit" or "Safe-Fit"? OR at least see what it is set at?
- KennyT_altera
Super Contributor
Understood, let me know the feedback by end of the week.
- TSchu3
Occasional Contributor
Here are my findings so far-
1- I implemented a version of the design with reduced memory just to see when it would start fitting. I discovered that when I reduce memory usage in order to fit onto the smaller chip then Quartus uses MLABS. However when I try to implement the full design and fitment fails. The report then shows 0 MLAB usage.
So it is tricky to say what the problem is for the failing design.
For the large Arria - It shows 2415 MLABS used.
For the Small Arria with reduced memory - it shows 3653For the full design on smaller Arria- is shows 0
Interestingly it states that MLABs can be up to 1/2 of total LABs. But in neither case does it use half.
And for the Small Chip design w/ reduced memory it only uses 92% of Logic and MLABs
2- ALM usage of the Full design on smaller chip, which fails fitment is 119,902 (48%)
ALM usage is 185,619 on the small chip (74%) w/ reduced memory
ALM usage is 172,802 on the large chip (40%)
3- I could not see any differences in port depth.
I have not yet tried forcing an instance into an MLAB. It is failing by such a large degree I'm not sure which instances to try or how many.
4 I am not able to determine whether this applies or not. Since the design fails fitment it can't run timing analysis
This all brings me back to my initial question.
Why does the smaller chip claim to need 36,086,072 memory bits and 3,055 blocks , when the larger chip only needs 35,349,568 bits and 2713 blocks?
Also please note that 36,086,072 bits is only 83% of the smaller Arria chip and should fit (in my experience).
Thanks again.- TSchu3
Occasional Contributor
Additional information-
I attempted to force several memory instances to MLAB via
set_instance_assignment -name RAM_BLOCK_TYPE MLAB -to <ram_instance>
This had no effect.
However, what did work was altering fifos in the platform designer.
I discovered that Quartus was constraining all fifos to use only M20k.
This seemed odd to me, so I looked at them in the platform designer. They were all set to 'Auto' under the "What should the memory block type be?". To test this out I set some of them to MLAB. Then I saw a significant reduction in M20K use and MLABs were selected instead.
It seems that for some reason Quartus is interpreting 'Auto' to be constraining to M20k only? Not sure how else to explain it.
These fifos are all set to 'Auto' in the successful project on the larger chip and Quartus does not constrain them to M20k there. But on this smaller chip it does.
- TSchu3
Occasional Contributor
Hi, I'm still digging through this as time permits. I will update later today or next week.
I am still skeptical that any of the above listed options will explain the current problem but I will check them all.
Thanks