Issue in HDL Coder

조회 수: 14 (최근 30일)
John Brooks
John Brooks 2023년 3월 28일
편집: Kiran Kintali 2023년 3월 28일
I get the following errors (shown in snapshots at the end of the post) when trying to do fixed point conversion. I'm not sure where to go from here.
I did some testing and it appears that the code that was generated doesn't even work on it's own:
>> confirming_behav
Error using movmean
Invalid data type. First input must be numeric or logical.
Error in confirming_behav>WaveletFilteredSection4 (line 54)
mean = movmean(abs((w)), fi(15, 0, 4, 0, fm));
Error in confirming_behav (line 12)
w2 = WaveletFilteredSection4(coeffs,sig);
>> confirming_behav
I think the issue is in the fixed point function but I don't know a lot about that function. I will be reading up on the documentation to see what could be done but I'd like to know how to fix this in the base HDL coder settings.

답변 (2개)

Kiran Kintali
Kiran Kintali 2023년 3월 28일
Can you share the design, testbench and project files?
Feel free to reach out to MathWorks tech support or DM me with the reproduction steps.
  댓글 수: 1
John Brooks
John Brooks 2023년 3월 28일
Just sent you a message.

댓글을 달려면 로그인하십시오.


Kiran Kintali
Kiran Kintali 2023년 3월 28일
편집: Kiran Kintali 2023년 3월 28일
t = 1:10;
x = [4 8 6 -1 -2 -3 -1 3 4 5];
yc = movmean(x,5);
plot(t,x,t,yc);
The movemean function does not support fixed-point inputs and hence the error input should be .
>> movmean(fi(x), 5)
Error using movmean
Invalid data type. First input must be numeric or logical.
I would consider writing a local function that replaces movemean with equivalent MATLAB code before float to fixed conversion.
In addition you have too much IO coming into the design:
Both inputs to the design 'coeffs' and 'sig' and output 'w' are "double(8192 x 1)" and eventually when converted to fixed point wordlength of 'N'; You would need 3xNx8192 pins which would violate the IO threshold on the hardware.
You might want to consider a streaming version of this algorithm if you are targeting HDL code generation.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by