Why do I get an error related to memory or variable size when using the NCO HDL Optimized block?
2 views (last 30 days)
Show older comments
MathWorks Support Team
on 6 Jul 2018
Edited: MathWorks Support Team
on 31 May 2023
I am inputting a phase vector (one scalar value per time step) to the NCO HDL Optimized block, and trying to view the results in the Spectrum Analyzer. However, I keep getting this error message when trying to run my model:
ERROR: Maximum variable size allowed by the program is exceeded.
Error in port widths or dimensions.
What is the cause of this error? My input phase vector only has 100,000 elements, and I often work with signals of this size in Simulink.
Accepted Answer
MathWorks Support Team
on 31 May 2023
Edited: MathWorks Support Team
on 31 May 2023
This error, or related errors such as "Out of memory", is likely due to the number of quantizer accumulator bits you have specified on the block dialog for the NCO HDL Optimized block. Based on the documentation page for this block, a lookup table is used to return sine values. This lookup table will have 2^(number of quantizer accumulator bits) entries. If a large number of quantizer accumulator bits is entered, such as "48", this will exceed the computer maximum variable size.
To check the documentation page, execute the following command in MATLAB command line:
>> web(fullfile(docroot, 'dsp/ref/ncohdloptimized.html'))
You can check your computer's maximum variable size and see how that size compares to 2^(number of quantizer accumulator bits) using the following commands:
>> [str, maxsize] = computer
>> 2^48 > maxsize
For a 64-bit machine, even though 48 is the first number of quantizer bits that directly violates this size limit, it is recommend to use a number much smaller than 48. Memory and size-related errors will likely still be thrown for any number of quantizer bits greater than or equal to 30.
0 Comments
More Answers (0)
See Also
Categories
Find more on Quantizers in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!