Why do I get an error related to memory or variable size when using the NCO HDL Optimized block?
조회 수: 2 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2018년 7월 6일
편집: MathWorks Support Team
2023년 5월 31일
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.
채택된 답변
MathWorks Support Team
2023년 5월 31일
편집: MathWorks Support Team
2023년 5월 31일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Quantizers에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!